public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: binutils@sourceware.org
Subject: [patch] dwarf display: false (location list) in DWARF-4
Date: Wed, 27 Jul 2011 12:30:00 -0000	[thread overview]
Message-ID: <20110727100605.GA17872@host1.jankratochvil.net> (raw)

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.  */

             reply	other threads:[~2011-07-27 10:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27 12:30 Jan Kratochvil [this message]
2011-07-27 18:15 ` Jakub Jelinek
2011-07-27 18:28   ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110727100605.GA17872@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).