This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations in the debug_info section)
- From: Joern Rennecke <joern dot rennecke at superh dot com>
- To: binutils at sources dot redhat dot com
- Cc: Alexandre Oliva <aoliva at redhat dot com>, Alan Modra <amodra at bigpond dot net dot au>, Nick Clifton <nickc at redhat dot com>
- Date: Tue, 22 Apr 2003 21:12:01 +0100
- Subject: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations in the debug_info section)
- Organization: SuperH UK Ltd.
- References: <3EA58964.E0269B6F@superh.com> <3EA58B57.F6F58A01@superh.com>
--
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658
Alexandre's patch did not only cause warnings, it also corrupted most or all
of the strings.
The reaadelf.wi template hasn't been updated in years, and not only the
representation of the debug information, even the source file numbers
are out of date; that mean that any sucess on this testcase (not counting
XFAILs) on any target must have been a bug.
I've updated readelf.wi so that the test passes for sh-elf; the readelf.out
for sh-elf is attached separately. The output style change that I have
considered a bug is the adding of a trailing "; " in every location
expression, e.g. (DW_OP_addr: 0) .
The following patch implements this readelf.wi update and suppression of
the trailing "; ".
If someone knows what the right dejagnu incantation is, it would be nice
to invoke gcc either with -fsigned-char or -funsigned-char when
generating testprog.o, so that we get a reproducible type for string.
Or should we change the source file testprog.c ?
2003-04-22 J"orn Rennecke <joern dot rennecke at superh dot com>
binutils:
* readelf.c (decode_location_expression): Don't add a trailing "; " .
binutils/testsuite:
* readelf.wi: Update.
Index: readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.202
diff -p -r1.202 readelf.c
*** readelf.c 22 Apr 2003 16:22:26 -0000 1.202
--- readelf.c 22 Apr 2003 19:55:38 -0000
*************** decode_location_expression (data, pointe
*** 7727,7733 ****
}
/* Separate the ops. */
! printf ("; ");
}
}
--- 7655,7662 ----
}
/* Separate the ops. */
! if (data < end)
! printf ("; ");
}
}
Index: testsuite/binutils-all/readelf.wi
===================================================================
RCS file: /cvs/src/src/binutils/testsuite/binutils-all/readelf.wi,v
retrieving revision 1.4
diff -p -r1.4 readelf.wi
*** testsuite/binutils-all/readelf.wi 18 Feb 2001 23:32:59 -0000 1.4
--- testsuite/binutils-all/readelf.wi 22 Apr 2003 19:55:38 -0000
*************** The section .debug_info contains:
*** 6,76 ****
Abbrev Offset: 0
Pointer Size: 4
<.><.*>: Abbrev Number: .* \(DW_TAG_compile_unit\)
! DW_AT_name : .*/testprog.c
! DW_AT_comp_dir : .*/binutils
! DW_AT_producer : GNU C .*
! DW_AT_language : 1 \(ANSI C\)
! DW_AT_low_pc : 0
! DW_AT_high_pc : .*
DW_AT_stmt_list : 0
- <.><.*>: Abbrev Number: 2 \(DW_TAG_subprogram\)
- DW_AT_external : 1
- DW_AT_name : fn
- DW_AT_decl_file : 1
- DW_AT_decl_line : 10
- DW_AT_type : .*
- DW_AT_low_pc : 0
DW_AT_high_pc : .*
! DW_AT_frame_base : 1 byte block: .*
<.><.*>: Abbrev Number: 3 \(DW_TAG_base_type\)
DW_AT_name : int
DW_AT_byte_size : 4
DW_AT_encoding : 5 \(signed\)
<.><.*>: Abbrev Number: 4 \(DW_TAG_subprogram\)
- DW_AT_sibling : .*
DW_AT_external : 1
! DW_AT_name : main
DW_AT_decl_file : 1
! DW_AT_decl_line : 16
DW_AT_type : .*
! DW_AT_low_pc : .*
DW_AT_high_pc : .*
DW_AT_frame_base : 1 byte block: .*
! <.><.*>: Abbrev Number: 5 \(DW_TAG_lexical_block\)
DW_AT_low_pc : .*
DW_AT_high_pc : .*
<.><.*>: Abbrev Number: 6 \(DW_TAG_variable\)
! DW_AT_name : common
DW_AT_decl_file : 1
! DW_AT_decl_line : 3
DW_AT_type : <.*>
DW_AT_external : 1
DW_AT_location : 5 byte block: 3 0 0 0 0 \(DW_OP_addr: 0\)
<.><.*>: Abbrev Number: 6 \(DW_TAG_variable\)
! DW_AT_name : global
DW_AT_decl_file : 1
! DW_AT_decl_line : 4
DW_AT_type : <.*>
DW_AT_external : 1
DW_AT_location : 5 byte block: 3 0 0 0 0 \(DW_OP_addr: 0\)
<.><.*>: Abbrev Number: 7 \(DW_TAG_variable\)
! DW_AT_name : local
DW_AT_decl_file : 1
! DW_AT_decl_line : 5
DW_AT_type : <.*>
DW_AT_location : 5 byte block: 3 . 0 0 . \(DW_OP_addr: .\)
<.><.*>: Abbrev Number: 8 \(DW_TAG_array_type\)
DW_AT_sibling : <.*>
DW_AT_type : <.*>
<.><.*>: Abbrev Number: 9 \(DW_TAG_subrange_type\)
DW_AT_upper_bound : 6
- <.><.*>: Abbrev Number: 3 \(DW_TAG_base_type\)
- DW_AT_name : char
- DW_AT_byte_size : 1
- DW_AT_encoding : 8 \(unsigned char\)
<.><.*>: Abbrev Number: 7 \(DW_TAG_variable\)
! DW_AT_name : string
DW_AT_decl_file : 1
! DW_AT_decl_line : 6
DW_AT_type : <.*>
DW_AT_location : 5 byte block: 3 . 0 0 . \(DW_OP_addr: .\)
--- 6,109 ----
Abbrev Offset: 0
Pointer Size: 4
<.><.*>: Abbrev Number: .* \(DW_TAG_compile_unit\)
! # DW_AT_comp_dir : .*/binutils
DW_AT_stmt_list : 0
DW_AT_high_pc : .*
! DW_AT_low_pc : 0.*
! DW_AT_producer .*: GNU C .*
! DW_AT_language : 1 \(ANSI C\)
! DW_AT_name : .*/testprog.c
! <.><.*>: Abbrev Number: 2 \(DW_TAG_base_type\)
! DW_AT_name : \(indirect string, offset: 0x.*\): unsigned int
! DW_AT_byte_size : 4
! DW_AT_encoding : 7 \(unsigned\)
! <.><.*>: Abbrev Number: 2 \(DW_TAG_base_type\)
! DW_AT_name : \(indirect string, offset: 0x.*\): long int
! DW_AT_byte_size : 4
! DW_AT_encoding : 5 \(signed\)
! <.><.*>: Abbrev Number: 2 \(DW_TAG_base_type\)
! DW_AT_name : \(indirect string, offset: 0x.*\): long long int
! DW_AT_byte_size : 8
! DW_AT_encoding : 5 \(signed\)
<.><.*>: Abbrev Number: 3 \(DW_TAG_base_type\)
DW_AT_name : int
DW_AT_byte_size : 4
DW_AT_encoding : 5 \(signed\)
+ <.><.*>: Abbrev Number: 2 \(DW_TAG_base_type\)
+ DW_AT_name : \(indirect string, offset: 0x.*\): unsigned int
+ DW_AT_byte_size : 4
+ DW_AT_encoding : 7 \(unsigned\)
+ <.><.*>: Abbrev Number: 2 \(DW_TAG_base_type\)
+ DW_AT_name : \(indirect string, offset: 0x.*\): unsigned char
+ DW_AT_byte_size : 1
+ DW_AT_encoding : 8 \(unsigned char\)
+ <.><.*>: Abbrev Number: 2 \(DW_TAG_base_type\)
+ DW_AT_name : \(indirect string, offset: 0x.*\): long unsigned int
+ DW_AT_byte_size : 4
+ DW_AT_encoding : 7 \(unsigned\)
+ <.><.*>: Abbrev Number: 2 \(DW_TAG_base_type\)
+ DW_AT_name : \(indirect string, offset: 0x.*\): short int
+ DW_AT_byte_size : 2
+ DW_AT_encoding : 5 \(signed\)
+ <.><.*>: Abbrev Number: 2 \(DW_TAG_base_type\)
+ DW_AT_name : \(indirect string, offset: 0x.*\): char
+ DW_AT_byte_size : 1
+ DW_AT_encoding : 6 \(signed char\)
+ <.><.*>: Abbrev Number: 2 \(DW_TAG_base_type\)
+ DW_AT_name : \(indirect string, offset: 0x4c\): short unsigned int
+ DW_AT_byte_size : 2
+ DW_AT_encoding : 7 \(unsigned\)
+ <.><.*>: Abbrev Number: 2 \(DW_TAG_base_type\)
+ DW_AT_name : \(indirect string, offset: 0x.*\): long long unsigned int
+ DW_AT_byte_size : 8
+ DW_AT_encoding : 7 \(unsigned\)
<.><.*>: Abbrev Number: 4 \(DW_TAG_subprogram\)
DW_AT_external : 1
! DW_AT_name : fn
DW_AT_decl_file : 1
! DW_AT_decl_line : 13
DW_AT_type : .*
! DW_AT_low_pc : 0.*
DW_AT_high_pc : .*
DW_AT_frame_base : 1 byte block: .*
! <.><.*>: Abbrev Number: 5 \(DW_TAG_subprogram\)
! DW_AT_external : 1
! DW_AT_name .*: main
! DW_AT_decl_file : 1
! DW_AT_decl_line : 19
! DW_AT_type : .*
DW_AT_low_pc : .*
DW_AT_high_pc : .*
+ DW_AT_frame_base : 1 byte block: .*
<.><.*>: Abbrev Number: 6 \(DW_TAG_variable\)
! DW_AT_name .*: common
DW_AT_decl_file : 1
! DW_AT_decl_line : 6
DW_AT_type : <.*>
DW_AT_external : 1
DW_AT_location : 5 byte block: 3 0 0 0 0 \(DW_OP_addr: 0\)
<.><.*>: Abbrev Number: 6 \(DW_TAG_variable\)
! DW_AT_name .*: global
DW_AT_decl_file : 1
! DW_AT_decl_line : 7
DW_AT_type : <.*>
DW_AT_external : 1
DW_AT_location : 5 byte block: 3 0 0 0 0 \(DW_OP_addr: 0\)
<.><.*>: Abbrev Number: 7 \(DW_TAG_variable\)
! DW_AT_name .*: local
DW_AT_decl_file : 1
! DW_AT_decl_line : 8
DW_AT_type : <.*>
DW_AT_location : 5 byte block: 3 . 0 0 . \(DW_OP_addr: .\)
<.><.*>: Abbrev Number: 8 \(DW_TAG_array_type\)
DW_AT_sibling : <.*>
DW_AT_type : <.*>
<.><.*>: Abbrev Number: 9 \(DW_TAG_subrange_type\)
+ DW_AT_type : <.*>
DW_AT_upper_bound : 6
<.><.*>: Abbrev Number: 7 \(DW_TAG_variable\)
! DW_AT_name .*: string
DW_AT_decl_file : 1
! DW_AT_decl_line : 9
DW_AT_type : <.*>
DW_AT_location : 5 byte block: 3 . 0 0 . \(DW_OP_addr: .\)
The section .debug_info contains:
Compilation Unit @ 0:
Length: 236
Version: 2
Abbrev Offset: 0
Pointer Size: 4
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_stmt_list : 0
DW_AT_high_pc : 0x98 152
DW_AT_low_pc : 0 0
DW_AT_producer : (indirect string, offset: 0xc2): GNU C 3.4 20030303 (experimental)
DW_AT_language : 1 (ANSI C)
DW_AT_name : (indirect string, offset: 0x74): /swbuild/build/main/srcw/binutils/testsuite/binutils-all/testprog.c
<1><21>: Abbrev Number: 2 (DW_TAG_base_type)
DW_AT_name : (indirect string, offset: 0xe9): unsigned int
DW_AT_byte_size : 4
DW_AT_encoding : 7 (unsigned)
<1><28>: Abbrev Number: 2 (DW_TAG_base_type)
DW_AT_name : (indirect string, offset: 0x2c): long int
DW_AT_byte_size : 4
DW_AT_encoding : 5 (signed)
<1><2f>: Abbrev Number: 2 (DW_TAG_base_type)
DW_AT_name : (indirect string, offset: 0x1e): long long int
DW_AT_byte_size : 8
DW_AT_encoding : 5 (signed)
<1><36>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_name : int
DW_AT_byte_size : 4
DW_AT_encoding : 5 (signed)
<1><3d>: Abbrev Number: 2 (DW_TAG_base_type)
DW_AT_name : (indirect string, offset: 0xe9): unsigned int
DW_AT_byte_size : 4
DW_AT_encoding : 7 (unsigned)
<1><44>: Abbrev Number: 2 (DW_TAG_base_type)
DW_AT_name : (indirect string, offset: 0x66): unsigned char
DW_AT_byte_size : 1
DW_AT_encoding : 8 (unsigned char)
<1><4b>: Abbrev Number: 2 (DW_TAG_base_type)
DW_AT_name : (indirect string, offset: 0x3a): long unsigned int
DW_AT_byte_size : 4
DW_AT_encoding : 7 (unsigned)
<1><52>: Abbrev Number: 2 (DW_TAG_base_type)
DW_AT_name : (indirect string, offset: 0xb8): short int
DW_AT_byte_size : 2
DW_AT_encoding : 5 (signed)
<1><59>: Abbrev Number: 2 (DW_TAG_base_type)
DW_AT_name : (indirect string, offset: 0xe4): char
DW_AT_byte_size : 1
DW_AT_encoding : 6 (signed char)
<1><60>: Abbrev Number: 2 (DW_TAG_base_type)
DW_AT_name : (indirect string, offset: 0x4c): short unsigned int
DW_AT_byte_size : 2
DW_AT_encoding : 7 (unsigned)
<1><67>: Abbrev Number: 2 (DW_TAG_base_type)
DW_AT_name : (indirect string, offset: 0x7): long long unsigned int
DW_AT_byte_size : 8
DW_AT_encoding : 7 (unsigned)
<1><6e>: Abbrev Number: 4 (DW_TAG_subprogram)
DW_AT_external : 1
DW_AT_name : fn
DW_AT_decl_file : 1
DW_AT_decl_line : 13
DW_AT_type : <36>
DW_AT_low_pc : 0 0
DW_AT_high_pc : 0xe 14
DW_AT_frame_base : 1 byte block: 5e (DW_OP_reg14)
<1><83>: Abbrev Number: 5 (DW_TAG_subprogram)
DW_AT_external : 1
DW_AT_name : (indirect string, offset: 0x35): main
DW_AT_decl_file : 1
DW_AT_decl_line : 19
DW_AT_type : <36>
DW_AT_low_pc : 0xe 14
DW_AT_high_pc : 0x98 152
DW_AT_frame_base : 1 byte block: 5e (DW_OP_reg14)
<1><99>: Abbrev Number: 6 (DW_TAG_variable)
DW_AT_name : (indirect string, offset: 0x5f): common
DW_AT_decl_file : 1
DW_AT_decl_line : 6
DW_AT_type : <36>
DW_AT_external : 1
DW_AT_location : 5 byte block: 3 0 0 0 0 (DW_OP_addr: 0)
<1><ab>: Abbrev Number: 6 (DW_TAG_variable)
DW_AT_name : (indirect string, offset: 0xf6): global
DW_AT_decl_file : 1
DW_AT_decl_line : 7
DW_AT_type : <36>
DW_AT_external : 1
DW_AT_location : 5 byte block: 3 0 0 0 0 (DW_OP_addr: 0)
<1><bd>: Abbrev Number: 7 (DW_TAG_variable)
DW_AT_name : (indirect string, offset: 0xfd): local
DW_AT_decl_file : 1
DW_AT_decl_line : 8
DW_AT_type : <36>
DW_AT_location : 5 byte block: 3 0 0 0 4 (DW_OP_addr: 4)
<1><ce>: Abbrev Number: 8 (DW_TAG_array_type)
DW_AT_sibling : <de>
DW_AT_type : <59>
<2><d7>: Abbrev Number: 9 (DW_TAG_subrange_type)
DW_AT_type : <3d>
DW_AT_upper_bound : 6
<1><de>: Abbrev Number: 7 (DW_TAG_variable)
DW_AT_name : (indirect string, offset: 0x0): string
DW_AT_decl_file : 1
DW_AT_decl_line : 9
DW_AT_type : <ce>
DW_AT_location : 5 byte block: 3 0 0 0 8 (DW_OP_addr: 8)