public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: readelf: apply all rela relocations in the debug_info section
@ 2003-04-22 18:28 Joern Rennecke
  2003-04-22 18:36 ` Joern Rennecke
  0 siblings, 1 reply; 22+ messages in thread
From: Joern Rennecke @ 2003-04-22 18:28 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: binutils, Alan Modra

>       * readelf.c (display_debug_info): Apply RELA relocations on the
>       entire section.
>       (byte_put_little_endian, byte_put_big_endian): New functions.
>       (byte_put): New variable.
>       (get_file_header): Initialize it.

This breaks the readelf -wi test for sh-elf.

-- 
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658

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

* Re: readelf: apply all rela relocations in the debug_info section
  2003-04-22 18:28 readelf: apply all rela relocations in the debug_info section Joern Rennecke
@ 2003-04-22 18:36 ` Joern Rennecke
  2003-04-22 20:13   ` RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations in the debug_info section) Joern Rennecke
  0 siblings, 1 reply; 22+ messages in thread
From: Joern Rennecke @ 2003-04-22 18:36 UTC (permalink / raw)
  To: Alexandre Oliva, binutils, Alan Modra

Joern Rennecke wrote:
> 
> >       * readelf.c (display_debug_info): Apply RELA relocations on the
> >       entire section.
> >       (byte_put_little_endian, byte_put_big_endian): New functions.
> >       (byte_put): New variable.
> >       (get_file_header): Initialize it.
> 
> This breaks the readelf -wi test for sh-elf.

P.S.: I should probably say: It breaks this test some more.  The
comparison template is already wrong, but with your patch, it doesn't
even get that far, readelf spews two warnings:
readelf: Warning: Skipping unexpected symbol type 1
readelf: Warning: Skipping unexpected symbol type 1

gdb says that these are relocations for the symbols _global and _common.
	
-- 
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658

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

* RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations  in the debug_info section)
  2003-04-22 18:36 ` Joern Rennecke
@ 2003-04-22 20:13   ` Joern Rennecke
  2003-04-23 17:36     ` Nick Clifton
  0 siblings, 1 reply; 22+ messages in thread
From: Joern Rennecke @ 2003-04-22 20:13 UTC (permalink / raw)
  To: binutils; +Cc: Alexandre Oliva, Alan Modra, Nick Clifton

[-- Attachment #1: Type: text/plain, Size: 118 bytes --]

	
-- 
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658

[-- Attachment #2: readelf-diff --]
[-- Type: text/plain, Size: 9201 bytes --]

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.rennecke@superh.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: .\)

[-- Attachment #3: readelf.out --]
[-- Type: text/plain, Size: 4520 bytes --]

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)


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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations  in the debug_info section)
  2003-04-22 20:13   ` RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations in the debug_info section) Joern Rennecke
@ 2003-04-23 17:36     ` Nick Clifton
  2003-04-23 17:39       ` Daniel Jacobowitz
                         ` (3 more replies)
  0 siblings, 4 replies; 22+ messages in thread
From: Nick Clifton @ 2003-04-23 17:36 UTC (permalink / raw)
  To: Joern Rennecke; +Cc: binutils, Alexandre Oliva, Alan Modra

Hi Joern,

> 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 "; ".

Your patch still does not resolve the "readelf: Warning: Skipping
unexpected symbol type 1" problem that you mentioned in your earlier
post.  In my opinion however the readelf.wi is severely broken, since
there is no real guaranteed structure to the output of "readelf -wi".

Instead I am going to apply your patch together with a change of my
own.  This additional patch:

  * Filters out "skipping unexpected symbol" messages.

  * Shortens the expected output file (readelf.wi) so that only the
    first few blocks are present.  These blocks ought to be in every
    toolchain's output.  They were for all the toolchains I tested.

  * Adds several more toolchains to the expected failure list, since
    they do not default to generating dwarf2 output.

  * Updates testprog.c to explicitly make the char array unsigned, and
    to remove the inclusion of stdio.h and string.h so that it can be
    compiled without a complete run time environment present.


> 2003-04-22  J"orn Rennecke <joern.rennecke@superh.com>
> 
> binutils:
> 	* readelf.c (decode_location_expression): Don't add a trailing "; " .
> binutils/testsuite:
> 	* readelf.wi: Update.

Approved and applied.


Cheers
        Nick

2003-04-23  Nick Clifton  <nickc@redhat.com>

	* readelf.exp (proc prune_readelf_warnings): New function.
	(proc readelf_test): Prune warning messages.
	(readelf_test -wi): Add more expected failures.
	* readelf.wi: Severly reduce expected output.
	* testprog.c (string): Explicitly use unsigned chars.
	(stdio.h, string.h): Remove inclusion.

Index: testsuite/binutils-all/readelf.exp
===================================================================
RCS file: /cvs/src/src/binutils/testsuite/binutils-all/readelf.exp,v
retrieving revision 1.15
diff -c -3 -p -w -r1.15 readelf.exp
*** testsuite/binutils-all/readelf.exp	15 Nov 2001 01:11:09 -0000	1.15
--- testsuite/binutils-all/readelf.exp	23 Apr 2003 17:22:52 -0000
*************** proc readelf_find_size { binary_file } {
*** 164,169 ****
--- 164,175 ----
      pass $testname
  }
  
+ # Simple proc to skip certain expected warning messages.
+ proc prune_readelf_warnings { text } {
+     regsub -all "(^|\n)(.*Skipping unexpected symbol type.*)" $text "\\1" text
+     return $text
+ }
+ 
  # Run an individual readelf test.
  # Basically readelf is run on the binary_file with the given options.
  # Readelf's output is captured and then compared against the contents
*************** proc readelf_test { options binary_file 
*** 184,192 ****
  	setup_xfail $xfail
      }
      
      if ![string match "" $got] then {
  	send_log $got
! 	fail "readelf $options"
  	return
      }
  
--- 190,201 ----
  	setup_xfail $xfail
      }
  
+     set got [prune_readelf_warnings $got]
+     
      if ![string match "" $got] then {
+ 	fail "readelf $options (reason: unexpected output)"
  	send_log $got
! 	send_log "\n"
  	return
      }
  
*************** if [is_remote host] {
*** 288,291 ****
  # The xfail targets here do not default to DWARF2 format debug information
  # The symptom is that the output of 'readelf -wi' is empty.
  
! readelf_test -wi $tempfile readelf.wi {v850*-*-* cris-*-* mips*-*-elf* *-*-linux* h8300*-*-*}
--- 297,300 ----
  # The xfail targets here do not default to DWARF2 format debug information
  # The symptom is that the output of 'readelf -wi' is empty.
  
! readelf_test -wi $tempfile readelf.wi {v850*-*-* cris-*-* mips*-*-elf* avr-*-* d30v-*-* h8300*-*-* i960-*-* m32r-*-* sparc-*-*}

Index: testsuite/binutils-all/readelf.wi
===================================================================
RCS file: /cvs/src/src/binutils/testsuite/binutils-all/readelf.wi,v
retrieving revision 1.4
diff -c -3 -p -w -r1.4 readelf.wi
*** testsuite/binutils-all/readelf.wi	18 Feb 2001 23:32:59 -0000	1.4
--- testsuite/binutils-all/readelf.wi	23 Apr 2003 17:22:52 -0000
*************** The section .debug_info contains:
*** 4,76 ****
     Length:        .*
     Version:       2
     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: .\)
--- 4,29 ----
     Length:        .*
     Version:       2
     Abbrev Offset: 0
!    Pointer Size:  .
   <.><.*>: Abbrev Number: .* \(DW_TAG_compile_unit\)
       DW_AT_stmt_list   : 0	
!      DW_AT_high_pc     : .*	
!      DW_AT_low_pc      : 0.*	
!      DW_AT_producer    :.*
!      DW_AT_language    : 1	\(ANSI C\)
!      DW_AT_name        : .*
!  <.><.*>: Abbrev Number: .* \(DW_TAG_subprogram\)
       DW_AT_external    : 1	
       DW_AT_name        : fn	
       DW_AT_decl_file   : 1	
!      DW_AT_decl_line   : 12	
       DW_AT_type        : .*	
!      DW_AT_low_pc      : 0.*	
       DW_AT_high_pc     : .*	
!      DW_AT_frame_base  : .*
!  <.><.*>: Abbrev Number: .* \(DW_TAG_base_type\)
       DW_AT_name        : int	
!      DW_AT_byte_size   : .*
!      DW_AT_encoding    : .*	\(signed\)
!  <.><.*>: Abbrev Number: .* \(DW_TAG_subprogram\)
! #pass

Index: testsuite/binutils-all/testprog.c
===================================================================
RCS file: /cvs/src/src/binutils/testsuite/binutils-all/testprog.c,v
retrieving revision 1.3
diff -c -3 -p -w -r1.3 testprog.c
*** testsuite/binutils-all/testprog.c	12 Feb 2001 00:21:58 -0000	1.3
--- testsuite/binutils-all/testprog.c	23 Apr 2003 17:22:52 -0000
***************
*** 1,12 ****
! /* This program is used to test objcopy and strip.  */
  
! #include <stdio.h>
! #include <string.h>
  
  int common;
  int global = 1;
  static int local = 2;
! static char string[] = "string";
  
  int
  fn ()
--- 1,11 ----
! /* This program is used to test objcopy, readelf and strip.  */
  
! extern int strcmp (char *, const char *);
  
  int common;
  int global = 1;
  static int local = 2;
! static unsigned char string[] = "string";
  
  int
  fn ()

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations  in the debug_info section)
  2003-04-23 17:36     ` Nick Clifton
@ 2003-04-23 17:39       ` Daniel Jacobowitz
  2003-04-23 17:59         ` Nick Clifton
  2003-04-23 18:09       ` H. J. Lu
                         ` (2 subsequent siblings)
  3 siblings, 1 reply; 22+ messages in thread
From: Daniel Jacobowitz @ 2003-04-23 17:39 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Joern Rennecke, binutils, Alexandre Oliva, Alan Modra

On Wed, Apr 23, 2003 at 06:34:31PM +0100, Nick Clifton wrote:
> Hi Joern,
> 
> > 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 "; ".
> 
> Your patch still does not resolve the "readelf: Warning: Skipping
> unexpected symbol type 1" problem that you mentioned in your earlier
> post.  In my opinion however the readelf.wi is severely broken, since
> there is no real guaranteed structure to the output of "readelf -wi".
> 
> Instead I am going to apply your patch together with a change of my
> own.  This additional patch:
> 
>   * Filters out "skipping unexpected symbol" messages.

But are they "expected"?  Or are they a bug?  I think they're probably
a bug...

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations  in the debug_info section)
  2003-04-23 17:39       ` Daniel Jacobowitz
@ 2003-04-23 17:59         ` Nick Clifton
  0 siblings, 0 replies; 22+ messages in thread
From: Nick Clifton @ 2003-04-23 17:59 UTC (permalink / raw)
  To: drow; +Cc: joern.rennecke, binutils, aoliva, amodra

Hi Daniel,

> > Instead I am going to apply your patch together with a change of my
> > own.  This additional patch:
> > 
> >   * Filters out "skipping unexpected symbol" messages.
> 
> But are they "expected"?  Or are they a bug?  I think they're probably
> a bug...

Hmm, well I am not so sure, but if you have proof, please let me know.
My gut feeling (since I have not yet investigated) is that this is a
bug in readelf, in that it ought to be able to handle the unrelocated
debug entries, or whatever it is that is causing this problem.  So
really it is a feature or limitation of readelf, not a bug.  Of course
I could be completely wrong about this...

Since we are about to create a new branch, it seemed like a good idea
to have the binutils tests passing for as many platforms as possible,
even if we are papering over a problem.  I am sure that I can rely
upon you and others to make sure that this problem does not get
dropped after the release.

Cheers
        Nick

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations  in the debug_info section)
  2003-04-23 17:36     ` Nick Clifton
  2003-04-23 17:39       ` Daniel Jacobowitz
@ 2003-04-23 18:09       ` H. J. Lu
  2003-04-23 18:17         ` Nick Clifton
  2003-04-23 18:47       ` Joern Rennecke
  2003-04-24 17:21       ` Joern Rennecke
  3 siblings, 1 reply; 22+ messages in thread
From: H. J. Lu @ 2003-04-23 18:09 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Joern Rennecke, binutils, Alexandre Oliva, Alan Modra

On Wed, Apr 23, 2003 at 06:34:31PM +0100, Nick Clifton wrote:
> Hi Joern,
> 
> > 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 "; ".
> 
> Your patch still does not resolve the "readelf: Warning: Skipping
> unexpected symbol type 1" problem that you mentioned in your earlier
> post.  In my opinion however the readelf.wi is severely broken, since
> there is no real guaranteed structure to the output of "readelf -wi".
> 
> Instead I am going to apply your patch together with a change of my
> own.  This additional patch:
> 

Now it fails on RedHat 9:


H.J.
----
exec /export/build/linux/binutils-debug/build-i686-linux/binutils/readelf  -wi tmpdir/testprog.o > readelf.out
regexp_diff match failure
regexp "^     DW_AT_producer    :.*$"
line   "     DW_AT_name        : (indirect string, offset: 0x68): /net/gnu/export/linux/src/binutils/binutils/binutils/testsuite/binutils-all/testprog.c	"
regexp_diff match failure
regexp "^     DW_AT_language    : 1	\(ANSI C\)$"
line   "     DW_AT_producer    : (indirect string, offset: 0x2e): GNU C 3.2.2 20030222 (Red Hat Linux 3.2.2-5)	"
regexp_diff match failure
regexp "^     DW_AT_name        : .*$"
line   "     DW_AT_language    : 1	(ANSI C)"
FAIL: readelf -wi

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations  in the debug_info section)
  2003-04-23 18:09       ` H. J. Lu
@ 2003-04-23 18:17         ` Nick Clifton
  2003-04-23 18:22           ` H. J. Lu
  0 siblings, 1 reply; 22+ messages in thread
From: Nick Clifton @ 2003-04-23 18:17 UTC (permalink / raw)
  To: hjl; +Cc: binutils

Hi H.J.

> Now it fails on RedHat 9:

Strange.  I am running RH9 and I do not get that failure.  Was this
with a natively configured toolchain ?

Anyway it looks like we need to reduce the text inside readelf.wi even
more.  I suspect that the best thing to do would be to delete the test
entirely.  Do you agree ?

Cheers
       Nick

> 
> H.J.
> ----
> exec /export/build/linux/binutils-debug/build-i686-linux/binutils/readelf  -wi tmpdir/testprog.o > readelf.out
> regexp_diff match failure
> regexp "^     DW_AT_producer    :.*$"
> line   "     DW_AT_name        : (indirect string, offset: 0x68): /net/gnu/export/linux/src/binutils/binutils/binutils/testsuite/binutils-all/testprog.c	"
> regexp_diff match failure
> regexp "^     DW_AT_language    : 1	\(ANSI C\)$"
> line   "     DW_AT_producer    : (indirect string, offset: 0x2e): GNU C 3.2.2 20030222 (Red Hat Linux 3.2.2-5)	"
> regexp_diff match failure
> regexp "^     DW_AT_name        : .*$"
> line   "     DW_AT_language    : 1	(ANSI C)"
> FAIL: readelf -wi

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations  in the debug_info section)
  2003-04-23 18:17         ` Nick Clifton
@ 2003-04-23 18:22           ` H. J. Lu
  0 siblings, 0 replies; 22+ messages in thread
From: H. J. Lu @ 2003-04-23 18:22 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

On Wed, Apr 23, 2003 at 07:15:48PM +0100, Nick Clifton wrote:
> Hi H.J.
> 
> > Now it fails on RedHat 9:
> 
> Strange.  I am running RH9 and I do not get that failure.  Was this
> with a natively configured toolchain ?

Yes, I just did

# .../binutils/configure

But I did use yesterday's binutils from CVS to build it.


H.J.

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela  relocations  in the debug_info section)
  2003-04-23 17:36     ` Nick Clifton
  2003-04-23 17:39       ` Daniel Jacobowitz
  2003-04-23 18:09       ` H. J. Lu
@ 2003-04-23 18:47       ` Joern Rennecke
  2003-04-24 17:21       ` Joern Rennecke
  3 siblings, 0 replies; 22+ messages in thread
From: Joern Rennecke @ 2003-04-23 18:47 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils, Alexandre Oliva, Alan Modra, H. J. Lu

Nick Clifton wrote:
> Your patch still does not resolve the "readelf: Warning: Skipping
> unexpected symbol type 1" problem that you mentioned in your earlier
> post.  In my opinion however the readelf.wi is severely broken, since
> there is no real guaranteed structure to the output of "readelf -wi".
> 
> Instead I am going to apply your patch together with a change of my
> own.  This additional patch:
> 
>   * Filters out "skipping unexpected symbol" messages.
> 
>   * Shortens the expected output file (readelf.wi) so that only the
>     first few blocks are present.  These blocks ought to be in every
>     toolchain's output.  They were for all the toolchains I tested.
> 
>   * Adds several more toolchains to the expected failure list, since
>     they do not default to generating dwarf2 output.
> 
>   * Updates testprog.c to explicitly make the char array unsigned, and
>     to remove the inclusion of stdio.h and string.h so that it can be
>     compiled without a complete run time environment present.

Yes, the binutils testsuite passes now on sh-elf.


"H. J. Lu" wrote:	
> Now it fails on RedHat 9:

Not to say that this is acceptable, but if it ever suceeded in recent
years, that must have been a bug, since the line numbers in readelf.wi
were out of sync with testprog.c

The current failure really comes down to the brokenness that Nick
mentioned above.  Either we have to process the output more
intelligently - with GNU grep, we could just use grep -A xx -B yy to
look for the expected bits, paste this all together into a massaged
output file, and compare that to our template; an awk wizard can
surely do better.  Or we could start to supply different templates
for different targets.

-- 
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela  relocations  in the debug_info section)
  2003-04-23 17:36     ` Nick Clifton
                         ` (2 preceding siblings ...)
  2003-04-23 18:47       ` Joern Rennecke
@ 2003-04-24 17:21       ` Joern Rennecke
  2003-04-25  9:34         ` Nick Clifton
  3 siblings, 1 reply; 22+ messages in thread
From: Joern Rennecke @ 2003-04-24 17:21 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils, Alexandre Oliva, Alan Modra, hjl

Nick Clifton wrote:
		
> Anyway it looks like we need to reduce the text inside readelf.wi even
> more.  I suspect that the best thing to do would be to delete the test
> entirely.  Do you agree ?

It is useful to find regressions like the stray "; ", or readelf giving
extra warning messages.
Till we find someone who volunteers to sort the output intelligently,
we could at least grep for the most salient bits, i.e.:
grep DW_AT_producer < readelf.out > readelf.out2
grep DW_AT_language < readelf.out >> readelf.out2
grep 'DW_AT_name.*: fn' < readelf.out >> readelf.out2
etc.

-- 
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela  relocations  in the debug_info section)
  2003-04-24 17:21       ` Joern Rennecke
@ 2003-04-25  9:34         ` Nick Clifton
  2003-04-25 13:38           ` Daniel Jacobowitz
  0 siblings, 1 reply; 22+ messages in thread
From: Nick Clifton @ 2003-04-25  9:34 UTC (permalink / raw)
  To: joern.rennecke, hjl; +Cc: binutils

Hi Joern, Hi H.J.

> > Anyway it looks like we need to reduce the text inside readelf.wi even
> > more.  I suspect that the best thing to do would be to delete the test
> > entirely.  Do you agree ?
> 
> It is useful to find regressions like the stray "; ", or readelf giving
> extra warning messages.
> Till we find someone who volunteers to sort the output intelligently,
> we could at least grep for the most salient bits, i.e.:
> grep DW_AT_producer < readelf.out > readelf.out2
> grep DW_AT_language < readelf.out >> readelf.out2
> grep 'DW_AT_name.*: fn' < readelf.out >> readelf.out2
> etc.

That would be good.

HJ - Do you still get failures from this test with your x86 Linux
build ?  If not, then lets leave the test as it is until someone gets
around to rewriting it properly.  Otherwise I will have a go at
reworking it to Joern's suggestion.

Cheers
        Nick

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela  relocations  in the debug_info section)
  2003-04-25  9:34         ` Nick Clifton
@ 2003-04-25 13:38           ` Daniel Jacobowitz
  2003-04-25 15:36             ` H. J. Lu
  2003-04-25 16:05             ` Nick Clifton
  0 siblings, 2 replies; 22+ messages in thread
From: Daniel Jacobowitz @ 2003-04-25 13:38 UTC (permalink / raw)
  To: Nick Clifton; +Cc: joern.rennecke, hjl, binutils

On Fri, Apr 25, 2003 at 10:31:53AM +0100, Nick Clifton wrote:
> Hi Joern, Hi H.J.
> 
> > > Anyway it looks like we need to reduce the text inside readelf.wi even
> > > more.  I suspect that the best thing to do would be to delete the test
> > > entirely.  Do you agree ?
> > 
> > It is useful to find regressions like the stray "; ", or readelf giving
> > extra warning messages.
> > Till we find someone who volunteers to sort the output intelligently,
> > we could at least grep for the most salient bits, i.e.:
> > grep DW_AT_producer < readelf.out > readelf.out2
> > grep DW_AT_language < readelf.out >> readelf.out2
> > grep 'DW_AT_name.*: fn' < readelf.out >> readelf.out2
> > etc.
> 
> That would be good.
> 
> HJ - Do you still get failures from this test with your x86 Linux
> build ?  If not, then lets leave the test as it is until someone gets
> around to rewriting it properly.  Otherwise I will have a go at
> reworking it to Joern's suggestion.

I can reproduce them here on gcc 3.2.3pre.  Same symptom; things come
out in a different order.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela  relocations  in the debug_info section)
  2003-04-25 13:38           ` Daniel Jacobowitz
@ 2003-04-25 15:36             ` H. J. Lu
  2003-04-25 16:05             ` Nick Clifton
  1 sibling, 0 replies; 22+ messages in thread
From: H. J. Lu @ 2003-04-25 15:36 UTC (permalink / raw)
  To: Nick Clifton, joern.rennecke, binutils

On Fri, Apr 25, 2003 at 09:38:12AM -0400, Daniel Jacobowitz wrote:
> On Fri, Apr 25, 2003 at 10:31:53AM +0100, Nick Clifton wrote:
> > Hi Joern, Hi H.J.
> > 
> > > > Anyway it looks like we need to reduce the text inside readelf.wi even
> > > > more.  I suspect that the best thing to do would be to delete the test
> > > > entirely.  Do you agree ?
> > > 
> > > It is useful to find regressions like the stray "; ", or readelf giving
> > > extra warning messages.
> > > Till we find someone who volunteers to sort the output intelligently,
> > > we could at least grep for the most salient bits, i.e.:
> > > grep DW_AT_producer < readelf.out > readelf.out2
> > > grep DW_AT_language < readelf.out >> readelf.out2
> > > grep 'DW_AT_name.*: fn' < readelf.out >> readelf.out2
> > > etc.
> > 
> > That would be good.
> > 
> > HJ - Do you still get failures from this test with your x86 Linux
> > build ?  If not, then lets leave the test as it is until someone gets
> > around to rewriting it properly.  Otherwise I will have a go at
> > reworking it to Joern's suggestion.
> 
> I can reproduce them here on gcc 3.2.3pre.  Same symptom; things come
> out in a different order.
> 

I still have the same problem on RedHat 9 with gcc version 3.2.2
20030222 (Red Hat Linux 3.2.2-5).


H.J.

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela  relocations  in the debug_info section)
  2003-04-25 13:38           ` Daniel Jacobowitz
  2003-04-25 15:36             ` H. J. Lu
@ 2003-04-25 16:05             ` Nick Clifton
  2003-04-25 16:10               ` H. J. Lu
  2003-04-25 16:43               ` Joern Rennecke
  1 sibling, 2 replies; 22+ messages in thread
From: Nick Clifton @ 2003-04-25 16:05 UTC (permalink / raw)
  To: joern.rennecke, hjl, drow; +Cc: binutils

Hi Guys,

> I can reproduce them here on gcc 3.2.3pre.  Same symptom; things come
> out in a different order.

Poo.  Oh well, please try the following patch instead.  I think it
does the right thing, and I have tested it extensively with the
toolchains I have here, but I would like independent confirmation that
it works.

Cheers
        Nick

2003-04-25  Nick Clifton  <nickc@redhat.com>

	* (prune_read_warnings): Rename to prune_readelf_wi_warnings.
        (readelf_wi_test): New proc: Test 'readelf -wi' by grepping
        through its output.
        Replace invocation of "readelf_test -wi" with "readelf_wi_test"

Index: binutils/testsuite/binutils-all/readelf.exp
===================================================================
RCS file: /cvs/src/src/binutils/testsuite/binutils-all/readelf.exp,v
retrieving revision 1.16
diff -c -3 -p -w -r1.16 readelf.exp
*** binutils/testsuite/binutils-all/readelf.exp	23 Apr 2003 17:36:08 -0000	1.16
--- binutils/testsuite/binutils-all/readelf.exp	25 Apr 2003 16:01:46 -0000
*************** proc readelf_find_size { binary_file } {
*** 164,175 ****
      pass $testname
  }
  
- # Simple proc to skip certain expected warning messages.
- proc prune_readelf_warnings { text } {
-     regsub -all "(^|\n)(.*Skipping unexpected symbol type.*)" $text "\\1" text
-     return $text
- }
- 
  # Run an individual readelf test.
  # Basically readelf is run on the binary_file with the given options.
  # Readelf's output is captured and then compared against the contents
--- 164,169 ----
*************** proc readelf_test { options binary_file 
*** 190,197 ****
  	setup_xfail $xfail
      }
  
-     set got [prune_readelf_warnings $got]
-     
      if ![string match "" $got] then {
  	fail "readelf $options (reason: unexpected output)"
  	send_log $got
--- 184,189 ----
*************** proc readelf_test { options binary_file 
*** 225,230 ****
--- 217,305 ----
      pass "readelf $options"
  }
  
+ # Simple proc to skip certain expected warning messages.
+ 
+ proc prune_readelf_wi_warnings { text } {
+     regsub -all "(^|\n)(.*Skipping unexpected symbol type.*)" $text "\\1" text
+     return $text
+ }
+ 
+ # Testing the "readelf -wi" option is difficult because there
+ # is no guaranteed order to the output, and because some ports
+ # will use indirect string references, whilst others will use
+ # direct references.  So instead of having an expected output
+ # file, like the other readelf tests, we grep for strings that
+ # really ought to be there.
+ 
+ proc readelf_wi_test {} {
+     global READELF
+     global READELFFLAGS
+     global srcdir
+     global subdir
+     
+     # Compile the second test file.
+     if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
+ 	verbose "Unable to compile test file."
+ 	untested "readelf -wi"
+ 	return
+     }
+ 
+     # Download it.
+     set tempfile [remote_download host tmpdir/testprog.o];
+ 
+     # Run "readelf -wi" on it.
+     send_log "exec $READELF $READELFFLAGS -wi $tempfile > readelf.out\n"
+     catch "exec $READELF $READELFFLAGS -wi $tempfile > readelf.out" got
+ 
+     # Upload the results.
+     set output [remote_upload host readelf.out];
+ 
+     file_on_host delete $tempfile;
+     
+     # Strip any superflous warnings.
+     set got [prune_readelf_wi_warnings $got]
+ 
+     if ![string match "" $got] then {
+ 	fail "readelf $options (reason: unexpected output)"
+ 	send_log $got
+ 	send_log "\n"
+ 	return
+     }
+ 
+     if ![file size $output] then {
+ 	# If the output file is empty, then this target does not
+ 	# generate dwarf2 output.  This is not a failure.
+ 	verbose "No output from 'readelf -wi'"
+ 	untested "readelf -wi"
+ 	return
+     }
+     
+     # Search for strings that should be in the output.
+     set sought {
+ 	".*DW_TAG_compile_unit.*"
+ 	".*DW_TAG_subprogram.*"
+ 	".*DW_TAG_base_type.*"
+ 	".*DW_AT_producer.*(GNU C|indirect string).*"
+ 	".*DW_AT_language.*ANSI C.*"
+ 	".*DW_AT_name.*(testprog.c|indirect string).*"
+ 	".*DW_AT_name.*fn.*"
+ 	".*DW_AT_name.*(main|indirect string).*"
+     }
+     
+     foreach looked_for $sought {	
+ 	set lines [grep $output $looked_for]
+ 	if ![llength $lines] then {
+ 	    fail "readelf -wi: missing: $looked_for"
+ 	    send_log readelf.out
+ 	    return
+ 	}
+     }
+ 
+     file_on_host delete $output;
+     
+     # All done.
+     pass "readelf -wi"
+ }
  
  
  # Only ELF based toolchains need readelf.
*************** readelf_test -S $tempfile readelf.s  {}
*** 281,300 ****
  readelf_test -s $tempfile readelf.ss {}
  readelf_test -r $tempfile readelf.r  {}
  
! 
! # Compile the second test file.
! if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
!     untested "readelf -w"
!     return
! }
! 
! if [is_remote host] {
!     set tempfile [remote_download host tmpdir/testprog.o];
! } else {
!     set tempfile tmpdir/testprog.o
! }
! 
! # The xfail targets here do not default to DWARF2 format debug information
! # The symptom is that the output of 'readelf -wi' is empty.
! 
! readelf_test -wi $tempfile readelf.wi {v850*-*-* cris-*-* mips*-*-elf* avr-*-* d30v-*-* h8300*-*-* i960-*-* m32r-*-* sparc-*-*}
--- 356,359 ----
  readelf_test -s $tempfile readelf.ss {}
  readelf_test -r $tempfile readelf.r  {}
  
! readelf_wi_test

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela  relocations  in the debug_info section)
  2003-04-25 16:05             ` Nick Clifton
@ 2003-04-25 16:10               ` H. J. Lu
  2003-04-25 16:43               ` Joern Rennecke
  1 sibling, 0 replies; 22+ messages in thread
From: H. J. Lu @ 2003-04-25 16:10 UTC (permalink / raw)
  To: Nick Clifton; +Cc: joern.rennecke, drow, binutils

On Fri, Apr 25, 2003 at 05:02:40PM +0100, Nick Clifton wrote:
> Hi Guys,
> 
> > I can reproduce them here on gcc 3.2.3pre.  Same symptom; things come
> > out in a different order.
> 
> Poo.  Oh well, please try the following patch instead.  I think it
> does the right thing, and I have tested it extensively with the
> toolchains I have here, but I would like independent confirmation that
> it works.
> 
> Cheers
>         Nick
> 
> 2003-04-25  Nick Clifton  <nickc@redhat.com>
> 
> 	* (prune_read_warnings): Rename to prune_readelf_wi_warnings.
>         (readelf_wi_test): New proc: Test 'readelf -wi' by grepping
>         through its output.
>         Replace invocation of "readelf_test -wi" with "readelf_wi_test"
> 

Yes, it works for me. Thanks.


H.J.

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela   relocations  in the debug_info section)
  2003-04-25 16:05             ` Nick Clifton
  2003-04-25 16:10               ` H. J. Lu
@ 2003-04-25 16:43               ` Joern Rennecke
  2003-04-25 17:18                 ` Daniel Jacobowitz
  1 sibling, 1 reply; 22+ messages in thread
From: Joern Rennecke @ 2003-04-25 16:43 UTC (permalink / raw)
  To: Nick Clifton; +Cc: hjl, drow, binutils

Nick Clifton wrote:
> +     set sought {
> +       ".*DW_TAG_compile_unit.*"
> +       ".*DW_TAG_subprogram.*"
> +       ".*DW_TAG_base_type.*"
> +       ".*DW_AT_producer.*(GNU C|indirect string).*"
> +       ".*DW_AT_language.*ANSI C.*"
> +       ".*DW_AT_name.*(testprog.c|indirect string).*"
> +       ".*DW_AT_name.*fn.*"
> +       ".*DW_AT_name.*(main|indirect string).*"
> +     }

Hello Nick,

At least for sh-elf, after the " \(indirect string, offset: 0x[0-9a-f]+\): "
bit, it still displays the original string.  Are there any targets where
this is not the case?
I would also like to see a grep for "\(DW_OP_addr: 0\)", since we actually
had a regression there.
	
-- 
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations  in the debug_info section)
  2003-04-25 16:43               ` Joern Rennecke
@ 2003-04-25 17:18                 ` Daniel Jacobowitz
  2003-04-26  7:57                   ` Nick Clifton
  0 siblings, 1 reply; 22+ messages in thread
From: Daniel Jacobowitz @ 2003-04-25 17:18 UTC (permalink / raw)
  To: Joern Rennecke; +Cc: Nick Clifton, hjl, binutils

On Fri, Apr 25, 2003 at 05:41:32PM +0100, Joern Rennecke wrote:
> Nick Clifton wrote:
> > +     set sought {
> > +       ".*DW_TAG_compile_unit.*"
> > +       ".*DW_TAG_subprogram.*"
> > +       ".*DW_TAG_base_type.*"
> > +       ".*DW_AT_producer.*(GNU C|indirect string).*"
> > +       ".*DW_AT_language.*ANSI C.*"
> > +       ".*DW_AT_name.*(testprog.c|indirect string).*"
> > +       ".*DW_AT_name.*fn.*"
> > +       ".*DW_AT_name.*(main|indirect string).*"
> > +     }
> 
> Hello Nick,
> 
> At least for sh-elf, after the " \(indirect string, offset: 0x[0-9a-f]+\): "
> bit, it still displays the original string.  Are there any targets where
> this is not the case?

There should not be; if there are, it's a bug.  So I'd say the indirect
string bit can probably go.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations  in the debug_info section)
  2003-04-25 17:18                 ` Daniel Jacobowitz
@ 2003-04-26  7:57                   ` Nick Clifton
  2003-04-26 13:56                     ` Daniel Jacobowitz
  2003-04-28 13:02                     ` Joern Rennecke
  0 siblings, 2 replies; 22+ messages in thread
From: Nick Clifton @ 2003-04-26  7:57 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Joern Rennecke, hjl, binutils

Hi Daniel,Hi Joern,

> > > +       ".*DW_AT_producer.*(GNU C|indirect string).*"
> > > +       ".*DW_AT_language.*ANSI C.*"
> > > +       ".*DW_AT_name.*(testprog.c|indirect string).*"
> > > +       ".*DW_AT_name.*fn.*"
> > > +       ".*DW_AT_name.*(main|indirect string).*"
> > > +     }
> > 
> > At least for sh-elf, after the " \(indirect string, offset: 0x[0-9a-f]+\): "
> > bit, it still displays the original string.  Are there any targets where
> > this is not the case?
> 
> There should not be; if there are, it's a bug.  So I'd say the indirect
> string bit can probably go.

Actually they are needed.  Without them the sh-elf sh64-elf and
mn10300-elf ports will fail this test.  The problem is that we are
running readelf on the object file not the executable, so there can be
unresolved relocs in the debug info sections.

> > I would also like to see a grep for "\(DW_OP_addr: 0\)", since we
> > actually had a regression there.

What was the regression ?

Anyway I have added this line to the test and checked it in.

Cheers
        Nick


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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations  in the debug_info section)
  2003-04-26  7:57                   ` Nick Clifton
@ 2003-04-26 13:56                     ` Daniel Jacobowitz
  2003-04-27  9:12                       ` Nick Clifton
  2003-04-28 13:02                     ` Joern Rennecke
  1 sibling, 1 reply; 22+ messages in thread
From: Daniel Jacobowitz @ 2003-04-26 13:56 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Joern Rennecke, hjl, binutils

On Sat, Apr 26, 2003 at 08:55:07AM +0100, Nick Clifton wrote:
> Hi Daniel,Hi Joern,
> 
> > > > +       ".*DW_AT_producer.*(GNU C|indirect string).*"
> > > > +       ".*DW_AT_language.*ANSI C.*"
> > > > +       ".*DW_AT_name.*(testprog.c|indirect string).*"
> > > > +       ".*DW_AT_name.*fn.*"
> > > > +       ".*DW_AT_name.*(main|indirect string).*"
> > > > +     }
> > > 
> > > At least for sh-elf, after the " \(indirect string, offset: 0x[0-9a-f]+\): "
> > > bit, it still displays the original string.  Are there any targets where
> > > this is not the case?
> > 
> > There should not be; if there are, it's a bug.  So I'd say the indirect
> > string bit can probably go.
> 
> Actually they are needed.  Without them the sh-elf sh64-elf and
> mn10300-elf ports will fail this test.  The problem is that we are
> running readelf on the object file not the executable, so there can be
> unresolved relocs in the debug info sections.

I'm confused.  Remember the original subject of this thread?  I thought
we should be applying all unresolved relocations now.

> Anyway I have added this line to the test and checked it in.

Thanks!

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations  in the debug_info section)
  2003-04-26 13:56                     ` Daniel Jacobowitz
@ 2003-04-27  9:12                       ` Nick Clifton
  0 siblings, 0 replies; 22+ messages in thread
From: Nick Clifton @ 2003-04-27  9:12 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Joern Rennecke, hjl, binutils

Hi Daniel,

> I'm confused.  Remember the original subject of this thread?  I thought
> we should be applying all unresolved relocations now.

Hmm, good point.  I guess there are still problems with the sh and
mn10300 ports then.  Will have to investigate once the branch/release
is done.

Cheers
        Nick

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

* Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela  relocations  in the debug_info section)
  2003-04-26  7:57                   ` Nick Clifton
  2003-04-26 13:56                     ` Daniel Jacobowitz
@ 2003-04-28 13:02                     ` Joern Rennecke
  1 sibling, 0 replies; 22+ messages in thread
From: Joern Rennecke @ 2003-04-28 13:02 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Daniel Jacobowitz, hjl, binutils

Nick Clifton wrote:
> > > I would also like to see a grep for "\(DW_OP_addr: 0\)", since we
> > > actually had a regression there.
> 
> What was the regression ?

The output was "\(DW_OP_addr: 0; \)" instead.
> 
> Anyway I have added this line to the test and checked it in.

Thanks.
	
-- 
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658

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

end of thread, other threads:[~2003-04-28 13:02 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-22 18:28 readelf: apply all rela relocations in the debug_info section Joern Rennecke
2003-04-22 18:36 ` Joern Rennecke
2003-04-22 20:13   ` RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations in the debug_info section) Joern Rennecke
2003-04-23 17:36     ` Nick Clifton
2003-04-23 17:39       ` Daniel Jacobowitz
2003-04-23 17:59         ` Nick Clifton
2003-04-23 18:09       ` H. J. Lu
2003-04-23 18:17         ` Nick Clifton
2003-04-23 18:22           ` H. J. Lu
2003-04-23 18:47       ` Joern Rennecke
2003-04-24 17:21       ` Joern Rennecke
2003-04-25  9:34         ` Nick Clifton
2003-04-25 13:38           ` Daniel Jacobowitz
2003-04-25 15:36             ` H. J. Lu
2003-04-25 16:05             ` Nick Clifton
2003-04-25 16:10               ` H. J. Lu
2003-04-25 16:43               ` Joern Rennecke
2003-04-25 17:18                 ` Daniel Jacobowitz
2003-04-26  7:57                   ` Nick Clifton
2003-04-26 13:56                     ` Daniel Jacobowitz
2003-04-27  9:12                       ` Nick Clifton
2003-04-28 13:02                     ` Joern Rennecke

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