From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Make inline-locals.c deterministic
Date: Tue, 21 Jul 2020 10:26:06 +0200 [thread overview]
Message-ID: <20200721082605.GA14238@delia> (raw)
Hi,
When running testcase gdb.opt/inline-locals.exp on openSUSE Tumbleweed, I get:
...
(gdb) info locals^M
array = {0 <repeats 48 times>, 15775231, 0, 194, 0, -11497, 32767, 4199061, \
0, 0, 0, 0, 0, 4198992, 0, 4198432, 0}^M
(gdb) FAIL: gdb.opt/inline-locals.exp: info locals above bar 2
...
Fix this by:
- completely initializing array before printing any value
- updating the pattern to match "array = {0 <repeats 64 times>}"
Tested on x86_64-linux.
Committed to trunk.
Thanks,
- Tom
[gdb/testsuite] Make inline-locals.c deterministic
gdb/testsuite/ChangeLog:
2020-07-21 Tom de Vries <tdevries@suse.de>
* gdb.opt/inline-locals.c (init_array): New func.
(func1): Use init_array.
* gdb.opt/inline-locals.exp: Update pattern.
---
gdb/testsuite/gdb.opt/inline-locals.c | 9 +++++++++
gdb/testsuite/gdb.opt/inline-locals.exp | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.opt/inline-locals.c b/gdb/testsuite/gdb.opt/inline-locals.c
index 8fb91946fa..143a09ebc1 100644
--- a/gdb/testsuite/gdb.opt/inline-locals.c
+++ b/gdb/testsuite/gdb.opt/inline-locals.c
@@ -29,9 +29,18 @@ volatile int *array_p;
void bar(void);
+void
+init_array (int *array, int n)
+{
+ int i;
+ for (i = 0; i < n; ++i)
+ array[i] = 0;
+}
+
inline ATTR int func1(int arg1)
{
int array[64];
+ init_array (array, 64);
array_p = array;
array[0] = result;
array[1] = arg1;
diff --git a/gdb/testsuite/gdb.opt/inline-locals.exp b/gdb/testsuite/gdb.opt/inline-locals.exp
index 8104b0f5b7..841f177209 100644
--- a/gdb/testsuite/gdb.opt/inline-locals.exp
+++ b/gdb/testsuite/gdb.opt/inline-locals.exp
@@ -43,7 +43,7 @@ if { ! $no_frames } {
"backtrace from bar 2"
gdb_test "up" "#1 .*func1 .* at .*" "up from bar 2"
gdb_test "info frame" ".*inlined into frame.*" "func1 inlined 2"
- set pass_re "array = {$decimal, \[^\r\n\]*}"
+ set pass_re "array = \\{0 <repeats 64 times>\\}"
set kfail_re [multi_line $pass_re \
"array = {<optimized out> <repeats 64 times>}"]
gdb_test_multiple "info locals" "info locals above bar 2" {
reply other threads:[~2020-07-21 8:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200721082605.GA14238@delia \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox