This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 07/12] vla: resolve dynamic bounds if value contents is a constant byte-sequence
- From: Joel Brobecker <brobecker at adacore dot com>
- To: gdb-patches at sourceware dot org
- Cc: Sanimir Agovic <sanimir dot agovic at intel dot com>
- Date: Mon, 14 Apr 2014 10:13:11 -0700
- Subject: [PATCH 07/12] vla: resolve dynamic bounds if value contents is a constant byte-sequence
- Authentication-results: sourceware.org; auth=none
- References: <0377C58828D86C4588AEEC42FC3B85A71D8507B7 at IRSMSX105 dot ger dot corp dot intel dot com> <1397495596-25364-1-git-send-email-brobecker at adacore dot com>
From: Sanimir Agovic <sanimir.agovic@intel.com>
A variable location might be a constant value and therefore no inferior memory
access is needed to read the content. In this case try to resolve the type
bounds.
gdb/ChangeLog:
* findvar.c (default_read_var_value): Resolve dynamic bounds if location
points to a constant blob.
---
gdb/ChangeLog | 5 +++++
gdb/findvar.c | 12 +++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 717c197..3ea7687 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2014-04-14 Sanimir Agovic <sanimir.agovic@intel.com>
+ * findvar.c (default_read_var_value): Resolve dynamic bounds if location
+ points to a constant blob.
+
+2014-04-14 Sanimir Agovic <sanimir.agovic@intel.com>
+
* dwarf2read.c (read_subrange_type): Convert DW_AT_count to a dynamic
property and store it as the high bound and flag the range accordingly.
* gdbtypes.c (resolve_dynamic_bounds): If range is flagged as
diff --git a/gdb/findvar.c b/gdb/findvar.c
index a2a7bb7..998a799 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -437,7 +437,12 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
switch (SYMBOL_CLASS (var))
{
case LOC_CONST:
- /* Put the constant back in target format. */
+ if (is_dynamic_type (type))
+ {
+ /* Value is a constant byte-sequence and needs no memory access. */
+ type = resolve_dynamic_type (type, /* Unused address. */ 0);
+ }
+ /* Put the constant back in target format. */
v = allocate_value (type);
store_signed_integer (value_contents_raw (v), TYPE_LENGTH (type),
gdbarch_byte_order (get_type_arch (type)),
@@ -464,6 +469,11 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
return v;
case LOC_CONST_BYTES:
+ if (is_dynamic_type (type))
+ {
+ /* Value is a constant byte-sequence and needs no memory access. */
+ type = resolve_dynamic_type (type, /* Unused address. */ 0);
+ }
v = allocate_value (type);
memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var),
TYPE_LENGTH (type));
--
1.8.3.2