[PATCH] Fix gdb.base/shreloc.exp: (msymbol) relocated functions have different addresses fail in cygwin
Hui Zhu
hui_zhu@mentor.com
Thu Sep 12 06:31:00 GMT 2013
On 09/09/13 22:26, Hui Zhu wrote:
> On Mon, Sep 9, 2013 at 9:45 PM, Yao Qi <yao@codesourcery.com> wrote:
>> On 09/09/2013 04:40 PM, Hui Zhu wrote:
>>>
>>> - send_gdb "shell grep -E \" ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n"
>>> + if { "${plus_var}" == "" } {
>>> + send_gdb "shell grep -E \" ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n"
>>> + } else {
>>> + send_gdb "shell grep -E \" ${plus_var} .* ${var}(\[ \t\]+.*)?\$\"
>>> ${msymfile}\n"
>>> + }
>>
>>
>> Why don't do this unconditionally?
>>
>> send_gdb "shell grep -E \" T .* ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n"
>
>
> Because other test use this function too.
>
> Thanks,
> Hui
>
>>
>> --
>> Yao (é½å°§)
Hi,
After dicsussion with Yao.
I got that on any targets, fn_[12] should be in .text section, so 'T' should work for all targets.
And the purpose of this test is to make sure that " (msymbol) relocated functions have different addresses".
So I change this patch to just check "T" symbol for any target.
Thanks,
Hui
2013-09-12 Hui Zhu <hui@codesourcery.com>
* gdb.base/shreloc.exp (get_msym_addrs): Add argument "plus_var".
(check_different): Ditto.
((msymbol) relocated functions have different addresses): Add
argument 'T' when call check_different.
-------------- next part --------------
--- a/gdb/testsuite/gdb.base/shreloc.exp
+++ b/gdb/testsuite/gdb.base/shreloc.exp
@@ -157,14 +157,18 @@ proc send_gdb_discard { command } {
}
}
-proc get_msym_addrs { var msymfile } {
+proc get_msym_addrs { var msymfile { plus_var "" } } {
# Extract the list of values for symbols matching var in the
# minimal symbol output file
global gdb_prompt hex
set result ""
- send_gdb "shell grep -E \" ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n"
+ if { "${plus_var}" == "" } {
+ send_gdb "shell grep -E \" ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n"
+ } else {
+ send_gdb "shell grep -E \" ${plus_var} .* ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n"
+ }
while 1 {
gdb_expect {
@@ -201,10 +205,10 @@ proc check_same {var msymfile} {
}
}
-proc check_different {var msymfile} {
+proc check_different {var msymfile { plus_var "" } } {
# Check that the minimal symbol values matching var are different
- set addr_list [lsort [get_msym_addrs "${var}" "${msymfile}"]]
+ set addr_list [lsort [get_msym_addrs "${var}" "${msymfile}" "${plus_var}"]]
set prev ""
if { [llength ${addr_list}] < 2 } {
@@ -236,7 +240,9 @@ if [send_gdb_discard "maint print msymbo
fail "(msymbol) relocated extern vars have different addresses"
}
- if {[check_different "fn_\[12\]" "${msymfile}"]} {
+ # Msymbol type of "relocated function" should be 'T', so we just
+ # check 'T' type.
+ if {[check_different "fn_\[12\]" "${msymfile}" "T"]} {
pass "(msymbol) relocated functions have different addresses"
} else {
fail "(msymbol) relocated functions have different addresses"
More information about the Gdb-patches
mailing list