This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[commit, testsuite] Fix dump.exp test case regression on s390x-linux


Hello,

on s390x-linux we see a dump.exp failure because the "restore" command
is called with "${array2_start}-${array_start}" as offset expression.

On this platform, the two values happen to be in the range 0x8000xxxx,
and the first is smaller than the second.  This causes the values, and
thus the difference to be interpreted as "unsigned int" type, and the
resulting value is in the 0xffffxxxx range.

GDB then adds this value to a 64-bit address.  As the supposedly negative
difference was not extended to 64 bits, this yields the wrong result.

I don't think GDB is doing anything wrong here; the offset should not
be passed as a value of "unsigned int" type.  I've fixed the test case
to perform a subtraction of two pointer values instead, resulting in
the proper type for the difference.

Tested on s390(x)-linux and ppc(64)-linux, fixes the regression.

Committed to mainline.

Bye,
Ulrich

ChangeLog:

	* gdb.base/dump.exp: Pass difference of pointer types instead
	of integer types as offset to restore in intarr3.srec case.


Index: gdb/testsuite/gdb.base/dump.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/dump.exp,v
retrieving revision 1.17
diff -c -p -r1.17 dump.exp
*** gdb/testsuite/gdb.base/dump.exp	9 Jul 2009 20:30:59 -0000	1.17
--- gdb/testsuite/gdb.base/dump.exp	26 Sep 2009 01:47:36 -0000
*************** if ![string compare $is64bitonly "no"] t
*** 504,510 ****
  
    # restore with expressions 
    test_restore_saved_value \
! 	"intarr3.srec ${array2_start}-${array_start} &intarray\[3\] &intarray\[4\]" \
  	"array partial with expressions" 4 "intarray2\[3\]"
  
    gdb_test "print intarray2\[2\] == 0" " = 1" "element 2 not changed, == 4"
--- 504,510 ----
  
    # restore with expressions 
    test_restore_saved_value \
! 	"intarr3.srec (char*)${array2_start}-(char*)${array_start} &intarray\[3\] &intarray\[4\]" \
  	"array partial with expressions" 4 "intarray2\[3\]"
  
    gdb_test "print intarray2\[2\] == 0" " = 1" "element 2 not changed, == 4"
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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