From: Alexandre Oliva <aoliva@redhat.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sources.redhat.com, roland@redhat.com
Subject: Re: Support Dwarf3 DW_CFA_val_* expressions
Date: Sun, 28 May 2006 22:22:00 -0000 [thread overview]
Message-ID: <orslmu4rse.fsf@free.oliva.athome.lsd.ic.unicamp.br> (raw)
In-Reply-To: <200603111139.k2BBdbsG011027@elgar.sibelius.xs4all.nl> (Mark Kettenis's message of "Sat, 11 Mar 2006 12:39:37 +0100 (CET)")
[-- Attachment #1: Type: text/plain, Size: 271 bytes --]
On Mar 11, 2006, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
> Anyway, feel free to commit the code that adds support for the new
> DWARF3 expressions (the origional one, not the "corrected" one ;).
Thanks, and sorry about the delay. I'm finally checking this in.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gdb-cfaval-3.patch --]
[-- Type: text/x-patch, Size: 3531 bytes --]
for gdb/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* dwarf2-frame.h (enum dwarf2_frame_reg_rule): Add
DWARF2_FRAME_REG_SAVED_VAL_OFFSET and
DWARF2_FRAME_REG_SAVED_VAL_EXP.
* dwarf2-frame.c (execute_cfa_program): Handle val_offset,
val_offset_sf and val_expression.
(dwarf2_frame_prev_register): Handle the new reg rules.
(dwarf2_frame_this_id): Use pc instead of function entry point.
Index: gdb/dwarf2-frame.c
===================================================================
--- gdb/dwarf2-frame.c.orig 2006-05-28 02:44:41.000000000 -0300
+++ gdb/dwarf2-frame.c 2006-05-28 02:44:47.000000000 -0300
@@ -481,6 +481,34 @@ bad CFI data; mismatched DW_CFA_restore_
fs->regs.reg[reg].loc.offset = offset;
break;
+ case DW_CFA_val_offset:
+ insn_ptr = read_uleb128 (insn_ptr, insn_end, ®);
+ dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
+ insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp);
+ offset = utmp * fs->data_align;
+ fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAVED_VAL_OFFSET;
+ fs->regs.reg[reg].loc.offset = offset;
+ break;
+
+ case DW_CFA_val_offset_sf:
+ insn_ptr = read_uleb128 (insn_ptr, insn_end, ®);
+ dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
+ insn_ptr = read_sleb128 (insn_ptr, insn_end, &offset);
+ offset *= fs->data_align;
+ fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAVED_VAL_OFFSET;
+ fs->regs.reg[reg].loc.offset = offset;
+ break;
+
+ case DW_CFA_val_expression:
+ insn_ptr = read_uleb128 (insn_ptr, insn_end, ®);
+ dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
+ insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp);
+ fs->regs.reg[reg].loc.exp = insn_ptr;
+ fs->regs.reg[reg].exp_len = utmp;
+ fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAVED_VAL_EXP;
+ insn_ptr += utmp;
+ break;
+
case DW_CFA_def_cfa_sf:
insn_ptr = read_uleb128 (insn_ptr, insn_end, &fs->cfa_reg);
if (eh_frame_p)
@@ -965,6 +993,28 @@ dwarf2_frame_prev_register (struct frame
}
break;
+ case DWARF2_FRAME_REG_SAVED_VAL_OFFSET:
+ *optimizedp = 0;
+ *lvalp = not_lval;
+ *addrp = 0;
+ *realnump = -1;
+ if (valuep)
+ store_unsigned_integer (valuep, register_size (gdbarch, regnum),
+ cache->cfa + cache->reg[regnum].loc.offset);
+ break;
+
+ case DWARF2_FRAME_REG_SAVED_VAL_EXP:
+ *optimizedp = 0;
+ *lvalp = not_lval;
+ *addrp = 0;
+ *realnump = -1;
+ if (valuep)
+ store_unsigned_integer (valuep, register_size (gdbarch, regnum),
+ execute_stack_op (cache->reg[regnum].loc.exp,
+ cache->reg[regnum].exp_len,
+ next_frame, cache->cfa));
+ break;
+
case DWARF2_FRAME_REG_UNSPECIFIED:
/* GCC, in its infinite wisdom decided to not provide unwind
information for registers that are "same value". Since
Index: gdb/dwarf2-frame.h
===================================================================
--- gdb/dwarf2-frame.h.orig 2006-05-28 02:00:31.000000000 -0300
+++ gdb/dwarf2-frame.h 2006-05-28 02:44:47.000000000 -0300
@@ -51,6 +51,10 @@ enum dwarf2_frame_reg_rule
DWARF2_FRAME_REG_SAVED_EXP,
DWARF2_FRAME_REG_SAME_VALUE,
+ /* These are defined in Dwarf3. */
+ DWARF2_FRAME_REG_SAVED_VAL_OFFSET,
+ DWARF2_FRAME_REG_SAVED_VAL_EXP,
+
/* These aren't defined by the DWARF2 CFI specification, but are
used internally by GDB. */
DWARF2_FRAME_REG_RA, /* Return Address. */
[-- Attachment #3: Type: text/plain, Size: 249 bytes --]
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Secretary for FSF Latin America http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}
next prev parent reply other threads:[~2006-05-28 6:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-03 17:54 Alexandre Oliva
2006-03-04 12:01 ` Mark Kettenis
2006-03-04 14:43 ` Alexandre Oliva
2006-03-04 15:07 ` Daniel Jacobowitz
2006-03-07 14:25 ` Alexandre Oliva
2006-03-07 15:01 ` Mark Kettenis
2006-03-07 19:55 ` Alexandre Oliva
2006-03-12 18:15 ` Mark Kettenis
2006-05-28 22:22 ` Alexandre Oliva [this message]
2006-03-13 2:25 ` Daniel Jacobowitz
2006-03-13 6:23 ` Alexandre Oliva
2006-03-24 23:08 ` 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=orslmu4rse.fsf@free.oliva.athome.lsd.ic.unicamp.br \
--to=aoliva@redhat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=mark.kettenis@xs4all.nl \
--cc=roland@redhat.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