public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-jankratochvil-vla: Support DW_AT_upper_bound is referencing an optimized-out variable. https://bugzilla.redhat.com/show_bug.cgi?id=591879
@ 2010-05-13 16:09 jkratoch
  0 siblings, 0 replies; only message in thread
From: jkratoch @ 2010-05-13 16:09 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-vla has been updated
       via  a683bac73af74a757591672d89d720169c0b5ec9 (commit)
      from  ec5a7769d5c05542d12fc21afa25f32360db7de4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit a683bac73af74a757591672d89d720169c0b5ec9
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu May 13 18:08:30 2010 +0200

    Support DW_AT_upper_bound is referencing an optimized-out variable.
    https://bugzilla.redhat.com/show_bug.cgi?id=591879

-----------------------------------------------------------------------

Summary of changes:
 gdb/dwarf2loc.c                                |    3 ++
 gdb/dwarf2read.c                               |    5 +++
 gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S   |   38 +++++++++++++++++++++++-
 gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp |    3 ++
 4 files changed, 48 insertions(+), 1 deletions(-)

First 500 lines of diff:
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 20dcacd..c75726f 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -383,6 +383,9 @@ dwarf_loclist_baton_eval (struct dwarf2_loclist_baton *dllbaton,
   size_t size;
   struct value *val;
 
+  if (!dllbaton)
+    return 0;
+
   data = find_location_expression (dllbaton, &size,
 				   get_frame_address_in_block (frame));
   if (data == NULL)
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 0ca34f2..7da2510 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -11693,6 +11693,11 @@ dwarf2_attr_to_loclist_baton (struct attribute *attr, struct dwarf2_cu *cu)
 {
   struct dwarf2_loclist_baton *baton;
 
+  /* DW_AT_location of the referenced DIE may be missing if the referenced
+     variable has been optimized out.  */
+  if (!attr)
+    return NULL;
+
   if (!(attr_form_is_section_offset (attr)
 	/* ".debug_loc" may not exist at all, or the offset may be outside
 	   the section.  If so, fall through to the complaint in the
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
index 9353698..7fb00ea 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
@@ -51,6 +51,17 @@ vardata:
 	.4byte		.Llen_var-.Lcu1_begin	/* DW_AT_upper_bound */
 	.byte		0			/* End of children of die */
 
+	/* DW_AT_upper_bound is referencing an optimized-out variable.  */
+.Larrayb_type:
+	.uleb128	2			/* Abbrev: DW_TAG_array_type */
+	.4byte		.Lchar_type-.Lcu1_begin	/* DW_AT_type */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subrange_type */
+	.4byte		.Luint_type-.Lcu1_begin	/* DW_AT_type */
+	.byte		0			/* DW_AT_lower_bound */
+	.4byte		.Llenb_var-.Lcu1_begin	/* DW_AT_upper_bound */
+	.byte		0			/* End of children of die */
+
 .Luint_type:
 	.uleb128	4			/* Abbrev: DW_TAG_base_type */
 	.4byte		.Luint_str		/* DW_AT_name */
@@ -69,9 +80,24 @@ vardata:
 	.4byte		.Luint_type-.Lcu1_begin	/* DW_AT_type */
 	.4byte		.Llen_loclist-.Lloclist	/* DW_AT_location */
 
+	/* optimized-out variable for b_string.  */
+.Llenb_var:
+	.uleb128	7			/* Abbrev: DW_TAG_variable artificial no DW_AT_location */
+	.byte		1			/* DW_AT_artificial */
+	.4byte		.Luint_type-.Lcu1_begin	/* DW_AT_type */
+
 	.uleb128	6			/* Abbrev: DW_TAG_variable DW_FORM_string */
 	.string		"a_string"		/* DW_AT_name */
-	.4byte		.Larray_type-.Lcu1_begin/* DW_AT_type */
+	.4byte		.Larray_type-.Lcu1_begin /* DW_AT_type */
+	.byte		2f - 1f			/* DW_AT_location */
+1:	.byte		3			/*   DW_OP_addr */
+	.4byte		vardata			/*   <addr> */
+2:
+
+	/* DW_AT_upper_bound is referencing an optimized-out variable.  */
+	.uleb128	6			/* Abbrev: DW_TAG_variable DW_FORM_string */
+	.string		"b_string"		/* DW_AT_name */
+	.4byte		.Larrayb_type-.Lcu1_begin /* DW_AT_type */
 	.byte		2f - 1f			/* DW_AT_location */
 1:	.byte		3			/*   DW_OP_addr */
 	.4byte		vardata			/*   <addr> */
@@ -164,6 +190,16 @@ vardata:
 	.byte		0x0			/* Terminator */
 	.byte		0x0			/* Terminator */
 
+	.uleb128	7			/* Abbrev code */
+	.uleb128	0x34			/* DW_TAG_variable */
+	.byte		0x0			/* no_children */
+	.uleb128	0x34			/* DW_AT_artificial */
+	.uleb128	0x0c			/* DW_FORM_flag */
+	.uleb128	0x49			/* DW_AT_type */
+	.uleb128	0x13			/* DW_FORM_ref4 */
+	.byte		0x0			/* Terminator */
+	.byte		0x0			/* Terminator */
+
 	.byte		0x0			/* Terminator */
 
 /* String table */
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
index 28db005..5dbed3f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
@@ -46,3 +46,6 @@ if ![runto "*main"] {
 
 gdb_test "p a_string" { = "seen"}
 gdb_test "ptype a_string" {type = char \[4\]}
+
+gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"}
+gdb_test "ptype b_string" {type = char \[\]}


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-13 16:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-13 16:09 [SCM] archer-jankratochvil-vla: Support DW_AT_upper_bound is referencing an optimized-out variable. https://bugzilla.redhat.com/show_bug.cgi?id=591879 jkratoch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).