public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Dwarf unwinder problems with store.exp and preserved regs
@ 2003-07-01 21:44 Daniel Jacobowitz
  2003-07-02  6:38 ` Andreas Jaeger
  2003-07-02 19:11 ` Richard Henderson
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2003-07-01 21:44 UTC (permalink / raw)
  To: gdb

I see two kinds of failures in store.exp right now, on the two targets I'm
testing.  On i386, with DWARF 2 unwinding, I see spurious <value optimized
out> messages; and on ARM (without DWARF 2 unwinding) I see legitimately
corrupted values.  The latter are easy, so I'll send a patch momentarily. 
The former are more interesting.

Here's the problem: the unwinder does not know what registers are considered
call saved.  GDB reads some initial CIE unwind information from the debug
file:

  /* Instruction sequence to initialize a register set.  */
  unsigned char *initial_instructions;

  /* True if a 'z' augmentation existed.  */
  unsigned char saw_z_augmentation;

      cie->saw_z_augmentation = (*augmentation == 'z');
      if (cie->saw_z_augmentation)
        {
          ULONGEST length;

          length = read_unsigned_leb128 (unit->abfd, buf, &bytes_read);
          buf += bytes_read;
          cie->initial_instructions = buf + length;
          augmentation++;
        }

However, GCC only emits information about the CFA, not about the default
saved-ness of registers.  So we get:

168       /* Initialize newly allocated registers.  */
169       memset (rs->reg + rs->num_regs, 0, (num_regs - rs->num_regs) * size);

And 0 is UNDEFINED.  So $ebx - a call-saved register on i386 - shows up as
undefined.

There are two things we can do about this, I think, and perhaps we should
do both:
  - Fix GCC.  I -believe-, from reading the spec, that GCC is to blame for
    not emiting this information.
  - Provide an architecture method to pre-initialize the register table
    before initial_instructions is evaluated.

Thoughts?
-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-07-02 21:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-01 21:44 Dwarf unwinder problems with store.exp and preserved regs Daniel Jacobowitz
2003-07-02  6:38 ` Andreas Jaeger
2003-07-02 19:11 ` Richard Henderson
2003-07-02 19:19   ` Daniel Jacobowitz
2003-07-02 21:33     ` Richard Henderson
2003-07-02 21:39       ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).