I’m trying to debug a function in 3rd party shared library. I’m having a hard time setting a breakpoint in the function as the application dies shortly after loading the library. Does anyone know of a way to set a pending break-point in mdb so the breakpoint is set shortly after the library is loaded?
Mustafa
What you call pending breakpoint is called deferred breakpoint in
mdb; the way it’s being used is like this:I.e. just turn the
::bpcommand around,<addr>::bpis direct (and requires the symbol / address to be present, already loaded), while::bp <object`symbol>is deferred (and activated by the debugger when the specified object is first loaded). Using theobject`symbolnotation you can distinguish between identically-named functions in different libraries even:> !ldd /bin/ls libsec.so.1 => /lib/libsec.so.1 libc.so.1 => /lib/libc.so.1 libavl.so.1 => /lib/libavl.so.1 libm.so.2 => /lib/libm.so.2 > ::bp libsec.so.1`_init > ::bp libc.so.1`_init > ::bp libavl.so.1`_init > ::bp libm.so.2`_init > ::bp _init > :r mdb: stop at libc.so.1`_init mdb: target stopped at: libc.so.1`_init:save %sp, -0x60, %sp > :c mdb: stop at libavl.so.1`_init mdb: target stopped at: libavl.so.1`_init: save %sp, -0x60, %sp > :c mdb: stop at libsec.so.1`_init mdb: target stopped at: libsec.so.1`_init: save %sp, -0x60, %sp > :c mdb: stop at _init mdb: target stopped at: _init: save %sp, -0x60, %spEnjoy debugging !