Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: Orjan Friberg <orjan.friberg@axis.com>
Cc: Daniel Jacobowitz <drow@false.org>, gdb-patches@sources.redhat.com
Subject: Re: [CRIS] dwarf2 frame sniffer problem?
Date: Fri, 19 Mar 2004 00:09:00 -0000	[thread overview]
Message-ID: <40509C21.1040906@gnu.org> (raw)
Message-ID: <20040319000900.Tv-nu0HLPU49aTEmbHsKrPINaDmCK3_7FLCooaIqrAM@z> (raw)
In-Reply-To: <40508BD8.10802@axis.com>

> I don't know if this is related to the previous suggested problem (i.e. the dwarf2 information being wrong), but I changed the test program slightly to:
> 
> void bar(void) {}
> void foo(void)
> {
>   bar();
> }
> int main ()
> {
>   foo();
>   return 0;
> }
> 
> Now foo is no longer a leaf function, and thus saves the return address on the stack in its prologue.  Stepping over foo ("next" in main) causes a breakpoint to be set at the first instruction in foo.  After the target is stopped at that instruction (which is where the return address is pushed on the stack) dwarf2_frame_prev_register is called, which thinks that the PC is saved on the stack (case DWARF2_FRAME_REG_SAVED_OFFSET) and reads it from there.  Obviously the value it reads is wrong, since the return address hasn't been pushed yet.
> 
> What's wrong here?  Is the dwarf2 debug information wrong, or should dwarf2_frame_prev_register not have been called while still in the prologue?

Does this:

         /* NOTE: cagney/2003-09-05: CFI should specify the disposition
            of all debug info registers.  If it doesn't, complain (but
            not too loudly).  It turns out that GCC assumes that an
            unspecified register implies "same value" when CFI (draft
            7) specifies nothing at all.  Such a register could equally
            be interpreted as "undefined".  Also note that this check
            isn't sufficient; it only checks that all registers in the
            range [0 .. max column] are specified, and won't detect
            problems when a debug info register falls outside of the
            table.  We need a way of iterating through all the valid
            DWARF2 register numbers.  */
         if (fs->regs.reg[column].how == DWARF2_FRAME_REG_UNSPECIFIED)
           complaint (&symfile_complaints,
                      "Incomplete CFI data; unspecified registers at 0x%s",
                      paddr (fs->pc));
         else
           cache->reg[regnum] = fs->regs.reg[column];

sound like your problem?  It's possible to specify initial values of 
such registers with:

/* Set the architecture-specific register state initialization
    function for GDBARCH to INIT_REG.  */

extern void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch,
                                        void (*init_reg) (struct gdbarch 
*, int,
                                              struct 
dwarf2_frame_state_reg *));

Andrew



  reply	other threads:[~2004-03-11 17:05 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-10 16:53 Orjan Friberg
2004-03-10 16:59 ` Daniel Jacobowitz
2004-03-19  0:09   ` Daniel Jacobowitz
2004-03-19  0:09   ` Orjan Friberg
2004-03-11 14:09     ` Orjan Friberg
2004-03-11 15:55     ` Orjan Friberg
2004-03-11 17:05       ` Andrew Cagney [this message]
2004-03-19  0:09         ` Andrew Cagney
2004-03-19  0:09         ` Orjan Friberg
2004-03-12 12:00           ` Orjan Friberg
2004-03-11 17:11       ` Daniel Jacobowitz
2004-03-12 10:23         ` Orjan Friberg
2004-03-19  0:09           ` Daniel Jacobowitz
2004-03-12 15:38             ` Daniel Jacobowitz
2004-03-15 10:19             ` Orjan Friberg
2004-03-19  0:09               ` Orjan Friberg
2004-03-16 16:26             ` Orjan Friberg
2004-03-16 19:13               ` Daniel Jacobowitz
2004-03-16 20:51                 ` Hans-Peter Nilsson
2004-03-16 22:27                   ` Daniel Jacobowitz
2004-03-16 23:38                     ` Hans-Peter Nilsson
2004-03-16 23:58                       ` Daniel Jacobowitz
2004-03-19  0:09                         ` Daniel Jacobowitz
2004-03-19  0:09                       ` Hans-Peter Nilsson
2004-03-19  0:09                     ` Daniel Jacobowitz
2004-03-19  0:09                   ` Hans-Peter Nilsson
2004-03-19  0:09                 ` Daniel Jacobowitz
2004-03-19  0:09               ` Orjan Friberg
2004-03-19  0:09           ` Orjan Friberg
2004-03-19  0:09           ` Orjan Friberg
2004-03-12 13:50             ` Orjan Friberg
2004-03-19  0:09           ` Orjan Friberg
2004-03-12 15:38             ` Orjan Friberg
2004-03-19  0:09         ` Daniel Jacobowitz
2004-03-19  0:09       ` Orjan Friberg
2004-03-19  0:09 ` Orjan Friberg

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=40509C21.1040906@gnu.org \
    --to=cagney@gnu.org \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=orjan.friberg@axis.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