* [2/3] RFC: *stopped and CLI commands
@ 2011-11-16 20:00 Tom Tromey
2011-11-22 15:08 ` Pedro Alves
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2011-11-16 20:00 UTC (permalink / raw)
To: gdb-patches
I noticed while working on the PR that if you type "run" to an MI-mode
gdb, then the *stopped notification will not have any 'reason' field, or
other fields emitted by the print_it method.
The fix is simple: call bpstat_print at the right place in MI.
There is already a little special case in this code for printing the
frame, so I think a bit more here doesn't hurt.
The test case is in the next patch.
Tom
2011-11-16 Tom Tromey <tromey@redhat.com>
* mi/mi-interp.c (mi_on_normal_stop): Call bpstat_print.
From 9554d74f7a6b4b0db7f416b970ae94f55e4e8aa0 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@redhat.com>
Date: Tue, 15 Nov 2011 14:35:23 -0700
Subject: [PATCH 2/3] make *stopped show reason for CLI commands as well
---
gdb/ChangeLog | 4 ++++
gdb/mi/mi-interp.c | 1 +
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 805e3f8..2aec1c7 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -429,6 +429,7 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
struct ui_out *saved_uiout = current_uiout;
current_uiout = mi_uiout;
+ bpstat_print (bs);
print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
current_uiout = saved_uiout;
}
--
1.7.6.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [2/3] RFC: *stopped and CLI commands
2011-11-16 20:00 [2/3] RFC: *stopped and CLI commands Tom Tromey
@ 2011-11-22 15:08 ` Pedro Alves
2011-11-22 20:05 ` Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2011-11-22 15:08 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
On Wednesday 16 November 2011 20:00:30, Tom Tromey wrote:
> diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
> index 805e3f8..2aec1c7 100644
> --- a/gdb/mi/mi-interp.c
> +++ b/gdb/mi/mi-interp.c
> @@ -429,6 +429,7 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
> struct ui_out *saved_uiout = current_uiout;
>
> current_uiout = mi_uiout;
> + bpstat_print (bs);
> print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
> current_uiout = saved_uiout;
> }
Hmm, I should have read this one first. This means that with
patch 3 we'll print "Stopped due to ..." twice?
--
Pedro Alves
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [2/3] RFC: *stopped and CLI commands
2011-11-22 15:08 ` Pedro Alves
@ 2011-11-22 20:05 ` Tom Tromey
2011-11-22 20:48 ` Pedro Alves
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2011-11-22 20:05 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
>>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:
Pedro> On Wednesday 16 November 2011 20:00:30, Tom Tromey wrote:
>> diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
>> index 805e3f8..2aec1c7 100644
>> --- a/gdb/mi/mi-interp.c
>> +++ b/gdb/mi/mi-interp.c
>> @@ -429,6 +429,7 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
>> struct ui_out *saved_uiout = current_uiout;
>>
>> current_uiout = mi_uiout;
>> + bpstat_print (bs);
>> print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
>> current_uiout = saved_uiout;
>> }
Pedro> Hmm, I should have read this one first. This means that with
Pedro> patch 3 we'll print "Stopped due to ..." twice?
Yes, I hadn't noticed that. Oops.
However, we still need this call in order to get the reason= output in
the MI notification when the command was a CLI command. That is, if you
omit this call, you get:
(gdb)
run
&"run\n"
~"Starting program: /home/tromey/Space/SecondArcher/build/gdb/testsuite/gdb.mi/solib-main \n"
=thread-group-started,id="i1",pid="32683"
=thread-created,id="1",group-id="i1"
^running
*running,thread-id="all"
(gdb)
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
~"Stopped due to shared library event\n"
*stopped,frame={addr="0x0000003a15c0ea20",func="__GI__dl_debug_state",args=[],file="dl-debug.c",fullname="/usr/src/debug/glibc-2.14-34-ge2a3090/elf/dl-debug.c",line="77"},thread-id="1",stopped-threads="all",core="2"
Note how the *stopped doesn't have a reason.
The fix is to leave this call to bpstat_print, but to change the
printing of "Stopped due to shared library event" to use ui_out_text
rather than printf_filtered. This eliminates the double printing.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [2/3] RFC: *stopped and CLI commands
2011-11-22 20:05 ` Tom Tromey
@ 2011-11-22 20:48 ` Pedro Alves
0 siblings, 0 replies; 4+ messages in thread
From: Pedro Alves @ 2011-11-22 20:48 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On Tuesday 22 November 2011 20:05:17, Tom Tromey wrote:
> >>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:
> Pedro> Hmm, I should have read this one first. This means that with
> Pedro> patch 3 we'll print "Stopped due to ..." twice?
>
> Yes, I hadn't noticed that. Oops.
>
> However, we still need this call in order to get the reason= output in
> the MI notification when the command was a CLI command. That is, if you
> omit this call, you get:
...
> Note how the *stopped doesn't have a reason.
>
> The fix is to leave this call to bpstat_print, but to change the
> printing of "Stopped due to shared library event" to use ui_out_text
> rather than printf_filtered. This eliminates the double printing.
Yeah, makes sense.
--
Pedro Alves
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-11-22 20:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-16 20:00 [2/3] RFC: *stopped and CLI commands Tom Tromey
2011-11-22 15:08 ` Pedro Alves
2011-11-22 20:05 ` Tom Tromey
2011-11-22 20:48 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox