public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/10852] New: command sequences interrupted unexpectedly
@ 2009-10-26 19:08 ppluzhnikov at google dot com
  2009-10-31 17:55 ` [Bug breakpoints/10852] " ppluzhnikov at google dot com
  2010-02-26  3:08 ` tyl dot ero dot d dot erkirk at gmail dot com
  0 siblings, 2 replies; 8+ messages in thread
From: ppluzhnikov at google dot com @ 2009-10-26 19:08 UTC (permalink / raw)
  To: gdb-prs

Original thread: http://sourceware.org/ml/gdb/2009-10/msg00349.html


From: Eli Zaretskii <eliz@gnu.org>
Date: Sat, Oct 24, 2009 at 7:12 AM
To: gdb@sourceware.org


Some commands seem to be not working inside breakpoint commands, in
the sense that breakpoint commands after them are not executed.

Two examples that I tried were `finish' and `until'.  What I wanted
was to stop at function entry, print some variable, then let the
function run to completion, and print some other (global) variable
that gets modified by this function.  The breakpoint commands
therefore were something like

 break FOO
 commands
 >print BAR
 >finish
 >print BAZ
 >end

and similarly with `until' instead of `finish'; I used the last line
of the function's body for its argument.

What I see is that the second `print' is never executed.  Sounds like
a bug to me.  Or did I miss something?

----------
From: Pedro Alves <pedro@codesourcery.com>
Date: Sat, Oct 24, 2009 at 9:03 AM
To: gdb@sourceware.org, Eli Zaretskii <eliz@gnu.org>


A Saturday 24 October 2009 15:12:41, Eli Zaretskii escreveu:
>From gdb.texinfo:'Break Commands':

"You can use breakpoint commands to start your program up again.  Simply
use the @code{continue} command, or @code{step}, or any other command
that resumes execution.

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 @code{next} or @code{step}), you may encounter
another breakpoint---which could have its own command list, leading to
ambiguities about which list to execute."

----------
From: Paul Pluzhnikov <ppluzhnikov@google.com>
Date: Sat, Oct 24, 2009 at 12:29 PM
To: Eli Zaretskii <eliz@gnu.org>
Cc: Pedro Alves <pedro@codesourcery.com>, gdb@sourceware.org


FWIW, I very often would like to do this:

 int foo(int x) { ... }

break foo
command 1
print x
finish  ## expecting it to print return of foo()
continue

and that last 'continue' of course doesn't work, so I have to sit an
press enter all day :-(

The argument of "you may encounter other breakpoints ..." is (IMHO) a
weak one: I *don't* in fact encounter any other breakpoints.

It's probably not too difficult to implement "if you encounter any
other breakpoint with its own command list while executing the
original command list, the original command list is abandoned" policy.
I'll open a feature request unless somebody explains why this would be
a bad idea.

----------
From: Michael Snyder <msnyder@vmware.com>
Date: Sat, Oct 24, 2009 at 3:58 PM
To: Paul Pluzhnikov <ppluzhnikov@google.com>
Cc: Eli Zaretskii <eliz@gnu.org>, Pedro Alves <pedro@codesourcery.com>,
"gdb@sourceware.org" <gdb@sourceware.org>


I think the "argument" that you may encounter other breakpoints
is in part a rationalization.  In reality, it seems to me that
we just didn't want to make breakpoint command handling (which
would have included handle_inferior_event) recursive.

----------
From: Joel Brobecker <brobecker@adacore.com>
Date: Mon, Oct 26, 2009 at 2:59 AM
To: Paul Pluzhnikov <ppluzhnikov@google.com>
Cc: Eli Zaretskii <eliz@gnu.org>, Pedro Alves <pedro@codesourcery.com>,
gdb@sourceware.org


I think it would indeed be a big improvement.  I was hoping that the issue
would go away with python support, but anyone who learnt about this behavior
was surprised and found the argument to be very weak.

----------
From: Vladimir Prus <vladimir@codesourcery.com>
Date: Mon, Oct 26, 2009 at 4:30 AM
To: gdb@sources.redhat.com


I'd like to mention this is not the only case where GDB abandons something
when hitting something else. E.g. if you have solib events enabled, and do
next and solib is loaded, the "next" operation is aborted, and you're stuck
in the middle of nowhere with no chance for a frontend to do anything.

It would be nice of infrun be rewritten to use a proper state machine, permitting
nesting.

-- 
           Summary: command sequences interrupted unexpectedly
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: ppluzhnikov at google dot com
                CC: gdb-prs at sourceware dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=10852

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug breakpoints/10852] command sequences interrupted unexpectedly
  2009-10-26 19:08 [Bug breakpoints/10852] New: command sequences interrupted unexpectedly ppluzhnikov at google dot com
@ 2009-10-31 17:55 ` ppluzhnikov at google dot com
  2010-02-26  3:08 ` tyl dot ero dot d dot erkirk at gmail dot com
  1 sibling, 0 replies; 8+ messages in thread
From: ppluzhnikov at google dot com @ 2009-10-31 17:55 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From ppluzhnikov at google dot com  2009-10-31 17:55 -------
PR10227 is possibly related.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1


http://sourceware.org/bugzilla/show_bug.cgi?id=10852

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug breakpoints/10852] command sequences interrupted unexpectedly
  2009-10-26 19:08 [Bug breakpoints/10852] New: command sequences interrupted unexpectedly ppluzhnikov at google dot com
  2009-10-31 17:55 ` [Bug breakpoints/10852] " ppluzhnikov at google dot com
@ 2010-02-26  3:08 ` tyl dot ero dot d dot erkirk at gmail dot com
  1 sibling, 0 replies; 8+ messages in thread
From: tyl dot ero dot d dot erkirk at gmail dot com @ 2010-02-26  3:08 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From tyl dot ero dot d dot erkirk at gmail dot com  2010-02-26 03:08 -------
*** Bug 11285 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |g_sauthoff at web dot de


http://sourceware.org/bugzilla/show_bug.cgi?id=10852

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug breakpoints/10852] command sequences interrupted unexpectedly
       [not found] <bug-10852-4717@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2023-10-27 18:31 ` ratmice at gmail dot com
@ 2023-10-27 21:45 ` g_sauthoff at web dot de
  4 siblings, 0 replies; 8+ messages in thread
From: g_sauthoff at web dot de @ 2023-10-27 21:45 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=10852

abandoned account please delete <g_sauthoff at web dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|g_sauthoff at web dot de           |

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug breakpoints/10852] command sequences interrupted unexpectedly
       [not found] <bug-10852-4717@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-10-31 17:49 ` tromey at sourceware dot org
@ 2023-10-27 18:31 ` ratmice at gmail dot com
  2023-10-27 21:45 ` g_sauthoff at web dot de
  4 siblings, 0 replies; 8+ messages in thread
From: ratmice at gmail dot com @ 2023-10-27 18:31 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=10852

matt rice <ratmice at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ratmice at gmail dot com

--- Comment #6 from matt rice <ratmice at gmail dot com> ---
I'd posted that workaround on SO, I believe it only works in a subset of
situations,
consider the case where `finish` ends up hitting another breakpoint itself with
commands.

That is I believe it will only work in cases which don't involve any reentrancy
which in practice turns out to be most common.

It is also perhaps worth mentioning python `FinishBreakpoint`s here as someone
running into this issue might be able to see if those run into the same issue
or not (I haven't looked).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug breakpoints/10852] command sequences interrupted unexpectedly
       [not found] <bug-10852-4717@http.sourceware.org/bugzilla/>
  2012-05-10 23:07 ` ppluzhnikov at google dot com
  2020-10-31 17:47 ` tromey at sourceware dot org
@ 2020-10-31 17:49 ` tromey at sourceware dot org
  2023-10-27 18:31 ` ratmice at gmail dot com
  2023-10-27 21:45 ` g_sauthoff at web dot de
  4 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2020-10-31 17:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=10852

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrewg at felinemenace dot org

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
*** Bug 8965 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug breakpoints/10852] command sequences interrupted unexpectedly
       [not found] <bug-10852-4717@http.sourceware.org/bugzilla/>
  2012-05-10 23:07 ` ppluzhnikov at google dot com
@ 2020-10-31 17:47 ` tromey at sourceware dot org
  2020-10-31 17:49 ` tromey at sourceware dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2020-10-31 17:47 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=10852

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
I'm fairly surprised that the workaround works.
On the one hand, if it works and doesn't cause problems,
then maybe we can fix the original bug.  However I thought
fixing the bug was problematic, though I don't recall the
details.

I came here to mention another idea, which is to add new
commands so that scripts could add continuations, like:

commands 5
  print i
  after finish
    print i
  end
end

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug breakpoints/10852] command sequences interrupted unexpectedly
       [not found] <bug-10852-4717@http.sourceware.org/bugzilla/>
@ 2012-05-10 23:07 ` ppluzhnikov at google dot com
  2020-10-31 17:47 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: ppluzhnikov at google dot com @ 2012-05-10 23:07 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=10852

--- Comment #3 from Paul Pluzhnikov <ppluzhnikov at google dot com> 2012-05-10 23:06:39 UTC ---
Over on stackoverflow, someone suggested a workaround:
http://stackoverflow.com/a/10529068/50617

A 2nd work around that doesn't require python appears to be defining a new gdb
command and running that in commands:

define foo
print *i
set $addrOfI = i
finish
print *$addrOfI
end

break doSomething
commands
foo
end

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2023-10-27 21:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-26 19:08 [Bug breakpoints/10852] New: command sequences interrupted unexpectedly ppluzhnikov at google dot com
2009-10-31 17:55 ` [Bug breakpoints/10852] " ppluzhnikov at google dot com
2010-02-26  3:08 ` tyl dot ero dot d dot erkirk at gmail dot com
     [not found] <bug-10852-4717@http.sourceware.org/bugzilla/>
2012-05-10 23:07 ` ppluzhnikov at google dot com
2020-10-31 17:47 ` tromey at sourceware dot org
2020-10-31 17:49 ` tromey at sourceware dot org
2023-10-27 18:31 ` ratmice at gmail dot com
2023-10-27 21:45 ` g_sauthoff at web dot de

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