Re: How to debug D on Linux

2021-01-13 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Jan 13, 2021 at 4:10 PM Roguish via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Wednesday, 13 January 2021 at 14:17:51 UTC, Rikki Cattermole > wrote: > > > > Same thing. > > Clear, thanks. > > I'm just discovering today that DMD and LDC are two different > compiler

Re: How to debug D on Linux

2021-01-13 Thread Roguish via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 14:27:48 UTC, user1234 wrote: You really mostly only requires -g. Then you have to learn gdb. A few basis to get started I've used GDB before, but I've forgotten nearly all of it. Your recap of the basics is appreciated. :-)

Re: How to debug D on Linux

2021-01-13 Thread Roguish via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 14:17:51 UTC, Rikki Cattermole wrote: Same thing. Clear, thanks. I'm just discovering today that DMD and LDC are two different compilers. I got a different impression from the following webpage, which claims that ldmd2 is a wrapper invoking ldc2. https://s

Re: How to debug D on Linux

2021-01-13 Thread Roguish via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 14:13:17 UTC, evilrat wrote: if you are looking for back trace someone recently posted a hint for linux where there is no back trace by default is to import core.sys.linux.backtrace or something that has back trace info and using it in exception handler for runt

Re: How to debug D on Linux

2021-01-13 Thread Roguish via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 14:13:11 UTC, Adam D. Ruppe wrote: -debug enables the `debug` keyword inside the D code itself. This lets you bypass other rules temporarily. For example ... It does NOT do anything related to running D in debuggers like gdb, it just enables code guarded by

Re: How to debug D on Linux

2021-01-13 Thread Roguish via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 14:13:07 UTC, drug wrote: Short answer - sometimes the compiler does not emit a stackframe (due to optimization for example). OK, so -gs prevents a certain optimization that would make debugging harder in certain situations. Thanks for clearing that up.

Re: How to debug D on Linux

2021-01-13 Thread user1234 via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 13:47:55 UTC, Roguish wrote: On Wednesday, 13 January 2021 at 13:30:48 UTC, Roguish wrote: Anything else I need to know when debugging on Linux, without an IDE? One specific question I have is: what's the difference between -g and -debug and -d-debug? Also,

Re: How to debug D on Linux

2021-01-13 Thread Rikki Cattermole via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 13:47:55 UTC, Roguish wrote: On Wednesday, 13 January 2021 at 13:30:48 UTC, Roguish wrote: Anything else I need to know when debugging on Linux, without an IDE? One specific question I have is: what's the difference between -g and -debug and -d-debug? From L

Re: How to debug D on Linux

2021-01-13 Thread evilrat via Digitalmars-d-learn
if you are looking for back trace someone recently posted a hint for linux where there is no back trace by default is to import core.sys.linux.backtrace or something that has back trace info and using it in exception handler for runtime to print the stack trace. https://dlang.org/phobos/core_r

Re: How to debug D on Linux

2021-01-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 13:47:55 UTC, Roguish wrote: One specific question I have is: what's the difference between -g and -debug and -d-debug? -debug enables the `debug` keyword inside the D code itself. This lets you bypass other rules temporarily. For example void foo() pure {

Re: How to debug D on Linux

2021-01-13 Thread drug via Digitalmars-d-learn
On 1/13/21 4:47 PM, Roguish wrote: Also, what does it mean to "always emit a stackframe" (compiler option -gs) ? Short answer - sometimes the compiler does not emit a stackframe (due to optimization for example). In general if you are able to debug your binary by gdb then you don't need to

Re: How to debug D on Linux

2021-01-13 Thread drug via Digitalmars-d-learn
On 1/13/21 4:47 PM, Roguish wrote: On Wednesday, 13 January 2021 at 13:30:48 UTC, Roguish wrote: Anything else I need to know when debugging on Linux, without an IDE? One specific question I have is: what's the difference between -g and -debug and -d-debug? Also, what does it mean to "alway

Re: How to debug D on Linux

2021-01-13 Thread Roguish via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 13:30:48 UTC, Roguish wrote: Anything else I need to know when debugging on Linux, without an IDE? One specific question I have is: what's the difference between -g and -debug and -d-debug? Also, what does it mean to "always emit a stackframe" (compiler opti

Re: How to debug D on Linux

2021-01-13 Thread Roguish via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 13:22:01 UTC, Roguish wrote: How to debug D? be possible to get at least a stack trace? I've discovered that GDB works with the binary generated by the D compiler, so that's great. Anything else I need to know when debugging on Linux, without an IDE?

How to debug D on Linux

2021-01-13 Thread Roguish via Digitalmars-d-learn
How to debug D? My little trial app gives a segmentation fault. Probably a null pointer somewhere, which I could find simply by reading my code. But I'm puzzled that the program outputs very little helpful info when it crashes, even though I've compiled with all the debug options I could find i