public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* can't 'continue' after 'next' in breakpoint's commands/end block
@ 2021-06-10 16:44 Andrey Butirsky
  2021-06-11  8:07 ` Aktemur, Tankut Baris
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Butirsky @ 2021-06-10 16:44 UTC (permalink / raw)
  To: gdb

Hello, I'm trying to debug KWin window manager,
to not halt the session it can't be paused so I created such script to
trace function calls:

$ cat ~/kde/gdb-x
set pagination off

break KGlobalAccelImpl::x11KeyPress(xcb_key_press_event_t*) 
break TabBox::keyPress(int )
break /home/bam/kde/src/kde/workspace/kwin/src/tabbox/tabbox.cpp:555

commands 1-20
# FIXME: for some reason KWin halts on any stepping command here, ideas?
#next
continue
end

continue &

I'm attaching to a KWin process such way:

gdb attach $(pidof kwin_wayland) -x ~/kde/gdb-x

The problem is I can't insert next/step and such commands in the
breakpoint's 'commands' block - the process halts just after the 'next'
there despite the presence of 'continue' command afterward.

So I need to switch to another VT and kill gdb process to bring my
session back.

I'm not quite understand why it happens and what I can do with it. Any
ideas?

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

* RE: can't 'continue' after 'next' in breakpoint's commands/end block
  2021-06-10 16:44 can't 'continue' after 'next' in breakpoint's commands/end block Andrey Butirsky
@ 2021-06-11  8:07 ` Aktemur, Tankut Baris
  0 siblings, 0 replies; 2+ messages in thread
From: Aktemur, Tankut Baris @ 2021-06-11  8:07 UTC (permalink / raw)
  To: Andrey Butirsky; +Cc: gdb

On Thursday, June 10, 2021 6:45 PM, Andrey Butirsky wrote:
> Hello, I'm trying to debug KWin window manager,
> to not halt the session it can't be paused so I created such script to
> trace function calls:
> 
> $ cat ~/kde/gdb-x
> set pagination off
> 
> break KGlobalAccelImpl::x11KeyPress(xcb_key_press_event_t*)
> break TabBox::keyPress(int )
> break /home/bam/kde/src/kde/workspace/kwin/src/tabbox/tabbox.cpp:555
> 
> commands 1-20
> # FIXME: for some reason KWin halts on any stepping command here, ideas?
> #next
> continue
> end
> 
> continue &
> 
> I'm attaching to a KWin process such way:
> 
> gdb attach $(pidof kwin_wayland) -x ~/kde/gdb-x
> 
> The problem is I can't insert next/step and such commands in the
> breakpoint's 'commands' block - the process halts just after the 'next'
> there despite the presence of 'continue' command afterward.
> 
> So I need to switch to another VT and kill gdb process to bring my
> session back.
> 
> I'm not quite understand why it happens and what I can do with it. Any
> ideas?

Hi, 

GDB stops executing the breakpoint commands if a command modifies the stopped
thread's PC.  The "next" command hence causes the execution of the commands
to be truncated.

https://sourceware.org/gdb/current/onlinedocs/gdb/Break-Commands.html#Break-Commands
"Any other commands in the command list, after a command that resumes execution,
are ignored. This is because any time you resume execution (even with a simple
next or step), you may encounter another breakpoint—which could have its own
command list, leading to ambiguities about which list to execute."

Instead of "next", could you define another breakpoint at the next line and
define breakpoint commands for that new BP as well?

-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

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

end of thread, other threads:[~2021-06-11  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10 16:44 can't 'continue' after 'next' in breakpoint's commands/end block Andrey Butirsky
2021-06-11  8:07 ` Aktemur, Tankut Baris

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).