aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2008-12-16 05:06:05 +0000
committerPaul Pluzhnikov <ppluzhnikov@google.com>2008-12-16 05:06:05 +0000
commit7b1f21e5c448158d2d5f6db508fa2dd4f391de41 (patch)
tree9eb931b67c4d5603e5f4625842926faac99fa2ca /gdb
parent2e9de9fa1e000219a016cd5ede1b7cbdb4ded4ba (diff)
downloadgdb-7b1f21e5c448158d2d5f6db508fa2dd4f391de41.zip
gdb-7b1f21e5c448158d2d5f6db508fa2dd4f391de41.tar.gz
gdb-7b1f21e5c448158d2d5f6db508fa2dd4f391de41.tar.bz2
2008-12-15 Paul Pluzhnikov <ppluzhnikov@google.com>
* dbxread.c (read_ofile_symtab): Sign-extend 32-bit N_LSYM and N_PSYM STABS values for 64-bit GDB.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/dbxread.c13
2 files changed, 18 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4a4f5df..0a20c1d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2008-12-15 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * dbxread.c (read_ofile_symtab): Sign-extend 32-bit N_LSYM and
+ N_PSYM STABS values for 64-bit GDB.
+
2008-12-15 Tristan Gingold <gingold@adacore.com>
* dwarf2expr.c (execute_stack_op): Handle DW_OP_swap.
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index dde922a..115bdef 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -2597,6 +2597,19 @@ read_ofile_symtab (struct partial_symtab *pst)
if (type & N_STAB)
{
+ if (sizeof (nlist.n_value) > 4
+ /* We are a 64-bit debugger debugging a 32-bit program. */
+ && (type == N_LSYM || type == N_PSYM))
+ /* We have to be careful with the n_value in the case of N_LSYM
+ and N_PSYM entries, because they are signed offsets from frame
+ pointer, but we actually read them as unsigned 32-bit values.
+ This is not a problem for 32-bit debuggers, for which negative
+ values end up being interpreted correctly (as negative
+ offsets) due to integer overflow.
+ But we need to sign-extend the value for 64-bit debuggers,
+ or we'll end up interpreting negative values as very large
+ positive offsets. */
+ nlist.n_value = (nlist.n_value ^ 0x80000000) - 0x80000000;
process_one_symbol (type, nlist.n_desc, nlist.n_value,
namestring, section_offsets, objfile);
}