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 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?

Re: Collections in D

2021-01-13 Thread Roguish via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 12:39:50 UTC, evilrat wrote: There is no specific set container, they just implemented as generic algorithms over the ranges. I see. Thanks for pointing that out.

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

Re: Collections in D

2021-01-13 Thread Roguish via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 12:48:47 UTC, Ferhat Kurtulmuş wrote: I read many posts that rbtree can be a replacement for sets in dlang. see its behaviour is identical. Thanks, will read up.

Re: Collections in D

2021-01-13 Thread Roguish via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 11:58:11 UTC, Roguish wrote: I can't find anything about collections in D. All I have found are arrays and maps ("associative arrays"). What about lists and sets? What if I just want a linked list? It seems collections are called "containers" in D's standard l

Collections in D

2021-01-13 Thread Roguish via Digitalmars-d-learn
I can't find anything about collections in D. All I have found are arrays and maps ("associative arrays"). What about lists and sets? What if I just want a linked list?