How can I get a backtrace on segfault?
Jonathan M Davis
jmdavisProg at gmx.com
Wed Sep 14 01:12:35 PDT 2011
On Wednesday, September 14, 2011 10:07:54 Tobias Pankrath wrote:
> struct Foo
> {
> int bar_;
> @property
> int bar() { return bar; }
> }
>
> Foo myFoo;
> myFoo.bar; // (1)
>
> The program will segfault at (1). I would have spot the error
> much faster, if I've got a decent backtrace, instead of
> "segmentation fault".
>
> How can I get one? I've found the backtrace handler in
> object_.d, but I don't know how to make it work.
What OS are you on? On 32-bit Linux, it should just work. On 64-bit Linux,
there's a bug which makes it so that you don't get one. If you're on Windows
(which I'm guessing that you're not since you're talking about segfaults
rather than access violations), then I believe that it should just work, but
there might be something that you have to do to get it to work (I don't use
Windows much, so I'm not sure).
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list