public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Relax pattern to match the output of "info frame" in gdb.base/savedregs.exp
@ 2015-03-20 11:01 Yao Qi
  2015-03-26  8:17 ` Yao Qi
  0 siblings, 1 reply; 2+ messages in thread
From: Yao Qi @ 2015-03-20 11:01 UTC (permalink / raw)
  To: gdb-patches

From: Yao Qi <yao.qi@linaro.org>

Hi,
I see the following two fails in gdb.base/savedregs.exp on aarch64-linux,

info frame 2^M
Stack frame at 0x7ffffffa60:^M
 pc = 0x40085c in thrower (gdb/testsuite/gdb.base/savedregs.c:49); saved pc = 0x400898^M
 called by frame at 0x7ffffffa70, caller of frame at 0x7fffffe800^M
 source language c.^M
 Arglist at 0x7ffffffa60, args: ^M
 Locals at 0x7ffffffa60, Previous frame's sp is 0x7ffffffa60^M
(gdb) FAIL: gdb.base/savedregs.exp: Get thrower info frame

info frame 2^M
Stack frame at 0x7fffffe800:^M
 pc = 0x400840 in catcher (gdb/testsuite/gdb.base/savedregs.c:42); saved pc = 0x7fb7ffc350^M
 called by frame at 0x7fffffe800, caller of frame at 0x7fffffe7e0^M
 source language c.^M
 Arglist at 0x7fffffe7f0, args: sig=11^M
 Locals at 0x7fffffe7f0, Previous frame's sp is 0x7fffffe800
(gdb) FAIL: gdb.base/savedregs.exp: Get catcher info frame

looks the test expects to match "Saved registers:" from the output of
"info frame", but no registers are saved on these two frames, because
thrower and catcher are simple and leaf functions.

(gdb) disassemble thrower
Dump of assembler code for function thrower:
   0x0000000000400858 <+0>:	mov	x0, #0x0                   	// #0
   0x000000000040085c <+4>:	strb	wzr, [x0]
   0x0000000000400860 <+8>:	ret
End of assembler dump.
(gdb) disassemble catcher
Dump of assembler code for function catcher:
   0x0000000000400838 <+0>:	sub	sp, sp, #0x10
   0x000000000040083c <+4>:	str	w0, [sp,#12]
   0x0000000000400840 <+8>:	adrp	x0, 0x410000
   0x0000000000400844 <+12>:	add	x0, x0, #0xb9c
   0x0000000000400848 <+16>:	mov	w1, #0x1                   	// #1
   0x000000000040084c <+20>:	str	w1, [x0]
   0x0000000000400850 <+24>:	add	sp, sp, #0x10
   0x0000000000400854 <+28>:	ret

There are two ways to fix these fails, one is to modify functions to
force some registers saved (for example, doing function call in them),
and the other one is to relax the pattern to optionally match
"Saved registers:".  I did both, and feel that the latter is simple,
so here is it.

gdb/testsuite:

2015-03-20  Yao Qi  <yao.qi@linaro.org>

	* gdb.base/savedregs.exp (process_saved_regs): Make
	"Saved registers:" optional in the pattern.
---
 gdb/testsuite/gdb.base/savedregs.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/savedregs.exp b/gdb/testsuite/gdb.base/savedregs.exp
index da8d90f..33df407 100644
--- a/gdb/testsuite/gdb.base/savedregs.exp
+++ b/gdb/testsuite/gdb.base/savedregs.exp
@@ -77,7 +77,7 @@ proc process_saved_regs { current inner outer } {
 		set pat "Stack frame at .* Saved registers:.*"
 	    }
 	    default {
-		set pat "Stack frame at .* in $func .* Saved registers:.*"
+		set pat "Stack frame at .* in $func .*( Saved registers:.*)?"
 	    }
 	}
 	# If the "info frame" barf, capture the output anyway so that
-- 
1.9.1

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

* Re: [PATCH] Relax pattern to match the output of "info frame" in gdb.base/savedregs.exp
  2015-03-20 11:01 [PATCH] Relax pattern to match the output of "info frame" in gdb.base/savedregs.exp Yao Qi
@ 2015-03-26  8:17 ` Yao Qi
  0 siblings, 0 replies; 2+ messages in thread
From: Yao Qi @ 2015-03-26  8:17 UTC (permalink / raw)
  To: gdb-patches

On 20/03/15 11:00, Yao Qi wrote:
> gdb/testsuite:
>
> 2015-03-20  Yao Qi<yao.qi@linaro.org>
>
> 	* gdb.base/savedregs.exp (process_saved_regs): Make
> 	"Saved registers:" optional in the pattern.

I've pushed it in.

-- 
Yao (齐尧)

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

end of thread, other threads:[~2015-03-26  8:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-20 11:01 [PATCH] Relax pattern to match the output of "info frame" in gdb.base/savedregs.exp Yao Qi
2015-03-26  8:17 ` Yao Qi

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).