This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Fix readelf -wi test (Was: Re: readelf: apply all rela relocations in the debug_info section)


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 dot rennecke at superh dot 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 at redhat dot 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 ()


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]