[1/2] gdb.ada/minsyms.exp: Don't hardcode the variable's address

Message ID 1511280661-14725-2-git-send-email-palves@redhat.com
State New, archived
Headers

Commit Message

Pedro Alves Nov. 21, 2017, 4:11 p.m. UTC
  This new testcase has a test that fails like this here:

  $1 = (<data variable, no debug info> *) 0x60208c <some_minsym>
  (gdb) FAIL: gdb.ada/minsyms.exp: print &some_minsym

The problem is that the testcase hardcodes an expected address for the
"some_minsym" variable, which obviously isn't stable.

Fix that by expecting $hex instead.

gdb/testsuite/ChangeLog:
2017-11-21  Pedro Alves  <palves@redhat.com>

	* gdb.ada/minsyms.exp: Accept any address for 'some_minsym'.
---
 gdb/testsuite/gdb.ada/minsyms.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Sergio Durigan Junior Nov. 21, 2017, 4:24 p.m. UTC | #1
On Tuesday, November 21 2017, Pedro Alves wrote:

> This new testcase has a test that fails like this here:
>
>   $1 = (<data variable, no debug info> *) 0x60208c <some_minsym>
>   (gdb) FAIL: gdb.ada/minsyms.exp: print &some_minsym
>
> The problem is that the testcase hardcodes an expected address for the
> "some_minsym" variable, which obviously isn't stable.
>
> Fix that by expecting $hex instead.

No Ada expert here, but I'd say this is borderline obvious and should go
in :-).

Thanks,

> gdb/testsuite/ChangeLog:
> 2017-11-21  Pedro Alves  <palves@redhat.com>
>
> 	* gdb.ada/minsyms.exp: Accept any address for 'some_minsym'.
> ---
>  gdb/testsuite/gdb.ada/minsyms.exp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdb/testsuite/gdb.ada/minsyms.exp b/gdb/testsuite/gdb.ada/minsyms.exp
> index 2c91125..9878f9f 100644
> --- a/gdb/testsuite/gdb.ada/minsyms.exp
> +++ b/gdb/testsuite/gdb.ada/minsyms.exp
> @@ -35,7 +35,7 @@ gdb_test "print integer(some_minsym)" \
>           " = 1234"
>  
>  gdb_test "print &some_minsym" \
> -         " = \\(access <data variable, no debug info>\\) 0x62c2f8 <some_minsym>"
> +         " = \\(access <data variable, no debug info>\\) $hex <some_minsym>"
>  
>  gdb_test "print /x integer(&some_minsym)" \
>           " = $hex"
> -- 
> 2.5.5
  
Joel Brobecker Nov. 21, 2017, 4:50 p.m. UTC | #2
> This new testcase has a test that fails like this here:
> 
>   $1 = (<data variable, no debug info> *) 0x60208c <some_minsym>
>   (gdb) FAIL: gdb.ada/minsyms.exp: print &some_minsym
> 
> The problem is that the testcase hardcodes an expected address for the
> "some_minsym" variable, which obviously isn't stable.
> 
> Fix that by expecting $hex instead.
> 
> gdb/testsuite/ChangeLog:
> 2017-11-21  Pedro Alves  <palves@redhat.com>
> 
> 	* gdb.ada/minsyms.exp: Accept any address for 'some_minsym'.

Gaaah. Head-slapping myself on that one.

Thanks for fixing. Obviously OK :).
  
Pedro Alves Nov. 21, 2017, 5:08 p.m. UTC | #3
On 11/21/2017 04:50 PM, Joel Brobecker wrote:
>> This new testcase has a test that fails like this here:
>>
>>   $1 = (<data variable, no debug info> *) 0x60208c <some_minsym>
>>   (gdb) FAIL: gdb.ada/minsyms.exp: print &some_minsym
>>
>> The problem is that the testcase hardcodes an expected address for the
>> "some_minsym" variable, which obviously isn't stable.
>>
>> Fix that by expecting $hex instead.
>>
>> gdb/testsuite/ChangeLog:
>> 2017-11-21  Pedro Alves  <palves@redhat.com>
>>
>> 	* gdb.ada/minsyms.exp: Accept any address for 'some_minsym'.
> 
> Gaaah. Head-slapping myself on that one.
> 
> Thanks for fixing. Obviously OK :).

:-)

I pushed this one in, to get it out of the way.

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/testsuite/gdb.ada/minsyms.exp b/gdb/testsuite/gdb.ada/minsyms.exp
index 2c91125..9878f9f 100644
--- a/gdb/testsuite/gdb.ada/minsyms.exp
+++ b/gdb/testsuite/gdb.ada/minsyms.exp
@@ -35,7 +35,7 @@  gdb_test "print integer(some_minsym)" \
          " = 1234"
 
 gdb_test "print &some_minsym" \
-         " = \\(access <data variable, no debug info>\\) 0x62c2f8 <some_minsym>"
+         " = \\(access <data variable, no debug info>\\) $hex <some_minsym>"
 
 gdb_test "print /x integer(&some_minsym)" \
          " = $hex"