summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorHannes Domani <ssbssa@yahoo.de>2022-04-16 20:51:21 +0200
committerHannes Domani <ssbssa@yahoo.de>2022-04-16 20:52:56 +0200
commitf6201a399af51b8bdca6dbb7bac496519e966aac (patch)
treebcee8e681f57fa99eda25be71bef8e829a254dfc /gdb
parent966dffcb4fbc03bf4f8b943bd86f06f383cec37c (diff)
downloadbinutils-gdb-f6201a399af51b8bdca6dbb7bac496519e966aac.tar.gz
PDB: on i386 local variables are relative to $ebp
Diffstat (limited to 'gdb')
-rw-r--r--gdb/windows-nat.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 1e9e6fcc895..fefdee0b6ea 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -60,6 +60,9 @@
#include "i386-tdep.h"
#include "i387-tdep.h"
+#ifdef __x86_64__
+#include "amd64-tdep.h"
+#endif
#include "windows-tdep.h"
#include "windows-nat.h"
@@ -3056,7 +3059,13 @@ pdb_read_variable (struct symbol *symbol, struct frame_info *frame)
pdb_regrel_baton *baton
= (pdb_regrel_baton *) SYMBOL_LOCATION_BATON (symbol);
gdbarch *gdbarch = get_frame_arch (frame);
- int regnum = gdbarch_sp_regnum (gdbarch);
+ int regnum;
+#ifdef __x86_64__
+ if (gdbarch_ptr_bit (gdbarch) == 64)
+ regnum = AMD64_RSP_REGNUM;
+ else
+#endif
+ regnum = I386_EBP_REGNUM;
ULONGEST regvalue = get_frame_register_unsigned (frame, regnum);
return value_at_lazy (symbol->type (), regvalue + baton->offset);
}