This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Don't clear continuations when changing interpreters (Re: Properly cancel continuations on error. Don't throw away the target on error thrown while handling a target event.)
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 30 May 2011 19:40:17 +0100
- Subject: Don't clear continuations when changing interpreters (Re: Properly cancel continuations on error. Don't throw away the target on error thrown while handling a target event.)
- References: <201105301919.46586.pedro@codesourcery.com>
On Monday 30 May 2011 19:19:46, Pedro Alves wrote:
> This:
>
> > Index: src/gdb/interps.c
> > ===================================================================
> > --- src.orig/gdb/interps.c 2011-05-30 18:15:07.000000000 +0100
> > +++ src/gdb/interps.c 2011-05-30 18:15:41.664991398 +0100
> > @@ -150,7 +150,7 @@ interp_set (struct interp *interp, int t
> >
> > if (current_interpreter != NULL)
> > {
> > - do_all_continuations ();
> > + do_all_continuations (1);
>
> ... is what we used to do before I had removed the "err" parameter
> back in 2008, and so I reverted it like that, but I think this call
> do_all_continuations call should just go away. I'll do so on a
> follow up patch.
Indeed, with:
#include <stdlib.h>
int
do_sleep (void)
{
sleep (30);
return 1;
}
int
main ()
{
int i = 0;
while (1)
{
i++;
do_sleep ();
}
return 0;
}
...
(gdb) start
Temporary breakpoint 1 at 0x400516: file loop_long.c, line 13.
Starting program: /home/pedro/gdb/tests/loop_long
Temporary breakpoint 1, main () at loop_long.c:13
13 int i = 0;
(gdb) s
17 i++;
(gdb) s
18 do_sleep ();
(gdb) s
do_sleep () at loop_long.c:6
6 sleep (30);
(gdb) set debug infrun 1
(gdb) finish &
infrun: clear_proceed_status_thread (process 5831)
Run till exit from #0 do_sleep () at loop_long.c:6
infrun: proceed (addr=0xffffffffffffffff, signal=144, step=0)
infrun: resume (step=0, signal=0), trap_expected=0, current thread [process 5831] at 0x4004f8
(gdb) infrun: target_wait (-1, status) =
infrun: -1 [process -1],
infrun: status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
interpreter-exec mi "-asdf"
warning: Error removing breakpoint 0
^error,msg="Undefined MI command: asdf"
(gdb)
<time passes>
(gdb) infrun: target_wait (-1, status) =
infrun: 5831 [process 5831],
infrun: status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x400527
infrun: random signal 5
Program received signal SIGTRAP, Trace/breakpoint trap.
infrun: stop_stepping
0x0000000000400527 in main () at loop_long.c:19
19 }
The MI command cancels the continuations, and
breaks the ongoing background "finish" command.
This must be happening the other way around as
well --- executing -exec-finish in MI, and doing
'interpreter-exec cli "foobar"', which is much more
common, particularly, in non-stop mode...
After the patch:
(gdb) set debug infrun 1
(gdb) finish &
infrun: clear_proceed_status_thread (process 5328)
Run till exit from #0 do_sleep () at loop_long.c:6
infrun: proceed (addr=0xffffffffffffffff, signal=144, step=0)
infrun: resume (step=0, signal=0), trap_expected=0, current thread [process 5328] at 0x4004f8
(gdb) infrun: target_wait (-1, status) =
infrun: -1 [process -1],
infrun: status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
interpreter-exec mi "-asdf"
^error,msg="Undefined MI command: asdf"
(gdb)
(gdb) infrun: target_wait (-1, status) =
infrun: 5328 [process 5328],
infrun: status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x400526
infrun: BPSTAT_WHAT_STOP_NOISY
infrun: stop_stepping
main () at loop_long.c:19
19 }
Value returned is $1 = 1
I can't figure out why was it that at some point this was
necessary. Maybe it never was...
Will test&apply in a bit.
--
Pedro Alves
2011-05-30 Pedro Alves <pedro@codesourcery.com>
gdb/
* interps.c (interp_set): Don't cancel continuations.
---
gdb/interps.c | 1 -
1 file changed, 1 deletion(-)
Index: src/gdb/interps.c
===================================================================
--- src.orig/gdb/interps.c 2011-05-30 16:59:14.000000000 +0100
+++ src/gdb/interps.c 2011-05-30 17:18:13.964992588 +0100
@@ -150,7 +150,6 @@ interp_set (struct interp *interp, int t
if (current_interpreter != NULL)
{
- do_all_continuations (1);
ui_out_flush (uiout);
if (current_interpreter->procs->suspend_proc
&& !current_interpreter->procs->suspend_proc (current_interpreter->