diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-06-22 12:23:53 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2022-10-02 11:57:30 +0100 |
commit | 21a52f7d827dab6bf14f81f478e1f9c7bdc7f218 (patch) | |
tree | 2f7693de7a3b14790964cdd96d20de704309259f /gdb/testsuite/lib | |
parent | f7052ade774e66cdbca9e3e4839ea747a88af85b (diff) | |
download | gdb-21a52f7d827dab6bf14f81f478e1f9c7bdc7f218.zip gdb-21a52f7d827dab6bf14f81f478e1f9c7bdc7f218.tar.gz gdb-21a52f7d827dab6bf14f81f478e1f9c7bdc7f218.tar.bz2 |
gdb/testsuite: new test for -data-disassemble opcodes format
Add another test for the output of MI command -data-disassemble. The
new check validates the format of the 'opcodes' field, specifically,
this test checks that the field contains a series of bytes, separated
by a single space.
We also check that the bytes are in the correct order, that is, the
first byte is from the lowest address, and subsequent bytes are from
increasing addresses.
The motivation for this test (besides more tests being generally good)
is that I plan to make changes to how opcode bytes are displayed in
the disassembler output, and I want to ensure that I don't break any
existing MI behaviour.
There should be no user visible changes to GDB after this commit.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r-- | gdb/testsuite/lib/mi-support.exp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index e821c0f..2b534f5 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -2833,3 +2833,30 @@ proc mi_is_target_remote {} { return [gdb_is_target_remote_prompt "$mi_gdb_prompt"] } + +# Retrieve the value of EXP in the inferior, represented in format +# specified in FMT (using "printFMT"). DEFAULT is used as fallback if +# print fails. TEST is the test message to use. It can be omitted, +# in which case a test message is built from EXP. +# +# This is an MI version of gdb_valueof. + +proc mi_get_valueof { fmt exp default {test ""} } { + global mi_gdb_prompt + + if {$test == "" } { + set test "get valueof \"${exp}\"" + } + + set val ${default} + gdb_test_multiple "print${fmt} ${exp}" "$test" { + -re "~\"\\$\[0-9\]* = (\[^\r\n\]*)\\\\n\"\r\n\\^done\r\n$mi_gdb_prompt$" { + set val $expect_out(1,string) + pass "$test" + } + timeout { + fail "$test (timeout)" + } + } + return ${val} +} |