aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2016-10-13 16:08:17 +0100
committerYao Qi <yao.qi@linaro.org>2016-10-13 16:08:17 +0100
commit5ad9dba7519caa3e6193c87699ae37e24d0fe05c (patch)
tree35dc98a9a393e58867c36e61cdec360c72430adf
parent62df7e210ebf096dc09ad14d9316fcda0f6217f7 (diff)
downloadgdb-5ad9dba7519caa3e6193c87699ae37e24d0fe05c.zip
gdb-5ad9dba7519caa3e6193c87699ae37e24d0fe05c.tar.gz
gdb-5ad9dba7519caa3e6193c87699ae37e24d0fe05c.tar.bz2
Share proc get_var_address
This patch moves proc get_var_address into lib/gdb.exp, and remove the duplicate copy in gdb.base/*.exp files. gdb/testsuite: 2016-10-13 Yao Qi <yao.qi@linaro.org> * gdb.base/code_elim.exp (get_var_address): Remove. * gdb.base/relocate.exp: Likewise. * gdb.base/shreloc.exp: Likewise. * lib/gdb.exp (get_var_address): New.
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.base/code_elim.exp21
-rw-r--r--gdb/testsuite/gdb.base/relocate.exp23
-rw-r--r--gdb/testsuite/gdb.base/shreloc.exp22
-rw-r--r--gdb/testsuite/lib/gdb.exp24
5 files changed, 31 insertions, 66 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 18dd701..ac2d05d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,12 @@
2016-10-13 Yao Qi <yao.qi@linaro.org>
+ * gdb.base/code_elim.exp (get_var_address): Remove.
+ * gdb.base/relocate.exp: Likewise.
+ * gdb.base/shreloc.exp: Likewise.
+ * lib/gdb.exp (get_var_address): New.
+
+2016-10-13 Yao Qi <yao.qi@linaro.org>
+
* gdb.base/structs.exp: Invoke gdb_skip_float_test, and do
floating point tests if $skip_float_test is false.
diff --git a/gdb/testsuite/gdb.base/code_elim.exp b/gdb/testsuite/gdb.base/code_elim.exp
index 6badbcc..9ace1df 100644
--- a/gdb/testsuite/gdb.base/code_elim.exp
+++ b/gdb/testsuite/gdb.base/code_elim.exp
@@ -41,27 +41,6 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable $op
return -1
}
-proc get_var_address { var } {
- global gdb_prompt hex
-
- # Match output like:
- # $1 = (int *) 0x0
- # $5 = (int (*)()) 0
- # $6 = (int (*)()) 0x24 <function_bar>
-
- gdb_test_multiple "print &${var}" "get address of ${var}" {
- -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $" {
- pass "get address of ${var}"
- if { $expect_out(1,string) == "0" } {
- return "0x0"
- } else {
- return $expect_out(1,string)
- }
- }
- }
- return ""
-}
-
proc not_null_var_address { var } {
# Same as get_var_address, expect that it reports a failure if a null
diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp
index 1212d0f..52fc3ce 100644
--- a/gdb/testsuite/gdb.base/relocate.exp
+++ b/gdb/testsuite/gdb.base/relocate.exp
@@ -25,29 +25,6 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug}]
return -1
}
-proc get_var_address { var } {
- global gdb_prompt hex
-
- # Match output like:
- # $1 = (int *) 0x0
- # $5 = (int (*)()) 0
- # $6 = (int (*)()) 0x24 <function_bar>
-
- gdb_test_multiple "print &${var}" "get address of ${var}" {
- -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $" {
- pass "get address of ${var}"
- if { $expect_out(1,string) == "0" } {
- return "0x0"
- } else {
- return $expect_out(1,string)
- }
- }
- }
- return ""
-}
-
-
-
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
diff --git a/gdb/testsuite/gdb.base/shreloc.exp b/gdb/testsuite/gdb.base/shreloc.exp
index 548568e..1d3ed8b 100644
--- a/gdb/testsuite/gdb.base/shreloc.exp
+++ b/gdb/testsuite/gdb.base/shreloc.exp
@@ -81,28 +81,6 @@ if ![runto_main] then {
return 0
}
-proc get_var_address { var } {
- global gdb_prompt hex
-
- # Match output like:
- # $1 = (int *) 0x0
- # $5 = (int (*)()) 0
- # $6 = (int (*)()) 0x24 <function_bar>
-
- gdb_test_multiple "print &${var}" "get address of ${var}" {
- -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $"
- {
- pass "get address of ${var}"
- if { $expect_out(1,string) == "0" } {
- return "0x0"
- } else {
- return $expect_out(1,string)
- }
- }
- }
- return ""
-}
-
#
# Check debugging symbol relocations
#
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index ab661ce..378eea0 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -5586,6 +5586,30 @@ proc get_target_charset { } {
return "UTF-8"
}
+# Get the address of VAR.
+
+proc get_var_address { var } {
+ global gdb_prompt hex
+
+ # Match output like:
+ # $1 = (int *) 0x0
+ # $5 = (int (*)()) 0
+ # $6 = (int (*)()) 0x24 <function_bar>
+
+ gdb_test_multiple "print &${var}" "get address of ${var}" {
+ -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $"
+ {
+ pass "get address of ${var}"
+ if { $expect_out(1,string) == "0" } {
+ return "0x0"
+ } else {
+ return $expect_out(1,string)
+ }
+ }
+ }
+ return ""
+}
+
# Get the current value for remotetimeout and return it.
proc get_remotetimeout { } {
global gdb_prompt