Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Jerome Guitton <guitton@adacore.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] backtrace in mixed language applications
Date: Wed, 15 Aug 2007 19:14:00 -0000	[thread overview]
Message-ID: <20070815191834.GK11498@adacore.com> (raw)
In-Reply-To: <20070810100313.GA29799@adacore.com>

[I told Jerome about his attachments being encoded as video/dv]

> 2007-08-10  Jerome Guitton  <guitton@adacore.com>
> 
>         * stack.c (backtrace_command_1): select the frame that we are
>         about to print.

I'm uncertain about this one. I should have reviewed it when it was
checked in our tree...

> Index: stack.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/stack.c,v
> retrieving revision 1.150
> diff -u -p -r1.150 stack.c
> --- stack.c     25 Jul 2007 00:28:25 -0000      1.150
> +++ stack.c     10 Aug 2007 09:41:20 -0000
> @@ -1104,12 +1104,14 @@ backtrace_command_1 (char *count_exp, in
>    struct frame_info *fi;
>    int count;
>    int i;
> -  struct frame_info *trailing;
> +  struct frame_info *trailing, *selected_frame;
>    int trailing_level;
> 
>    if (!target_has_stack)
>      error (_("No stack."));
> 
> +  selected_frame = get_selected_frame (NULL);
> +
>    /* The following code must do two things.  First, it must set the
>       variable TRAILING to the frame from which we should start
>       printing.  Second, it must set the variable count to the number
> @@ -1177,6 +1179,10 @@ backtrace_command_1 (char *count_exp, in
>      {
>        QUIT;
> 
> +      /* Select the frame that we are printing, so that the parameters
> +         are displayed using the appropriate language.  */
> +      select_frame (fi);
> +
>        /* Don't use print_stack_frame; if an error() occurs it probably
>           means further attempts to backtrace would fail (on the other
>           hand, perhaps the code does or could be fixed to make sure
> @@ -1188,6 +1194,7 @@ backtrace_command_1 (char *count_exp, in
>        /* Save the last frame to check for error conditions.  */
>        trailing = fi;
>      }
> +  select_frame (selected_frame);

I think this opens the chance for the debugger to change the selected
frame if something goes wrong (or the user presses controlC), which is an
unexpected side-effect.

Also, I'm thinking this is the wrong place for doing this frame switch.
How about doing it inside print_frame? I think this would make sure
we cover all the cases where we print a frame, such as after an "up",
"down", or a "frame" command. And I think the frame selection needs
to be protected against error raising.

What do others think?

-- 
Joel


  reply	other threads:[~2007-08-15 19:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-10 10:03 Jerome Guitton
2007-08-15 19:14 ` Joel Brobecker [this message]
2007-08-15 19:29   ` Daniel Jacobowitz
2007-09-17 11:28 ` Jerome Guitton
2008-01-09 20:48 ` [RFA] backtrace in mixed language applications (take 2) Joel Brobecker
2008-01-29 18:06   ` Daniel Jacobowitz
2008-02-04 20:56     ` Joel Brobecker
2008-02-04 21:04       ` Joel Brobecker
2008-04-24  2:15         ` Joel Brobecker
2008-05-01 19:48           ` Daniel Jacobowitz
2008-05-07 11:36             ` Joel Brobecker

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=20070815191834.GK11498@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=guitton@adacore.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