Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: <gdb-patches@sourceware.org>, "'Tom Tromey'" <tromey@redhat.com>
Subject: [RFA] testsuite, add get_hexadecimal_valueof proc to lib/gdb.exp
Date: Sat, 14 Feb 2009 00:00:00 -0000	[thread overview]
Message-ID: <000701c98e36$466ebb50$d34c31f0$@u-strasbg.fr> (raw)

  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]


             reply	other threads:[~2009-02-13 23:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-14  0:00 Pierre Muller [this message]
2009-02-14  0:09 ` Tom Tromey
2009-02-14  0:28   ` Tom Tromey
2009-02-14  0:38     ` Pierre Muller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000701c98e36$466ebb50$d34c31f0$@u-strasbg.fr' \
    --to=muller@ics.u-strasbg.fr \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox