From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5488 invoked by alias); 3 Oct 2012 09:29:09 -0000 Received: (qmail 5469 invoked by uid 22791); 3 Oct 2012 09:29:08 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Oct 2012 09:29:03 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1TJLGH-0002LC-2h from Hafiz_Abid@mentor.com ; Wed, 03 Oct 2012 02:29:01 -0700 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 3 Oct 2012 02:29:00 -0700 Received: from EU-MBX-02.mgc.mentorg.com ([169.254.3.206]) by SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) with mapi id 14.01.0289.001; Wed, 3 Oct 2012 10:28:59 +0100 From: "Abid, Hafiz" To: Joshua Watt , "gdb-patches@sourceware.org" Subject: RE: [PATCH] Add option to control checking of inner frames when doing a backtrace Date: Wed, 03 Oct 2012 09:29:00 -0000 Message-ID: References: In-Reply-To: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 X-SW-Source: 2012-10/txt/msg00031.txt.bz2 Hi, You may need copyright assignment. Also the patch needs change log entry. S= ee some of my comments inline.=20 > -----Original Message----- > From: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] On Behalf Of Joshua Watt > Sent: Tuesday, October 02, 2012 6:59 PM > To: gdb-patches@sourceware.org > Subject: [PATCH] Add option to control checking of inner frames when > doing a backtrace >=20 > Please note: this is the first patch I have ever submitted for GDB, so > please let > me know if there are any problems. -- Joshua Watt >=20 >=20 > This patch allows the user to turn off the checking for inner frames > when performing > a backtrace using the command: >=20 > set backtrace check-inner off >=20 > This is useful if a thread is switching execution to run on another > stack, as this will > often cause the inner frame condition to fail. I don't understand the motivation. Can you please explain a bit more. >=20 > diff -U 5 -Nar gdb-7.5.50.20121002-orig/gdb/frame.c > gdb-7.5.50.20121002/gdb/frame.c > --- gdb-7.5.50.20121002-orig/gdb/frame.c 2012-09-17 02:15:48 -0500 > +++ gdb-7.5.50.20121002/gdb/frame.c 2012-10-02 12:25:47 -0500 > @@ -205,10 +205,20 @@ > _("An upper bound on the number " > "of backtrace levels is %s.\n"), > value); > } >=20 > +static unsigned int backtrace_check_inner =3D TRUE; > +static void > +show_backtrace_check_inner (struct ui_file *file, int from_tty, > + struct cmd_list_element *c, const char *value) > +{ > + fprintf_filtered (file, _("Whether backtraces should check for inner > " > + "frames is %s.\n"), > + value); > +} > + >=20 > static void > fprint_field (struct ui_file *file, const char *name, int p, CORE_ADDR > addr) > { > if (p) > @@ -1670,11 +1680,12 @@ >=20 > /* Check that this frame's ID isn't inner to (younger, below, next) > the next frame. This happens when a frame unwind goes backwards. > This check is valid only if this frame and the next frame are > NORMAL. > See the comment at frame_id_inner for details. */ > - if (get_frame_type (this_frame) =3D=3D NORMAL_FRAME > + if (backtrace_check_inner > + && get_frame_type (this_frame) =3D=3D NORMAL_FRAME > && this_frame->next->unwind->type =3D=3D NORMAL_FRAME > && frame_id_inner (get_frame_arch (this_frame->next), this_id, > get_frame_id (this_frame->next))) > { > CORE_ADDR this_pc_in_block; > @@ -2504,10 +2515,25 @@ > NULL, > show_backtrace_limit, > &set_backtrace_cmdlist, > &show_backtrace_cmdlist); >=20 > + add_setshow_boolean_cmd ("check-inner", class_obscure, > + &backtrace_check_inner, _("\ > +Sets whether backtraces will check if a frame is inner to the previous > frame"), > + _("\ > +Shows whether backtraces will check if a frame is inner to the > previous frame"), > + _("\ > +Normally frames are laid out in a specific order on the stack. This > controls\n\ > +whether GDB will validate that the frames are in the correct order. > Frames\n\ > +can commonly be out of order if a thread switches to a different > stack during\n\ > +execution"), > + NULL, > + show_backtrace_check_inner, > + &set_backtrace_cmdlist, > + &show_backtrace_cmdlist); > + > /* Debug this files internals. */ > add_setshow_zuinteger_cmd ("frame", class_maintenance, &frame_debug, > _("\ > Set frame debugging."), _("\ > Show frame debugging."), _("\ > When non-zero, frame specific internal debugging is enabled."), This command will need documentation(see gdb/doc/gdb.texinfo in GDB source = base). =20 Regards, Abid -- Hafiz Abid Qadeer Mentor Graphics hafiz_abid@mentor.com +44 161 926 1630