How to create maintenance breakpoints for running programs?

Simon Sobisch simonsobisch@gnu.org
Tue Nov 2 16:43:14 GMT 2021


I _guess_ GDB has an "internal" event handler which checks for libc 
being loaded in the inferior and sets those maintainance breakpoints 
then and likely also deletes them on unload of libc.

Can anyone point out a sample how to do the same for an own library from 
a python module, please?

Thank you,
Simon


Am 28.10.2021 um 11:35 schrieb Simon Sobisch:
> We can create  maintenance breakpoints with 
> gdb.Breakpoint(internal=True), which is good.
> 
> I've now stumbled over the problem that this _does_ work with not 
> running / attached targets but raises an error message "No symbol table 
> is loaded.  Use the "file" command."
> 
> the breakpoint is then shown under "maint info break" as PENDING (as 
> expected) and is resolved on "start".
> 
> 
> What I _want_ to achieve is the same as one can see with "plain GDB":
> 
> $ gdb -q
> (gdb) maint info break
> No breakpoints or watchpoints.
> (gdb) file prog
> (gdb) star
> ...
> (gdb) maint info break
> (gdb) maint info break
> Num     Type                  Disp Enb Address            What
> -1      shlib events          keep y   0x00007ffff7fe2590 
> <__GI__dl_debug_state> inf 1
> -1.1                               y   0x00007ffff7fe2590 
> <__GI__dl_debug_state> inf 1
> -2      longjmp master        keep n   0x00007ffff7db3950 
> <__libc_siglongjmp> inf 1
> -2.1                               y   0x00007ffff7db3950 
> <__libc_siglongjmp> inf 1
> -3      longjmp master        keep n   0x00007ffff7db3950 
> <__libc_siglongjmp> inf 1
> -3.1                               y   0x00007ffff7db3950 
> <__libc_siglongjmp> inf 1
> -4      longjmp master        keep n   0x00007ffff7db3950 
> <__libc_siglongjmp> inf 1
> -4.1                               y   0x00007ffff7db3950 
> <__libc_siglongjmp> inf 1
> -5      longjmp master        keep n   0x00007ffff7db3950 
> <__libc_siglongjmp> inf 1
> -5.1                               y   0x00007ffff7db3950 
> <__libc_siglongjmp> inf 1
> -6      longjmp master        keep n   0x00007ffff7db3950 
> <__libc_siglongjmp> inf 1
> -6.1                               y   0x00007ffff7db3950 
> <__libc_siglongjmp> inf 1
> -7      longjmp master        keep n   0x00007ffff7db3950 
> <__libc_siglongjmp> inf 1
> -7.1                               y   0x00007ffff7db3950 
> <__libc_siglongjmp> inf 1
> -8      std::terminate master keep n   0x00007ffff59369c0 
> <std::terminate()> inf 1
> -8.1                               y   0x00007ffff59369c0 
> <std::terminate()> inf 1
> 
> 
> I'd like to do the same - is there any event I can register to so that I 
> don't create a <PENDING> breakpoint and an error but instead create the 
> breakpoint when GDB actually has a running program?
> 
> Thanks for any insights,
> Simon


More information about the Gdb mailing list