From 3f7de0e75e3af06d979c591dafb63ce87dc40515 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 23 Apr 2003 17:36:08 +0000 Subject: [PATCH] Fix "readelf -wi" test --- binutils/ChangeLog | 4 ++ binutils/readelf.c | 3 +- binutils/testsuite/ChangeLog | 13 ++++ binutils/testsuite/binutils-all/readelf.exp | 13 +++- binutils/testsuite/binutils-all/readelf.wi | 77 ++++----------------- binutils/testsuite/binutils-all/testprog.c | 7 +- 6 files changed, 48 insertions(+), 69 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index ec73a37864e..0f3a282de06 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2003-04-23 J"orn Rennecke + + * readelf.c (decode_location_expression): Don't add a trailing ';'. + 2003-04-23 Dimitrie O. Paun Nick Clifton diff --git a/binutils/readelf.c b/binutils/readelf.c index f66ea42dd44..8d4917a7cb2 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -7727,7 +7727,8 @@ decode_location_expression (data, pointer_size, length) } /* Separate the ops. */ - printf ("; "); + if (data < end) + printf ("; "); } } diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index f69caef92f8..162708f2d1c 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2003-04-23 Nick Clifton + + * 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. + +2003-04-23 J"orn Rennecke + + * readelf.wi: Update. + 2003-04-22 Dimitrie O. Paun * binutils-all/windres/windres.exp: Add test for the new -J diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp index 059955d01c7..a76620d4fb7 100644 --- a/binutils/testsuite/binutils-all/readelf.exp +++ b/binutils/testsuite/binutils-all/readelf.exp @@ -164,6 +164,12 @@ proc readelf_find_size { binary_file } { 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 @@ -183,10 +189,13 @@ proc readelf_test { options binary_file regexp_file xfails } { foreach xfail $xfails { setup_xfail $xfail } + + set got [prune_readelf_warnings $got] if ![string match "" $got] then { + fail "readelf $options (reason: unexpected output)" send_log $got - fail "readelf $options" + send_log "\n" return } @@ -288,4 +297,4 @@ if [is_remote host] { # 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*-*-*} +readelf_test -wi $tempfile readelf.wi {v850*-*-* cris-*-* mips*-*-elf* avr-*-* d30v-*-* h8300*-*-* i960-*-* m32r-*-* sparc-*-*} diff --git a/binutils/testsuite/binutils-all/readelf.wi b/binutils/testsuite/binutils-all/readelf.wi index d76e649e224..b46cce5851c 100644 --- a/binutils/testsuite/binutils-all/readelf.wi +++ b/binutils/testsuite/binutils-all/readelf.wi @@ -4,73 +4,26 @@ The section .debug_info contains: Length: .* Version: 2 Abbrev Offset: 0 - Pointer Size: 4 + Pointer Size: . <.><.*>: 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_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 : 10 + DW_AT_decl_line : 12 DW_AT_type : .* - DW_AT_low_pc : 0 + 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_frame_base : .* + <.><.*>: Abbrev Number: .* \(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: .\) + DW_AT_byte_size : .* + DW_AT_encoding : .* \(signed\) + <.><.*>: Abbrev Number: .* \(DW_TAG_subprogram\) +#pass diff --git a/binutils/testsuite/binutils-all/testprog.c b/binutils/testsuite/binutils-all/testprog.c index 57de4610a60..2a347c887e8 100644 --- a/binutils/testsuite/binutils-all/testprog.c +++ b/binutils/testsuite/binutils-all/testprog.c @@ -1,12 +1,11 @@ -/* This program is used to test objcopy and strip. */ +/* This program is used to test objcopy, readelf and strip. */ -#include -#include +extern int strcmp (char *, const char *); int common; int global = 1; static int local = 2; -static char string[] = "string"; +static unsigned char string[] = "string"; int fn () -- 2.30.2