Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Abid, Hafiz" <Hafiz_Abid@mentor.com>
To: Joshua Watt <jpewdev@gmail.com>,
	"gdb-patches@sourceware.org"	<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	[thread overview]
Message-ID: <EB3B29AD43CA924DA27099BC851923768C56C1C1@EU-MBX-02.mgc.mentorg.com> (raw)
In-Reply-To: <CAEPrYjRZDs1JV93cWRH1JUEMcQEW2aqtZ6fS_4i9g9wuHfR1VQ@mail.gmail.com>

Hi,
You may need copyright assignment. Also the patch needs change log entry. See some of my comments inline. 


> -----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
> 
> 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
> 
> 
> This patch allows the user to turn off the checking for inner frames
> when performing
> a backtrace using the command:
> 
> set backtrace check-inner off
> 
> 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.

> 
> 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);
>  }
> 
> +static unsigned int backtrace_check_inner = 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);
> +}
> +
> 
>  static void
>  fprint_field (struct ui_file *file, const char *name, int p, CORE_ADDR
> addr)
>  {
>    if (p)
> @@ -1670,11 +1680,12 @@
> 
>    /* 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) == NORMAL_FRAME
> +  if (backtrace_check_inner
> +      && get_frame_type (this_frame) == NORMAL_FRAME
>        && this_frame->next->unwind->type == 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);
> 
> +  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).
 
Regards,
Abid
--
Hafiz Abid Qadeer
Mentor Graphics
hafiz_abid@mentor.com
+44 161 926 1630


  reply	other threads:[~2012-10-03  9:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-02 17:58 Joshua Watt
2012-10-03  9:29 ` Abid, Hafiz [this message]
2012-10-03 14:03   ` Joshua Watt
2012-10-03 13:57 ` Joel Brobecker
2012-10-05 21:10   ` Joshua Watt
2012-10-06 18:34   ` Jan Kratochvil
2012-10-07  5:52     ` Jan Kratochvil

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=EB3B29AD43CA924DA27099BC851923768C56C1C1@EU-MBX-02.mgc.mentorg.com \
    --to=hafiz_abid@mentor.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jpewdev@gmail.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