gdb/testsuite: add mi_info_frame helper proc (and use it)
authorAndrew Burgess <aburgess@redhat.com>
Fri, 4 Aug 2023 13:25:54 +0000 (14:25 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Wed, 23 Aug 2023 09:29:15 +0000 (10:29 +0100)
commit696b09bb2a1c9023a294096cfde085e395b4e5cc
treee75750df7d622519ca85c9ee9b963a7c448a8891
parent9d7d58e7262eff313be6a1e66b8b026e3e7fed0d
gdb/testsuite: add mi_info_frame helper proc (and use it)

New helper proc mi_info_frame which takes care of running the MI
-stack-info-frame command and matching its output.

Like the breakpoint helper procs, this new proc takes a name/value
argument list and uses this to build the expected result regexp.  This
means that we can now write something like:

  mi_info_frame "test name here" \
    -level 0 -func name -line 123

Instead of the current equivalent:

  mi_gdb_test "235-stack-info-frame" \
    "235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"name\",file=\".*\",fullname=\".*\",line=\"123\",arch=\".*\"\}" \
    "test name here"

There's also a helper proc mi_make_info_frame_regexp which is
responsible for building the 'frame={...}' part of the pattern.

I've update the two existing tests that use -stack-info-frame and
expect the command to succeed.  There is another test that runs
-stack-info-frame and expects the command to fail -- the helper proc
doesn't help with this case, so that test is not changed.
gdb/testsuite/gdb.mi/mi-cmd-user-context.exp
gdb/testsuite/gdb.mi/mi-stack.exp
gdb/testsuite/lib/mi-support.exp