This is the mail archive of the gdb-cvs@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]

[binutils-gdb/gdb-8.1-branch] Fix scm-ports.exp regression


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5429afd6529f3a7dc7d733fc21053ca3ecadd033

commit 5429afd6529f3a7dc7d733fc21053ca3ecadd033
Author: Tom Tromey <tom@tromey.com>
Date:   Wed Jan 3 11:12:34 2018 -0700

    Fix scm-ports.exp regression
    
    In https://sourceware.org/ml/gdb-patches/2017-12/msg00215.html, Jan
    pointed out that the scalar printing patches caused a regression in
    scm-ports.exp on x86.
    
    What happens is that on x86, this:
    
    	set sp_reg [get_integer_valueof "\$sp" 0]
    
    ... ends up setting sp_reg to a negative value, because
    get_integer_valueof uses "print/d":
    
        print /d $sp
        $1 = -11496
    
    Then later the test suite does:
    
        gdb_test "guile (print (seek rw-mem-port (value->integer sp-reg) SEEK_SET))" \
    	"= $sp_reg" \
    	"seek to \$sp"
    
    ... expecting this value to be identical to the saved $sp_reg value.
    However it gets:
    
        guile (print (seek rw-mem-port (value->integer sp-reg) SEEK_SET))
        = 4294955800
    
    "print" is just a wrapper for guile's format:
    
        gdb_test_no_output "guile (define (print x) (format #t \"= ~A\" x) (newline))"
    
    The seek function returns a scm_t_off, the printing of which is
    handled by guile, not by gdb.
    
    Tested on x86-64 Fedora 26 using an ordinary build and also a -m32
    build.
    
    2018-01-15  Tom Tromey  <tom@tromey.com>
    
    	* gdb.guile/scm-ports.exp (test_mem_port_rw): Use get_valueof to
    	compute sp_reg.

Diff:
---
 gdb/testsuite/ChangeLog               | 5 +++++
 gdb/testsuite/gdb.guile/scm-ports.exp | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 90ffb4f..c9cca47 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-01-15  Tom Tromey  <tom@tromey.com>
+
+	* gdb.guile/scm-ports.exp (test_mem_port_rw): Use get_valueof to
+	compute sp_reg.
+
 2018-01-12  Pedro Alves  <palves@redhat.com>
 
 	* gdb.base/continue-after-aborted-step-over.c: New.
diff --git a/gdb/testsuite/gdb.guile/scm-ports.exp b/gdb/testsuite/gdb.guile/scm-ports.exp
index 48af5e3..04170ef 100644
--- a/gdb/testsuite/gdb.guile/scm-ports.exp
+++ b/gdb/testsuite/gdb.guile/scm-ports.exp
@@ -104,7 +104,7 @@ proc test_mem_port_rw { kind } {
 	    "get sp reg"
 	# Note: Only use $sp_reg for gdb_test result matching, don't use it in
 	# gdb commands.  Otherwise transcript.N becomes unusable.
-	set sp_reg [get_integer_valueof "\$sp" 0]
+	set sp_reg [get_valueof /u "\$sp" 0]
 	gdb_test_no_output "guile (define byte-at-sp (parse-and-eval \"*(char*) \$sp\"))" \
 	    "save current value at sp"
 	# Pass the result of parse-and-eval through value-fetch-lazy!,


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