www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.debugger - Has anyone had success debugging on OSX?

reply pineapple <meapineapple gmail.com> writes:
I've at least got my code running in windbg on Windows, but I'd 
also like to get a debugging environment set up in OSX. It looks 
as though gdb is probably my best option but I haven't been able 
work out how to get it to work with my compiled D programs.
May 19 2016
next sibling parent pineapple <meapineapple gmail.com> writes:
Along the same lines, what about compiling and debugging in a 
ubuntu VM? I gave that a shot, too, but didn't get much of 
anywhere.
May 19 2016
prev sibling next sibling parent Jacob Carlborg <doob me.com> writes:
On 2016-05-19 13:02, pineapple wrote:
 I've at least got my code running in windbg on Windows, but I'd also
 like to get a debugging environment set up in OSX. It looks as though
 gdb is probably my best option but I haven't been able work out how to
 get it to work with my compiled D programs.
It depends on what features you need. I know you can get a stacktrace at least, with mangled names :) -- /Jacob Carlborg
May 19 2016
prev sibling next sibling parent Jacob Carlborg <doob me.com> writes:
On 2016-05-19 13:02, pineapple wrote:
 I've at least got my code running in windbg on Windows, but I'd also
 like to get a debugging environment set up in OSX. It looks as though
 gdb is probably my best option but I haven't been able work out how to
 get it to work with my compiled D programs.
I also recommend asking in the learn forum/group, to make your post more visual. -- /Jacob Carlborg
May 19 2016
prev sibling next sibling parent reply Guillaume Piolat <contact gam3sfrommars.fr> writes:
On Thursday, 19 May 2016 at 11:02:00 UTC, pineapple wrote:
 I've at least got my code running in windbg on Windows, but I'd 
 also like to get a debugging environment set up in OSX. It 
 looks as though gdb is probably my best option but I haven't 
 been able work out how to get it to work with my compiled D 
 programs.
I'm using lldb with both LDC and DMD. It works really well, you get stack-traces, source information, etc. But names are mangled.
May 19 2016
parent reply pineapple <meapineapple gmail.com> writes:
On Thursday, 19 May 2016 at 11:36:58 UTC, Guillaume Piolat wrote:
 I'm using lldb with both LDC and DMD. It works really well, you 
 get stack-traces, source information, etc.
 But names are mangled.
Anything that helps me narrow down where this error "malloc: *** error for object 0x7ff34387e600: pointer being freed was not allocated" is actually occurring is a win in my book. Ideally I'd like to be able to step through code in a visual environment and evaluate expressions like I do in tools like PyCharm's Python debugger, but for now I'm just trying to solve this specific problem and a stack trace would be very helpful. Perhaps you could post a short guide on how to set up the tools you use for debugging?
May 19 2016
parent reply Jacob Carlborg <doob me.com> writes:
On 2016-05-19 15:14, pineapple wrote:

 Anything that helps me narrow down where this error "malloc: *** error
 for object 0x7ff34387e600: pointer being freed was not allocated" is
 actually occurring is a win in my book.

 Ideally I'd like to be able to step through code in a visual environment
 and evaluate expressions like I do in tools like PyCharm's Python
 debugger,
You can debug your application in Xcode. You would need to create a dummy project: 1. File -> New -> Project 2. Other -> Empty -> Next 3. Type a name then choose where to create it 4. In the top left corner in the toolbar, click "No Scheme" 5. Click New Scheme 6. Type a name 7. In the right side, choose Run 8. In the middle, choose Info -> Executable -> Other and pick your application, then close the dialog 9. Now click the run button (the one looking like a play button) in the top left corner in the toolbar When your application crashes it should open the debugger view. You might need to add your source files to the project to get a source mapping. Do that by dragging them to the left side in the Xcode window. but for now I'm just trying to solve this specific problem and
 a stack trace would be very helpful.
Just to get a stack trace it's enough to run your program through lldb: "lldb my_program". When it crashes, execute the "bt" (backtrace) command to print the stack trace.
 Perhaps you could post a short guide on how to set up the tools you use
 for debugging?
-- /Jacob Carlborg
May 19 2016
parent pineapple <meapineapple gmail.com> writes:
On Friday, 20 May 2016 at 06:59:08 UTC, Jacob Carlborg wrote:
 You can debug your application in Xcode. You would need to 
 create a dummy project:
Thanks for your answer!
May 20 2016
prev sibling parent reply Vadim Lopatin <coolreader.org gmail.com> writes:
On Thursday, 19 May 2016 at 11:02:00 UTC, pineapple wrote:
 I've at least got my code running in windbg on Windows, but I'd 
 also like to get a debugging environment set up in OSX. It 
 looks as though gdb is probably my best option but I haven't 
 been able work out how to get it to work with my compiled D 
 programs.
Did someone try to use LLDBMI2 debugger? https://github.com/freedib/lldbmi2 It seems to be GDB/MI compatible frontend for LLDB debugger. Should work with Eclipse/DDT
May 23 2016
parent reply chmike <christophe meessen.net> writes:
On Tuesday, 24 May 2016 at 06:14:49 UTC, Vadim Lopatin wrote:
 On Thursday, 19 May 2016 at 11:02:00 UTC, pineapple wrote:
 I've at least got my code running in windbg on Windows, but 
 I'd also like to get a debugging environment set up in OSX. It 
 looks as though gdb is probably my best option but I haven't 
 been able work out how to get it to work with my compiled D 
 programs.
Did someone try to use LLDBMI2 debugger? https://github.com/freedib/lldbmi2 It seems to be GDB/MI compatible frontend for LLDB debugger. Should work with Eclipse/DDT
I have seen that there seam to be a problem with the debug source line info that confuses gdb when compiled with dmd. I have filed a bug about this in bugzilla. Until this problem is solved, you might have a better chance with gdb when using ldc.
May 29 2016
parent reply Vadim Lopatin <coolreader.org gmail.com> writes:
On Monday, 30 May 2016 at 06:39:38 UTC, chmike wrote:
 On Tuesday, 24 May 2016 at 06:14:49 UTC, Vadim Lopatin wrote:
 On Thursday, 19 May 2016 at 11:02:00 UTC, pineapple wrote:
 I've at least got my code running in windbg on Windows, but 
 I'd also like to get a debugging environment set up in OSX. 
 It looks as though gdb is probably my best option but I 
 haven't been able work out how to get it to work with my 
 compiled D programs.
Did someone try to use LLDBMI2 debugger? https://github.com/freedib/lldbmi2 It seems to be GDB/MI compatible frontend for LLDB debugger. Should work with Eclipse/DDT
I have seen that there seam to be a problem with the debug source line info that confuses gdb when compiled with dmd. I have filed a bug about this in bugzilla. Until this problem is solved, you might have a better chance with gdb when using ldc.
Trying to get DlangIDE + lldbmi2 working. Partially done (implemented some fixes to support it). Experimenting with DMD generated program. Breakpoint setting is working. I can run program, it stops ok on breakpoint (at requested position). Stack frames are shown w/o source file and line number. Variables are not shown. Probably, something in DMD debug info is incompatible with LLDB (or lldbmi2 frontend has some bug)
Jun 07 2016
parent Vadim Lopatin <coolreader.org gmail.com> writes:
On Tuesday, 7 June 2016 at 18:35:15 UTC, Vadim Lopatin wrote:
 Trying to get DlangIDE + lldbmi2 working.
 Partially done (implemented some fixes to support it).
 Experimenting with DMD generated program.
 Breakpoint setting is working. I can run program, it stops ok 
 on breakpoint (at requested position). Stack frames are shown 
 w/o source file and line number.
 Variables are not shown.

 Probably, something in DMD debug info is incompatible with LLDB
 (or lldbmi2 frontend has some bug)
Managed to hack lldbmi2 to get line numbers working. But it looks like there are some problems with Function debug information.
Jun 07 2016