This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

LD_PRELOAD, SIGTRAP and step/next


Dear all,

I am debugging using a memory checking library -- dmalloc -- this does
the usual things via an LD_PRELOAD over the malloc.  I am getting
SIGTRAP when trying to call a function in this library -- but only after
a step or a next; after a user-defined breakpoint behaviour is correct!

Can anyone explain/resolve the behaviour:

(gdb) set environment LD_PRELOAD=lib/libdmalloc.so
(gdb) b main
(gdb) run
Starting program: /home/david/projects/code/ddt/examples/a.out

Breakpoint 1, main (argc=1, argv=0xbffff604, environ=0xbffff60c) at
hello.c:65
65              int tag = 50;           /* Tag for messages */
(gdb) print dmalloc_message("hello")ne}
void
(gdb) step
79              t2 = malloc(sizeof(typeThree));
(gdb) p dmalloc_message ("ho")
Program received signal SIGTRAP, Trace/breakpoint trap.
0xb7f831c3 in dmalloc_message (format=0x0) at malloc.c:2079
2079    {
The program being debugged was signaled while in a function called from
GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on"
Evaluation of the expression containing the function (dmalloc_message) 
[..]

Very odd indeed!


d.

-- 
David Lecomber <david@allinea.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]