aboutsummaryrefslogtreecommitdiff
path: root/gdb/findvar.c
diff options
context:
space:
mode:
authorgdb-3.5 <gdb@fsf.org>1990-02-08 06:14:00 +0000
committerPedro Alves <palves@redhat.com>2012-06-03 15:36:32 +0100
commit7a67dd45ca1c191a0220697a3ec9fa92993caf8c (patch)
treeea93641dd0b45fbca686b5e989b0f1085a7541b7 /gdb/findvar.c
parent1c997a4ae86938343edb715efc3fc742c5f668fe (diff)
downloadgdb-7a67dd45ca1c191a0220697a3ec9fa92993caf8c.zip
gdb-7a67dd45ca1c191a0220697a3ec9fa92993caf8c.tar.gz
gdb-7a67dd45ca1c191a0220697a3ec9fa92993caf8c.tar.bz2
gdb-3.5
Diffstat (limited to 'gdb/findvar.c')
-rw-r--r--gdb/findvar.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 82d32b7..0157d10 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -283,11 +283,19 @@ read_var_value (var, frame)
addr = val;
break;
+/* Nonzero if a struct which is located in a register or a LOC_ARG
+ really contains
+ the address of the struct, not the struct itself. GCC_P is nonzero
+ if the function was compiled with GCC. */
+#if !defined (REG_STRUCT_HAS_ADDR)
+#define REG_STRUCT_HAS_ADDR(gcc_p) 0
+#endif
+
case LOC_ARG:
fi = get_frame_info (frame);
addr = val + FRAME_ARGS_ADDRESS (fi);
break;
-
+
case LOC_REF_ARG:
fi = get_frame_info (frame);
addr = val + FRAME_ARGS_ADDRESS (fi);
@@ -308,8 +316,17 @@ read_var_value (var, frame)
case LOC_REGISTER:
case LOC_REGPARM:
- v = value_from_register (type, val, frame);
- return v;
+ {
+ struct block *b = get_frame_block (frame);
+
+ v = value_from_register (type, val, frame);
+
+ if (REG_STRUCT_HAS_ADDR(b->gcc_compile_flag)
+ && TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ addr = *(CORE_ADDR *)VALUE_CONTENTS (v);
+ else
+ return v;
+ }
}
read_memory (addr, VALUE_CONTENTS (v), len);