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]

[RFA] testsuite, add get_hexadecimal_valueof proc to lib/gdb.exp


  Following our discussion by email and on IRC,
I submit here one more patch corresponding to
a new gdb.exp proc that reads
an hexadecimal number.

Tom, could you please run your patch tester on this?

Thanks in advance,


Pierre Muller
Pascal language support maintainer for GDB



2009-02-14  Pierre Muller  <muller@ics.u-strasbg.fr>

	* lib/gdb.exp (get_hexadecimal_valueof): New procedure.
	* gdb.base/pc-fp.exp (get_valueofx): Remove.
	Replace calls to get_valueofx by get_hexadecimal_valueof.

$ cvs diff -up  gdb.base/pc-fp.exp lib/gdb.exp
Index: gdb.base/pc-fp.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/pc-fp.exp,v
retrieving revision 1.11
diff -u -p -r1.11 pc-fp.exp
--- gdb.base/pc-fp.exp  3 Jan 2009 05:58:03 -0000       1.11
+++ gdb.base/pc-fp.exp  13 Feb 2009 23:48:20 -0000
@@ -53,26 +53,11 @@ if ![runto_main] then {
     continue
 }

-proc get_valueofx { fmt exp default } {
-    global gdb_prompt
-    send_gdb "print${fmt} ${exp}\n"
-    gdb_expect {
-       -re "\\$\[0-9\]* = (0x\[0-9a-zA-Z\]+).*$gdb_prompt $" {
-           set val $expect_out(1,string)
-           pass "get value of ${exp}"
-       }
-       timeout {
-           set val ${default}
-           fail "get value of ${exp} (timeout)"
-       }
-    }
-    return ${val}
-}

 # Get the value of PC and FP

-set valueof_pc [get_valueofx "/x" "\$pc" "0"]
-set valueof_fp [get_valueofx "/x" "\$fp" "0"]
+set valueof_pc [get_hexadecimal_valueof "\$pc" "0"]
+set valueof_fp [get_hexadecimal_valueof "\$fp" "0"]

 # Check that the sequence $REGNAME -> REGNUM -> $REGNAME works.  Use
 # display since that encodes and then decodes the expression parameter
Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.111
diff -u -p -r1.111 gdb.exp
--- lib/gdb.exp 13 Feb 2009 23:37:24 -0000      1.111
+++ lib/gdb.exp 13 Feb 2009 23:48:21 -0000
@@ -2913,6 +2913,22 @@ proc get_integer_valueof { exp default }
     return ${val}
 }

+proc get_hexadecimal_valueof { exp default } {
+    global gdb_prompt
+    send_gdb "print /x ${exp}\n"
+    set test "get hexadecimal valueof \"${exp}\""
+    gdb_expect {
+       -re "\\$\[0-9\]* = (0x\[0-9a-zA-Z\]+).*$gdb_prompt $" {
+           set val $expect_out(1,string)
+           pass "$test"
+       }
+       timeout {
+           set val ${default}
+           fail "$test (timeout)"
+       }
+    }
+    return ${val}
+}

 proc get_sizeof { type default } {
     return [get_integer_valueof "sizeof (${type})" $default]


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