From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25600 invoked by alias); 31 Aug 2010 18:37:48 -0000 Received: (qmail 25587 invoked by uid 22791); 31 Aug 2010 18:37:47 -0000 X-SWARE-Spam-Status: No, hits=0.2 required=5.0 tests=AWL,BAYES_00,RCVD_ILLEGAL_IP X-Spam-Check-By: sourceware.org Received: from imr4.ericy.com (HELO imr4.ericy.com) (198.24.6.8) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 31 Aug 2010 18:37:41 +0000 Received: from eusaamw0712.eamcs.ericsson.se ([147.117.20.181]) by imr4.ericy.com (8.14.3/8.14.3/Debian-9.1ubuntu1) with ESMTP id o7VIi1GA023427; Tue, 31 Aug 2010 13:44:59 -0500 Received: from EUSAACMS0703.eamcs.ericsson.se ([169.254.1.134]) by eusaamw0712.eamcs.ericsson.se ([147.117.20.181]) with mapi; Tue, 31 Aug 2010 14:37:38 -0400 From: Marc Khouzam To: "'Michael Snyder'" , "'Pedro Alves'" CC: "'gdb@sourceware.org'" Date: Tue, 31 Aug 2010 18:37:00 -0000 Subject: RE: Different output from -gdb-show than show Message-ID: References: <201008311629.12479.pedro@codesourcery.com> <4C7D4AED.1090000@vmware.com> In-Reply-To: <4C7D4AED.1090000@vmware.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-08/txt/msg00176.txt.bz2 =20 > -----Original Message----- > From: Michael Snyder [mailto:msnyder@vmware.com]=20 > Sent: Tuesday, August 31, 2010 2:33 PM > To: Pedro Alves > Cc: gdb@sourceware.org; Marc Khouzam > Subject: Re: Different output from -gdb-show than show >=20 > Pedro Alves wrote: > > 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=3D"reverse" > >> (gdb) show exec-direction > >> &"show exec-direction\n" > >> ~"Forward.\n" > >> ^done > >> > >> For some reason, -gdb-show is giving a different result=20 > than CLI show. > >> For my "does target support reverse" case, I will be=20 > forced to use 'show'. > >> > >> Bug? > >=20 > > Yes. Here in infrun.c: > >=20 > >> /* User interface for reverse debugging: > >> Set exec-direction / show exec-direction commands > >> (returns error unless target implements=20 > to_set_exec_direction method). */ > >> > >> enum exec_direction_kind execution_direction =3D EXEC_FORWARD; > >> static const char exec_forward[] =3D "forward"; > >> static const char exec_reverse[] =3D "reverse"; > >> static const char *exec_direction =3D exec_forward; > >> static const char *exec_direction_names[] =3D { > >> 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 =3D EXEC_FORWARD; > >> else if (!strcmp (exec_direction, exec_reverse)) > >> execution_direction =3D EXEC_REVERSE; > >> } > >> } > >> > >=20 > > The above does not complain if target_can_execute_reverse=20 > is false, contrary > > to what the comment above says. > > Leaves exec_direction and execution_direction out of sync=20 > in that case. > > (your case, because you haven't started the process yet,=20 > you're debugging > > the executable, which can't do reverse debugging) > >=20 > >> static void > >> show_exec_direction_func (struct ui_file *out, int from_tty, > >> struct cmd_list_element *cmd, const=20 > 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,=20 > >> _("Forward (target `%s' does not support=20 > exec-direction).\n"), > >> target_shortname); > >> break; > >> } > >> } > >=20 > > "show exec-direction" prints based on execution_direction, while > > "-gdb-show exec-direction" prints the raw exec_drection string: > >=20 > >> add_setshow_enum_cmd ("exec-direction", class_run,=20 > exec_direction_names, > >> &exec_direction, _("Set direction of=20 > execution.\n\ > > ^^^^^^^^^^^^^^^ > > This is what is used by -gdb-show. --^ > >=20 > >=20 >=20 >=20 > My bad. >=20 > Would this be suitable? >=20 > 2010-08-31 Michael Snyder >=20 > * infrun.c (set_exec_direction_func): Error out if=20 > target does not > support reverse execution. >=20 > Index: infrun.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/infrun.c,v > retrieving revision 1.445 > diff -u -p -r1.445 infrun.c > --- infrun.c 1 Jul 2010 15:36:15 -0000 1.445 > +++ infrun.c 31 Aug 2010 18:32:36 -0000 > @@ -6436,6 +6436,8 @@ set_exec_direction_func (char *args, int > else if (!strcmp (exec_direction, exec_reverse)) > execution_direction =3D EXEC_REVERSE; > } > + else maybe also doing exec_direction =3D exec_forward; before the error? (I stole it from the non_stop case :-)) > + error (_("Target does not support this operation.")); > } >=20=20 > static void