[gdb/testsuite] Fix unbalanced quotes in mi_expect_stop argument
authorTom de Vries <tdevries@suse.de>
Fri, 24 Mar 2023 09:45:37 +0000 (10:45 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 24 Mar 2023 09:45:37 +0000 (10:45 +0100)
commitc569a946f6925d3f210c3eaf74dcda56843350ef
tree810910c33bbc22a669a7d72df325cc48f0923e1a
parent1985d8cb7048bcfce60b59cfe219d3b09bda6373
[gdb/testsuite] Fix unbalanced quotes in mi_expect_stop argument

In proc mi_expect_stop there's a proc argument reason that's handled like so:
...
set r "reason=\"$reason\","
...

That's fine for say:
...
set reason "foo"
...
for which this evaluates to:
...
set r "reason=\"foo\","
...

But there are more complex uses, for instance:
...
set reason "breakpoint-hit\",disp=\"keep\",bkptno=\"$decimal"
...
which evaluates to:
...
set r "\"breakpoint-hit\",disp=\"keep\",bkptno=\"$decimal\""
...

Note how in this reason argument, the first two '\"' seems to form a pair
surrounding ',disp=', which is not the case, which is confusing.

Fix this by only adding the quotes in mi_expect_stop if the string doesn't
already contain quotes, such that we have the more readable:
...
set reason "\"breakpoint-hit\",disp=\"keep\",bkptno=\"$decimal\""
...

Tested on x86_64-linux.
gdb/testsuite/gdb.ada/mi_catch_assert.exp
gdb/testsuite/gdb.ada/mi_catch_ex.exp
gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp
gdb/testsuite/gdb.ada/mi_ex_cond.exp
gdb/testsuite/lib/mi-support.exp