How to set breakpoints on future shared libraries with a command flag How to set breakpoints on future shared libraries with a command flag c c

How to set breakpoints on future shared libraries with a command flag


Replying to myself, I'd like to give the answer that someone gave me on IRC:

(gdb) apropos pendingactions -- Specify the actions to be taken at a tracepointset breakpoint -- Breakpoint specific settingsset breakpoint pending -- Set debugger's behavior regarding pending breakpointsshow breakpoint -- Breakpoint specific settingsshow breakpoint pending -- Show debugger's behavior regarding pending breakpoints

And so set breakpoint pending on does the trick; it is used in cmds.gdb like e.g.

set breakpoint pending onbreak <source file name>:<line number>


OT: In terminal it would look like this to debug Caja in one line:

gdb -ex "set breakpoint pending on" -ex "break gdk_x_error" -ex run --args caja --sync


With no symbols.

objdump -t /lib/libacl.soSYMBOL TABLE:no symbolsobjdump -T /lib/libacl.so...00002bd0 g    DF .text  000000d0  ACL_1.0     acl_delete_entry...(gdb) break 0x0002bd0 (gdb) x/20i acl_delete_entry0x2bd0 <acl_delete_entry>:      stwu    r1,-32(r1)0x2bd4 <acl_delete_entry+4>:    mflr    r00x2bd8 <acl_delete_entry+8>:    stw     r29,20(r1)0x2bdc <acl_delete_entry+12>:   stw     r30,24(r1)0x2be0 <acl_delete_entry+16>:   mr      r29,r40x2be4 <acl_delete_entry+20>:   li      r4,28972