* [PATCH] Fix gdb.base/shreloc.exp: (msymbol) relocated functions have different addresses fail in cygwin
@ 2013-09-09 8:41 Hui Zhu
2013-09-09 13:46 ` Yao Qi
0 siblings, 1 reply; 8+ messages in thread
From: Hui Zhu @ 2013-09-09 8:41 UTC (permalink / raw)
To: gdb-patches ml
[-- Attachment #1: Type: text/plain, Size: 896 bytes --]
Hi,
I got fail with gdb.base/shreloc.exp in cygwin:
shell grep -E " fn_[12]([ ^G]+.*)?$"
/home/hzhu/bg/gdb/testsuite/gdb.base/shreloc.txt^M
[20] A 0x0 fn_1 section .text^M
[21] A 0x0 fn_2 section .text^M
[35] T 0x40010e0 fn_1 section .text^M
[30] T 0x4310e0 fn_2 section .text^M
(gdb) PASS: gdb.base/shreloc.exp: get_msym_addrs fn_[12]
FAIL: gdb.base/shreloc.exp: (msymbol) relocated functions have
different addresses
The reason is because the address of fn_1 and fn_2 is same.
But I checked the file with nm:
$ nm gdb.base/shreloc.exe | grep fn
004050c0 I __imp__fn_1
004050cc I __imp__fn_2
00000000 A _fn_1
00000000 A _fn_2
I think the behavior of GDB to output same address is right. So I
make a patch to test.
Please help me review it.
Thanks,
Hui
2013-09-09 Hui Zhu <hui@codesourcery.com>
* gdb.base/shreloc.exp (get_msym_addrs): Add argument "plus_var".
(check_different): Ditto.
[-- Attachment #2: fix-cygwin-shreloc.txt --]
[-- Type: text/plain, Size: 1683 bytes --]
--- 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,12 @@ if [send_gdb_discard "maint print msymbo
fail "(msymbol) relocated extern vars have different addresses"
}
- if {[check_different "fn_\[12\]" "${msymfile}"]} {
+ if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } {
+ set check_str "T"
+ } else {
+ set check_str ""
+ }
+ if {[check_different "fn_\[12\]" "${msymfile}" "${check_str}"]} {
pass "(msymbol) relocated functions have different addresses"
} else {
fail "(msymbol) relocated functions have different addresses"
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix gdb.base/shreloc.exp: (msymbol) relocated functions have different addresses fail in cygwin
2013-09-09 8:41 [PATCH] Fix gdb.base/shreloc.exp: (msymbol) relocated functions have different addresses fail in cygwin Hui Zhu
@ 2013-09-09 13:46 ` Yao Qi
2013-09-09 14:27 ` Hui Zhu
0 siblings, 1 reply; 8+ messages in thread
From: Yao Qi @ 2013-09-09 13:46 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches ml
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"
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix gdb.base/shreloc.exp: (msymbol) relocated functions have different addresses fail in cygwin
2013-09-09 13:46 ` Yao Qi
@ 2013-09-09 14:27 ` Hui Zhu
2013-09-12 6:31 ` Hui Zhu
0 siblings, 1 reply; 8+ messages in thread
From: Hui Zhu @ 2013-09-09 14:27 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches ml
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 (齐尧)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix gdb.base/shreloc.exp: (msymbol) relocated functions have different addresses fail in cygwin
2013-09-09 14:27 ` Hui Zhu
@ 2013-09-12 6:31 ` Hui Zhu
2013-09-12 6:50 ` Yao Qi
0 siblings, 1 reply; 8+ messages in thread
From: Hui Zhu @ 2013-09-12 6:31 UTC (permalink / raw)
To: Yao Qi; +Cc: Hui Zhu, gdb-patches ml
[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]
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.
[-- Attachment #2: fix-cygwin-shreloc.txt --]
[-- Type: text/plain, Size: 1637 bytes --]
--- 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"
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix gdb.base/shreloc.exp: (msymbol) relocated functions have different addresses fail in cygwin
2013-09-12 6:31 ` Hui Zhu
@ 2013-09-12 6:50 ` Yao Qi
2013-09-12 7:28 ` Hui Zhu
0 siblings, 1 reply; 8+ messages in thread
From: Yao Qi @ 2013-09-12 6:50 UTC (permalink / raw)
To: Hui Zhu; +Cc: Hui Zhu, gdb-patches ml
On 09/12/2013 02:31 PM, Hui Zhu wrote:
> -proc get_msym_addrs { var msymfile } {
> +proc get_msym_addrs { var msymfile { plus_var "" } } {
'plus_var' is not good candidate for parameter name. I'd call it 'mst'
or 'msym_type'.
> # 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"
> + }
This condition checking is not necessary, we can do
send_gdb "shell grep -E \"${plus_var} ${var}(\[ \t\]+.*)?\$\"
${msymfile}\n"
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix gdb.base/shreloc.exp: (msymbol) relocated functions have different addresses fail in cygwin
2013-09-12 6:50 ` Yao Qi
@ 2013-09-12 7:28 ` Hui Zhu
2013-10-07 9:28 ` Hui Zhu
2013-11-24 12:14 ` Fwd: " Hui Zhu
0 siblings, 2 replies; 8+ messages in thread
From: Hui Zhu @ 2013-09-12 7:28 UTC (permalink / raw)
To: Yao Qi; +Cc: Hui Zhu, gdb-patches ml
[-- Attachment #1: Type: text/plain, Size: 1385 bytes --]
Hi Yao,
Thanks for your review.
On 09/12/13 14:49, Yao Qi wrote:
> On 09/12/2013 02:31 PM, Hui Zhu wrote:
>> -proc get_msym_addrs { var msymfile } {
>> +proc get_msym_addrs { var msymfile { plus_var "" } } {
>
> 'plus_var' is not good candidate for parameter name. I'd call it 'mst'
> or 'msym_type'.
Fixed.
>
>> # 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"
>> + }
>
> This condition checking is not necessary, we can do
>
> send_gdb "shell grep -E \"${plus_var} ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n"
Because for the output format is: [ 7] T 0x2aaaaacd058a fn_1 section .text shreloc1.c
It need a ".*" after "T". So I change "T" to "T.*" to handle it.
Post a new version according to your comments.
Best,
Hui
2013-09-12 Hui Zhu <hui@codesourcery.com>
* gdb.base/shreloc.exp (get_msym_addrs): Add argument "msym_type".
(check_different): Ditto.
((msymbol) relocated functions have different addresses): Add
argument 'T.*' when call check_different.
[-- Attachment #2: fix-cygwin-shreloc.txt --]
[-- Type: text/plain, Size: 1519 bytes --]
--- a/gdb/testsuite/gdb.base/shreloc.exp
+++ b/gdb/testsuite/gdb.base/shreloc.exp
@@ -157,14 +157,14 @@ proc send_gdb_discard { command } {
}
}
-proc get_msym_addrs { var msymfile } {
+proc get_msym_addrs { var msymfile { msym_type "" } } {
# 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"
+ send_gdb "shell grep -E \"${msym_type} ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n"
while 1 {
gdb_expect {
@@ -201,10 +201,10 @@ proc check_same {var msymfile} {
}
}
-proc check_different {var msymfile} {
+proc check_different {var msymfile { msym_type "" } } {
# 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}" "${msym_type}"]]
set prev ""
if { [llength ${addr_list}] < 2 } {
@@ -236,7 +236,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"
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix gdb.base/shreloc.exp: (msymbol) relocated functions have different addresses fail in cygwin
2013-09-12 7:28 ` Hui Zhu
@ 2013-10-07 9:28 ` Hui Zhu
2013-11-24 12:14 ` Fwd: " Hui Zhu
1 sibling, 0 replies; 8+ messages in thread
From: Hui Zhu @ 2013-10-07 9:28 UTC (permalink / raw)
To: Hui Zhu; +Cc: Yao Qi, gdb-patches ml
Ping.
Thanks,
Hui
On Thu, Sep 12, 2013 at 3:28 PM, Hui Zhu <hui_zhu@mentor.com> wrote:
> Hi Yao,
>
> Thanks for your review.
>
>
> On 09/12/13 14:49, Yao Qi wrote:
>>
>> On 09/12/2013 02:31 PM, Hui Zhu wrote:
>>>
>>> -proc get_msym_addrs { var msymfile } {
>>> +proc get_msym_addrs { var msymfile { plus_var "" } } {
>>
>>
>> 'plus_var' is not good candidate for parameter name. I'd call it 'mst'
>> or 'msym_type'.
>
>
> Fixed.
>
>
>>
>>> # 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"
>>> + }
>>
>>
>> This condition checking is not necessary, we can do
>>
>> send_gdb "shell grep -E \"${plus_var} ${var}(\[ \t\]+.*)?\$\"
>> ${msymfile}\n"
>
>
> Because for the output format is: [ 7] T 0x2aaaaacd058a fn_1 section .text
> shreloc1.c
> It need a ".*" after "T". So I change "T" to "T.*" to handle it.
>
> Post a new version according to your comments.
>
> Best,
>
> Hui
>
>
> 2013-09-12 Hui Zhu <hui@codesourcery.com>
>
> * gdb.base/shreloc.exp (get_msym_addrs): Add argument "msym_type".
>
> (check_different): Ditto.
> ((msymbol) relocated functions have different addresses): Add
> argument 'T.*' when call check_different.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Fwd: Re: [PATCH] Fix gdb.base/shreloc.exp: (msymbol) relocated functions have different addresses fail in cygwin
2013-09-12 7:28 ` Hui Zhu
2013-10-07 9:28 ` Hui Zhu
@ 2013-11-24 12:14 ` Hui Zhu
1 sibling, 0 replies; 8+ messages in thread
From: Hui Zhu @ 2013-11-24 12:14 UTC (permalink / raw)
To: gdb-patches ml
[-- Attachment #1: Type: text/plain, Size: 1747 bytes --]
Ping.
Thanks,
Hui
-------- Original Message --------
Subject: Re: [PATCH] Fix gdb.base/shreloc.exp: (msymbol) relocated functions have different addresses fail in cygwin
Date: Thu, 12 Sep 2013 15:28:12 +0800
From: Hui Zhu <hui_zhu@mentor.com>
To: Yao Qi <yao@codesourcery.com>
CC: Hui Zhu <teawater@gmail.com>, gdb-patches ml <gdb-patches@sourceware.org>
Hi Yao,
Thanks for your review.
On 09/12/13 14:49, Yao Qi wrote:
> On 09/12/2013 02:31 PM, Hui Zhu wrote:
>> -proc get_msym_addrs { var msymfile } {
>> +proc get_msym_addrs { var msymfile { plus_var "" } } {
>
> 'plus_var' is not good candidate for parameter name. I'd call it 'mst'
> or 'msym_type'.
Fixed.
>
>> # 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"
>> + }
>
> This condition checking is not necessary, we can do
>
> send_gdb "shell grep -E \"${plus_var} ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n"
Because for the output format is: [ 7] T 0x2aaaaacd058a fn_1 section .text shreloc1.c
It need a ".*" after "T". So I change "T" to "T.*" to handle it.
Post a new version according to your comments.
Best,
Hui
2013-09-12 Hui Zhu <hui@codesourcery.com>
* gdb.base/shreloc.exp (get_msym_addrs): Add argument "msym_type".
(check_different): Ditto.
((msymbol) relocated functions have different addresses): Add
argument 'T.*' when call check_different.
[-- Attachment #2: fix-cygwin-shreloc.txt --]
[-- Type: text/plain, Size: 1519 bytes --]
--- a/gdb/testsuite/gdb.base/shreloc.exp
+++ b/gdb/testsuite/gdb.base/shreloc.exp
@@ -157,14 +157,14 @@ proc send_gdb_discard { command } {
}
}
-proc get_msym_addrs { var msymfile } {
+proc get_msym_addrs { var msymfile { msym_type "" } } {
# 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"
+ send_gdb "shell grep -E \"${msym_type} ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n"
while 1 {
gdb_expect {
@@ -201,10 +201,10 @@ proc check_same {var msymfile} {
}
}
-proc check_different {var msymfile} {
+proc check_different {var msymfile { msym_type "" } } {
# 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}" "${msym_type}"]]
set prev ""
if { [llength ${addr_list}] < 2 } {
@@ -236,7 +236,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"
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-11-24 10:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-09 8:41 [PATCH] Fix gdb.base/shreloc.exp: (msymbol) relocated functions have different addresses fail in cygwin Hui Zhu
2013-09-09 13:46 ` Yao Qi
2013-09-09 14:27 ` Hui Zhu
2013-09-12 6:31 ` Hui Zhu
2013-09-12 6:50 ` Yao Qi
2013-09-12 7:28 ` Hui Zhu
2013-10-07 9:28 ` Hui Zhu
2013-11-24 12:14 ` Fwd: " Hui Zhu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).