mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-24 02:24:46 +08:00
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.
This commit is contained in:
parent
62df7e210e
commit
5ad9dba751
@ -1,3 +1,10 @@
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
#
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user