Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH][testsuite] Match symbol on address 0x0
@ 2014-07-11  9:18 Yao Qi
  2014-07-11  9:47 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2014-07-11  9:18 UTC (permalink / raw)
  To: gdb-patches

We see the failing fails on arm-none-eabi target,

print (void*)v_signed_char^M
$190 = (void *) 0x0 <_ftext>^M
(gdb) FAIL: gdb.base/exprs.exp: print (void*)v_signed_char (print
(void*)v_signed_char)

GDB behaves correctly but the test assumes there is no symbol on
address 0x0.  That is not correct on bare metal targets.

(gdb) info symbol 0x0
_ftext in section .text

This patch is to relax the pattern to match the possible symbol on
address 0x0.  OK?

gdb/testsuite:

2014-07-11  Yao Qi  <yao@codesourcery.com>

	* gdb.base/exprs.exp: Match the possible symbol on address
	0x0.
---
 gdb/testsuite/gdb.base/exprs.exp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp
index ebce24f..1006aa1 100644
--- a/gdb/testsuite/gdb.base/exprs.exp
+++ b/gdb/testsuite/gdb.base/exprs.exp
@@ -201,14 +201,14 @@ test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long > 0" "\\$\[0-
 # NB: Some architectures convert a ``NULL'' pointer into
 #     something else. Don't simply test for 0.
 #
-test_expr "set variable v_signed_char = 0" "print (void*)v_signed_char" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_char"
-test_expr "set variable v_signed_short = 0" "print (void*)v_signed_short" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_short"
-test_expr "set variable v_signed_int = 0" "print (void*)v_signed_int" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_int"
-test_expr "set variable v_signed_long = 0" "print (void*)v_signed_long" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_long"
-test_expr "set variable v_unsigned_char = 0" "print (void*)v_unsigned_char" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_unsigned_char"
-test_expr "set variable v_unsigned_short = 0" "print (void*)v_unsigned_short" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_unsigned_short"
-test_expr "set variable v_unsigned_int = 0" "print (void*)v_unsigned_int" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_unsigned_int"
-test_expr "set variable v_unsigned_long = 0" "print (void*)v_unsigned_long" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_unsigned_long"
+test_expr "set variable v_signed_char = 0" "print (void*)v_signed_char" "\\$\[0-9\]* = .void \\*. ${hex}(| <.*>)" "print (void*)v_signed_char"
+test_expr "set variable v_signed_short = 0" "print (void*)v_signed_short" "\\$\[0-9\]* = .void \\*. ${hex}(| <.*>)" "print (void*)v_signed_short"
+test_expr "set variable v_signed_int = 0" "print (void*)v_signed_int" "\\$\[0-9\]* = .void \\*. ${hex}(| <.*>)" "print (void*)v_signed_int"
+test_expr "set variable v_signed_long = 0" "print (void*)v_signed_long" "\\$\[0-9\]* = .void \\*. ${hex}(| <.*>)" "print (void*)v_signed_long"
+test_expr "set variable v_unsigned_char = 0" "print (void*)v_unsigned_char" "\\$\[0-9\]* = .void \\*. ${hex}(| <.*>)" "print (void*)v_unsigned_char"
+test_expr "set variable v_unsigned_short = 0" "print (void*)v_unsigned_short" "\\$\[0-9\]* = .void \\*. ${hex}(| <.*>)" "print (void*)v_unsigned_short"
+test_expr "set variable v_unsigned_int = 0" "print (void*)v_unsigned_int" "\\$\[0-9\]* = .void \\*. ${hex}(| <.*>)" "print (void*)v_unsigned_int"
+test_expr "set variable v_unsigned_long = 0" "print (void*)v_unsigned_long" "\\$\[0-9\]* = .void \\*. ${hex}(| <.*>)" "print (void*)v_unsigned_long"
 #
 # Test expressions with pointers out of range
 #
-- 
1.9.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][testsuite] Match symbol on address 0x0
  2014-07-11  9:18 [PATCH][testsuite] Match symbol on address 0x0 Yao Qi
@ 2014-07-11  9:47 ` Pedro Alves
  2014-07-11 11:04   ` Yao Qi
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2014-07-11  9:47 UTC (permalink / raw)
  To: Yao Qi, gdb-patches

On 07/11/2014 09:17 AM, Yao Qi wrote:
> We see the failing fails on arm-none-eabi target,
> 
> print (void*)v_signed_char^M
> $190 = (void *) 0x0 <_ftext>^M
> (gdb) FAIL: gdb.base/exprs.exp: print (void*)v_signed_char (print
> (void*)v_signed_char)
> 
> GDB behaves correctly but the test assumes there is no symbol on
> address 0x0.  That is not correct on bare metal targets.
> 
> (gdb) info symbol 0x0
> _ftext in section .text
> 
> This patch is to relax the pattern to match the possible symbol on
> address 0x0.  OK?

Indeed that seems like an irrelevant detail for the purpose of
the test.  Wouldn't just doing "set print symbol off" work?

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][testsuite] Match symbol on address 0x0
  2014-07-11  9:47 ` Pedro Alves
@ 2014-07-11 11:04   ` Yao Qi
  2014-07-11 11:11     ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2014-07-11 11:04 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 07/11/2014 05:28 PM, Pedro Alves wrote:
> Indeed that seems like an irrelevant detail for the purpose of
> the test.  Wouldn't just doing "set print symbol off" work?

Oh, it works indeed!  How about this?

-- 
Yao (齐尧)

We see the following fails on arm-none-eabi target,

print (void*)v_signed_char^M
$190 = (void *) 0x0 <_ftext>^M
(gdb) FAIL: gdb.base/exprs.exp: print (void*)v_signed_char (print
(void*)v_signed_char)

GDB behaves correctly but the test assumes there is no symbol on
address 0x0.  This patch is set print symbol off, so that tests below
can match the address only.

gdb/testsuite:

2014-07-11  Yao Qi  <yao@codesourcery.com>

	* gdb.base/exprs.exp: "set print symbol off".
---
 gdb/testsuite/gdb.base/exprs.exp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp
index ebce24f..4647d72 100644
--- a/gdb/testsuite/gdb.base/exprs.exp
+++ b/gdb/testsuite/gdb.base/exprs.exp
@@ -200,7 +200,9 @@ test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long > 0" "\\$\[0-
 # Test expressions with casts to a pointer.
 # NB: Some architectures convert a ``NULL'' pointer into
 #     something else. Don't simply test for 0.
-#
+# Prevent symbol on address 0x0 being printed.
+gdb_test_no_output "set print symbol off"
+
 test_expr "set variable v_signed_char = 0" "print (void*)v_signed_char" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_char"
 test_expr "set variable v_signed_short = 0" "print (void*)v_signed_short" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_short"
 test_expr "set variable v_signed_int = 0" "print (void*)v_signed_int" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_int"
-- 
1.9.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][testsuite] Match symbol on address 0x0
  2014-07-11 11:04   ` Yao Qi
@ 2014-07-11 11:11     ` Pedro Alves
  2014-07-11 11:28       ` Yao Qi
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2014-07-11 11:11 UTC (permalink / raw)
  To: Yao Qi, gdb-patches

On 07/11/2014 11:50 AM, Yao Qi wrote:
> On 07/11/2014 05:28 PM, Pedro Alves wrote:
>> > Indeed that seems like an irrelevant detail for the purpose of
>> > the test.  Wouldn't just doing "set print symbol off" work?
> Oh, it works indeed!  How about this?

OK.

Thanks,
-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][testsuite] Match symbol on address 0x0
  2014-07-11 11:11     ` Pedro Alves
@ 2014-07-11 11:28       ` Yao Qi
  0 siblings, 0 replies; 5+ messages in thread
From: Yao Qi @ 2014-07-11 11:28 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 07/11/2014 07:03 PM, Pedro Alves wrote:
> On 07/11/2014 11:50 AM, Yao Qi wrote:
>> On 07/11/2014 05:28 PM, Pedro Alves wrote:
>>>> Indeed that seems like an irrelevant detail for the purpose of
>>>> the test.  Wouldn't just doing "set print symbol off" work?
>> Oh, it works indeed!  How about this?
> 
> OK.

Thanks, patch is pushed in.

-- 
Yao (齐尧)


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-11 11:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-11  9:18 [PATCH][testsuite] Match symbol on address 0x0 Yao Qi
2014-07-11  9:47 ` Pedro Alves
2014-07-11 11:04   ` Yao Qi
2014-07-11 11:11     ` Pedro Alves
2014-07-11 11:28       ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox