Re: [swift-users] About Swift Package Manager and LLDB

2017-11-06 Thread ‫Fadi Botros‬ ‫ via swift-users
This happens when try to print(self)Processing command: po print(self) 
HandleCommand, cmd_obj : 'expression' Handl - Pastebin.com

  
|  
|   
|   
|   ||

   |

  |
|  
|   |  
Processing command: po print(self) HandleCommand, cmd_obj : 'expressio...
   |   |

  |

  |

 

This happens when REPL then try to "import PerfectTemplate"== 
[UserExpression::Evaluate] Parsing expression import PerfectTemplate == Swif - 
Pastebin.com

  
|  
|   
|   
|   ||

   |

  |
|  
|   |  
== [UserExpression::Evaluate] Parsing expression import PerfectTemplate == ...
   |   |

  |

  |

 

Also the same problem happens in Kitura (even if only use packages that depend 
on Swift 4)

  من: Michael Gottesman 
 إلى: Michael Gottesman  
نسخة كربونية: "swift-users@swift.org" ; ‫Fadi Botros‬ ‫ 

 تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 7:01 م
 الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
   
Or actually:
https://github.com/apple/swift/blob/master/docs/DebuggingTheCompiler.rst#debugging-failures-in-lldb
I would just enable all of the logging and post it here or if the log is very 
big put the log into a pastebin.

On Nov 6, 2017, at 8:59 AM, Michael Gottesman via swift-users 
 wrote:

I am not going to answer this fully (I forwarded it to the appropriate people 
though). But to help them out, can you go to ./docs/DebuggingTheCompiler and 
enable lldb logging and post the output here?
Michael

On Nov 6, 2017, at 8:43 AM, ⁨‫Fadi Botros‬ ‫ via swift-users⁩ 
<⁨swift-users@swift.org⁩> wrote:
I'm interested in doing Web Application using Swift and promoting this to be a 
trend someday.But I couldn't find a way to debug web apps without using 
XcodeThis is irrelevant because web applications are mainly on Linux, so what 
if we want to do remote debugging ?
I tried using the SPM, and when I try to compile a Kitura or Perfect app then 
try to debug it, it gives me this
(lldb) po print(self)
warning: Swift error in module .
Debug info from this module will be unavailable in the debugger.

error: in auto-import:
failed to get module '' from AST context
I'm using macOS Sierra (sorry didn't have time to upgrade), with Swift 4 that 
comes with Xcode 9Also tried the same experiment on Xubuntu using Swift 4 
debian package provided on swift.org itself
The only succeeded way is to generate an xcodeproj and compile it, this is 
irrelevant because it is only macOS, while servers are Linux.
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users



   ___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Optimal String conversion to/from UTF-8 w/o null-termination?

2017-11-06 Thread Kelvin Ma via swift-users
doesn’t the compiler like to optimize the loop out of the benchmarking
code? i’ve always had a hard time writing benchmarks in Swift

On Fri, Nov 3, 2017 at 7:10 PM, Ryan Walklin via swift-users <
swift-users@swift.org> wrote:

> Why not just profile it? Set up a loop of 100,000 or so with each method
> and time it.
>
> Ryan
>
> > On 4 Nov 2017, at 6:42 am, Jens Alfke via swift-users <
> swift-users@swift.org> wrote:
> >
> > I’m working with a C API that represents strings as UTF-8 data tagged
> with a length but **without a trailing NUL byte**. In other words, its
> string type is basically a tuple {const char*, size_t}. I need to convert
> this representation to and from Swift 4 strings.
> >
> > This needs to be efficient, as these calls will occur in some areas of
> my project that are known to be performance-critical. (Equivalent
> conversions in my Obj-C code have already shown up as hot-spots and been
> carefully optimized.)
> >
> > For String-to-UTF-8, I’m using String.withCString():
> >_ = str.withCString { bytes in c_function(bytes, strlen(bytes)) }
> > An alternative is
> >let bytes = [UInt8](str.utf8)
> >c_function(, bytes.count)
> > Any idea which of these is more optimal? The former has to call strlen,
> but I suspect the latter may incur more heap allocation.
> >
> > For UTF-8-to-String I use this, where `stringPointer` is an
> UnsafeRawPointer and stringLen is an Int:
> >let data = Data(bytes: stringPointer, count: stringLen)
> >return String(data: data, encoding: String.Encoding.utf8)
> > I’m unhappy about this because it incurs both heap allocation and
> copying the string bytes. But Data doesn’t seem to have the “noCopy”
> options that NSData does. Any way to pass the bytes directly to String
> without an intermediate copy?
> >
> > —Jens
> >
> > PS: I’m aware this is an FAQ, but I’ve already put in time searching.
> Most of the hits are obsolete because the damn String API keeps changing,
> or else they assume NUL-terminated C strings; and the remainder don’t
> consider performance.
> > ___
> > swift-users mailing list
> > swift-users@swift.org
> > https://lists.swift.org/mailman/listinfo/swift-users
>
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] About Swift Package Manager and LLDB

2017-11-06 Thread Johannes Weiß via swift-users
Hi Fadi,

Just two questions:
- did you compile & run this program on the same machine or not? (the 
.swiftmodule files and others are needed for LLDB)
- did you use your Linux distro's lldb or the one that comes with the Swift 
toolchain? (you'll need the very LLDB that comes with the Swift compiler you 
used (next to swiftc) IIRC)

-- Johannes

> On 6 Nov 2017, at 8:43 am, ⁨‫Fadi Botros‬ ‫ via swift-users⁩ 
> <⁨swift-users@swift.org⁩> wrote:
> 
> I'm interested in doing Web Application using Swift and promoting this to be 
> a trend someday.
> But I couldn't find a way to debug web apps without using Xcode
> This is irrelevant because web applications are mainly on Linux, so what if 
> we want to do remote debugging ?
> 
> I tried using the SPM, and when I try to compile a Kitura or Perfect app then 
> try to debug it, it gives me this
> 
> (lldb) po print(self)
> warning: Swift error in module .
> Debug info from this module will be unavailable in the debugger.
> 
> error: in auto-import:
> failed to get module '' from AST context
> 
> I'm using macOS Sierra (sorry didn't have time to upgrade), with Swift 4 that 
> comes with Xcode 9
> Also tried the same experiment on Xubuntu using Swift 4 debian package 
> provided on swift.org itself
> 
> The only succeeded way is to generate an xcodeproj and compile it, this is 
> irrelevant because it is only macOS, while servers are Linux.
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Optimal String conversion to/from UTF-8 w/o null-termination?

2017-11-06 Thread Quinn "The Eskimo!" via swift-users

On 6 Nov 2017, at 17:21, Kelvin Ma via swift-users  
wrote:

> doesn’t the compiler like to optimize the loop out of the benchmarking code?

Yep.  I would resolve this by reading the input from a file.  For example, in 
the data-to-String case, you could:

1. Read lots of individual chunks of data from the file

2. Run each chunk through the `String` initialiser

3. Count how many chunks work and how many fail, so the output depends on the 
input

4. Print that number, which prevents the compiler optimising the whole thing 
away

Share and Enjoy
--
Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] About Swift Package Manager and LLDB

2017-11-06 Thread Michael Gottesman via swift-users
Perfect! This is exactly what I was looking for. = ). Thanks!

> On Nov 6, 2017, at 11:27 AM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com⁩> 
> wrote:
> 
> This happens when try to print(self)
> Processing command: po print(self) HandleCommand, cmd_obj : 'expression' 
> Handl - Pastebin.com 
> 
> 
> Processing command: po print(self) HandleCommand, cmd_obj : 'expressio...
>  
> 
> 
> This happens when REPL then try to "import PerfectTemplate"
> == [UserExpression::Evaluate] Parsing expression import PerfectTemplate == 
> Swif - Pastebin.com 
> 
> 
> == [UserExpression::Evaluate] Parsing expression import PerfectTemplate == ...
>  
> 
> 
> Also the same problem happens in Kitura (even if only use packages that 
> depend on Swift 4)
> 
> من: Michael Gottesman 
> إلى: Michael Gottesman  
> نسخة كربونية: "swift-users@swift.org" ; ‫Fadi Botros‬ 
> ‫ 
> تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 7:01 م
> الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
> 
> Or actually:
> 
> https://github.com/apple/swift/blob/master/docs/DebuggingTheCompiler.rst#debugging-failures-in-lldb
>  
> 
> 
> I would just enable all of the logging and post it here or if the log is very 
> big put the log into a pastebin.
> 
>> On Nov 6, 2017, at 8:59 AM, Michael Gottesman via swift-users 
>> > wrote:
>> 
> 
> I am not going to answer this fully (I forwarded it to the appropriate people 
> though). But to help them out, can you go to ./docs/DebuggingTheCompiler and 
> enable lldb logging and post the output here?
> 
> Michael
> 
>> On Nov 6, 2017, at 8:43 AM, ⁨‫Fadi Botros‬ ‫ via swift-users⁩ 
>> <⁨swift-users@swift.org ⁩> wrote:
>> 
>> I'm interested in doing Web Application using Swift and promoting this to be 
>> a trend someday.
>> But I couldn't find a way to debug web apps without using Xcode
>> This is irrelevant because web applications are mainly on Linux, so what if 
>> we want to do remote debugging ?
>> 
>> I tried using the SPM, and when I try to compile a Kitura or Perfect app 
>> then try to debug it, it gives me this
>> 
>> (lldb) po print(self)
>> warning: Swift error in module .
>> Debug info from this module will be unavailable in the debugger.
>> 
>> error: in auto-import:
>> failed to get module '' from AST context
>> 
>> I'm using macOS Sierra (sorry didn't have time to upgrade), with Swift 4 
>> that comes with Xcode 9
>> Also tried the same experiment on Xubuntu using Swift 4 debian package 
>> provided on swift.org  itself
>> 
>> The only succeeded way is to generate an xcodeproj and compile it, this is 
>> irrelevant because it is only macOS, while servers are Linux.
>> ___
>> swift-users mailing list
>> swift-users@swift.org 
>> https://lists.swift.org/mailman/listinfo/swift-users 
>> 
> 
> ___
> swift-users mailing list
> swift-users@swift.org 
> https://lists.swift.org/mailman/listinfo/swift-users
> 
> 
> 

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] About Swift Package Manager and LLDB

2017-11-06 Thread Jim Ingham via swift-users
The log for “print self” was unfortunately captured too late.  Reading in the 
PerfectTemplate module had already failed, and so any subsequent attempt will 
just report it as failed.  To get the complete error log for this, you need to 
put:

log enable -f /tmp/lldb-type-log.txt lldb types

in your ~/.lldbinit file and then start a fresh debugging session and capture 
the whole session.

The failure from the REPL  is because you have to tell the REPL where to look 
for other frameworks from which it might load modules.  You can pass 
appropriate -I, -L and -F flags to the “swift” invocation too tell the compiler 
lldb’s using to implement the REPL where to look for this module.

The example you gave seems to be a MacOS X example.  The binary type was MachO 
etc.  If this is just a small example that you are using to demonstrate the 
problem, can you file a PR with the swift bug reporter with this example and 
how you built/ran it and we can take a look here.  That’s probably easier than 
trying to pass logs back and forth.

Jim

> On Nov 6, 2017, at 11:27 AM, ⁨‫Fadi Botros‬ ‫ via swift-users⁩ 
> <⁨swift-users@swift.org⁩> wrote:
> 
> This happens when try to print(self)
> Processing command: po print(self) HandleCommand, cmd_obj : 'expression' 
> Handl - Pastebin.com 
> 
> 
> Processing command: po print(self) HandleCommand, cmd_obj : 'expressio...
>  
> 
> 
> This happens when REPL then try to "import PerfectTemplate"
> == [UserExpression::Evaluate] Parsing expression import PerfectTemplate == 
> Swif - Pastebin.com 
> 
> 
> == [UserExpression::Evaluate] Parsing expression import PerfectTemplate == ...
>  
> 
> 
> Also the same problem happens in Kitura (even if only use packages that 
> depend on Swift 4)
> 
> من: Michael Gottesman 
> إلى: Michael Gottesman  
> نسخة كربونية: "swift-users@swift.org" ; ‫Fadi Botros‬ 
> ‫ 
> تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 7:01 م
> الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
> 
> Or actually:
> 
> https://github.com/apple/swift/blob/master/docs/DebuggingTheCompiler.rst#debugging-failures-in-lldb
>  
> 
> 
> I would just enable all of the logging and post it here or if the log is very 
> big put the log into a pastebin.
> 
>> On Nov 6, 2017, at 8:59 AM, Michael Gottesman via swift-users 
>> > wrote:
>> 
> 
> I am not going to answer this fully (I forwarded it to the appropriate people 
> though). But to help them out, can you go to ./docs/DebuggingTheCompiler and 
> enable lldb logging and post the output here?
> 
> Michael
> 
>> On Nov 6, 2017, at 8:43 AM, ⁨‫Fadi Botros‬ ‫ via swift-users⁩ 
>> <⁨swift-users@swift.org ⁩> wrote:
>> 
>> I'm interested in doing Web Application using Swift and promoting this to be 
>> a trend someday.
>> But I couldn't find a way to debug web apps without using Xcode
>> This is irrelevant because web applications are mainly on Linux, so what if 
>> we want to do remote debugging ?
>> 
>> I tried using the SPM, and when I try to compile a Kitura or Perfect app 
>> then try to debug it, it gives me this
>> 
>> (lldb) po print(self)
>> warning: Swift error in module .
>> Debug info from this module will be unavailable in the debugger.
>> 
>> error: in auto-import:
>> failed to get module '' from AST context
>> 
>> I'm using macOS Sierra (sorry didn't have time to upgrade), with Swift 4 
>> that comes with Xcode 9
>> Also tried the same experiment on Xubuntu using Swift 4 debian package 
>> provided on swift.org  itself
>> 
>> The only succeeded way is to generate an xcodeproj and compile it, this is 
>> irrelevant because it is only macOS, while servers are Linux.
>> ___
>> swift-users mailing list
>> swift-users@swift.org 
>> https://lists.swift.org/mailman/listinfo/swift-users 
>> 
> 
> ___
> swift-users mailing list
> swift-users@swift.org 
> https://lists.swift.org/mailman/listinfo/swift-users
> 
> 
> 
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


[swift-users] بخصوص: About Swift Package Manager and LLDB

2017-11-06 Thread ‫Fadi Botros‬ ‫ via swift-users
Also there is some very weird thing happens
When I use ^C to stop debuggingthen REPLimport PerfectTemplate
There is no error
But when use breakpointThe error happens
Is there something weird about breakpoints ?
Also please note that on macOS when I use SPM to convert project to Xcode 
project and compile using xcode-build all work perfectly(This is inconvienient 
since servers are Linux, web debugging must be on Linux)


  من: Jim Ingham 
 إلى: ‫Fadi Botros‬ ‫  
نسخة كربونية: Michael Gottesman ; "swift-users@swift.org" 

 تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 10:15 م
 الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
   
The log for “print self” was unfortunately captured too late.  Reading in the 
PerfectTemplate module had already failed, and so any subsequent attempt will 
just report it as failed.  To get the complete error log for this, you need to 
put:
log enable -f /tmp/lldb-type-log.txt lldb types
in your ~/.lldbinit file and then start a fresh debugging session and capture 
the whole session.
The failure from the REPL  is because you have to tell the REPL where to look 
for other frameworks from which it might load modules.  You can pass 
appropriate -I, -L and -F flags to the “swift” invocation too tell the compiler 
lldb’s using to implement the REPL where to look for this module.
The example you gave seems to be a MacOS X example.  The binary type was MachO 
etc.  If this is just a small example that you are using to demonstrate the 
problem, can you file a PR with the swift bug reporter with this example and 
how you built/ran it and we can take a look here.  That’s probably easier than 
trying to pass logs back and forth.
Jim

On Nov 6, 2017, at 11:27 AM, ⁨‫Fadi Botros‬ ‫ via swift-users⁩ 
<⁨swift-users@swift.org⁩> wrote:
This happens when try to print(self)Processing command: po print(self) 
HandleCommand, cmd_obj : 'expression' Handl - Pastebin.com

  
|  
|  
|  
|   ||

  |

  |
|  
|   |  
Processing command: po print(self) HandleCommand, cmd_obj : 'expressio...
   |   |

  |

  |

 

This happens when REPL then try to "import PerfectTemplate"== 
[UserExpression::Evaluate] Parsing expression import PerfectTemplate == Swif - 
Pastebin.com

  
|  
|  
|  
|   ||

  |

  |
|  
|   |  
== [UserExpression::Evaluate] Parsing expression import PerfectTemplate == ...
   |   |

  |

  |

 

Also the same problem happens in Kitura (even if only use packages that depend 
on Swift 4)

  من: Michael Gottesman 
 إلى: Michael Gottesman  
نسخة كربونية: "swift-users@swift.org" ; ‫Fadi Botros‬ ‫ 

 تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 7:01 م
 الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
  
Or actually:
https://github.com/apple/swift/blob/master/docs/DebuggingTheCompiler.rst#debugging-failures-in-lldb
I would just enable all of the logging and post it here or if the log is very 
big put the log into a pastebin.

On Nov 6, 2017, at 8:59 AM, Michael Gottesman via swift-users 
 wrote:

I am not going to answer this fully (I forwarded it to the appropriate people 
though). But to help them out, can you go to ./docs/DebuggingTheCompiler and 
enable lldb logging and post the output here?
Michael

On Nov 6, 2017, at 8:43 AM, ⁨‫Fadi Botros‬ ‫ via swift-users⁩ 
<⁨swift-users@swift.org⁩> wrote:
I'm interested in doing Web Application using Swift and promoting this to be a 
trend someday.But I couldn't find a way to debug web apps without using 
XcodeThis is irrelevant because web applications are mainly on Linux, so what 
if we want to do remote debugging ?
I tried using the SPM, and when I try to compile a Kitura or Perfect app then 
try to debug it, it gives me this
(lldb) po print(self)
warning: Swift error in module .
Debug info from this module will be unavailable in the debugger.

error: in auto-import:
failed to get module '' from AST context
I'm using macOS Sierra (sorry didn't have time to upgrade), with Swift 4 that 
comes with Xcode 9Also tried the same experiment on Xubuntu using Swift 4 
debian package provided on swift.org itself
The only succeeded way is to generate an xcodeproj and compile it, this is 
irrelevant because it is only macOS, while servers are Linux.
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users



   ___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users




   ___
swift-users mailing list
swift-users@swift.org

Re: [swift-users] About Swift Package Manager and LLDB

2017-11-06 Thread Jim Ingham via swift-users
Swift doesn’t seem to be reporting whatever the error is, I just see:

((SwiftASTContext*)0x7f8c555c84a0)->GetModule('PerfectTemplate') -- failed with 
no error

That’s not very helpful.  Again, I’ll probably need to make this happen locally 
to see what went wrong.  If you have a project that shows the issue which you 
can make available, please file a bug with a description of how you build and 
debug this app, I’ll take a look.

Jim


> On Nov 6, 2017, at 12:56 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com⁩> 
> wrote:
> 
> OK
> Here is when captured "print self" log from the beginning
> 
> Attached here is the full log file
> See the attachments
> من: Jim Ingham 
> إلى: ‫Fadi Botros‬ ‫  
> نسخة كربونية: Michael Gottesman ; 
> "swift-users@swift.org" 
> تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 10:15 م
> الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
> 
> The log for “print self” was unfortunately captured too late.  Reading in the 
> PerfectTemplate module had already failed, and so any subsequent attempt will 
> just report it as failed.  To get the complete error log for this, you need 
> to put:
> 
> log enable -f /tmp/lldb-type-log.txt lldb types
> 
> in your ~/.lldbinit file and then start a fresh debugging session and capture 
> the whole session.
> 
> The failure from the REPL  is because you have to tell the REPL where to look 
> for other frameworks from which it might load modules.  You can pass 
> appropriate -I, -L and -F flags to the “swift” invocation too tell the 
> compiler lldb’s using to implement the REPL where to look for this module.
> 
> The example you gave seems to be a MacOS X example.  The binary type was 
> MachO etc.  If this is just a small example that you are using to demonstrate 
> the problem, can you file a PR with the swift bug reporter with this example 
> and how you built/ran it and we can take a look here.  That’s probably easier 
> than trying to pass logs back and forth.
> 
> Jim
> 
>> On Nov 6, 2017, at 11:27 AM, ⁨‫Fadi Botros‬ ‫ via swift-users⁩ 
>> <⁨swift-users@swift.org ⁩> wrote:
>> 
>> This happens when try to print(self)
>> Processing command: po print(self) HandleCommand, cmd_obj : 'expression' 
>> Handl - Pastebin.com 
>> 
>> 
>> Processing command: po print(self) HandleCommand, cmd_obj : 'expressio...
>>  
>> 
>> 
>> This happens when REPL then try to "import PerfectTemplate"
>> == [UserExpression::Evaluate] Parsing expression import PerfectTemplate == 
>> Swif - Pastebin.com 
>> 
>> 
>> == [UserExpression::Evaluate] Parsing expression import PerfectTemplate == 
>> ...
>>  
>> 
>> 
>> Also the same problem happens in Kitura (even if only use packages that 
>> depend on Swift 4)
>> 
>> من: Michael Gottesman >
>> إلى: Michael Gottesman > 
>> نسخة كربونية: "swift-users@swift.org " 
>> >; ‫Fadi Botros‬ ‫ 
>> >
>> تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 7:01 م
>> الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
>> 
>> Or actually:
>> 
>> https://github.com/apple/swift/blob/master/docs/DebuggingTheCompiler.rst#debugging-failures-in-lldb
>>  
>> 
>> 
>> I would just enable all of the logging and post it here or if the log is 
>> very big put the log into a pastebin.
>> 
>>> On Nov 6, 2017, at 8:59 AM, Michael Gottesman via swift-users 
>>> > wrote:
>>> 
>> 
>> I am not going to answer this fully (I forwarded it to the appropriate 
>> people though). But to help them out, can you go to 
>> ./docs/DebuggingTheCompiler and enable lldb logging and post the output here?
>> 
>> Michael
>> 
>>> On Nov 6, 2017, at 8:43 AM, ⁨‫Fadi Botros‬ ‫ via swift-users⁩ 
>>> <⁨swift-users@swift.org ⁩> wrote:
>>> 
>>> I'm interested in doing Web Application using Swift and promoting this to 
>>> be a trend someday.
>>> But I couldn't find a way to debug web apps without using Xcode
>>> This is irrelevant because web applications are mainly on Linux, so what if 
>>> we want to do remote debugging ?
>>> 
>>> I tried using the SPM, and when I try to compile a Kitura or Perfect app 
>>> then try to debug it, it gives me this
>>> 
>>> (lldb) po print(self)
>>> warning: Swift error in module .
>>> Debug info from this module will be unavailable in the debugger.
>>> 
>>> error: in auto-import:
>>> failed to get module '' from AST context
>>> 
>>> I'm using macOS Sierra (sorry didn't have time to upgrade), with 

[swift-users] بخصوص: About Swift Package Manager and LLDB

2017-11-06 Thread ‫Fadi Botros‬ ‫ via swift-users
OK You want it locally
It is just the PerfectTemplate without ANY CHANGE (Perfect framework by 
PerfectlySoft)
(Also Kitura makes the same problem, but I didn't try to get a full log to see 
whether the same problem or not)

PerfectlySoft/PerfectTemplate
  
|  
|   
|   
|   ||

   |

  |
|  
||  
PerfectlySoft/PerfectTemplate
 PerfectTemplate - Empty Perfect Starter Project.  |   |

  |

  |

 

IBM-Swift/Kitura

  
|  
|   
|   
|   ||

   |

  |
|  
||  
IBM-Swift/Kitura
 Kitura - A Swift web framework and HTTP server.  |   |

  |

  |

 

My experiments was on macOS SierraSwift toolchain coming with Xcode 9.0 itself
Also I tried on Xubuntu but didn't try logging (also gives the same error 
apparently with Perfect, didn't try Kitura on Xubuntu)

  من: Jim Ingham 
 إلى: ‫Fadi Botros‬ ‫  
نسخة كربونية: Michael Gottesman ; "swift-users@swift.org" 

 تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 11:45 م
 الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
   
Swift doesn’t seem to be reporting whatever the error is, I just see:
((SwiftASTContext*)0x7f8c555c84a0)->GetModule('PerfectTemplate') -- failed with 
no error

That’s not very helpful.  Again, I’ll probably need to make this happen locally 
to see what went wrong.  If you have a project that shows the issue which you 
can make available, please file a bug with a description of how you build and 
debug this app, I’ll take a look.
Jim


On Nov 6, 2017, at 12:56 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com⁩> wrote:
OKHere is when captured "print self" log from the beginning
Attached here is the full log fileSee the attachments
  من: Jim Ingham 
 إلى: ‫Fadi Botros‬ ‫  
نسخة كربونية: Michael Gottesman ; "swift-users@swift.org" 

 تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 10:15 م
 الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
  
The log for “print self” was unfortunately captured too late.  Reading in the 
PerfectTemplate module had already failed, and so any subsequent attempt will 
just report it as failed.  To get the complete error log for this, you need to 
put:
log enable -f /tmp/lldb-type-log.txt lldb types
in your ~/.lldbinit file and then start a fresh debugging session and capture 
the whole session.
The failure from the REPL  is because you have to tell the REPL where to look 
for other frameworks from which it might load modules.  You can pass 
appropriate -I, -L and -F flags to the “swift” invocation too tell the compiler 
lldb’s using to implement the REPL where to look for this module.
The example you gave seems to be a MacOS X example.  The binary type was MachO 
etc.  If this is just a small example that you are using to demonstrate the 
problem, can you file a PR with the swift bug reporter with this example and 
how you built/ran it and we can take a look here.  That’s probably easier than 
trying to pass logs back and forth.
Jim

On Nov 6, 2017, at 11:27 AM, ⁨‫Fadi Botros‬ ‫ via swift-users⁩ 
<⁨swift-users@swift.org⁩> wrote:
This happens when try to print(self)Processing command: po print(self) 
HandleCommand, cmd_obj : 'expression' Handl - Pastebin.com

  
|  
|  
|  
|   ||

  |

  |
|  
|   |  
Processing command: po print(self) HandleCommand, cmd_obj : 'expressio...
   |   |

  |

  |

 

This happens when REPL then try to "import PerfectTemplate"== 
[UserExpression::Evaluate] Parsing expression import PerfectTemplate == Swif - 
Pastebin.com

  
|  
|  
|  
|   ||

  |

  |
|  
|   |  
== [UserExpression::Evaluate] Parsing expression import PerfectTemplate == ...
   |   |

  |

  |

 

Also the same problem happens in Kitura (even if only use packages that depend 
on Swift 4)

  من: Michael Gottesman 
 إلى: Michael Gottesman  
نسخة كربونية: "swift-users@swift.org" ; ‫Fadi Botros‬ ‫ 

 تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 7:01 م
 الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
  
Or actually:
https://github.com/apple/swift/blob/master/docs/DebuggingTheCompiler.rst#debugging-failures-in-lldb
I would just enable all of the logging and post it here or if the log is very 
big put the log into a pastebin.

On Nov 6, 2017, at 8:59 AM, Michael Gottesman via swift-users 
 wrote:

I am not going to answer this fully (I forwarded it to the appropriate people 
though). But to help them out, can you go to ./docs/DebuggingTheCompiler and 
enable lldb logging and post the output here?
Michael

On Nov 6, 2017, at 8:43 AM, ⁨‫Fadi Botros‬ ‫ via swift-users⁩ 
<⁨swift-users@swift.org⁩> wrote:
I'm interested in doing Web Application using Swift and promoting this to be a 
trend someday.But I couldn't find a way to debug web apps without using 
XcodeThis is irrelevant because web applications are 

Re: [swift-users] Handle deprecated enum cases from a library

2017-11-06 Thread Dennis Weissmann via swift-users
Hey Charles,

Thanks for going through this with me :)

I'm not sure whether or not this is a compiler bug (that's partially why I 
posted it here), although I have the feeling that *something* is definitely 
wrong.

Funnily enough, the following code shows 3 compiler warnings which are 
incorrect:

private func handleLocalAuthenticationError(_ error: LAError) {
switch error.code {
case .userCancel, .appCancel, .systemCancel:
print(".userCancel, .appCancel, .systemCancel")
case .authenticationFailed:
print(".authenticationFailed")
case .passcodeNotSet:
print(".passcodeNotSet")
case .biometryNotEnrolled, .touchIDNotEnrolled: // Compiler: 
Case will never be executed
print(".biometryNotEnrolled, .touchIDNotEnrolled")
case .biometryNotAvailable, .touchIDNotAvailable:   // Compiler: 
Case will never be executed
print(".biometryNotAvailable, .touchIDNotAvailable")
case .biometryLockout, .touchIDLockout: // Compiler: 
Case will never be executed
print(".biometryLockout, .touchIDLockout")
case .userFallback:
print(".userFallback")
case .invalidContext:
print(".invalidContext")
case .notInteractive:
print(".notInteractive")
}
}

let error = LAError(.touchIDLockout)
handleLocalAuthenticationError(error)

When you run it in a playground, you can see that the case *gets* executed.

- Dennis

> On Nov 5, 2017, at 7:13 PM, Charles Srstka  wrote:
> 
>> On Nov 5, 2017, at 10:39 AM, Dennis Weissmann > > wrote:
>> 
>>> You can delete the default case here, and your switch will still be 
>>> exhaustive
>> That's exactly my problem! It is *not*.
>> 
>> When I delete the default clause, the compiler warns that the switch is not 
>> exhaustive and fixits suggest to add the "missing" deprecated cases.
>> 
>> - Dennis
> 
> Hi Dennis,
> 
> Ah, I see—although the switch should be considered exhaustive since you have 
> covered all the possible cases, the compiler is claiming that it is not. I 
> would probably consider this to be a compiler bug. Have you considered filing 
> a report at bugs.swift.org ?
> 
> Charles
> 

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


[swift-users] بخصوص: بخصوص: About Swift Package Manager and LLDB

2017-11-06 Thread ‫Fadi Botros‬ ‫ via swift-users
WEIRD WEIRD WEIRDIt seems it is threading issueBecause when I tried to 
breakpoint on line 71 file main.swift (like you did)It worked perfectlyI even 
could "frame variable" fully
It seems that perfect framework when handle an HTTP request, it makes something 
in threads, I don't know how to debug it
Try to debug on line 31 then invoke an HTTP request on localhost:8181, you will 
reproduce the error

But it works when I use xcode (Again this is irreleveant, this is not the 
solution)


  من: Jim Ingham 
 إلى: ‫Fadi Botros‬ ‫  
نسخة كربونية: Michael Gottesman ; "swift-users@swift.org" 

 تاريخ الإرسال: الثلاثاء 7 نوفمبر، 2017‏ 12:21 ص
 الموضوع: Re: بخصوص: [swift-users] About Swift Package Manager and LLDB
   
This works for me (with Xcode 9.0):
 > git clone https://github.com/PerfectlySoft/PerfectTemplate.git PTCloning 
into 'PT'...remote: Counting objects: 214, done.remote: Total 214 (delta 0), 
reused 0 (delta 0), pack-reused 214Receiving objects: 100% (214/214), 48.65 KiB 
| 0 bytes/s, done.Resolving deltas: 100% (110/110), done. > cd PT > swift 
build > cd .build/debug > lldb PerfectTemplate(lldb) target 
create "PerfectTemplate"Current executable set to 'PerfectTemplate' 
(x86_64).(lldb) b s -l 71Breakpoint 1: where = PerfectTemplate`main + 2627 at 
main.swift:71, address = 0x000100436c33(lldb) runProcess 26948 launched: 
'/private/tmp/PT/.build/x86_64-apple-macosx10.10/debug/PerfectTemplate' 
(x86_64)Process 26948 stopped* thread #1, queue = 'com.apple.main-thread', stop 
reason = breakpoint 1.1    frame #0: 0x000100436c33 PerfectTemplate`main at 
main.swift:71   68      69   do {   70   // Launch the servers based on the 
configuration data.-> 71   try HTTPServer.launch(configurationData: confData)   
      ^   72   } catch {   73   fatalError("\(error)") // fatal error launching 
one of the servers   74   }Target 0: (PerfectTemplate) stopped.(lldb) expr 
confData.count(Int) $R1 = 1
Do the same steps not work for you?  If you were doing something different can 
you describe the steps you took?
Jim

On Nov 6, 2017, at 2:10 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com⁩> wrote:
Also please notedI think it is a SPM issue not an LLDB oneBecause when compiled 
on the same mac with Xcode (Swift package manager generate Xcode project), then 
use xcode-buildLLDB works perfectly in this circumstances
I think you should refine the compilation script generated by SPM to generate 
something like Xcode results (I think Xcode itself uses normal Swift toolchain, 
I think it does nothing here more than generating a better compilation/linking 
script)


  من: Jim Ingham 
 إلى: ‫Fadi Botros‬ ‫  
نسخة كربونية: Michael Gottesman ; "swift-users@swift.org" 

 تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 11:45 م
 الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
  
Swift doesn’t seem to be reporting whatever the error is, I just see:
((SwiftASTContext*)0x7f8c555c84a0)->GetModule('PerfectTemplate') -- failed with 
no error

That’s not very helpful.  Again, I’ll probably need to make this happen locally 
to see what went wrong.  If you have a project that shows the issue which you 
can make available, please file a bug with a description of how you build and 
debug this app, I’ll take a look.
Jim


On Nov 6, 2017, at 12:56 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com⁩> wrote:
OKHere is when captured "print self" log from the beginning
Attached here is the full log fileSee the attachments
  من: Jim Ingham 
 إلى: ‫Fadi Botros‬ ‫  
نسخة كربونية: Michael Gottesman ; "swift-users@swift.org" 

 تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 10:15 م
 الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
  
The log for “print self” was unfortunately captured too late.  Reading in the 
PerfectTemplate module had already failed, and so any subsequent attempt will 
just report it as failed.  To get the complete error log for this, you need to 
put:
log enable -f /tmp/lldb-type-log.txt lldb types
in your ~/.lldbinit file and then start a fresh debugging session and capture 
the whole session.
The failure from the REPL  is because you have to tell the REPL where to look 
for other frameworks from which it might load modules.  You can pass 
appropriate -I, -L and -F flags to the “swift” invocation too tell the compiler 
lldb’s using to implement the REPL where to look for this module.
The example you gave seems to be a MacOS X example.  The binary type was MachO 
etc.  If this is just a small example that you are using to demonstrate the 
problem, can you file a PR with the swift bug reporter with this example and 
how you built/ran it and we can take a look here.  That’s probably easier than 
trying to pass logs back and forth.
Jim

On Nov 6, 2017, 

Re: [swift-users] About Swift Package Manager and LLDB

2017-11-06 Thread ‫Fadi Botros‬ ‫ via swift-users
I think really like I said in the last message, it is a threading issueBecause 
debugging on Line 71 (which you debugged): It gives that you are on the main 
thread Thread #1When on line 31 (which I debugged): It gives that you are on 
Thread #2 (then you can't import any modules, nor print any variables, etc... 
The error you have its details on the previous messages)

Does GCD work perfectly with SPM ??? Do I have to do something special to 
enable GCD debugging without Xcode ??

  من: Jim Ingham 
 إلى: Jim Ingham  
نسخة كربونية: ‫Fadi Botros‬ ‫ ; "swift-users@swift.org" 

 تاريخ الإرسال: الثلاثاء 7 نوفمبر، 2017‏ 12:22 ص
 الموضوع: Re: [swift-users] بخصوص: About Swift Package Manager and LLDB
   



On Nov 6, 2017, at 2:21 PM, Jim Ingham via swift-users  
wrote:

This works for me (with Xcode 9.0):
 > git clone https://github.com/PerfectlySoft/PerfectTemplate.git PTCloning 
into 'PT'...remote: Counting objects: 214, done.remote: Total 214 (delta 0), 
reused 0 (delta 0), pack-reused 214Receiving objects: 100% (214/214), 48.65 KiB 
| 0 bytes/s, done.Resolving deltas: 100% (110/110), done. > cd PT > swift 
build > cd .build/debug > lldb PerfectTemplate(lldb) target 
create "PerfectTemplate"Current executable set to 'PerfectTemplate' 
(x86_64).(lldb) b s -l 71
You’ll have to say:
(lldb) br s -l 71 
here.
Jim

Breakpoint 1: where = PerfectTemplate`main + 2627 at main.swift:71, address = 
0x000100436c33(lldb) runProcess 26948 launched: 
'/private/tmp/PT/.build/x86_64-apple-macosx10.10/debug/PerfectTemplate' 
(x86_64)Process 26948 stopped* thread #1, queue = 'com.apple.main-thread', stop 
reason = breakpoint 1.1    frame #0: 0x000100436c33 PerfectTemplate`main at 
main.swift:71   68      69   do {   70   // Launch the servers based on the 
configuration data.-> 71   try HTTPServer.launch(configurationData: confData)   
      ^   72   } catch {   73   fatalError("\(error)") // fatal error launching 
one of the servers   74   }Target 0: (PerfectTemplate) stopped.(lldb) expr 
confData.count(Int) $R1 = 1
Do the same steps not work for you?  If you were doing something different can 
you describe the steps you took?
Jim

On Nov 6, 2017, at 2:10 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com⁩> wrote:
Also please notedI think it is a SPM issue not an LLDB oneBecause when compiled 
on the same mac with Xcode (Swift package manager generate Xcode project), then 
use xcode-buildLLDB works perfectly in this circumstances
I think you should refine the compilation script generated by SPM to generate 
something like Xcode results (I think Xcode itself uses normal Swift toolchain, 
I think it does nothing here more than generating a better compilation/linking 
script)


  من: Jim Ingham 
 إلى: ‫Fadi Botros‬ ‫  
نسخة كربونية: Michael Gottesman ; "swift-users@swift.org" 

 تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 11:45 م
 الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
  
Swift doesn’t seem to be reporting whatever the error is, I just see:
((SwiftASTContext*)0x7f8c555c84a0)->GetModule('PerfectTemplate') -- failed with 
no error

That’s not very helpful.  Again, I’ll probably need to make this happen locally 
to see what went wrong.  If you have a project that shows the issue which you 
can make available, please file a bug with a description of how you build and 
debug this app, I’ll take a look.
Jim


On Nov 6, 2017, at 12:56 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com⁩> wrote:
OKHere is when captured "print self" log from the beginning
Attached here is the full log fileSee the attachments
  من: Jim Ingham 
 إلى: ‫Fadi Botros‬ ‫  
نسخة كربونية: Michael Gottesman ; "swift-users@swift.org" 

 تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 10:15 م
 الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
  
The log for “print self” was unfortunately captured too late.  Reading in the 
PerfectTemplate module had already failed, and so any subsequent attempt will 
just report it as failed.  To get the complete error log for this, you need to 
put:
log enable -f /tmp/lldb-type-log.txt lldb types
in your ~/.lldbinit file and then start a fresh debugging session and capture 
the whole session.
The failure from the REPL  is because you have to tell the REPL where to look 
for other frameworks from which it might load modules.  You can pass 
appropriate -I, -L and -F flags to the “swift” invocation too tell the compiler 
lldb’s using to implement the REPL where to look for this module.
The example you gave seems to be a MacOS X example.  The binary type was MachO 
etc.  If this is just a small example that you are using to demonstrate the 
problem, can you file a PR with the swift bug reporter with this example and 
how you 

Re: [swift-users] About Swift Package Manager and LLDB

2017-11-06 Thread ‫Fadi Botros‬ ‫ via swift-users

I don't think Perfect has problems because it debugs perfectly on XcodeKitura 
may have some flaws because on Xcode also causes some issues BUT YOU STILL CAN 
GET FRAME, ETC.. WHILE NOT HAVING THOSE IN SPM
The problem is in SPMJust make the SPM build Swift Packages like Xcode (or 
equivalent)
  من: Jim Ingham 
 إلى: ‫Fadi Botros‬ ‫  
نسخة كربونية: Michael Gottesman ; "swift-users@swift.org" 

 تاريخ الإرسال: الثلاثاء 7 نوفمبر، 2017‏ 1:39 ص
 الموضوع: Re: بخصوص: بخصوص: [swift-users] About Swift Package Manager and LLDB
   
It isn’t quite as mysterious as that.  lldb emulates the context of the frame 
you are stopped in when you run “frame variable” or “expression”.  It looks 
like PerfectTemplate doesn’t have a problem, and doesn’t rely on modules that 
we can’t reconstruct.  But some of the other modules do have problems.  For 
instance, if I let the program come up, interrupt it and switch to a frame in 
the PerfectHTTPServer, then I see:
(lldb) expr let $mystr = "Some string"error: in auto-import:failed to get 
module 'PerfectHTTPServer' from AST context:error: missing required modules: 
'PerfectCHTTPParser', 'PerfectCZlib'

But that’s not the only one with problems, and I’m still not getting any useful 
error messages back from swift.  I’ll have to dig into this more.
Jim



On Nov 6, 2017, at 2:38 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com⁩> wrote:
WEIRD WEIRD WEIRDIt seems it is threading issueBecause when I tried to 
breakpoint on line 71 file main.swift (like you did)It worked perfectlyI even 
could "frame variable" fully
It seems that perfect framework when handle an HTTP request, it makes something 
in threads, I don't know how to debug it
Try to debug on line 31 then invoke an HTTP request on localhost:8181, you will 
reproduce the error

But it works when I use xcode (Again this is irreleveant, this is not the 
solution)


  من: Jim Ingham 
 إلى: ‫Fadi Botros‬ ‫  
نسخة كربونية: Michael Gottesman ; "swift-users@swift.org" 

 تاريخ الإرسال: الثلاثاء 7 نوفمبر، 2017‏ 12:21 ص
 الموضوع: Re: بخصوص: [swift-users] About Swift Package Manager and LLDB
  
This works for me (with Xcode 9.0):
 > git clone https://github.com/PerfectlySoft/PerfectTemplate.git PTCloning 
into 'PT'...remote: Counting objects: 214, done.remote: Total 214 (delta 0), 
reused 0 (delta 0), pack-reused 214Receiving objects: 100% (214/214), 48.65 KiB 
| 0 bytes/s, done.Resolving deltas: 100% (110/110), done. > cd PT > swift 
build > cd .build/debug > lldb PerfectTemplate(lldb) target 
create "PerfectTemplate"Current executable set to 'PerfectTemplate' 
(x86_64).(lldb) b s -l 71Breakpoint 1: where = PerfectTemplate`main + 2627 at 
main.swift:71, address = 0x000100436c33(lldb) runProcess 26948 launched: 
'/private/tmp/PT/.build/x86_64-apple-macosx10.10/debug/PerfectTemplate' 
(x86_64)Process 26948 stopped* thread #1, queue = 'com.apple.main-thread', stop 
reason = breakpoint 1.1    frame #0: 0x000100436c33 PerfectTemplate`main at 
main.swift:71   68      69   do {   70   // Launch the servers based on the 
configuration data.-> 71   try HTTPServer.launch(configurationData: confData)   
      ^   72   } catch {   73   fatalError("\(error)") // fatal error launching 
one of the servers   74   }Target 0: (PerfectTemplate) stopped.(lldb) expr 
confData.count(Int) $R1 = 1
Do the same steps not work for you?  If you were doing something different can 
you describe the steps you took?
Jim

On Nov 6, 2017, at 2:10 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com⁩> wrote:
Also please notedI think it is a SPM issue not an LLDB oneBecause when compiled 
on the same mac with Xcode (Swift package manager generate Xcode project), then 
use xcode-buildLLDB works perfectly in this circumstances
I think you should refine the compilation script generated by SPM to generate 
something like Xcode results (I think Xcode itself uses normal Swift toolchain, 
I think it does nothing here more than generating a better compilation/linking 
script)


  من: Jim Ingham 
 إلى: ‫Fadi Botros‬ ‫  
نسخة كربونية: Michael Gottesman ; "swift-users@swift.org" 

 تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 11:45 م
 الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
  
Swift doesn’t seem to be reporting whatever the error is, I just see:
((SwiftASTContext*)0x7f8c555c84a0)->GetModule('PerfectTemplate') -- failed with 
no error

That’s not very helpful.  Again, I’ll probably need to make this happen locally 
to see what went wrong.  If you have a project that shows the issue which you 
can make available, please file a bug with a description of how you build and 
debug this app, I’ll take a look.
Jim


On Nov 6, 2017, at 12:56 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com⁩> wrote:
OKHere is 

Re: [swift-users] About Swift Package Manager and LLDB

2017-11-06 Thread Jim Ingham via swift-users
It does look like this is a known bug (not yet fixed) in SPM:

https://bugs.swift.org/browse/SR-3280 

The bug isn’t fixed yet (apparently it’s blocked on a swift compiler issue.)  
There’s a workaround in that report, though I don’t know how viable it is.  
Anyway, you can track that bug to see when this gets fixed.

Jim

> On Nov 6, 2017, at 3:45 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com⁩> wrote:
> 
> 
> I don't think Perfect has problems because it debugs perfectly on Xcode
> Kitura may have some flaws because on Xcode also causes some issues BUT YOU 
> STILL CAN GET FRAME, ETC.. WHILE NOT HAVING THOSE IN SPM
> 
> The problem is in SPM
> Just make the SPM build Swift Packages like Xcode (or equivalent)
> 
> من: Jim Ingham 
> إلى: ‫Fadi Botros‬ ‫  
> نسخة كربونية: Michael Gottesman ; 
> "swift-users@swift.org" 
> تاريخ الإرسال: الثلاثاء 7 نوفمبر، 2017‏ 1:39 ص
> الموضوع: Re: بخصوص: بخصوص: [swift-users] About Swift Package Manager and LLDB
> 
> It isn’t quite as mysterious as that.  lldb emulates the context of the frame 
> you are stopped in when you run “frame variable” or “expression”.  It looks 
> like PerfectTemplate doesn’t have a problem, and doesn’t rely on modules that 
> we can’t reconstruct.  But some of the other modules do have problems.  For 
> instance, if I let the program come up, interrupt it and switch to a frame in 
> the PerfectHTTPServer, then I see:
> 
> (lldb) expr let $mystr = "Some string"
> error: in auto-import:
> failed to get module 'PerfectHTTPServer' from AST context:
> error: missing required modules: 'PerfectCHTTPParser', 'PerfectCZlib'
> 
> 
> But that’s not the only one with problems, and I’m still not getting any 
> useful error messages back from swift.  I’ll have to dig into this more.
> 
> Jim
> 
> 
> 
>> On Nov 6, 2017, at 2:38 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com 
>> ⁩> wrote:
>> 
>> WEIRD WEIRD WEIRD
>> It seems it is threading issue
>> Because when I tried to breakpoint on line 71 file main.swift (like you did)
>> It worked perfectly
>> I even could "frame variable" fully
>> 
>> It seems that perfect framework when handle an HTTP request, it makes 
>> something in threads, I don't know how to debug it
>> 
>> Try to debug on line 31 then invoke an HTTP request on localhost:8181, you 
>> will reproduce the error
>> 
>> But it works when I use xcode (Again this is irreleveant, this is not the 
>> solution)
>> 
>> 
>> من: Jim Ingham >
>> إلى: ‫Fadi Botros‬ ‫ > 
>> نسخة كربونية: Michael Gottesman > >; "swift-users@swift.org 
>> " > >
>> تاريخ الإرسال: الثلاثاء 7 نوفمبر، 2017‏ 12:21 ص
>> الموضوع: Re: بخصوص: [swift-users] About Swift Package Manager and LLDB
>> 
>> This works for me (with Xcode 9.0):
>> 
>>  > git clone https://github.com/PerfectlySoft/PerfectTemplate.git 
>>  PT
>> Cloning into 'PT'...
>> remote: Counting objects: 214, done.
>> remote: Total 214 (delta 0), reused 0 (delta 0), pack-reused 214
>> Receiving objects: 100% (214/214), 48.65 KiB | 0 bytes/s, done.
>> Resolving deltas: 100% (110/110), done.
>>  > cd PT
>>  > swift build
>> 
>>  > cd .build/debug
>>  > lldb PerfectTemplate
>> (lldb) target create "PerfectTemplate"
>> Current executable set to 'PerfectTemplate' (x86_64).
>> (lldb) b s -l 71
>> Breakpoint 1: where = PerfectTemplate`main + 2627 at main.swift:71, address 
>> = 0x000100436c33
>> (lldb) run
>> Process 26948 launched: 
>> '/private/tmp/PT/.build/x86_64-apple-macosx10.10/debug/PerfectTemplate' 
>> (x86_64)
>> Process 26948 stopped
>> * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
>> frame #0: 0x000100436c33 PerfectTemplate`main at main.swift:71
>>68
>>69do {
>>70// Launch the servers based on the configuration data.
>> -> 71try HTTPServer.launch(configurationData: confData)
>>  ^
>>72} catch {
>>73fatalError("\(error)") // fatal error launching one of 
>> the servers
>>74}
>> Target 0: (PerfectTemplate) stopped.
>> (lldb) expr confData.count
>> (Int) $R1 = 1
>> 
>> Do the same steps not work for you?  If you were doing something different 
>> can you describe the steps you took?
>> 
>> Jim
>> 
>>> On Nov 6, 2017, at 2:10 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com 
>>> ⁩> wrote:
>>> 
>>> Also please noted
>>> I think it is a SPM issue not an LLDB one
>>> Because when compiled on the same mac with Xcode (Swift package manager 
>>> generate Xcode project), then use xcode-build
>>> LLDB works 

[swift-users] xcode 9 new build system too aggressive?

2017-11-06 Thread David Baraff via swift-users
I will be editing a single file, and usually xcode will do a quick build as i 
change the code.  then, abruptly, i make one more edit to the file and all of a 
sudden xcode decides to compile tons more.  (little changes in the file, not 
defining new methods or classes or anything).

anybody else seeing this?

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


[swift-users] بخصوص: About Swift Package Manager and LLDB

2017-11-06 Thread ‫Fadi Botros‬ ‫ via swift-users
Also please notedI think it is a SPM issue not an LLDB oneBecause when compiled 
on the same mac with Xcode (Swift package manager generate Xcode project), then 
use xcode-buildLLDB works perfectly in this circumstances
I think you should refine the compilation script generated by SPM to generate 
something like Xcode results (I think Xcode itself uses normal Swift toolchain, 
I think it does nothing here more than generating a better compilation/linking 
script)


  من: Jim Ingham 
 إلى: ‫Fadi Botros‬ ‫  
نسخة كربونية: Michael Gottesman ; "swift-users@swift.org" 

 تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 11:45 م
 الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
   
Swift doesn’t seem to be reporting whatever the error is, I just see:
((SwiftASTContext*)0x7f8c555c84a0)->GetModule('PerfectTemplate') -- failed with 
no error

That’s not very helpful.  Again, I’ll probably need to make this happen locally 
to see what went wrong.  If you have a project that shows the issue which you 
can make available, please file a bug with a description of how you build and 
debug this app, I’ll take a look.
Jim


On Nov 6, 2017, at 12:56 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com⁩> wrote:
OKHere is when captured "print self" log from the beginning
Attached here is the full log fileSee the attachments
  من: Jim Ingham 
 إلى: ‫Fadi Botros‬ ‫  
نسخة كربونية: Michael Gottesman ; "swift-users@swift.org" 

 تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 10:15 م
 الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
  
The log for “print self” was unfortunately captured too late.  Reading in the 
PerfectTemplate module had already failed, and so any subsequent attempt will 
just report it as failed.  To get the complete error log for this, you need to 
put:
log enable -f /tmp/lldb-type-log.txt lldb types
in your ~/.lldbinit file and then start a fresh debugging session and capture 
the whole session.
The failure from the REPL  is because you have to tell the REPL where to look 
for other frameworks from which it might load modules.  You can pass 
appropriate -I, -L and -F flags to the “swift” invocation too tell the compiler 
lldb’s using to implement the REPL where to look for this module.
The example you gave seems to be a MacOS X example.  The binary type was MachO 
etc.  If this is just a small example that you are using to demonstrate the 
problem, can you file a PR with the swift bug reporter with this example and 
how you built/ran it and we can take a look here.  That’s probably easier than 
trying to pass logs back and forth.
Jim

On Nov 6, 2017, at 11:27 AM, ⁨‫Fadi Botros‬ ‫ via swift-users⁩ 
<⁨swift-users@swift.org⁩> wrote:
This happens when try to print(self)Processing command: po print(self) 
HandleCommand, cmd_obj : 'expression' Handl - Pastebin.com

  
|  
|  
|  
|   ||

  |

  |
|  
|   |  
Processing command: po print(self) HandleCommand, cmd_obj : 'expressio...
   |   |

  |

  |

 

This happens when REPL then try to "import PerfectTemplate"== 
[UserExpression::Evaluate] Parsing expression import PerfectTemplate == Swif - 
Pastebin.com

  
|  
|  
|  
|   ||

  |

  |
|  
|   |  
== [UserExpression::Evaluate] Parsing expression import PerfectTemplate == ...
   |   |

  |

  |

 

Also the same problem happens in Kitura (even if only use packages that depend 
on Swift 4)

  من: Michael Gottesman 
 إلى: Michael Gottesman  
نسخة كربونية: "swift-users@swift.org" ; ‫Fadi Botros‬ ‫ 

 تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 7:01 م
 الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
  
Or actually:
https://github.com/apple/swift/blob/master/docs/DebuggingTheCompiler.rst#debugging-failures-in-lldb
I would just enable all of the logging and post it here or if the log is very 
big put the log into a pastebin.

On Nov 6, 2017, at 8:59 AM, Michael Gottesman via swift-users 
 wrote:

I am not going to answer this fully (I forwarded it to the appropriate people 
though). But to help them out, can you go to ./docs/DebuggingTheCompiler and 
enable lldb logging and post the output here?
Michael

On Nov 6, 2017, at 8:43 AM, ⁨‫Fadi Botros‬ ‫ via swift-users⁩ 
<⁨swift-users@swift.org⁩> wrote:
I'm interested in doing Web Application using Swift and promoting this to be a 
trend someday.But I couldn't find a way to debug web apps without using 
XcodeThis is irrelevant because web applications are mainly on Linux, so what 
if we want to do remote debugging ?
I tried using the SPM, and when I try to compile a Kitura or Perfect app then 
try to debug it, it gives me this
(lldb) po print(self)
warning: Swift error in module .
Debug info from this module will be unavailable in the debugger.

error: in 

Re: [swift-users] بخصوص: About Swift Package Manager and LLDB

2017-11-06 Thread Jim Ingham via swift-users


> On Nov 6, 2017, at 2:21 PM, Jim Ingham via swift-users 
>  wrote:
> 
> This works for me (with Xcode 9.0):
> 
>  > git clone https://github.com/PerfectlySoft/PerfectTemplate.git 
>  PT
> Cloning into 'PT'...
> remote: Counting objects: 214, done.
> remote: Total 214 (delta 0), reused 0 (delta 0), pack-reused 214
> Receiving objects: 100% (214/214), 48.65 KiB | 0 bytes/s, done.
> Resolving deltas: 100% (110/110), done.
>  > cd PT
>  > swift build
> 
>  > cd .build/debug
>  > lldb PerfectTemplate
> (lldb) target create "PerfectTemplate"
> Current executable set to 'PerfectTemplate' (x86_64).
> (lldb) b s -l 71

You’ll have to say:

(lldb) br s -l 71 

here.

Jim

> Breakpoint 1: where = PerfectTemplate`main + 2627 at main.swift:71, address = 
> 0x000100436c33
> (lldb) run
> Process 26948 launched: 
> '/private/tmp/PT/.build/x86_64-apple-macosx10.10/debug/PerfectTemplate' 
> (x86_64)
> Process 26948 stopped
> * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
> frame #0: 0x000100436c33 PerfectTemplate`main at main.swift:71
>68 
>69 do {
>70 // Launch the servers based on the configuration data.
> -> 71 try HTTPServer.launch(configurationData: confData)
>   ^
>72 } catch {
>73 fatalError("\(error)") // fatal error launching one of 
> the servers
>74 }
> Target 0: (PerfectTemplate) stopped.
> (lldb) expr confData.count
> (Int) $R1 = 1
> 
> Do the same steps not work for you?  If you were doing something different 
> can you describe the steps you took?
> 
> Jim
> 
>> On Nov 6, 2017, at 2:10 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com 
>> ⁩> wrote:
>> 
>> Also please noted
>> I think it is a SPM issue not an LLDB one
>> Because when compiled on the same mac with Xcode (Swift package manager 
>> generate Xcode project), then use xcode-build
>> LLDB works perfectly in this circumstances
>> 
>> I think you should refine the compilation script generated by SPM to 
>> generate something like Xcode results (I think Xcode itself uses normal 
>> Swift toolchain, I think it does nothing here more than generating a better 
>> compilation/linking script)
>> 
>> 
>> من: Jim Ingham >
>> إلى: ‫Fadi Botros‬ ‫ > 
>> نسخة كربونية: Michael Gottesman > >; "swift-users@swift.org 
>> " > >
>> تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 11:45 م
>> الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
>> 
>> Swift doesn’t seem to be reporting whatever the error is, I just see:
>> 
>> ((SwiftASTContext*)0x7f8c555c84a0)->GetModule('PerfectTemplate') -- failed 
>> with no error
>> 
>> That’s not very helpful.  Again, I’ll probably need to make this happen 
>> locally to see what went wrong.  If you have a project that shows the issue 
>> which you can make available, please file a bug with a description of how 
>> you build and debug this app, I’ll take a look.
>> 
>> Jim
>> 
>> 
>>> On Nov 6, 2017, at 12:56 PM, ⁨‫Fadi Botros‬ ‫⁩ <⁨botros_f...@yahoo.com 
>>> ⁩> wrote:
>>> 
>>> OK
>>> Here is when captured "print self" log from the beginning
>>> 
>>> Attached here is the full log file
>>> See the attachments
>>> من: Jim Ingham >
>>> إلى: ‫Fadi Botros‬ ‫ > 
>>> نسخة كربونية: Michael Gottesman >> >; "swift-users@swift.org 
>>> " >> >
>>> تاريخ الإرسال: الإثنين 6 نوفمبر، 2017‏ 10:15 م
>>> الموضوع: Re: [swift-users] About Swift Package Manager and LLDB
>>> 
>>> The log for “print self” was unfortunately captured too late.  Reading in 
>>> the PerfectTemplate module had already failed, and so any subsequent 
>>> attempt will just report it as failed.  To get the complete error log for 
>>> this, you need to put:
>>> 
>>> log enable -f /tmp/lldb-type-log.txt lldb types
>>> 
>>> in your ~/.lldbinit file and then start a fresh debugging session and 
>>> capture the whole session.
>>> 
>>> The failure from the REPL  is because you have to tell the REPL where to 
>>> look for other frameworks from which it might load modules.  You can pass 
>>> appropriate -I, -L and -F flags to the “swift” invocation too tell the 
>>> compiler lldb’s using to implement the REPL where to look for this module.
>>> 
>>> The example you gave seems to be a MacOS X example.  The binary type was 
>>> MachO etc.  If this is just a small example that you are using to 
>>> demonstrate the problem, can you file a 

Re: [swift-users] Handle deprecated enum cases from a library

2017-11-06 Thread Charles Srstka via swift-users
> On Nov 6, 2017, at 5:47 AM, Dennis Weissmann  
> wrote:
> 
> Hey Charles,
> 
> Thanks for going through this with me :)
> 
> I'm not sure whether or not this is a compiler bug (that's partially why I 
> posted it here), although I have the feeling that *something* is definitely 
> wrong.
> 
> Funnily enough, the following code shows 3 compiler warnings which are 
> incorrect:
> 
> private func handleLocalAuthenticationError(_ error: LAError) {
> switch error.code {
> case .userCancel, .appCancel, .systemCancel:
> print(".userCancel, .appCancel, .systemCancel")
> case .authenticationFailed:
> print(".authenticationFailed")
> case .passcodeNotSet:
> print(".passcodeNotSet")
> case .biometryNotEnrolled, .touchIDNotEnrolled: // Compiler: 
> Case will never be executed
> print(".biometryNotEnrolled, .touchIDNotEnrolled")
> case .biometryNotAvailable, .touchIDNotAvailable:   // Compiler: 
> Case will never be executed
> print(".biometryNotAvailable, .touchIDNotAvailable")
> case .biometryLockout, .touchIDLockout: // Compiler: 
> Case will never be executed
> print(".biometryLockout, .touchIDLockout")
> case .userFallback:
> print(".userFallback")
> case .invalidContext:
> print(".invalidContext")
> case .notInteractive:
> print(".notInteractive")
> }
> }
> 
> let error = LAError(.touchIDLockout)
> handleLocalAuthenticationError(error)
> 
> When you run it in a playground, you can see that the case *gets* executed.
> 
> - Dennis

I’d say that this sort of damned-if-you-do-damned-if-you-don’t behavior that 
emits a warning no matter what you do has to be a compiler bug. Post it on 
bugs.swift.org  and hopefully it will get fixed.

Charles

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Optimal String conversion to/from UTF-8 w/o null-termination?

2017-11-06 Thread Quinn "The Eskimo!" via swift-users

On 3 Nov 2017, at 19:42, Jens Alfke via swift-users  
wrote:

> Any way to pass the bytes directly to String without an intermediate copy?

You can do this with `UnsafeBufferPointer`.  For example:

extension String {
init?(bytes: UnsafePointer, count: Int) {
let bp = UnsafeBufferPointer(start: bytes, count: count)
self.init(bytes: bp, encoding: .utf8)
}
}

I don’t know if this is faster.

There are lots of different ways to achieve your two goals and I wouldn’t even 
start optimising this without a realistic model of what your strings look like 
in practice, and a performance test based on that model.

Share and Enjoy
--
Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


[swift-users] About Swift Package Manager and LLDB

2017-11-06 Thread ‫Fadi Botros‬ ‫ via swift-users
I'm interested in doing Web Application using Swift and promoting this to be a 
trend someday.But I couldn't find a way to debug web apps without using 
XcodeThis is irrelevant because web applications are mainly on Linux, so what 
if we want to do remote debugging ?
I tried using the SPM, and when I try to compile a Kitura or Perfect app then 
try to debug it, it gives me this
(lldb) po print(self)
warning: Swift error in module .
Debug info from this module will be unavailable in the debugger.

error: in auto-import:
failed to get module '' from AST context
I'm using macOS Sierra (sorry didn't have time to upgrade), with Swift 4 that 
comes with Xcode 9Also tried the same experiment on Xubuntu using Swift 4 
debian package provided on swift.org itself
The only succeeded way is to generate an xcodeproj and compile it, this is 
irrelevant because it is only macOS, while servers are Linux.
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] About Swift Package Manager and LLDB

2017-11-06 Thread Michael Gottesman via swift-users
I am not going to answer this fully (I forwarded it to the appropriate people 
though). But to help them out, can you go to ./docs/DebuggingTheCompiler and 
enable lldb logging and post the output here?

Michael

> On Nov 6, 2017, at 8:43 AM, ⁨‫Fadi Botros‬ ‫ via swift-users⁩ 
> <⁨swift-users@swift.org⁩> wrote:
> 
> I'm interested in doing Web Application using Swift and promoting this to be 
> a trend someday.
> But I couldn't find a way to debug web apps without using Xcode
> This is irrelevant because web applications are mainly on Linux, so what if 
> we want to do remote debugging ?
> 
> I tried using the SPM, and when I try to compile a Kitura or Perfect app then 
> try to debug it, it gives me this
> 
> (lldb) po print(self)
> warning: Swift error in module .
> Debug info from this module will be unavailable in the debugger.
> 
> error: in auto-import:
> failed to get module '' from AST context
> 
> I'm using macOS Sierra (sorry didn't have time to upgrade), with Swift 4 that 
> comes with Xcode 9
> Also tried the same experiment on Xubuntu using Swift 4 debian package 
> provided on swift.org itself
> 
> The only succeeded way is to generate an xcodeproj and compile it, this is 
> irrelevant because it is only macOS, while servers are Linux.
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users