From: Kris Thielemans <kris.thielemans@csc.mrc.ac.uk>
To: gdb@sources.redhat.com
Subject: gdb on cygwin and debugging assert() or program segmentation faults
Date: Tue, 19 Jul 2005 22:40:00 -0000 [thread overview]
Message-ID: <loom.20050720T002246-371@post.gmane.org> (raw)
Hi all,
I need to debug a C++ program that throws up an assert(). On Linux, I'm used to
be able to run the program in gdb, and when the assert happens, the program
stops (in the assert function) and I can do a back trace (e.g. info stack).
On cygwin on the other hand, I just get the assert message, and then gdb
says "Program exited normally". No backtrace possible.
The same difference in behaviour between Linux and cygwin with segmentation
faults.
It would be incredibly useful to be able to see where the
assert/segmentation fault happened.
On the cygwin list, Dave Korn suggested the following work-around (for asserts
only): do 'break __assert'. See end of email for more on this. However, that
still doesn't solve the segmentation fault problem
I have
GNU gdb 6.3.50_2004-12-28-cvs (cygwin-special)
gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
Any other suggestions?
Many thanks
Kris Thielemans
Hammersmith Imanet, part of GE Healthcare
United Kingdom
-------------
PS: more on "break __assert trick"
This works on cygwin because assert is defined in terms of __assert.
This trick did work until I updated my cygwin (it now uses gcc 3.4.4 and some
other stuff changed).
In fact, it will now break before entering main() (in
__static_initialization_and_destruction_0 ) but not when the assert is
called.
Using "break __assert" says
(gdb) break __assert
Breakpoint 1 at 0x4ac3e6: file /usr/lib/gcc/i686-pc-
cygwin/3.4.4/include/c++/iostream, line 77.
(gdb) r
Starting program: /home/kris/MyDocuments/mytest.exe
Breakpoint 1, __static_initialization_and_destruction_0 (__initialize_p=1,
__priority=65535)
at /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/iostream:77
(gdb) c
assertion "overlap>-epsilon" failed:
file "./include/stir/numerics/overlap_interpolate.inl", line 108
Program exited normally.
(I might be able to #define assert to my own function and break there.)
next reply other threads:[~2005-07-19 22:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-19 22:40 Kris Thielemans [this message]
2005-07-20 2:09 ` Brian Dessent
2005-07-20 2:37 ` Christopher Faylor
2005-07-20 10:28 ` Dave Korn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=loom.20050720T002246-371@post.gmane.org \
--to=kris.thielemans@csc.mrc.ac.uk \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox