diff options
author | Tom de Vries <tdevries@suse.de> | 2022-06-02 20:40:06 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2022-06-02 20:40:06 +0200 |
commit | bb785a92a88b538831d72e36f2d0fce76e0a32b1 (patch) | |
tree | 8753ee70c5657675e5f2fcfc0663435c0cb528ea /gdb/testsuite/gdb.mi/var-cmd.c | |
parent | 0c8cd1de90b97f12b27b40c2922a03a68932eea1 (diff) | |
download | gdb-bb785a92a88b538831d72e36f2d0fce76e0a32b1.zip gdb-bb785a92a88b538831d72e36f2d0fce76e0a32b1.tar.gz gdb-bb785a92a88b538831d72e36f2d0fce76e0a32b1.tar.bz2 |
[gdb/testsuite] Detect change instead of init in gdb.mi/mi-var-block.exp
On openSUSE Tumbleweed with target board unix/-m32, I run into:
...
PASS: gdb.mi/mi-var-block.exp: step at do_block_test 2
Expecting: ^(-var-update \*[^M
]+)?(\^done,changelist=\[{name="foo",in_scope="true",type_changed="false",has_more="0"},
{name="cb",in_scope="true",type_changed="false",has_more="0"}\][^M
]+[(]gdb[)] ^M
[ ]*)
-var-update *^M
^done,changelist=[{name="foo",in_scope="true",type_changed="false",has_more="0"}]^M
(gdb) ^M
FAIL: gdb.mi/mi-var-block.exp: update all vars: cb foo changed (unexpected output)
...
The problem is that the test-case attempts to detect a change in the cb
variable caused by this initialization:
...
void
do_block_tests ()
{
int cb = 12;
...
but that only works if the stack location happens to be unequal to 12 before
the initialization.
Fix this by first initializing to 0, and then changing the value to 12:
...
- int cb = 12;
+ int cb = 0;
+ cb = 12;
...
and detecting that change.
Tested on x86_64-linux.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29195
Diffstat (limited to 'gdb/testsuite/gdb.mi/var-cmd.c')
-rw-r--r-- | gdb/testsuite/gdb.mi/var-cmd.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c index fddb0d3..f331278 100644 --- a/gdb/testsuite/gdb.mi/var-cmd.c +++ b/gdb/testsuite/gdb.mi/var-cmd.c @@ -207,7 +207,8 @@ subroutine1 (int i, long *l) void do_block_tests () { - int cb = 12; + int cb = 0; + cb = 12; { int foo; |