This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFC/PATCH]: DWARF2_REG_TO_REGNUM
- To: gdb-patches at sources dot redhat dot com
- Subject: [RFC/PATCH]: DWARF2_REG_TO_REGNUM
- From: Michael Snyder <msnyder at redhat dot com>
- Date: Sun, 03 Dec 2000 12:22:10 -0800
- Organization: Red Hat, Inc.
This patch supplements Andrew's patch to multi-arch the several macros
that translate between a GCC register number and a GDB register number.
The dwarf2 reader will pick up register numbers from the compiler that
are associated with the storage locations of variables. The new macro
DWARF2_REG_TO_REGNUM will translate those register numbers into the ones
that GDB uses to identify a register. If undefined, it will default to
identity.
* dwarf2read.c (DWARF2_REG_TO_REGNUM): New macro. Default to identity.
(new_symbol): Use DWARF2_REG_TO_REGNUM) to translate the register id
associated with a register variable, basereg, frame pointer, etc.
*** /home/msnyder/sourceware/src/gdb/dwarf2read.c Tue Nov 7 18:50:51 2000
--- ./dwarf2read.c Sun Dec 3 12:14:36 2000
***************
*** 43,48 ****
--- 43,52 ----
#include "gdb_string.h"
#include <sys/types.h>
+ #ifndef DWARF2_REG_TO_REGNUM
+ #define DWARF2_REG_TO_REGNUM(REG) (REG)
+ #endif
+
#if 0
/* .debug_info header for a compilation unit
Because of alignment constraints, this structure has padding and cannot
*************** new_symbol (struct die_info *die, struct
*** 4201,4211 ****
else if (isreg)
{
SYMBOL_CLASS (sym) = LOC_REGISTER;
}
else if (offreg)
{
SYMBOL_CLASS (sym) = LOC_BASEREG;
! SYMBOL_BASEREG (sym) = basereg;
}
else if (islocal)
{
--- 4205,4217 ----
else if (isreg)
{
SYMBOL_CLASS (sym) = LOC_REGISTER;
+ SYMBOL_VALUE (sym) =
+ DWARF2_REG_TO_REGNUM (SYMBOL_VALUE (sym));
}
else if (offreg)
{
SYMBOL_CLASS (sym) = LOC_BASEREG;
! SYMBOL_BASEREG (sym) = DWARF2_REG_TO_REGNUM (basereg);
}
else if (islocal)
{
*************** new_symbol (struct die_info *die, struct
*** 4247,4252 ****
--- 4253,4260 ----
if (isreg)
{
SYMBOL_CLASS (sym) = LOC_REGPARM;
+ SYMBOL_VALUE (sym) =
+ DWARF2_REG_TO_REGNUM (SYMBOL_VALUE (sym));
}
else if (offreg)
{
*************** new_symbol (struct die_info *die, struct
*** 4259,4265 ****
else
{
SYMBOL_CLASS (sym) = LOC_BASEREG_ARG;
! SYMBOL_BASEREG (sym) = basereg;
}
}
else
--- 4267,4273 ----
else
{
SYMBOL_CLASS (sym) = LOC_BASEREG_ARG;
! SYMBOL_BASEREG (sym) = DWARF2_REG_TO_REGNUM (basereg);
}
}
else