From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8272 invoked by alias); 3 Oct 2013 05:04:14 -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 8262 invoked by uid 89); 3 Oct 2013 05:04:14 -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; Thu, 03 Oct 2013 05:04:14 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 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 r93541CK007008; Thu, 3 Oct 2013 07:04:01 +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; Thu, 3 Oct 2013 07:04:01 +0200 From: "ILG.Robert" To: Eli Zaretskii CC: "gdb-patches@sourceware.org" Subject: RE: Extending RSP with vCont;n and vCont;f Date: Thu, 03 Oct 2013 05:04:00 -0000 Message-ID: <7E3A266F5548C442BC08FA3038B5197C68449322@ATFKEX06.bachmann.at> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00112.txt.bz2 Hello again, Thank you for finding the documentation error. Below is the whole patch wit= h the correction. Thanks, Robert >>=20 >> we would like to improve the RSP command "vCont" for remote debugging. I= t seems that the range option has been=20 >>introduced recently to get rid of time consuming, successive single-steps= . Our intention is to get rid of further,=20 >>unnecessary RSP packages being sent as our target is capable to do a step= -over (called next by GDB) and a step-return=20 > > (called finish by GDB). Therefore we propose to extend the vCont comman= d with "vCont;n" and "vCont;f" as well. > >Thanks. > >> +=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,= =20 >> +GDB\n\ >> +=A0 tells the target to step out of the corresponding stack frame=20 >> +itself.\n\ >> +=A0 This speeds up source level stepping. If off, GDB issues slower\n\ > ^^ Two spaces between sentences, = please. diff --git a/gdb/remote.c b/gdb/remote.c index a9ef297..3522236 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -256,11 +256,19 @@ =20 /* vCont;r */ int r; + + /* vCont;f */ + int f; + + /* vCont;n */ + int n; }; =20 /* Controls whether GDB is willing to use range stepping. */ =20 static int use_range_stepping =3D 1; +static int use_finish_stepping =3D 1; +static int use_next_stepping =3D 1; =20 #define OPAQUETHREADBYTES 8 =20 @@ -4704,6 +4712,8 @@ support_C =3D 0; rs->supports_vCont.t =3D 0; rs->supports_vCont.r =3D 0; + rs->supports_vCont.n =3D 0; + rs->supports_vCont.f =3D 0; while (p && *p =3D=3D ';') { p++; @@ -4719,6 +4729,10 @@ rs->supports_vCont.t =3D 1; else if (*p =3D=3D 'r' && (*(p + 1) =3D=3D ';' || *(p + 1) =3D=3D 0)) rs->supports_vCont.r =3D 1; + else if (*p =3D=3D 'f' && (*(p + 1) =3D=3D ';' || *(p + 1) =3D=3D 0)) + rs->supports_vCont.f =3D 1; + else if (*p =3D=3D 'n' && (*(p + 1) =3D=3D ';' || *(p + 1) =3D=3D 0)) + rs->supports_vCont.n =3D 1; =20 p =3D strchr (p, ';'); } @@ -4747,9 +4761,29 @@ ptid_t ptid, int step, enum gdb_signal siggnal) { struct remote_state *rs =3D get_remote_state (); + struct thread_info *tp; + + if (ptid_equal (ptid, minus_one_ptid)) + { + /* If we don't know about the target thread's tid, then + * we're resuming magic_null_ptid (see caller). */ + tp =3D find_thread_ptid (magic_null_ptid); + } + else + tp =3D find_thread_ptid (ptid); =20 + gdb_assert (tp !=3D NULL); + if (step && siggnal !=3D GDB_SIGNAL_0) p +=3D xsnprintf (p, endp - p, ";S%02x", siggnal); + else if ( + /* GDB is willing to step next and target supports it */ + use_next_stepping && rs->supports_vCont.n && + /* step next is suitable for this resumption */ + step && (tp->control.step_over_calls =3D=3D STEP_OVER_ALL)) + { + p +=3D xsnprintf (p, endp - p, ";n"); + } else if (step /* GDB is willing to range step. */ && use_range_stepping @@ -4761,18 +4795,6 @@ it). */ && !(remote_multi_process_p (rs) && ptid_is_pid (ptid))) { - struct thread_info *tp; - - if (ptid_equal (ptid, minus_one_ptid)) - { - /* If we don't know about the target thread's tid, then - we're resuming magic_null_ptid (see caller). */ - tp =3D find_thread_ptid (magic_null_ptid); - } - else - tp =3D find_thread_ptid (ptid); - gdb_assert (tp !=3D NULL); - if (tp->control.may_range_step) { int addr_size =3D gdbarch_addr_bit (target_gdbarch ()) / 8; @@ -4790,6 +4812,14 @@ p +=3D xsnprintf (p, endp - p, ";s"); else if (siggnal !=3D GDB_SIGNAL_0) p +=3D xsnprintf (p, endp - p, ";C%02x", siggnal); + else if ( + /* GDB is willing to step next and target supports it */ + use_finish_stepping && rs->supports_vCont.f && + /* step finish is suitable for this resumption */ + (tp->control.proceed_to_finish =3D=3D 1)) + { + p +=3D xsnprintf (p, endp - p, ";f"); + } else p +=3D xsnprintf (p, endp - p, ";c"); =20 @@ -11760,6 +11790,82 @@ } } =20 +/* The "set/show next-stepping" show hook. */ + +static void +show_next_stepping (struct ui_file *file, int from_tty, + struct cmd_list_element *c, + const char *value) +{ + fprintf_filtered (file, + _("Debugger's willingness to use next stepping " + "is %s.\n"), value); +} + +/* The "set/show next-stepping" set hook. */ + +static void +set_next_stepping (char *ignore_args, int from_tty, + struct cmd_list_element *c) +{ + /* When enabling, check whether next stepping is actually + supported by the target, and warn if not. */ + if (use_next_stepping) + { + if (remote_desc !=3D NULL) + { + struct remote_state *rs =3D get_remote_state (); + + if (remote_protocol_packets[PACKET_vCont].support =3D=3D PACKET_SUPP= ORT_UNKNOWN) + remote_vcont_probe (rs); + + if (remote_protocol_packets[PACKET_vCont].support =3D=3D PACKET_ENAB= LE + && rs->supports_vCont.n) + return; + } + + warning (_("Next stepping is not supported by the current target")); + } +} + +/* The "set/show finish-stepping" show hook. */ + +static void +show_finish_stepping (struct ui_file *file, int from_tty, + struct cmd_list_element *c, + const char *value) +{ + fprintf_filtered (file, + _("Debugger's willingness to use finish stepping " + "is %s.\n"), value); +} + +/* The "set/show finish-stepping" set hook. */ + +static void +set_finish_stepping (char *ignore_args, int from_tty, + struct cmd_list_element *c) +{ + /* When enabling, check whether finish stepping is actually + supported by the target, and warn if not. */ + if (use_finish_stepping) + { + if (remote_desc !=3D NULL) + { + struct remote_state *rs =3D get_remote_state (); + + if (remote_protocol_packets[PACKET_vCont].support =3D=3D PACKET_SUPP= ORT_UNKNOWN) + remote_vcont_probe (rs); + + if (remote_protocol_packets[PACKET_vCont].support =3D=3D PACKET_ENAB= LE + && rs->supports_vCont.f) + return; + } + + warning (_("Finish stepping is not supported by the current target")= ); + } +} + void _initialize_remote (void) { @@ -12168,6 +12274,34 @@ &setlist, &showlist); =20 + add_setshow_boolean_cmd ("next-stepping", class_run, + &use_next_stepping, _("\ + Enable or disable next stepping."), _("\ + Show whether target-assisted next stepping is enabled."), _("\ + If on, and the target supports it, when skipping over a source line, GDB= \n\ + tells the target to skip the next instruction itself instead of\n\ + of issuing multiple single-steps. This speeds up source level\n\ + stepping. If off, GDB always issues slower stepping mechanisms\n\ + instead, even if next stepping is supported by the target. The default = is on."), + set_next_stepping, + show_next_stepping, + &setlist, + &showlist); + + add_setshow_boolean_cmd ("finish-stepping", class_run, + &use_finish_stepping, _("\ + Enable or disable finish stepping."), _("\ + Show whether target-assisted finish stepping is enabled."), _("\ + If on, and the target supports it, when stepping out of a function, GDB\= n\ + tells the target to step out of the corresponding stack frame itself.\n\ + This speeds up source level stepping. If off, GDB issues slower\n\ + stepping mechanisms instead, even if finish\n\ + stepping is supported by the target. The default is on."), + set_finish_stepping, + show_finish_stepping, + &setlist, + &showlist); + /* Eventually initialize fileio. See fileio.c */ initialize_remote_fileio (remote_set_cmdlist, remote_show_cmdlist);