diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2020-10-30 15:01:13 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-10-30 15:01:13 -0400 |
commit | aa2045e7fa41ea80a876421bca89443f7a2df92f (patch) | |
tree | d621c45ad142eb5a86769ac9798938415fe6ba09 /gdb | |
parent | b1ec273502937ca128df0ebf3e5961731fdc7272 (diff) | |
download | gdb-aa2045e7fa41ea80a876421bca89443f7a2df92f.zip gdb-aa2045e7fa41ea80a876421bca89443f7a2df92f.tar.gz gdb-aa2045e7fa41ea80a876421bca89443f7a2df92f.tar.bz2 |
gdb: rs6000_dwarf2_reg_to_regnum return -1 for unknown register number
With the current implementation of rs6000_dwarf2_reg_to_regnum, if an
unknown DWARF register number is passed, the same number is returned as
the internal GDB number. This assumes that the internal GDB register
numbers match the DWARF register numbers, which is not the case.
Change it to return -1, as documented in gdbarch.sh for the
dwarf2_reg_to_regnum method.
This fixes a failure in gdb.dwarf2/bad-regnum.exp:
(gdb) info addr foo1
-Symbol "foo1" is a variable in $.
-(gdb) FAIL: gdb.dwarf2/bad-regnum.exp: info addr foo1
+Symbol "foo1" is a variable in $bad_register_number.
+(gdb) PASS: gdb.dwarf2/bad-regnum.exp: info addr foo1
I ran the entire testsuite on powerpc64 (gcc203 on the compile farm) and
didn't see any regression.
gdb/ChangeLog:
* rs6000-tdep.c (rs6000_dwarf2_reg_to_regnum): Return -1 for
unknown register numbers.
Change-Id: I585aa07a08f845a46c36bfdb6d3118ea94f8f54d
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6ebc9be..185d4a3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2020-10-30 Simon Marchi <simon.marchi@polymtl.ca> + + * rs6000-tdep.c (rs6000_dwarf2_reg_to_regnum): Return -1 for + 2020-10-30 Tom Tromey <tromey@adacore.com> * Makefile.in (stamp-init): Depend on config.status. diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 264d4e0..4b8c3ed 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -3240,9 +3240,10 @@ rs6000_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int num) return tdep->ppc_vrsave_regnum; case 612: return tdep->ppc_spefscr_regnum; - default: - return num; } + + /* Unknown DWARF register number. */ + return -1; } /* Translate a .eh_frame register to DWARF register, or adjust a |