Aha!  Thanks, will give it a try next time there's a
problem.

Greg


Michael Ferguson wrote:
> Hi -
>
> Just responding to one thing:
>
> On 5/27/15, 3:50 PM, "Greg Kreider" <[email protected]> wrote:
>
>>
>> Might it possible to generate a map of the C lines that correspond
>> to each Chapel source line, so that you could use the normal C
>> debugging tools to find out where the error occurred, and then trace
>> it back to Chapel?  Bonus points if there was a way to do that
>> automatically ...
>
> This should work now... this works for me:
>
> foo.chpl:
>   proc doit()
>   {
>     writeln("hello");
>   }
>   doit();
>
>
>
> $ chpl -g --savec=tmp foo.chpl --cpp-lines
> $ gdb ./a.out
>
> (gdb) break doit_chpl
> (gdb) run
> Breakpoint 1, doit_chpl () at foo.chpl:3
> 3         writeln("hello");
>
>
>
> There are really three issues with this:
> 1) I get confused about which flags to the compiler cause
>     it to use C line numbers and which Chapel line numbers.
>     You sometimes have to specify --cpp-lines, which might
>     be confusingly named... (it means to add #line directives
>     to the generated C, not to use C line numbers when debugging).
> 2) Even though you can step through Chapel code, inspecting
>     variables often doesn't work as you would expect (since
>     the C code generated the debug info, not the Chapel code).
> 3) Chapel symbols generally have _chpl appended to them
>     and will be unique'd within your program. So if you had
>     multiple functions called doit, you might have doit3_chpl e.g..
>
> There is some ongoing work to improve debug-ability with the
> LLVM backend, so at least there's some ongoing work in the area...
> but I don't yet know what new abilities that will provide...
>
> I've also (a long time ago) done some work in getting stack
> traces for Chapel programs that abnormally exit. In practice,
> I usually just run the program in gdb and break on
> gdbShouldBreakHere() and then ask gdb for a stack trace..
>
> Cheers,
>
> -michael
>

------------------------------------------------------------------------------
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to