From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14228 invoked by alias); 2 Oct 2013 15:08:12 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 14214 invoked by uid 89); 2 Oct 2013 15:08:10 -0000 Received: from mail.bachmann.info (HELO mail.bachmann.info) (213.33.91.3) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 02 Oct 2013 15:08:10 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: mail.bachmann.info Received: from atfkex04.bachmann.at (atfkex04.bachmann.at [10.10.10.8]) by mail.bachmann.info (8.14.5/8.14.5) with ESMTP id r92F82Um032431 for ; Wed, 2 Oct 2013 17:08:02 +0200 Received: from atfkex06.bachmann.at ([fe80::f8b1:c064:d390:b714]) by atfkex04.bachmann.at ([fe80::e9df:b70d:a4dd:a52d%11]) with mapi id 14.03.0123.003; Wed, 2 Oct 2013 17:08:03 +0200 From: "ILG.Robert" To: "gdb-patches@sourceware.org" Subject: Extending RSP with vCont;n and vCont;f Date: Wed, 02 Oct 2013 15:08:00 -0000 Message-ID: <7E3A266F5548C442BC08FA3038B5197C68449231@ATFKEX06.bachmann.at> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-SW-Source: 2013-10/txt/msg00094.txt.bz2 Hallo, we would like to improve the RSP command "vCont" for remote debugging. It s= eems that the range option has been introduced recently to get rid of time = consuming, successive single-steps. Our intention is to get rid of further,= unnecessary RSP packages being sent as our target is capable to do a step-= over (called next by GDB) and a step-return (called finish by GDB). Therefo= re we propose to extend the vCont command with "vCont;n" and "vCont;f" as w= ell. You will find the necessary patch below. It has been tested on MinGW with a= x86-Target. It's based on the todays trunk. Thanks in advance.=20 Robert Ilg diff --git a/gdb/remote.c b/gdb/remote.c index a9ef297..df31c3a 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -256,11 +256,19 @@ =A0=A0=A0/* vCont;r */ =A0=A0 int r; + +=A0 /* vCont;f */ +=A0 int f; + +=A0 /* vCont;n */ +=A0 int n; }; =A0/* Controls whether GDB is willing to use range stepping.=A0 */ =A0static int use_range_stepping =3D 1; +static int use_finish_stepping =3D 1; +static int use_next_stepping =3D 1; =A0#define OPAQUETHREADBYTES 8 @@ -4704,6 +4712,8 @@ =A0=A0=A0=A0=A0=A0 support_C =3D 0; =A0=A0=A0=A0=A0=A0 rs->supports_vCont.t =3D 0; =A0=A0=A0=A0=A0=A0 rs->supports_vCont.r =3D 0; +=A0=A0=A0=A0=A0 rs->supports_vCont.n =3D 0; +=A0=A0=A0=A0=A0 rs->supports_vCont.f =3D 0; =A0=A0=A0=A0=A0=A0 while (p && *p =3D=3D ';') =A0=A0=A0 { =A0=A0=A0 =A0=A0p++; @@ -4719,6 +4729,10 @@ =A0=A0=A0 =A0=A0=A0=A0rs->supports_vCont.t =3D 1; =A0=A0=A0 =A0=A0else if (*p =3D=3D 'r' && (*(p + 1) =3D=3D ';' || *(p + 1) = =3D=3D 0)) =A0=A0=A0 =A0=A0=A0=A0rs->supports_vCont.r =3D 1; +=A0=A0=A0=A0=A0 else if (*p =3D=3D 'f' && (*(p + 1) =3D=3D ';' || *(p + 1)= =3D=3D 0)) +=A0=A0=A0=A0=A0=A0=A0 rs->supports_vCont.f =3D 1; +=A0=A0=A0=A0=A0 else if (*p =3D=3D 'n' && (*(p + 1) =3D=3D ';' || *(p + 1)= =3D=3D 0)) +=A0=A0=A0=A0=A0=A0=A0 rs->supports_vCont.n =3D 1; =A0=A0=A0=A0 =A0=A0p =3D strchr (p, ';'); =A0=A0=A0 } @@ -4747,9 +4761,29 @@ =A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0=A0ptid_t ptid, int step, enum gdb_signal si= ggnal) { =A0=A0 struct remote_state *rs =3D get_remote_state (); +=A0 struct thread_info *tp; + +=A0 if (ptid_equal (ptid, minus_one_ptid)) +=A0 { +=A0=A0=A0 /* If we don't know about the target thread's tid, then +=A0=A0=A0=A0 * we're resuming magic_null_ptid (see caller).=A0 */ +=A0=A0=A0 tp =3D find_thread_ptid (magic_null_ptid); +=A0=A0 } +=A0=A0 else +=A0=A0=A0=A0 tp =3D find_thread_ptid (ptid); +=A0=A0 gdb_assert (tp !=3D NULL); + =A0=A0 if (step && siggnal !=3D GDB_SIGNAL_0) =A0=A0=A0=A0 p +=3D xsnprintf (p, endp - p, ";S%02x", siggnal); +=A0 else if ( +=A0=A0=A0=A0=A0=A0 /* GDB is willing to step next and target supports it */ +=A0=A0=A0=A0=A0=A0 use_next_stepping && rs->supports_vCont.n && +=A0=A0=A0=A0=A0=A0 /* step next is suitable for this resumption */ +=A0=A0=A0=A0=A0=A0 step && (tp->control.step_over_calls =3D=3D STEP_OVER_A= LL)) +=A0 { +=A0=A0=A0 p +=3D xsnprintf (p, endp - p, ";n"); +=A0 } =A0=A0 else if (step =A0=A0=A0 =A0=A0=A0/* GDB is willing to range step.=A0 */ =A0=A0=A0 =A0=A0=A0&& use_range_stepping @@ -4761,18 +4795,6 @@ =A0=A0=A0 =A0=A0=A0=A0=A0=A0it).=A0 */ =A0=A0=A0 =A0=A0=A0&& !(remote_multi_process_p (rs) && ptid_is_pid (ptid))) =A0=A0=A0=A0 { -=A0=A0=A0=A0=A0 struct thread_info *tp; - -=A0=A0=A0=A0=A0 if (ptid_equal (ptid, minus_one_ptid)) -=A0=A0=A0 { -=A0=A0=A0 =A0 /* If we don't know about the target thread's tid, then -=A0=A0=A0 =A0=A0=A0=A0 we're resuming magic_null_ptid (see caller).=A0 */ -=A0=A0=A0 =A0 tp =3D find_thread_ptid (magic_null_ptid); -=A0=A0=A0 } -=A0=A0=A0=A0=A0 else -=A0=A0=A0 tp =3D find_thread_ptid (ptid); -=A0=A0=A0=A0=A0 gdb_assert (tp !=3D NULL); - =A0=A0=A0=A0=A0=A0 if (tp->control.may_range_step) =A0=A0=A0 { =A0=A0=A0 =A0=A0int addr_size =3D gdbarch_addr_bit (target_gdbarch ()) / 8; @@ -4790,6 +4812,14 @@ =A0=A0=A0=A0 p +=3D xsnprintf (p, endp - p, ";s"); =A0=A0 else if (siggnal !=3D GDB_SIGNAL_0) =A0=A0=A0=A0 p +=3D xsnprintf (p, endp - p, ";C%02x", siggnal); +=A0 else if ( +=A0=A0=A0=A0=A0=A0 /* GDB is willing to step next and target supports it */ +=A0=A0=A0=A0=A0=A0 use_finish_stepping && rs->supports_vCont.f && +=A0=A0=A0=A0=A0=A0 /* step finish is suitable for this resumption */ +=A0=A0=A0=A0=A0=A0 (tp->control.proceed_to_finish =3D=3D 1)) +=A0 { +=A0=A0=A0 p +=3D xsnprintf (p, endp - p, ";f"); +=A0 } =A0=A0 else =A0=A0=A0=A0 p +=3D xsnprintf (p, endp - p, ";c"); @@ -11760,6 +11790,82 @@ =A0=A0=A0=A0 } } +/* The "set/show next-stepping" show hook.=A0 */ + +static void +show_next_stepping (struct ui_file *file, int from_tty, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 struct cmd_list_element *c, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 const char *value) +{ +=A0 fprintf_filtered (file, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 _("Debugger's willingness to use next st= epping " +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "is %s.\n"), value); +} + +/* The "set/show next-stepping" set hook.=A0 */ + +static void +set_next_stepping (char *ignore_args, int from_tty, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 struct cmd_list_element *c) +{ +=A0 /* When enabling, check whether next stepping is actually +=A0=A0=A0=A0 supported by the target, and warn if not.=A0 */ +=A0 if (use_next_stepping) +=A0=A0=A0 { +=A0=A0=A0=A0=A0 if (remote_desc !=3D NULL) +=A0=A0=A0 { +=A0=A0=A0=A0=A0 struct remote_state *rs =3D get_remote_state (); + +=A0=A0=A0=A0=A0 if (remote_protocol_packets[PACKET_vCont].support =3D=3D P= ACKET_SUPPORT_UNKNOWN) +=A0=A0=A0=A0=A0=A0=A0 remote_vcont_probe (rs); + +=A0=A0=A0=A0=A0 if (remote_protocol_packets[PACKET_vCont].support =3D=3D P= ACKET_ENABLE +=A0=A0=A0=A0=A0=A0=A0=A0=A0 && rs->supports_vCont.n) +=A0=A0=A0=A0=A0=A0=A0 return; +=A0=A0=A0 } + +=A0=A0=A0=A0=A0 warning (_("Next stepping is not supported by the current = target")); +=A0=A0=A0 } +} + +/* The "set/show finish-stepping" show hook.=A0 */ + +static void +show_finish_stepping (struct ui_file *file, int from_tty, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 struct cmd_list_element *c, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 const char *value) +{ +=A0 fprintf_filtered (file, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 _("Debugger's willingness to use finish = stepping " +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "is %s.\n"), value); +} + +/* The "set/show finish-stepping" set hook.=A0 */ + +static void +set_finish_stepping (char *ignore_args, int from_tty, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 struct cmd_list_element *c) +{ +=A0 /* When enabling, check whether finish stepping is actually +=A0=A0=A0=A0 supported by the target, and warn if not.=A0 */ +=A0 if (use_finish_stepping) +=A0=A0=A0 { +=A0=A0=A0=A0=A0 if (remote_desc !=3D NULL) +=A0=A0=A0 { +=A0=A0=A0=A0=A0 struct remote_state *rs =3D get_remote_state (); + +=A0=A0=A0=A0=A0 if (remote_protocol_packets[PACKET_vCont].support =3D=3D P= ACKET_SUPPORT_UNKNOWN) +=A0=A0=A0=A0=A0=A0=A0 remote_vcont_probe (rs); + +=A0=A0=A0=A0=A0 if (remote_protocol_packets[PACKET_vCont].support =3D=3D P= ACKET_ENABLE +=A0=A0=A0=A0=A0=A0=A0=A0=A0 && rs->supports_vCont.f) +=A0=A0=A0=A0=A0=A0=A0 return; +=A0=A0=A0 } + +=A0=A0=A0=A0=A0 warning (_("Finish stepping is not supported by the curren= t target")); +=A0=A0=A0 } +} + void _initialize_remote (void) { @@ -12168,6 +12274,34 @@ =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0=A0&setlist, =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0=A0&showlist); +=A0 add_setshow_boolean_cmd ("next-stepping", class_run, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &use_next_stepping, _("\ +=A0 Enable or disable next stepping."), _("\ +=A0 Show whether target-assisted next stepping is enabled."), _("\ +=A0 If on, and the target supports it, when skipping over a source line, G= DB\n\ +=A0 tells the target to skip the next instruction itself instead of\n\ +=A0 of issuing multiple single-steps.=A0 This speeds up source level\n\ +=A0 stepping.=A0 If off, GDB always issues slower stepping mechanisms\n\ +=A0 instead, even if next stepping is supported by the target.=A0 The defa= ult is on."), +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 set_next_stepping, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 show_next_stepping, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &setlist, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &showlist); + +=A0 add_setshow_boolean_cmd ("finish-stepping", class_run, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &use_finish_stepping, _("\ +=A0 Enable or disable finish stepping."), _("\ +=A0 Show whether target-assisted finish stepping is enabled."), _("\ +=A0 If on, and the target supports it, when stepping out of a function, GD= B\n\ +=A0 tells the target to step out of the corresponding stack frame itself.\= n\ +=A0 This speeds up source level stepping. If off, GDB issues slower\n\ +=A0 stepping mechanisms instead, even if finish\n\ +=A0 stepping is supported by the target.=A0 The default is on."), +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 set_finish_stepping, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 show_finish_stepping, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &setlist, +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &showlist); + =A0=A0 /* Eventually initialize fileio.=A0 See fileio.c */ =A0=A0initialize_remote_fileio (remote_set_cmdlist, remote_show_cmdlist);