Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Nick Roberts <nickrob@snap.net.nz>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] PR backtrace/9786
Date: Mon, 23 Feb 2009 00:51:00 -0000	[thread overview]
Message-ID: <20090223001651.GA26056@adacore.com> (raw)
In-Reply-To: <18849.13514.379735.375860@kahikatea.snap.net.nz>

The problem was reported as follow: Doing an "info frame" right after
connecting to a remote target started through the gdbserver causes
a failed assertion:

    (gdb) target remote localhost:4444
    Remote debugging using localhost:4444
    0xb7fda810 in ?? () from /lib/ld-linux.so.2
    (gdb) info frame
    Stack level 0, frame at 0x0:
     eip = 0xb7fda810; saved eip 
    findvar.c:299: internal-error: value_of_register_lazy: Assertion `frame_id_p
    (get_frame_id (frame))' failed.
    A problem internal to GDB has been detected,
    further debugging may prove unreliable.
    Quit this debugging session? (y or n)

The problem occurs when trying to print the frame's return address
(saved eip ...). Of course, since the program has just been spawned
but hasn't started running yet, there is no return address...

The fix suggested by Nick is the following:

> @@ -976,7 +977,12 @@ frame_info (char *addr_exp, int from_tty
>    puts_filtered ("; ");
>    wrap_here ("    ");
>    printf_filtered ("saved %s ", pc_regname);
> -  fputs_filtered (paddress (frame_pc_unwind (fi)), gdb_stdout);
> +  value = frame_unwind_register_value (fi, gdbarch_pc_regnum (gdbarch));
> +  if (VALUE_LVAL (value)  == lval_register
> +      && !(frame_id_p (VALUE_FRAME_ID (value))))
> +    printf_filtered ("none");
> +  else
> +    fputs_filtered (paddress (frame_pc_unwind (fi)), gdb_stdout);
>    printf_filtered ("\n");

I wonder if it wouldn't be better to do a "get_prev_frame" and
check that this frame is valid, and if valid, then get the PC
from this prev_frame.

What do others think?

-- 
Joel


  reply	other threads:[~2009-02-23  0:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-22 19:37 Nick Roberts
2009-02-23  0:51 ` Joel Brobecker [this message]
2009-02-23  1:08   ` Pedro Alves
2009-02-23  2:08     ` Daniel Jacobowitz
2009-04-18  0:43 ` Nick Roberts
2009-04-20 17:19   ` Tom Tromey
2009-04-21  8:28     ` Nick Roberts
2009-06-23 18:39   ` Joel Brobecker
2009-06-23 18:46     ` Daniel Jacobowitz

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=20090223001651.GA26056@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nickrob@snap.net.nz \
    /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