diff options
author | Tom de Vries <tdevries@suse.de> | 2020-07-21 10:25:42 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2020-07-21 10:25:42 +0200 |
commit | f0f9e75a824dcd0053ae4e8f9aaf8056aa1a8bc5 (patch) | |
tree | 12bb39412a36df27319712968329a786c12d679b | |
parent | bd460ecb313d064e079acacfc1eba77c58684f98 (diff) | |
download | gdb-f0f9e75a824dcd0053ae4e8f9aaf8056aa1a8bc5.zip gdb-f0f9e75a824dcd0053ae4e8f9aaf8056aa1a8bc5.tar.gz gdb-f0f9e75a824dcd0053ae4e8f9aaf8056aa1a8bc5.tar.bz2 |
[gdb/testsuite] Make inline-locals.c deterministic
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.
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.
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.opt/inline-locals.c | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.opt/inline-locals.exp | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a68c272..f395665 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,11 @@ 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. + +2020-07-21 Tom de Vries <tdevries@suse.de> + * gdb.debuginfod/fetch_src_and_symbols.exp: Use save_vars for env vars. Fix PATH and DUPLICATE errors. Cleanup whitespace. diff --git a/gdb/testsuite/gdb.opt/inline-locals.c b/gdb/testsuite/gdb.opt/inline-locals.c index 8fb91946..143a09e 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 8104b0f..841f177 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" { |