This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/4] Show new created display
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 30 Apr 2014 17:25:56 +0100
- Subject: Re: [PATCH 2/4] Show new created display
- Authentication-results: sourceware.org; auth=none
- References: <1398665538-16580-1-git-send-email-yao at codesourcery dot com> <1398665538-16580-3-git-send-email-yao at codesourcery dot com>
On 04/28/2014 07:12 AM, Yao Qi wrote:
> When I run refactored unavailable.exp, I find
> command display behaves a little different on live inferior and on
> examining traceframes. In live inferior, when command "display argc"
> is typed, the value of "argc" is shown.
>
> (gdb) display argc
> 1: argc = 1 '\001'
>
> however, on tfile target, when command "display argc" is typed, the
> value of "argc" is not shown.
>
> (gdb) tfind
> Found trace frame 0, tracepoint 1
> at ../../../../git/gdb/testsuite/gdb.trace/unavailable.cc:198
> 198 i = (int) argc + argi + argf + argd + argstruct.memberi + argarray[1];
> (gdb) display argc
>
> I also notice that on "core" target, the value of "argc" isn't shown
> either. This difference is caused by the code below in printcmd.c:display_command,
>
> if (from_tty && target_has_execution)
> do_one_display (new);
>
> Looks the value of each display is shown if the target has execution.
> Source code archaeology doesn't tell much about this requirement.
> However, if we type command "display" then on "core" or "tfile"
> target, the value of "argc" is still displayed,
Maybe ancient, ancient code that tried to prevent "display $pc"
from erroring out?
Judging from doing that when there's execution, and then
killing the inferior, and getting:
(gdb) display
1: $pc = <error: No registers.>
Looks like we handle errors fine here, so I see no issue.
I assume that if there's no target pushed yet, we'll now
see that error -- it's fine with me.
It would be good if display.exp itself was augmented to explicitly
test this. Say, do "display global" (where global is a variable that
is initialized to something not zero), and also "display $pc" before
there's execution.
> This patch is to remove the checking to target_has_execution from the
> condition.
OK.
--
Pedro Alves