public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [patch] dwarf display: false (location list) in DWARF-4
@ 2011-07-27 12:30 Jan Kratochvil
  2011-07-27 18:15 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2011-07-27 12:30 UTC (permalink / raw)
  To: binutils

Hi,

echo 'struct s { char a[1<<24]; int b; } s;'|gcc -gdwarf-4 -o 1.o -c -x c -;readelf -wia 1.o

 <2><34>: Abbrev Number: 4 (DW_TAG_member)
    <35>   DW_AT_name        : b
    <37>   DW_AT_decl_file   : 1
    <38>   DW_AT_decl_line   : 1
    <39>   DW_AT_type        : <0x55>
    <3d>   DW_AT_data_member_location: 0x1000000        (location list)
+
   4      DW_TAG_member    [no children]
    DW_AT_name         DW_FORM_string
    DW_AT_decl_file    DW_FORM_data1
    DW_AT_decl_line    DW_FORM_data1
    DW_AT_type         DW_FORM_ref4
    DW_AT_data_member_location DW_FORM_data4

But that is wrong, DWARF-4 has DW_FORM_sec_offset for `(location list)',
0x1000000 is normal data (DW_FORM_data4) in DWARF-4.  There should be just:

    <3d>   DW_AT_data_member_location: 0x1000000

No regressions on {x86_64,i686}-fedora16pre-linux-gnu.  I haven't found the
string "location list" anywhere in the testsuites so I hope I did not break any
other targets' testsuites.


Thanks,
Jan


binutils/
2011-07-27  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* dwarf.c (read_and_display_attr_value): Recognize DW_FORM_data4 and
	DW_FORM_data8 as location list pointers only for DWARF < 4.

--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -1485,8 +1485,8 @@ read_and_display_attr_value (unsigned long attribute,
 	case DW_AT_GNU_call_site_data_value:
 	case DW_AT_GNU_call_site_target:
 	case DW_AT_GNU_call_site_target_clobbered:
-    	  if (form == DW_FORM_data4
-	      || form == DW_FORM_data8
+    	  if ((dwarf_version < 4
+	       && (form == DW_FORM_data4 || form == DW_FORM_data8))
 	      || form == DW_FORM_sec_offset)
 	    {
 	      /* Process location list.  */
@@ -1516,8 +1516,8 @@ read_and_display_attr_value (unsigned long attribute,
 	  break;
 
 	case DW_AT_ranges:
-	  if (form == DW_FORM_data4
-	      || form == DW_FORM_data8
+    	  if ((dwarf_version < 4
+	       && (form == DW_FORM_data4 || form == DW_FORM_data8))
 	      || form == DW_FORM_sec_offset)
 	    {
 	      /* Process range list.  */
@@ -1734,8 +1734,8 @@ read_and_display_attr_value (unsigned long attribute,
     case DW_AT_GNU_call_site_data_value:
     case DW_AT_GNU_call_site_target:
     case DW_AT_GNU_call_site_target_clobbered:
-      if (form == DW_FORM_data4
-	  || form == DW_FORM_data8
+      if ((dwarf_version < 4
+           && (form == DW_FORM_data4 || form == DW_FORM_data8))
 	  || form == DW_FORM_sec_offset)
 	printf (_("(location list)"));
       /* Fall through.  */

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-27 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-27 12:30 [patch] dwarf display: false (location list) in DWARF-4 Jan Kratochvil
2011-07-27 18:15 ` Jakub Jelinek
2011-07-27 18:28   ` Jan Kratochvil

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).