This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: program does not crash when attached to gdbserver
- From: Jonas Maebe <jonas dot maebe at elis dot ugent dot be>
- To: gdb at sourceware dot org
- Date: Sat, 13 Jun 2009 10:50:02 +0200
- Subject: Re: program does not crash when attached to gdbserver
- References: <DF49191A-3B41-4E40-892A-E631EA0D7343@cyclaero.com>
On 13 Jun 2009, at 00:55, Dr. Rolf Jansen wrote:
The problem is that the application crashes consistently after a
certain sequence of user interactions if it runs by its own.
However, the same binary does not crash, once it is attached to
gdbserver, and it does not crash even when continuing with a couple
of stress tests beyound the point at which it would have crashed
without gdbserver.
It would help so much to find the bug if the program would crash
into gdb and if gdb could show me the related source code. This
usually works quite well, for example when writing to memory at NULL.
Perhaps somebody has an idea about what type of bug might cause the
behaviour described above.
As you surmise below: probably using uninitialised and/or freed memory.
There was a debugger for Mac OS Classic called MacsBug, that had a
setting for scrambling the memory, so that accessing released memory
would immediately result into a crash. I cannot seem to find a
similar feature in gdb. Does gdb have any settings, that I can try?
In general, this is a feature of the compiler and/or run time, rather
than of the debugger (the debugger cannot know how the memory manager
of your run time works, so unless you exclusively use OS or OS-
supplied library functions, it cannot scramble anything). E.g., in
case of the Free Pascal Compiler, there are the -gttt (scramble all
local variables on function entry) and -gh (use the heaptrc unit,
which, a.o., scrambles all freed memory) options.
For GCC, you can have a look which of these work on your target
platform: http://en.wikipedia.org/wiki/Memory_debugger
Regarding scrambling local variables on function entry, I believe that
recent GCC's support doing that as well, but I don't know the command
line option by heart.
Jonas