public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* How to create maintenance breakpoints for running programs?
@ 2021-10-28  9:35 Simon Sobisch
  2021-11-02 16:43 ` Simon Sobisch
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Sobisch @ 2021-10-28  9:35 UTC (permalink / raw)
  To: gdb

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to create maintenance breakpoints for running programs?
  2021-10-28  9:35 How to create maintenance breakpoints for running programs? Simon Sobisch
@ 2021-11-02 16:43 ` Simon Sobisch
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Sobisch @ 2021-11-02 16:43 UTC (permalink / raw)
  To: gdb

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-02 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28  9:35 How to create maintenance breakpoints for running programs? Simon Sobisch
2021-11-02 16:43 ` Simon Sobisch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).