From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25195 invoked by alias); 24 Jul 2007 16:40:56 -0000 Received: (qmail 24923 invoked by uid 22791); 24 Jul 2007 16:40:56 -0000 X-Spam-Check-By: sourceware.org Received: from dmz.mips-uk.com (HELO dmz.mips-uk.com) (194.74.144.194) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 24 Jul 2007 16:40:51 +0000 Received: from internal-mx1 ([192.168.192.240] helo=ukservices1.mips.com) by dmz.mips-uk.com with esmtp (Exim 3.35 #1 (Debian)) id 1IDNRI-0003Hd-00; Tue, 24 Jul 2007 17:40:48 +0100 Received: from perivale.mips.com ([192.168.192.200]) by ukservices1.mips.com with esmtp (Exim 3.36 #1 (Debian)) id 1IDNR5-0003z8-00; Tue, 24 Jul 2007 17:40:35 +0100 Received: from macro (helo=localhost) by perivale.mips.com with local-esmtp (Exim 4.63) (envelope-from ) id 1IDNR5-0003NL-6q; Tue, 24 Jul 2007 17:40:35 +0100 Date: Tue, 24 Jul 2007 17:35:00 -0000 From: "Maciej W. Rozycki" To: gdb-patches@sourceware.org cc: "Maciej W. Rozycki" Subject: gdb.base/dump.exp: Force the correct endianness Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MIPS-Technologies-UK-MailScanner: Found to be clean X-MIPS-Technologies-UK-MailScanner-From: macro@mips.com Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00255.txt.bz2 Hello, Testcases in gdb.base/dump.exp use binary formats that do not carry endianness information. This causes failures if gdb supports both endiannesses, but the original binary used by the script is of the non-default one. The following fix has been successfully tested for mipsisa32-sde-elf, with the mips-sim-sde32/-EB and mips-sim-sde32/-EL target boards. Gdb defaults to the big endianness in this configuration, so with the latter board dumps of arrays from SREC and hex formats are currently seen endian-reversed. 2007-07-24 Maciej W. Rozycki * gdb.base/dump.exp: Force the correct endianness for binary formats not carrying this information. OK to apply? Maciej gdb-dump-endian.diff Index: gdb/src/gdb/testsuite/gdb.base/dump.exp =================================================================== --- gdb.orig/src/gdb/testsuite/gdb.base/dump.exp 2007-01-09 17:59:11.000000000 +0000 +++ gdb/src/gdb/testsuite/gdb.base/dump.exp 2007-07-24 17:25:17.000000000 +0100 @@ -34,6 +34,7 @@ set options {debug} set is64bitonly "no" +set endian "auto" if [istarget "alpha*-*-*"] then { # SREC etc cannot handle 64-bit addresses. Force the test @@ -70,6 +71,19 @@ return -1 } +# Get the endianness for the later use with endianless formats. + +send_gdb "show endian\n" +gdb_expect { + -re ".* (big|little) endian.*$gdb_prompt $" { + set endian $expect_out(1,string) + pass "endianness: $endian" + } + default { + fail "(timeout) getting target endianness" + } +} + # Now generate some dump files. proc make_dump_file { command msg } { @@ -190,6 +204,18 @@ gdb_start gdb_file_cmd ${binfile} +# Now fix the endianness at the correct state. + +send_gdb "set endian $endian\n" +gdb_expect { + -re ".* (big|little) endian.*$gdb_prompt $" { + pass "setting $endian endianness" + } + default { + fail "(timeout) setting $endian endianness" + } +} + # Reload saved values one by one, and compare. if { ![string compare $array_val \