This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch] Print register names also for DWARF loc/expr
On Fri, 23 Jul 2010 11:10:53 +0200, Jakub Jelinek wrote:
> I think it would be nicer if DW_OP_bregN printed the register name
> before : instead of after it, so
> DW_OP_breg0 (rax): 0
> instead of
> DW_OP_breg0: (rax) 0
> because the register is part of the opcode, rather than its operand.
OK.
Thanks,
Jan
binutils/
2010-07-23 Jan Kratochvil <jan.kratochvil@redhat.com>
Jakub Jelinek <jakub@redhat.com>
* dwarf.c (regname): New declaration.
(decode_location_expression): Print for registers also regname output.
binutils/testsuite/
2010-07-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* binutils-all/objdump.W: Update DW_OP_reg5 expected output.
gas/testsuite/
2010-07-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* gas/elf/dwarf2-1.d: Update DW_OP_reg5 expected output.
* gas/elf/dwarf2-2.d: Likewise.
* gas/i386/dw2-compress-1.d: Likewise.
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -27,6 +27,8 @@
#include "dwarf2.h"
#include "dwarf.h"
+static const char *regname (unsigned int regno, int row);
+
static int have_frame_base;
static int need_base_address;
@@ -936,7 +938,8 @@ decode_location_expression (unsigned char * data,
case DW_OP_reg29:
case DW_OP_reg30:
case DW_OP_reg31:
- printf ("DW_OP_reg%d", op - DW_OP_reg0);
+ printf ("DW_OP_reg%d (%s)", op - DW_OP_reg0,
+ regname (op - DW_OP_reg0, 1));
break;
case DW_OP_breg0:
@@ -971,14 +974,16 @@ decode_location_expression (unsigned char * data,
case DW_OP_breg29:
case DW_OP_breg30:
case DW_OP_breg31:
- printf ("DW_OP_breg%d: %ld", op - DW_OP_breg0,
+ printf ("DW_OP_breg%d (%s): %ld", op - DW_OP_breg0,
+ regname (op - DW_OP_breg0, 1),
read_leb128 (data, &bytes_read, 1));
data += bytes_read;
break;
case DW_OP_regx:
- printf ("DW_OP_regx: %lu", read_leb128 (data, &bytes_read, 0));
+ uvalue = read_leb128 (data, &bytes_read, 0);
data += bytes_read;
+ printf ("DW_OP_regx: %lu (%s)", uvalue, regname (uvalue, 1));
break;
case DW_OP_fbreg:
need_frame_base = 1;
@@ -988,7 +993,7 @@ decode_location_expression (unsigned char * data,
case DW_OP_bregx:
uvalue = read_leb128 (data, &bytes_read, 0);
data += bytes_read;
- printf ("DW_OP_bregx: %lu %ld", uvalue,
+ printf ("DW_OP_bregx: %lu (%s) %ld", uvalue, regname (uvalue, 1),
read_leb128 (data, &bytes_read, 1));
data += bytes_read;
break;
--- a/binutils/testsuite/binutils-all/objdump.W
+++ b/binutils/testsuite/binutils-all/objdump.W
@@ -23,7 +23,7 @@ Contents of the .debug_info section:
<3c> DW_AT_type : <0x4a>
<40> DW_AT_low_pc : 0x.
<44> DW_AT_high_pc : 0x.
- <48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5\)
+ <48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5 \([^()]*\)\)
<1><4a>: Abbrev Number: 3 \(DW_TAG_base_type\)
<4b> DW_AT_name : int
<4f> DW_AT_byte_size : 4
--- a/gas/testsuite/gas/elf/dwarf2-1.d
+++ b/gas/testsuite/gas/elf/dwarf2-1.d
@@ -24,7 +24,7 @@ Contents of the .debug_info section:
<3c> DW_AT_type : <0x4a>
<40> DW_AT_low_pc : 0x.
<44> DW_AT_high_pc : 0x.
- <48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5\)
+ <48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5 \([^()]*\)\)
<1><4a>: Abbrev Number: 3 \(DW_TAG_base_type\)
<4b> DW_AT_name : int
<4f> DW_AT_byte_size : 4
--- a/gas/testsuite/gas/elf/dwarf2-2.d
+++ b/gas/testsuite/gas/elf/dwarf2-2.d
@@ -24,7 +24,7 @@ Contents of the .debug_info section:
<3c> DW_AT_type : <0x4a>
<40> DW_AT_low_pc : 0x.
<44> DW_AT_high_pc : 0x.
- <48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5\)
+ <48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5 \([^()]*\)\)
<1><4a>: Abbrev Number: 3 \(DW_TAG_base_type\)
<4b> DW_AT_name : int
<4f> DW_AT_byte_size : 4
--- a/gas/testsuite/gas/i386/dw2-compress-1.d
+++ b/gas/testsuite/gas/i386/dw2-compress-1.d
@@ -24,7 +24,7 @@ Contents of the .zdebug_info section:
<3c> DW_AT_type : <0x4a>
<40> DW_AT_low_pc : 0x0
<44> DW_AT_high_pc : 0x4
- <48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5\)
+ <48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5 \([^()]*\)\)
<1><4a>: Abbrev Number: 3 \(DW_TAG_base_type\)
<4b> DW_AT_name : int
<4f> DW_AT_byte_size : 4