From: Pedro Alves <pedro@codesourcery.com>
To: gdb@sourceware.org
Cc: Marc Khouzam <marc.khouzam@ericsson.com>
Subject: Re: Different output from -gdb-show than show
Date: Tue, 31 Aug 2010 15:29:00 -0000 [thread overview]
Message-ID: <201008311629.12479.pedro@codesourcery.com> (raw)
In-Reply-To: <F7CE05678329534C957159168FA70DEC571703485B@EUSAACMS0703.eamcs.ericsson.se>
On Tuesday 31 August 2010 16:02:39, Marc Khouzam wrote:
> Hi,
>
> while looking for a way know if a target supports reverse execution
> I noticed this:
>
> > gdb.7.2 -i mi testing/a.out
> (gdb) start
> (gdb) -gdb-set exec-direction reverse
> ^done
> (gdb) -gdb-show exec-direction
> ^done,value="reverse"
> (gdb) show exec-direction
> &"show exec-direction\n"
> ~"Forward.\n"
> ^done
>
> For some reason, -gdb-show is giving a different result than CLI show.
> For my "does target support reverse" case, I will be forced to use 'show'.
>
> Bug?
Yes. Here in infrun.c:
> /* User interface for reverse debugging:
> Set exec-direction / show exec-direction commands
> (returns error unless target implements to_set_exec_direction method). */
>
> enum exec_direction_kind execution_direction = EXEC_FORWARD;
> static const char exec_forward[] = "forward";
> static const char exec_reverse[] = "reverse";
> static const char *exec_direction = exec_forward;
> static const char *exec_direction_names[] = {
> exec_forward,
> exec_reverse,
> NULL
> };
>
>
> static void
> set_exec_direction_func (char *args, int from_tty,
> struct cmd_list_element *cmd)
> {
> if (target_can_execute_reverse)
> {
> if (!strcmp (exec_direction, exec_forward))
> execution_direction = EXEC_FORWARD;
> else if (!strcmp (exec_direction, exec_reverse))
> execution_direction = EXEC_REVERSE;
> }
> }
>
The above does not complain if target_can_execute_reverse is false, contrary
to what the comment above says.
Leaves exec_direction and execution_direction out of sync in that case.
(your case, because you haven't started the process yet, you're debugging
the executable, which can't do reverse debugging)
> static void
> show_exec_direction_func (struct ui_file *out, int from_tty,
> struct cmd_list_element *cmd, const char *value)
> {
> switch (execution_direction) {
> case EXEC_FORWARD:
> fprintf_filtered (out, _("Forward.\n"));
> break;
> case EXEC_REVERSE:
> fprintf_filtered (out, _("Reverse.\n"));
> break;
> case EXEC_ERROR:
> default:
> fprintf_filtered (out,
> _("Forward (target `%s' does not support exec-direction).\n"),
> target_shortname);
> break;
> }
> }
"show exec-direction" prints based on execution_direction, while
"-gdb-show exec-direction" prints the raw exec_drection string:
> add_setshow_enum_cmd ("exec-direction", class_run, exec_direction_names,
> &exec_direction, _("Set direction of execution.\n\
^^^^^^^^^^^^^^^
This is what is used by -gdb-show. --^
--
Pedro Alves
next prev parent reply other threads:[~2010-08-31 15:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-31 15:03 Marc Khouzam
2010-08-31 15:29 ` Pedro Alves [this message]
2010-08-31 18:33 ` Michael Snyder
2010-08-31 18:37 ` Marc Khouzam
2010-08-31 18:41 ` Pedro Alves
2010-08-31 19:03 ` Michael Snyder
2010-08-31 19:08 ` Pedro Alves
2010-08-31 19:10 ` Michael Snyder
2010-08-31 19:29 ` Pedro Alves
2010-08-31 19:32 ` Michael Snyder
2010-08-31 19:40 ` Marc Khouzam
2010-08-31 20:03 ` Pedro Alves
2010-08-31 20:11 ` Marc Khouzam
2010-08-31 20:27 ` Pedro Alves
2010-09-01 15:37 ` Marc Khouzam
2010-08-31 19:39 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201008311629.12479.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb@sourceware.org \
--cc=marc.khouzam@ericsson.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox