From f6201a399af51b8bdca6dbb7bac496519e966aac Mon Sep 17 00:00:00 2001 From: Hannes Domani Date: Sat, 16 Apr 2022 20:51:21 +0200 Subject: PDB: on i386 local variables are relative to $ebp --- gdb/windows-nat.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gdb') 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); } -- cgit v1.2.1