This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Add entry_value/call_site support to readelf -wi/-wo
- From: Jakub Jelinek <jakub at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Wed, 16 Mar 2011 11:11:25 +0100
- Subject: [PATCH] Add entry_value/call_site support to readelf -wi/-wo
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
This patch teaches readelf -wi and -wo about the new DWARF GNU extensions
that just landed into gcc. For more details see
http://gcc.gnu.org/wiki/summit2010?action=AttachFile&do=view&target=jelinek.pdf
http://gcc.gnu.org/wiki/summit2010?action=AttachFile&do=view&target=jelinek-slides.pdf
http://www.dwarfstd.org/ShowIssue.php?issue=100909.1&type=open
http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open
Tested on x86_64-linux, ran readelf -wi and -wo on latest trunk cc1plus. Ok
to commit?
2011-03-16 Jakub Jelinek <jakub@redhat.com>
* dwarf.c (dw_TAG_name): Handle DW_TAG_GNU_call_site_parameter.
(read_and_display_attr_value): Handle DW_AT_GNU_call_site_data_value,
DW_AT_GNU_call_site_target and DW_AT_GNU_call_site_target_clobbered.
(get_AT_name): Handle DW_AT_GNU_call_site_value,
DW_AT_GNU_call_site_data_value, DW_AT_GNU_call_site_target,
DW_AT_GNU_call_site_target_clobbered, DW_AT_GNU_tail_call,
DW_AT_GNU_all_tail_call_sites, DW_AT_GNU_all_call_sites and
DW_AT_GNU_all_source_call_sites.
(decode_location_expression) <case DW_OP_GNU_entry_value>: Adjust
handling.
2011-03-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf.c (get_TAG_name): Handle DW_TAG_GNU_call_site.
(decode_location_expression): Handle DW_OP_GNU_entry_value.
(read_and_display_attr_value): Handle DW_AT_GNU_call_site_value.
(get_AT_name): Likewise.
--- binutils/dwarf.c.jj 2011-03-16 10:27:13.000000000 +0100
+++ binutils/dwarf.c 2011-03-16 10:42:03.000000000 +0100
@@ -563,6 +563,9 @@ get_TAG_name (unsigned long tag)
case DW_TAG_upc_shared_type: return "DW_TAG_upc_shared_type";
case DW_TAG_upc_strict_type: return "DW_TAG_upc_strict_type";
case DW_TAG_upc_relaxed_type: return "DW_TAG_upc_relaxed_type";
+ /* GNU values. */
+ case DW_TAG_GNU_call_site: return "DW_TAG_GNU_call_site";
+ case DW_TAG_GNU_call_site_parameter:return "DW_TAG_GNU_call_site_parameter";
default:
{
static char buffer[100];
@@ -1004,6 +1007,17 @@ decode_location_expression (unsigned cha
display_block (data, uvalue);
data += uvalue;
break;
+ case DW_OP_GNU_entry_value:
+ uvalue = read_leb128 (data, &bytes_read, 0);
+ data += bytes_read;
+ printf ("DW_OP_GNU_entry_value: (");
+ if (decode_location_expression (data, pointer_size, offset_size,
+ dwarf_version, uvalue,
+ cu_offset, section))
+ need_frame_base = 1;
+ putchar (')');
+ data += uvalue;
+ break;
/* GNU extensions. */
case DW_OP_GNU_push_tls_address:
@@ -1343,6 +1357,10 @@ read_and_display_attr_value (unsigned lo
case DW_AT_segment:
case DW_AT_static_link:
case DW_AT_use_location:
+ case DW_AT_GNU_call_site_value:
+ 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
|| form == DW_FORM_sec_offset)
@@ -1587,6 +1605,10 @@ read_and_display_attr_value (unsigned lo
case DW_AT_segment:
case DW_AT_static_link:
case DW_AT_use_location:
+ case DW_AT_GNU_call_site_value:
+ 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
|| form == DW_FORM_sec_offset)
@@ -1805,6 +1827,14 @@ get_AT_name (unsigned long attribute)
case DW_AT_GNU_odr_signature: return "DW_AT_GNU_odr_signature";
case DW_AT_use_GNAT_descriptive_type: return "DW_AT_use_GNAT_descriptive_type";
case DW_AT_GNAT_descriptive_type: return "DW_AT_GNAT_descriptive_type";
+ case DW_AT_GNU_call_site_value: return "DW_AT_GNU_call_site_value";
+ case DW_AT_GNU_call_site_data_value: return "DW_AT_GNU_call_site_data_value";
+ case DW_AT_GNU_call_site_target: return "DW_AT_GNU_call_site_target";
+ case DW_AT_GNU_call_site_target_clobbered: return "DW_AT_GNU_call_site_target_clobbered";
+ case DW_AT_GNU_tail_call: return "DW_AT_GNU_tail_call";
+ case DW_AT_GNU_all_tail_call_sites: return "DW_AT_GNU_all_tail_call_sites";
+ case DW_AT_GNU_all_call_sites: return "DW_AT_GNU_all_call_sites";
+ case DW_AT_GNU_all_source_call_sites: return "DW_AT_GNU_all_source_call_sites";
/* UPC extension. */
case DW_AT_upc_threads_scaled: return "DW_AT_upc_threads_scaled";
Jakub