[gdb/f17] Support constant DW_AT_high_pc produced by FSF GCC HEAD (Mark Wielaard).

Jan Kratochvil jankratochvil at fedoraproject.org
Wed Aug 22 14:08:00 UTC 2012


commit 35031c9fb4c7b608a254d39cd48905f54ec4d428
Author: Jan Kratochvil <jan.kratochvil at redhat.com>
Date:   Wed Aug 22 16:07:52 2012 +0200

    Support constant DW_AT_high_pc produced by FSF GCC HEAD (Mark Wielaard).

 gdb-highpc-const.patch |  103 ++++++++++++++++++++++++++++++++++++++++++++++++
 gdb.spec               |    9 ++++-
 2 files changed, 111 insertions(+), 1 deletions(-)
---
diff --git a/gdb-highpc-const.patch b/gdb-highpc-const.patch
new file mode 100644
index 0000000..a22154c
--- /dev/null
+++ b/gdb-highpc-const.patch
@@ -0,0 +1,103 @@
+http://sourceware.org/ml/gdb-cvs/2012-04/msg00225.html
+
+### src/gdb/ChangeLog	2012/04/27 18:50:35	1.14177
+### src/gdb/ChangeLog	2012/04/27 18:55:19	1.14178
+## -1,3 +1,10 @@
++2012-04-27  Mark Wielaard  <mjw at redhat.com>
++
++	* dwarf2read.c (dwarf2_get_pc_bounds): Check DW_AT_high_pc form to
++	see whether it is an address or a constant offset from DW_AT_low_pc.
++	(dwarf2_record_block_ranges): Likewise.
++	(read_partial_die): Likewise.
++
+ 2012-04-26  Mark Wielaard  <mjw at redhat.com>
+ 
+ 	* MAINTAINERS (Write After Approval): Add myself to the list.
+--- src/gdb/dwarf2read.c	2012/04/26 20:32:30	1.640
++++ src/gdb/dwarf2read.c	2012/04/27 18:55:19	1.641
+@@ -6706,17 +6706,23 @@
+ 		      struct partial_symtab *pst)
+ {
+   struct attribute *attr;
++  struct attribute *attr_high;
+   CORE_ADDR low = 0;
+   CORE_ADDR high = 0;
+   int ret = 0;
+ 
+-  attr = dwarf2_attr (die, DW_AT_high_pc, cu);
+-  if (attr)
++  attr_high = dwarf2_attr (die, DW_AT_high_pc, cu);
++  if (attr_high)
+     {
+-      high = DW_ADDR (attr);
+       attr = dwarf2_attr (die, DW_AT_low_pc, cu);
+       if (attr)
+-	low = DW_ADDR (attr);
++        {
++	  low = DW_ADDR (attr);
++	  if (attr_high->form == DW_FORM_addr)
++	    high = DW_ADDR (attr_high);
++	  else
++	    high = low + DW_UNSND (attr_high);
++	}
+       else
+ 	/* Found high w/o low attribute.  */
+ 	return 0;
+@@ -6864,16 +6870,20 @@
+ {
+   struct objfile *objfile = cu->objfile;
+   struct attribute *attr;
++  struct attribute *attr_high;
+ 
+-  attr = dwarf2_attr (die, DW_AT_high_pc, cu);
+-  if (attr)
++  attr_high = dwarf2_attr (die, DW_AT_high_pc, cu);
++  if (attr_high)
+     {
+-      CORE_ADDR high = DW_ADDR (attr);
+-
+       attr = dwarf2_attr (die, DW_AT_low_pc, cu);
+       if (attr)
+         {
+           CORE_ADDR low = DW_ADDR (attr);
++	  CORE_ADDR high;
++	  if (attr_high->form == DW_FORM_addr)
++	    high = DW_ADDR (attr_high);
++	  else
++	    high = low + DW_UNSND (attr_high);
+ 
+           record_block_range (block, baseaddr + low, baseaddr + high - 1);
+         }
+@@ -9925,6 +9935,7 @@
+   struct attribute attr;
+   int has_low_pc_attr = 0;
+   int has_high_pc_attr = 0;
++  int high_pc_relative = 0;
+ 
+   memset (part_die, 0, sizeof (struct partial_die_info));
+ 
+@@ -9981,7 +9992,13 @@
+ 	  break;
+ 	case DW_AT_high_pc:
+ 	  has_high_pc_attr = 1;
+-	  part_die->highpc = DW_ADDR (&attr);
++	  if (attr.form == DW_FORM_addr)
++	    part_die->highpc = DW_ADDR (&attr);
++	  else
++	    {
++	      high_pc_relative = 1;
++	      part_die->highpc = DW_UNSND (&attr);
++	    }
+ 	  break;
+ 	case DW_AT_location:
+           /* Support the .debug_loc offsets.  */
+@@ -10061,6 +10078,9 @@
+ 	}
+     }
+ 
++  if (high_pc_relative)
++    part_die->highpc += part_die->lowpc;
++
+   if (has_low_pc_attr && has_high_pc_attr)
+     {
+       /* When using the GNU linker, .gnu.linkonce. sections are used to
diff --git a/gdb.spec b/gdb.spec
index 9a4ef6d..46034a4 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -35,7 +35,7 @@ Version: 7.4.50.%{snap}
 
 # The release always contains a leading reserved number, start it at 1.
 # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
-Release: 49%{?dist}
+Release: 50%{?dist}
 
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain
 Group: Development/Debuggers
@@ -629,6 +629,9 @@ Patch691: gdb-ppc-watchpoint.patch
 Patch696: gdb-parameterref-1of2.patch
 Patch697: gdb-parameterref-2of2.patch
 
+# Support constant DW_AT_high_pc produced by FSF GCC HEAD (Mark Wielaard).
+Patch724: gdb-highpc-const.patch
+
 %if 0%{!?rhel:1} || 0%{?rhel} > 6
 # RL_STATE_FEDORA_GDB would not be found for:
 # Patch642: gdb-readline62-ask-more-rh.patch
@@ -951,6 +954,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 %patch691 -p1
 %patch696 -p1
 %patch697 -p1
+%patch724 -p1
 
 %patch393 -p1
 %if 0%{!?el5:1} || 0%{?scl:1}
@@ -1443,6 +1447,9 @@ fi
 %endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch"
 
 %changelog
+* Wed Aug 22 2012 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.4.50.20120120-50.fc17
+- Support constant DW_AT_high_pc produced by FSF GCC HEAD (Mark Wielaard).
+
 * Thu Jun 14 2012 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.4.50.20120120-49.fc17
 - Support DW_OP_GNU_parameter_ref for -O2 -g inferiors (BZ 827375).
 


More information about the scm-commits mailing list