* [RFC] Merge mi-cli.exp and mi2-cli.exp
@ 2012-08-31 13:29 Yao Qi
2012-09-03 9:08 ` Vladimir Prus
` (2 more replies)
0 siblings, 3 replies; 28+ messages in thread
From: Yao Qi @ 2012-08-31 13:29 UTC (permalink / raw)
To: gdb-patches
Hi,
When trying to add some new tests in mi-cli.exp, the same stuff should
be added to mi2-cli.exp as well. Then, looks most part of two tests are
identical, and I start to think about why don't merge them together.
In 2003, Andrew copied mi-*.exp to mi2-*.exp in this patch,
[patch,6.0,rfc,rfa:doco] Finish "mi2"/"mi3" rollover
http://sourceware.org/ml/gdb-patches/2003-08/msg00044.html
Unless I miss something, the intention of copying tests here is to test
both '-i=mi' and '-i=mi2' respectively. However, this duplicates the code,
and increase the effort to maintain, IMO.
Sometimes, people may only update one of two files, and keep them un-sync'ed.
http://sourceware.org/ml/gdb-patches/2009-03/msg00172.html
http://sourceware.org/ml/gdb-patches/2009-02/msg00278.html
I am wondering if we can get rid of mi2-cli.exp, and exercise MI with
different MIFLAGS in a single mi-cli.exp. This is what this patch does.
I don't re-indent the code to make patch readable. WDYT? If it is
OK, I'll post a full patch with code indentation and removing
mi2-cli.exp.
I realize other mi-foo.exp and mi2-foo.exp may have the same issue,
but I don't examine the difference of them. If it is the right way
to go, we can get rid of mi2-foo.exp gradually.
gdb/testsuite:
2012-08-31 Yao Qi <yao@codesourcery.com>
* lib/mi-support.exp (mi_run_test_with_miflags): New.
* gdb.mi/mi-cli.exp (test_mi_cli): New. Move tests into this
proc.
Invoke mi_run_test_with_miflags.
---
gdb/testsuite/gdb.mi/mi-cli.exp | 19 +++++++++++++------
gdb/testsuite/lib/mi-support.exp | 12 ++++++++++++
2 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp
index f487cbd..fc6229c 100644
--- a/gdb/testsuite/gdb.mi/mi-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi-cli.exp
@@ -20,12 +20,6 @@
# handlers, etc.
load_lib mi-support.exp
-set MIFLAGS "-i=mi"
-
-gdb_exit
-if [mi_gdb_start] {
- continue
-}
standard_testfile basics.c
@@ -34,6 +28,15 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
+proc test_mi_cli { } {
+ global binfile
+ global async
+
+gdb_exit
+if [mi_gdb_start] {
+ continue
+}
+
mi_gdb_test "-interpreter-exec" \
{\^error,msg="-interpreter-exec: Usage: -interpreter-exec interp command"} \
"-interpreter-exec with no arguments"
@@ -212,4 +215,8 @@ mi_gdb_test "888-interpreter-exec console \"set \$pc=0x0\"" \
"-interpreter-exec console \"\""
mi_gdb_exit
+}
+
+mi_run_test_with_miflags test_mi_cli
+
return 0
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 9de27dd..2ac8ca0 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -36,6 +36,18 @@ set library_loaded_re "=library-loaded\[^\n\]+\"\r\n(?:$gdbindex_warning_re)?"
set breakpoint_re "=(?:breakpoint-created|breakpoint-deleted)\[^\n\]+\"\r\n"
#
+# Run TEST_PROC with one argument which is the name of MI interpreter.
+#
+proc mi_run_test_with_miflags { test_proc } {
+ foreach mi_interp { "mi" "mi1" "mi2" "mi3" } {
+ set MIFLAGS "-i=${mi_interp}"
+ with_test_prefix "$mi_interp" {
+ $test_proc
+ }
+ }
+}
+
+#
# mi_gdb_exit -- exit the GDB, killing the target program if necessary
#
proc mi_gdb_exit {} {
--
1.7.7.6
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [RFC] Merge mi-cli.exp and mi2-cli.exp 2012-08-31 13:29 [RFC] Merge mi-cli.exp and mi2-cli.exp Yao Qi @ 2012-09-03 9:08 ` Vladimir Prus 2012-09-03 15:55 ` Yao Qi 2012-09-05 0:29 ` Stan Shebs 2012-09-19 11:22 ` Yao Qi 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi 2 siblings, 2 replies; 28+ messages in thread From: Vladimir Prus @ 2012-09-03 9:08 UTC (permalink / raw) To: gdb-patches On 31.08.2012 17:29, Yao Qi wrote: > Unless I miss something, the intention of copying tests here is to test > both '-i=mi' and '-i=mi2' respectively. However, this duplicates the code, > and increase the effort to maintain, IMO. Yep, that was the intent -- with the extra twist that tests for MI and MI2 are not necessary identical. In other words, MI2 tests are tests for MI2 when MI2 was declared "done", and the idea was that the output with "-i=mi2" would remain the same for years. -i=mi is our current version of MI, which may evolve, and when MI3 is declared "done", the current tests will be copied to mi3-* tests to keep backward compatibility in future. I am not quite sure how relevant this plan is these days. - Volodya ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFC] Merge mi-cli.exp and mi2-cli.exp 2012-09-03 9:08 ` Vladimir Prus @ 2012-09-03 15:55 ` Yao Qi 2012-09-05 0:29 ` Stan Shebs 1 sibling, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-09-03 15:55 UTC (permalink / raw) To: Vladimir Prus; +Cc: gdb-patches On 09/03/2012 05:08 PM, Vladimir Prus wrote: > Yep, that was the intent -- with the extra twist that tests for MI and > MI2 are not necessary > identical. In other words, MI2 tests are tests for MI2 when MI2 was > declared "done", and the > idea was that the output with "-i=mi2" would remain the same for years. > -i=mi is our current > version of MI, which may evolve, and when MI3 is declared "done", the > current tests will > be copied to mi3-* tests to keep backward compatibility in future. > mi and mi2 test cases are not necessarily identical, but most of them should be the same, and the difference should be a small part in test. I can't see the benefit of simply copying mi tests to mi2 tests. We can claim that a certain version of MI is done, but I am not sure we can claim the testing to a certain version or some versions of MI is done, unless we have a confident coverage result. What should we do if we want to add more tests to all existing MI? The tests are not specific to a certain version of MI. Do we have to copy the new tests to mi-foo.exp and mi2-foo.exp? I am writing some tests on breakpoint-modified notification on all types of 'breakpoint', such as watchpoint, catchpoint, dprintf, tracepoint, etc. I write them in mi-cli.exp, but I am wondering whether I should add them to mi2-cli.exp as well. -- Yao ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFC] Merge mi-cli.exp and mi2-cli.exp 2012-09-03 9:08 ` Vladimir Prus 2012-09-03 15:55 ` Yao Qi @ 2012-09-05 0:29 ` Stan Shebs 2012-09-10 20:09 ` Tom Tromey 2012-09-11 15:15 ` Pedro Alves 1 sibling, 2 replies; 28+ messages in thread From: Stan Shebs @ 2012-09-05 0:29 UTC (permalink / raw) To: gdb-patches On 9/3/12 2:08 AM, Vladimir Prus wrote: > On 31.08.2012 17:29, Yao Qi wrote: >> Unless I miss something, the intention of copying tests here is to test >> both '-i=mi' and '-i=mi2' respectively. However, this duplicates the >> code, >> and increase the effort to maintain, IMO. > > Yep, that was the intent -- with the extra twist that tests for MI and > MI2 are not necessary > identical. In other words, MI2 tests are tests for MI2 when MI2 was > declared "done", and the > idea was that the output with "-i=mi2" would remain the same for > years. -i=mi is our current > version of MI, which may evolve, and when MI3 is declared "done", the > current tests will > be copied to mi3-* tests to keep backward compatibility in future. > > I am not quite sure how relevant this plan is these days. That plan has pretty much fallen by the wayside. We should probably declare the current MI behavior as the "done" form of MI3, and disallow any incompatible changes. If someone wants to get ambitious, they are free to specify and implement MI4. :-) On the original question, I tend to agree with leaving the test files separate. Shared code risks being unable to detect when the MI code is broken for one of the MI versions, but not the other; this is a rare case where we want the tests to be a little more brittle than usual. Stan stan@codesourcery.com ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFC] Merge mi-cli.exp and mi2-cli.exp 2012-09-05 0:29 ` Stan Shebs @ 2012-09-10 20:09 ` Tom Tromey 2012-09-11 15:15 ` Pedro Alves 1 sibling, 0 replies; 28+ messages in thread From: Tom Tromey @ 2012-09-10 20:09 UTC (permalink / raw) To: Stan Shebs; +Cc: gdb-patches >>>>> "Stan" == Stan Shebs <stanshebs@earthlink.net> writes: Stan> That plan has pretty much fallen by the wayside. We should probably Stan> declare the current MI behavior as the "done" form of MI3, and Stan> disallow any incompatible changes. If someone wants to get ambitious, Stan> they are free to specify and implement MI4. :-) It seems to me that there is still room for MI3, since -i=mi still means MI2. Does anything we know of really use MI3? It seems like clients relying on this are taking liberties. OTOH it isn't like we'll run out of version numbers. Tom ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFC] Merge mi-cli.exp and mi2-cli.exp 2012-09-05 0:29 ` Stan Shebs 2012-09-10 20:09 ` Tom Tromey @ 2012-09-11 15:15 ` Pedro Alves 2012-09-11 21:53 ` Stan Shebs 2012-09-12 13:59 ` Yao Qi 1 sibling, 2 replies; 28+ messages in thread From: Pedro Alves @ 2012-09-11 15:15 UTC (permalink / raw) To: Stan Shebs; +Cc: gdb-patches On 09/05/2012 01:29 AM, Stan Shebs wrote: > On 9/3/12 2:08 AM, Vladimir Prus wrote: >> On 31.08.2012 17:29, Yao Qi wrote: >>> Unless I miss something, the intention of copying tests here is to test >>> both '-i=mi' and '-i=mi2' respectively. However, this duplicates the code, >>> and increase the effort to maintain, IMO. >> >> Yep, that was the intent -- with the extra twist that tests for MI and MI2 are not necessary >> identical. In other words, MI2 tests are tests for MI2 when MI2 was declared "done", and the >> idea was that the output with "-i=mi2" would remain the same for years. -i=mi is our current >> version of MI, which may evolve, and when MI3 is declared "done", the current tests will >> be copied to mi3-* tests to keep backward compatibility in future. >> >> I am not quite sure how relevant this plan is these days. > > > That plan has pretty much fallen by the wayside. We should probably declare the current MI behavior as the "done" form of MI3, and disallow any incompatible changes. If someone wants to get ambitious, they are free to specify and implement MI4. :-) I agree the plan has fallen by the wayside, but because the introduction of MI3 as a valid setting was premature and a mistake. MI2 is "done" in the sense that we will never change MI2's grammar and input/output in a backward incompatible way. We're free to add new output records, new commands, etc., but that isn't considered backward incompatible. That's all still layered on the same protocol. Incompatible changes would be things like what Vlad wrote in the sources, like: /* To cater for older frontends, emit ^running, but do it only once per each command. We do it here, since at this point we know that the target was successfully resumed, and in non-async mode, we won't return back to MI interpreter code until the target is done running, so delaying the output of "^running" until then will make it impossible for frontend to know what's going on. In future (MI3), we'll be outputting "^done" here. */ if (!running_result_record_printed && mi_proceeded) { fprintf_unfiltered (raw_stdout, "%s^running\n", current_token ? current_token : ""); } ... and ... fputs_unfiltered (context->token, raw_stdout); /* There's no particularly good reason why target-connect results in not ^done. Should kill ^connected for MI3. */ fputs_unfiltered (strcmp (context->command, "target-select") == 0 ? "^connected" : "^done", raw_stdout); I can't find anything in the code that checks for MI version being 3 and doing things differently. So, MI3 is pretty much still reserved for when we really need to be backwards incompatible (kind of like an ABI break). So I don't see the point of calling the current form of MI, MI3. It's still the same as MI2. > On the original question, I tend to agree with leaving the test files separate. Shared code risks being unable to detect when the MI code is broken for one of the MI versions, but not the other; this is a rare case where we want the tests to be a little more brittle than usual. OTOH, MI2 really broke backward compatibility with MI1 clients. The differences between MI1 and MI2 are not that great (grep for mi_version) though. But more than that, in reality, we stopped supporting MI1 almost 10 years ago: http://sourceware.org/ml/gdb-patches/2004-02/msg00352.html If you look at the current docs, you'll see we ended up with just calling it deprecated, as a result of that thread. But the reality is that we really stopped supporting it. See, for example that we deleted all the MI1 tests back then too <http://sourceware.org/ml/gdb-patches/2004-02/msg00295.html>: "In preparation for the next release - no point testing (i.e., maintaining) what isn't going to be supported." 2004-02-13 Andrew Cagney <cagney@redhat.com> * gdb.mi/mi1-basics.exp, gdb.mi/mi1-break.exp: Delete file. * gdb.mi/mi1-console.exp, gdb.mi/mi1-disassemble.exp: Delete file. * gdb.mi/mi1-eval.exp, gdb.mi/mi1-hack-cli.exp: Delete file. * gdb.mi/mi1-pthreads.exp, gdb.mi/mi1-read-memory.exp: Delete file. * gdb.mi/mi1-regs.exp, gdb.mi/mi1-return.exp: Delete file. * gdb.mi/mi1-simplerun.exp, gdb.mi/mi1-stack.exp: Delete file. * gdb.mi/mi1-stepi.exp, gdb.mi/mi1-symbol.exp: Delete file. * gdb.mi/mi1-until.exp, gdb.mi/mi1-var-block.exp: Delete file. * gdb.mi/mi1-var-child.exp, gdb.mi/mi1-var-cmd.exp: Delete file. * gdb.mi/mi1-var-display.exp, gdb.mi/mi1-watch.exp: Delete file. So my opinion is that we revisit the policy a bit, and backtrack a the mi-.*exp vs mi2-.*exp idea, get rid of the duplication, and call everything "MI2", as it is in practice (must be, because that's how we run the tests). When we really introduce an incompatible change that actually justifies MI3, _then_ we should revisit the policy of whether to mass copying/rename tests, or share them, depending on how big the difference between the versions would be, and therefore depending on the practicality of the different options. As is, the double testing seems just pointless to me. -- Pedro Alves ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFC] Merge mi-cli.exp and mi2-cli.exp 2012-09-11 15:15 ` Pedro Alves @ 2012-09-11 21:53 ` Stan Shebs 2012-09-12 15:28 ` Pedro Alves 2012-09-12 13:59 ` Yao Qi 1 sibling, 1 reply; 28+ messages in thread From: Stan Shebs @ 2012-09-11 21:53 UTC (permalink / raw) To: gdb-patches On 9/11/12 8:15 AM, Pedro Alves wrote: > On 09/05/2012 01:29 AM, Stan Shebs wrote: >> On 9/3/12 2:08 AM, Vladimir Prus wrote: >>> On 31.08.2012 17:29, Yao Qi wrote: >>>> Unless I miss something, the intention of copying tests here is to test >>>> both '-i=mi' and '-i=mi2' respectively. However, this duplicates the code, >>>> and increase the effort to maintain, IMO. >>> Yep, that was the intent -- with the extra twist that tests for MI and MI2 are not necessary >>> identical. In other words, MI2 tests are tests for MI2 when MI2 was declared "done", and the >>> idea was that the output with "-i=mi2" would remain the same for years. -i=mi is our current >>> version of MI, which may evolve, and when MI3 is declared "done", the current tests will >>> be copied to mi3-* tests to keep backward compatibility in future. >>> >>> I am not quite sure how relevant this plan is these days. >> >> That plan has pretty much fallen by the wayside. We should probably declare the current MI behavior as the "done" form of MI3, and disallow any incompatible changes. If someone wants to get ambitious, they are free to specify and implement MI4. :-) > I agree the plan has fallen by the wayside, but because the introduction of MI3 > as a valid setting was premature and a mistake. MI2 is "done" in the sense that we > will never change MI2's grammar and input/output in a backward incompatible way. > We're free to add new output records, new commands, etc., but that isn't considered > backward incompatible. That's all still layered on the same protocol. > > [...] > But more than that, in reality, we stopped supporting MI1 almost 10 years ago: > > http://sourceware.org/ml/gdb-patches/2004-02/msg00352.html That's a good point, seemed like it was just yesterday. :-) A little poking around the net shows that it's been quite a while since anybody has used MI1. > So my opinion is that we revisit the policy a bit, and backtrack a the > mi-.*exp vs mi2-.*exp idea, get rid of the duplication, and call everything > "MI2", as it is in practice (must be, because that's how we run the tests). > When we really introduce an incompatible change that actually justifies MI3, > _then_ we should revisit the policy of whether to mass copying/rename tests, or > share them, depending on how big the difference between the versions would be, > and therefore depending on the practicality of the different options. > Sounds like a fine idea - and MI1 has already been deprecated for a long time, so we can just whack things now. I'd also like to scrub the comment references to what MI3 will do. While it makes sense for comments to mention ideas for future work, it's misleading to imply that we've committed our future selves to make any particular change on any particular schedule. Stan stan@codesourcery.com ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFC] Merge mi-cli.exp and mi2-cli.exp 2012-09-11 21:53 ` Stan Shebs @ 2012-09-12 15:28 ` Pedro Alves 0 siblings, 0 replies; 28+ messages in thread From: Pedro Alves @ 2012-09-12 15:28 UTC (permalink / raw) To: Stan Shebs; +Cc: gdb-patches On 09/11/2012 10:53 PM, Stan Shebs wrote: >> But more than that, in reality, we stopped supporting MI1 almost 10 years ago: >> >> http://sourceware.org/ml/gdb-patches/2004-02/msg00352.html > > That's a good point, seemed like it was just yesterday. :-) A little poking around the net shows that it's been quite a while since anybody has used MI1. :-) > >> So my opinion is that we revisit the policy a bit, and backtrack a the >> mi-.*exp vs mi2-.*exp idea, get rid of the duplication, and call everything >> "MI2", as it is in practice (must be, because that's how we run the tests). >> When we really introduce an incompatible change that actually justifies MI3, >> _then_ we should revisit the policy of whether to mass copying/rename tests, or >> share them, depending on how big the difference between the versions would be, >> and therefore depending on the practicality of the different options. >> > > Sounds like a fine idea - and MI1 has already been deprecated for a long time, so we can just whack things now. To be clear, there's no MI1 test in the suite anymore. What we have is explicit -i=mi2 tests, and -i=mi tests. One of the sets was copied from the other, with the idea that we'd fork them and while breaking compatibility with MI2, and that -i=mi would then be switched to mean MI3. But that never happened. The -i=mi tests still test the same MI2. So we now test the same things twice, due to the tests having been copied prematurely. -- Pedro Alves ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFC] Merge mi-cli.exp and mi2-cli.exp 2012-09-11 15:15 ` Pedro Alves 2012-09-11 21:53 ` Stan Shebs @ 2012-09-12 13:59 ` Yao Qi 1 sibling, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-09-12 13:59 UTC (permalink / raw) To: Pedro Alves; +Cc: Stan Shebs, gdb-patches On 09/11/2012 11:15 PM, Pedro Alves wrote: > So my opinion is that we revisit the policy a bit, and backtrack a the > mi-.*exp vs mi2-.*exp idea, get rid of the duplication, and call everything > "MI2", as it is in practice (must be, because that's how we run the tests). > When we really introduce an incompatible change that actually justifies MI3, > _then_ we should revisit the policy of whether to mass copying/rename tests, or > share them, depending on how big the difference between the versions would be, > and therefore depending on the practicality of the different options. > > As is, the double testing seems just pointless to me. Agreed. -- Yao ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFC] Merge mi-cli.exp and mi2-cli.exp 2012-08-31 13:29 [RFC] Merge mi-cli.exp and mi2-cli.exp Yao Qi 2012-09-03 9:08 ` Vladimir Prus @ 2012-09-19 11:22 ` Yao Qi 2012-09-19 13:47 ` Pedro Alves 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi 2 siblings, 1 reply; 28+ messages in thread From: Yao Qi @ 2012-09-19 11:22 UTC (permalink / raw) To: gdb-patches Hi, Looks we have got some conclusions in this thread on MI and its tests, - mi1 was died - mi3 still doesn't happen - mi2 is only what we are using so, we are testing mi2 twice by mi-foo.exp and mi2-foo.exp. This patch is to merge mi-cli.exp to mi2-clil.exp, and remove mi-cli.exp from suite. -- Yao gdb/testsuite: 2012-09-19 Yao Qi <yao@codesourcery.com> * gdb.mi/mi-cli.exp: Remove. * gdb.mi/mi2-cli.exp: Merged from mi-cli.exp. --- gdb/testsuite/gdb.mi/mi-cli.exp | 215 -------------------------------------- gdb/testsuite/gdb.mi/mi2-cli.exp | 40 +++++++- 2 files changed, 38 insertions(+), 217 deletions(-) delete mode 100644 gdb/testsuite/gdb.mi/mi-cli.exp diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp deleted file mode 100644 index f487cbd..0000000 --- a/gdb/testsuite/gdb.mi/mi-cli.exp +++ /dev/null @@ -1,215 +0,0 @@ -# Copyright 2002-2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# This file tests that GDB's console can be accessed via the MI. -# Specifically, we are testing the "interpreter-exec" command and that -# the commands that are executed via this command are properly executed. -# Console commands executed via MI should use MI output wrappers, MI event -# handlers, etc. - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-cli.exp - return -1 -} - -mi_gdb_test "-interpreter-exec" \ - {\^error,msg="-interpreter-exec: Usage: -interpreter-exec interp command"} \ - "-interpreter-exec with no arguments" - -mi_gdb_test "-interpreter-exec console" \ - {\^error,msg="-interpreter-exec: Usage: -interpreter-exec interp command"} \ - "-interpreter-exec with one argument" - -mi_gdb_test "-interpreter-exec bogus command" \ - {\^error,msg="-interpreter-exec: could not find interpreter \\\"bogus\\\""} \ - "-interpreter-exec with bogus interpreter" - -set msg {Undefined command: \\\"bogus\\\"\. Try \\\"help\\\"\.} -mi_gdb_test "-interpreter-exec console bogus" \ - "&\\\"$msg\\\\n\\\".*\\^error,msg=\\\"$msg\\\".*" \ - "-interpreter-exec console bogus" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "-interpreter-exec console \"file $binfile\"" \ -# {(=.*)+\^done} \ -# "-interpreter-exec console \"file \$binfile\"" -mi_gdb_test "-interpreter-exec console \"file $binfile\"" \ - {~"Reading symbols from .*mi-cli...".*done} \ - "-interpreter-exec console \"file \$binfile\"" - -mi_run_to_main - -set line_main_head [gdb_get_line_number "main ("] -set line_main_body [expr $line_main_head + 2] -set line_main_hello [gdb_get_line_number "Hello, World!"] -set line_main_return [expr $line_main_hello + 2] -set line_callee4_head [gdb_get_line_number "callee4 ("] -set line_callee4_body [expr $line_callee4_head + 2] -set line_callee4_next [expr $line_callee4_body + 1] - -mi_gdb_test "-interpreter-exec console \"set args foobar\"" \ - ".*=cmd-param-changed,param=\"args\",value=\"foobar\".*\\^done" \ - "-interpreter-exec console \"set args foobar\"" - -mi_gdb_test "-interpreter-exec console \"show args\"" \ - {\~"Argument list to give program being debugged when it is started is \\\"foobar\\\"\.\\n".*\^done} \ - "-interpreter-exec console \"show args\"" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "-interpreter-exec console \"break callee4\"" \ -# {(&.*)*.*~"Breakpoint 2 at.*\\n".*=breakpoint-create,number="2".*\^done} \ -# "-interpreter-exec console \"break callee4\"" -mi_gdb_test "-interpreter-exec console \"break callee4\"" \ - {(&.*)*.*~"Breakpoint 2 at.*\\n".*\^done} \ - "-interpreter-exec console \"break callee4\"" - -mi_gdb_test "-interpreter-exec console \"info break\"" \ - {\~"Num[ \t]*Type[ \t]*Disp[ \t]*Enb[ \t]*Address[ \t]*What\\n".*~"2[ \t]*breakpoint[ \t]*keep[ \t]*y[ \t]*0x[0-9A-Fa-f]+[ \t]*in callee4 at .*basics.c:[0-9]+\\n".*\^done} \ - "-interpreter-exec console \"info break\"" - -mi_gdb_test "-interpreter-exec console \"set listsize 1\"" \ - ".*=cmd-param-changed,param=\"listsize\",value=\"1\".*\\^done" \ - "-interpreter-exec console \"set listsize 1\"" - -# {.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done } -mi_gdb_test "-interpreter-exec console \"list\"" \ - ".*\~\"$line_main_body\[\\\\t \]*callee1.*;\\\\n\".*\\^done" \ - "-interpreter-exec console \"list\"" - -mi_execute_to "exec-continue" "breakpoint-hit" "callee4" "" ".*basics.c" $line_callee4_body \ - { "" "disp=\"keep\"" } "continue to callee4" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "100-interpreter-exec console \"delete 2\"" \ -# {.*=breakpoint-delete,number=\"2\".*\^done} \ -# "-interpreter-exec console \"delete 2\"" -mi_gdb_test "100-interpreter-exec console \"delete 2\"" \ - {=breakpoint-deleted,id=\"2\"\r\n100\^done} \ - "-interpreter-exec console \"delete 2\"" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "200-interpreter-exec console \"up\"" \ -# {.*=selected-frame-level-changed,level="1".*\^done} \ -# "-interpreter-exec console \"up\"" -mi_gdb_test "200-interpreter-exec console \"up\"" \ - {~"#.*".*200\^done} \ - "-interpreter-exec console \"up\"" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "300-interpreter-exec console \"down\"" \ -# {.*=selected-frame-level-changed,level="0".*\^done} \ -# "-interpreter-exec console \"down\"" -mi_gdb_test "300-interpreter-exec console \"down\"" \ - {~"#.*".*300\^done} \ - "-interpreter-exec console \"down\"" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "-interpreter-exec console \"frame 2\"" \ -# {.*=selected-frame-level-changed,level="2".*\^done} \ -# "-interpreter-exec console \"frame 2\"" -mi_gdb_test "400-interpreter-exec console \"frame 2\"" \ - {~"#.*".*400\^done} \ - "-interpreter-exec console \"frame 2\"" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "-stack-select-frame 0" \ -# {.*=selected-frame-level-changed,level="0".*\^done} \ -# "-stack-select-frame 0" -mi_gdb_test "500-stack-select-frame 0" \ - {500\^done} \ - "-stack-select-frame 0" - -# When a CLI command is entered in MI session, the respose is different in -# sync and async modes. In sync mode normal_stop is called when current -# interpreter is CLI. So: -# - print_stop_reason prints stop reason in CLI uiout, and we don't show it -# in MI -# - The stop position is printed, and appears in MI 'console' channel. -# -# In async mode the stop event is processed when we're back to MI interpreter, -# so the stop reason is printed into MI uiout an. -if {$async} { - set reason "end-stepping-range" -} else { - set reason "" -} - -mi_execute_to "interpreter-exec console step" $reason "callee4" "" ".*basics.c" $line_callee4_next \ - "" "check *stopped from CLI command" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "-break-insert -t basics.c:$line_main_hello" \ -# {.*=breakpoint-create,number="3".*\^done} \ -# "-break-insert -t basics.c:\$line_main_hello" -mi_gdb_test "600-break-insert -t basics.c:$line_main_hello" \ - {600\^done,bkpt=.number="3",type="breakpoint".*\}} \ - "-break-insert -t basics.c:\$line_main_hello" - -mi_execute_to "exec-continue" "breakpoint-hit" "main" "" ".*basics.c" \ - $line_main_hello { "" "disp=\"del\"" } \ - "-exec-continue to line $line_main_hello" - -# Test that the token is output even for CLI commands -# Also test that *stopped includes frame information. -mi_gdb_test "34 next" \ - ".*34\\\^running.*\\*running,thread-id=\"all\"" \ - "34 next: run" - -if {!$async} { - gdb_expect { - -re "~\[^\r\n\]+\r\n" { - } - } -} - -# Note that the output does not include stop reason. This is fine. -# The purpose of *stopped notification for CLI command is to make -# sure that frontend knows that inferior is stopped, and knows where. -# Supplementary information is not necessary. -mi_expect_stop "$reason" "main" "" ".*basics.c" $line_main_return "" \ - "34 next: stop" - -mi_gdb_test "-interpreter-exec console \"list\"" \ - "\~\"$line_main_return\[\\\\t ]*callme \\(1\\);\\\\n\".*\\^done" \ - "-interpreter-exec console \"list\" at basics.c:\$line_main_return" - -mi_gdb_test "-interpreter-exec console \"help set args\"" \ - {\~"Set argument list to give program being debugged when it is started\.\\nFollow this command with any number of args, to be passed to the program\.".*\^done} \ - "-interpreter-exec console \"help set args\"" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "-interpreter-exec console \"set \$pc=0x0\"" \ -# {.*=target-changed.*\^done} \ -# "-interpreter-exec console \"set \$pc=0x0\"" -mi_gdb_test "888-interpreter-exec console \"set \$pc=0x0\"" \ - {888\^done} \ - "-interpreter-exec console \"set \$pc=0x0\"" - -#mi_gdb_test "-interpreter-exec console \"\"" \ - {} \ - "-interpreter-exec console \"\"" - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-cli.exp b/gdb/testsuite/gdb.mi/mi2-cli.exp index 9ab7518..73a79b5 100644 --- a/gdb/testsuite/gdb.mi/mi2-cli.exp +++ b/gdb/testsuite/gdb.mi/mi2-cli.exp @@ -67,6 +67,7 @@ set line_main_hello [gdb_get_line_number "Hello, World!"] set line_main_return [expr $line_main_hello + 2] set line_callee4_head [gdb_get_line_number "callee4 ("] set line_callee4_body [expr $line_callee4_head + 2] +set line_callee4_next [expr $line_callee4_body + 1] mi_gdb_test "-interpreter-exec console \"set args foobar\"" \ ".*=cmd-param-changed,param=\"args\",value=\"foobar\".*\\^done" \ @@ -141,6 +142,24 @@ mi_gdb_test "500-stack-select-frame 0" \ {500\^done} \ "-stack-select-frame 0" +# When a CLI command is entered in MI session, the respose is different in +# sync and async modes. In sync mode normal_stop is called when current +# interpreter is CLI. So: +# - print_stop_reason prints stop reason in CLI uiout, and we don't show it +# in MI +# - The stop position is printed, and appears in MI 'console' channel. +# +# In async mode the stop event is processed when we're back to MI interpreter, +# so the stop reason is printed into MI uiout an. +if {$async} { + set reason "end-stepping-range" +} else { + set reason "" +} + +mi_execute_to "interpreter-exec console step" $reason "callee4" "" ".*basics.c" $line_callee4_next \ + "" "check *stopped from CLI command" + # NOTE: cagney/2003-02-03: Not yet. # mi_gdb_test "-break-insert -t basics.c:$line_main_hello" \ # {.*=breakpoint-create,number="3".*\^done} \ @@ -153,8 +172,25 @@ mi_execute_to "exec-continue" "breakpoint-hit" "main" "" ".*basics.c" \ $line_main_hello { "" "disp=\"del\"" } \ "-exec-continue to line $line_main_hello" -mi_execute_to "exec-next" "end-stepping-range" "main" "" ".*basics.c" $line_main_return "" \ - "-exec-next to line $line_main_return" +# Test that the token is output even for CLI commands +# Also test that *stopped includes frame information. +mi_gdb_test "34 next" \ + ".*34\\\^running.*\\*running,thread-id=\"all\"" \ + "34 next: run" + +if {!$async} { + gdb_expect { + -re "~\[^\r\n\]+\r\n" { + } + } +} + +# Note that the output does not include stop reason. This is fine. +# The purpose of *stopped notification for CLI command is to make +# sure that frontend knows that inferior is stopped, and knows where. +# Supplementary information is not necessary. +mi_expect_stop "$reason" "main" "" ".*basics.c" $line_main_return "" \ + "34 next: stop" mi_gdb_test "-interpreter-exec console \"list\"" \ "\~\"$line_main_return\[\\\\t ]*callme \\(1\\);\\\\n\".*\\^done" \ -- 1.7.7.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFC] Merge mi-cli.exp and mi2-cli.exp 2012-09-19 11:22 ` Yao Qi @ 2012-09-19 13:47 ` Pedro Alves 2012-09-21 8:40 ` Yao Qi 0 siblings, 1 reply; 28+ messages in thread From: Pedro Alves @ 2012-09-19 13:47 UTC (permalink / raw) To: Yao Qi; +Cc: gdb-patches On 09/19/2012 12:21 PM, Yao Qi wrote: > Hi, > Looks we have got some conclusions in this thread on MI and its tests, > > - mi1 was died > - mi3 still doesn't happen > - mi2 is only what we are using > > so, we are testing mi2 twice by mi-foo.exp and mi2-foo.exp. This patch > is to merge mi-cli.exp to mi2-clil.exp, and remove mi-cli.exp from > suite. > Looks good to me. Thanks. -- Pedro Alves ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFC] Merge mi-cli.exp and mi2-cli.exp 2012-09-19 13:47 ` Pedro Alves @ 2012-09-21 8:40 ` Yao Qi 0 siblings, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-09-21 8:40 UTC (permalink / raw) To: gdb-patches On 09/19/2012 09:47 PM, Pedro Alves wrote: > On 09/19/2012 12:21 PM, Yao Qi wrote: >> Hi, >> Looks we have got some conclusions in this thread on MI and its tests, >> >> - mi1 was died >> - mi3 still doesn't happen >> - mi2 is only what we are using >> >> so, we are testing mi2 twice by mi-foo.exp and mi2-foo.exp. This patch >> is to merge mi-cli.exp to mi2-clil.exp, and remove mi-cli.exp from >> suite. >> > > Looks good to me. Thanks. > Thanks. Committed. I'll post follow up patches to merge mi-FOO.exp to mi2-FOO.exp. -- Yao ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 0/11] Cleanup MI test cases 2012-08-31 13:29 [RFC] Merge mi-cli.exp and mi2-cli.exp Yao Qi 2012-09-03 9:08 ` Vladimir Prus 2012-09-19 11:22 ` Yao Qi @ 2012-09-28 0:04 ` Yao Qi 2012-09-28 0:04 ` [PATCH 02/11] mi-var-block.exp Yao Qi ` (11 more replies) 2 siblings, 12 replies; 28+ messages in thread From: Yao Qi @ 2012-09-28 0:04 UTC (permalink / raw) To: gdb-patches Hi, This is a follow up to this thread, Re: [RFC] Merge mi-cli.exp and mi2-cli.exp http://sourceware.org/ml/gdb-patches/2012-09/msg00155.html in which we discussed that we are only using mi2 so far and some test cases are redundant. This patch is to get rid of the redundancy in test cases. Patch 01/11 simply removes mi-FOO.exp, because they are identical to mi2-FOO.exp. The rest of the patches merge mi-foo.exp with mi2-foo.exp, and remove mi-foo.exp. Note that this patch set doesn't cover mi2-var-child.exp and mi-var-child.exp, because they diverge too much for me to handle. ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 02/11] mi-var-block.exp 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi @ 2012-09-28 0:04 ` Yao Qi 2012-09-28 0:04 ` [PATCH 05/11] mi-pthreads.exp Yao Qi ` (10 subsequent siblings) 11 siblings, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-09-28 0:04 UTC (permalink / raw) To: gdb-patches gdb/testsuite: 2012-09-27 Yao Qi <yao@codesourcery.com> * gdb.mi/mi-var-block.exp: Remove. * gdb.mi/mi2-var-block.exp: Merged from mi-var-block.exp. --- gdb/testsuite/gdb.mi/mi-var-block.exp | 173 -------------------------------- gdb/testsuite/gdb.mi/mi2-var-block.exp | 4 +- 2 files changed, 2 insertions(+), 175 deletions(-) delete mode 100644 gdb/testsuite/gdb.mi/mi-var-block.exp diff --git a/gdb/testsuite/gdb.mi/mi-var-block.exp b/gdb/testsuite/gdb.mi/mi-var-block.exp deleted file mode 100644 index e2eb42f..0000000 --- a/gdb/testsuite/gdb.mi/mi-var-block.exp +++ /dev/null @@ -1,173 +0,0 @@ -# Copyright 1999-2002, 2004, 2007-2012 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can create, update, delete variables. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile var-cmd.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-var-block.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -mi_runto do_block_tests - -# Test: c_variable-3.2 -# Desc: create cb and foo -mi_create_varobj "cb" "cb" "create local variable cb" - -mi_gdb_test "-var-create foo * foo" \ - "\\^error,msg=\"-var-create: unable to create variable object\"" \ - "try to create local variable foo" - -# step to "foo = 123;" -mi_step_to "do_block_tests" "" "var-cmd.c" \ - [gdb_get_line_number "foo = 123;"] \ - "step at do_block_test" - - -# Be paranoid and assume 3.2 created foo -mi_gdb_test "-var-delete foo" \ - "\\^error,msg=\"Variable object not found\"" \ - "delete var foo" - - -# Test: c_variable-3.3 -# Desc: create foo -mi_create_varobj "foo" "foo" "create local variable foo" - -# step to "foo2 = 123;" -mi_step_to "do_block_tests" "" "var-cmd.c" \ - [gdb_get_line_number "foo2 = 123;"] \ - "step at do_block_test" - -# Test: c_variable-3.4 -# Desc: check foo, cb changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"foo\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"cb\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: cb foo changed" - -# step to "foo = 321;" -mi_step_to "do_block_tests" "" "var-cmd.c" \ - [gdb_get_line_number "foo = 321;"] \ - "step at do_block_test" - -# Test: c_variable-3.5 -# Desc: create inner block foo -mi_create_varobj "inner_foo" "foo" "create local variable inner_foo" - -# step to "foo2 = 0;" -mi_step_to "do_block_tests" "" "var-cmd.c" \ - [gdb_get_line_number "foo2 = 0;"] \ - "step at do_block_test" - -# Test: c_variable-3.6 -# Desc: create foo2 -mi_create_varobj "foo2" "foo2" "create local variable foo2" - -# Test: c_variable-3.7 -# Desc: check that outer foo in scope and inner foo out of scope -# Note: also a known gdb problem -setup_xfail *-*-* -mi_gdb_test "-var-update inner_foo" \ - "\\^done,changelist=\{FIXME\}" \ - "update inner_foo: should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* - -setup_xfail *-*-* -mi_gdb_test "-var-evaluate-expression inner_foo" \ - "\\^done,value=\{FIXME\}" \ - "evaluate inner_foo: should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* - -mi_gdb_test "-var-update foo" \ - "\\^done,changelist=\\\[\\\]" \ - "update foo: did not change" - -mi_gdb_test "-var-delete inner_foo" \ - "\\^done,ndeleted=\"1\"" \ - "delete var inner_foo" - -# step to "foo = 0;" -mi_step_to "do_block_tests" "" "var-cmd.c" \ - [gdb_get_line_number "foo = 0;"] \ - "step at do_block_test" - -# Test: c_variable-3.8 -# Desc: check that foo2 out of scope (known gdb problem) -setup_xfail *-*-* -mi_gdb_test "-var-update foo2" \ - "\\^done,changelist=\{FIXME\}" \ - "update foo2: should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* - -# step to "cb = 21;" -mi_step_to "do_block_tests" "" "var-cmd.c" \ - [gdb_get_line_number "cb = 21;"] \ - "step at do_block_test" - -# Test: c_variable-3.9 -# Desc: check that only cb is in scope (known gdb problem) -setup_xfail *-*-* -mi_gdb_test "-var-update foo2" \ - "\\^done,changelist=\\\[FIXME\\\]" \ - "update foo2 should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* -setup_xfail *-*-* -mi_gdb_test "-var-update foo" \ - "\\^done,changelist=\{FIXME\}" \ - "update foo should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* -mi_gdb_test "-var-update cb" \ - "\\^done,changelist=\\\[\\\]" \ - "update cb" - -# Test: c_variable-3.10 -# Desc: names of editable variables -#gdbtk_test c_variable-3.10 {names of editable variables} { -# editable_variables -#} {{foo cb foo2} {}} - -# Done with block tests -mi_gdb_test "-var-delete foo" \ - "\\^done,ndeleted=\"1\"" \ - "delete var foo" - -mi_gdb_test "-var-delete foo2" \ - "\\^done,ndeleted=\"1\"" \ - "delete var foo2" - -mi_gdb_test "-var-delete cb" \ - "\\^done,ndeleted=\"1\"" \ - "delete var cb" - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-var-block.exp b/gdb/testsuite/gdb.mi/mi2-var-block.exp index 6999db6..e4134c0 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-block.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-block.exp @@ -45,8 +45,8 @@ mi_runto do_block_tests mi_create_varobj "cb" "cb" "create local variable cb" mi_gdb_test "-var-create foo * foo" \ - "\\^error,msg=\"-var-create: unable to create variable object\"" \ - "create local variable foo" + "\\^error,msg=\"-var-create: unable to create variable object\"" \ + "try to create local variable foo" # step to "foo = 123;" mi_step_to "do_block_tests" "" "var-cmd.c" \ -- 1.7.7.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 05/11] mi-pthreads.exp 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi 2012-09-28 0:04 ` [PATCH 02/11] mi-var-block.exp Yao Qi @ 2012-09-28 0:04 ` Yao Qi 2012-09-28 0:05 ` [PATCH 10/11] mi-stack.exp Yao Qi ` (9 subsequent siblings) 11 siblings, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-09-28 0:04 UTC (permalink / raw) To: gdb-patches gdb/testsuite: 2012-09-27 Yao Qi <yao@codesourcery.com> * gdb.mi/mi-pthreads.exp: Remove. * gdb.mi/mi2-pthreads.exp: Merged from mi-pthreads.exp. --- gdb/testsuite/gdb.mi/mi-pthreads.exp | 77 --------------------------------- gdb/testsuite/gdb.mi/mi2-pthreads.exp | 6 +++ 2 files changed, 6 insertions(+), 77 deletions(-) delete mode 100644 gdb/testsuite/gdb.mi/mi-pthreads.exp diff --git a/gdb/testsuite/gdb.mi/mi-pthreads.exp b/gdb/testsuite/gdb.mi/mi-pthreads.exp deleted file mode 100644 index d30e0f2..0000000 --- a/gdb/testsuite/gdb.mi/mi-pthreads.exp +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 2002-2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# This file tests MI thread commands. -# Specifically, we are testing the MI command set and the console (in MI) -# command set ("interpreter-exec") and that the commands that are executed -# via these command pathways are properly executed. Console commands -# executed via MI should use MI output wrappers, MI event handlers, etc. - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if {[mi_gdb_start]} { - continue -} - -# This procedure tests the various thread commands in MI. -proc check_mi_thread_command_set {} { - - mi_runto done_making_threads - - set thread_list [get_mi_thread_list "in check_mi_thread_command_set"] - - mi_gdb_test "-thread-select" \ - {\^error,msg="-thread-select: USAGE: threadnum."} \ - "check_mi_thread_command_set: -thread-select" - - mi_gdb_test "-thread-select 123456789" \ - {&.*\^error,msg="Thread ID 123456789 not known\."} \ - "check_mi_thread_command_set: -thread-select 123456789" - - foreach thread $thread_list { - # line and file are optional. - # many of the threads are blocked in libc calls, - # and many people have libc's with no symbols. - mi_gdb_test "-thread-select $thread" \ - "\\^done,new-thread-id=\"$thread\",frame={.*}(,line=\"(-)?\[0-9\]+\",file=\".*\")?" \ - "check_mi_thread_command_set: -thread-select $thread" - } - - foreach thread $thread_list { - mi_gdb_test "-interpreter-exec console \"thread $thread\"" \ - ".*\\^done\r\n=thread-selected,id=\"$thread\"" \ - "check =thread-selected: thread $thread" - } -} - -# -# Start here -# -standard_testfile pthreads.c - -set options [list debug] -if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } { - return -1 -} - -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load $binfile - -check_mi_thread_command_set - -mi_gdb_exit - diff --git a/gdb/testsuite/gdb.mi/mi2-pthreads.exp b/gdb/testsuite/gdb.mi/mi2-pthreads.exp index 37f325e..5576661 100644 --- a/gdb/testsuite/gdb.mi/mi2-pthreads.exp +++ b/gdb/testsuite/gdb.mi/mi2-pthreads.exp @@ -50,6 +50,12 @@ proc check_mi_thread_command_set {} { "\\^done,new-thread-id=\"$thread\",frame={.*}(,line=\"(-)?\[0-9\]+\",file=\".*\")?" \ "check_mi_thread_command_set: -thread-select $thread" } + + foreach thread $thread_list { + mi_gdb_test "-interpreter-exec console \"thread $thread\"" \ + ".*\\^done\r\n=thread-selected,id=\"$thread\"" \ + "check =thread-selected: thread $thread" + } } # -- 1.7.7.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 10/11] mi-stack.exp 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi 2012-09-28 0:04 ` [PATCH 02/11] mi-var-block.exp Yao Qi 2012-09-28 0:04 ` [PATCH 05/11] mi-pthreads.exp Yao Qi @ 2012-09-28 0:05 ` Yao Qi 2012-09-28 0:05 ` [PATCH 04/11] mi-basics.exp Yao Qi ` (8 subsequent siblings) 11 siblings, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-09-28 0:05 UTC (permalink / raw) To: gdb-patches gdb/testsuite: 2012-09-27 Yao Qi <yao@codesourcery.com> * gdb.mi/mi-stack.exp: Remove. * gdb.mi/mi2-stack.exp: Merged from mi-stack.exp. --- gdb/testsuite/gdb.mi/mi-stack.exp | 211 ------------------------------------ gdb/testsuite/gdb.mi/mi2-stack.exp | 4 +- 2 files changed, 2 insertions(+), 213 deletions(-) delete mode 100644 gdb/testsuite/gdb.mi/mi-stack.exp diff --git a/gdb/testsuite/gdb.mi/mi-stack.exp b/gdb/testsuite/gdb.mi/mi-stack.exp deleted file mode 100644 index d743c68..0000000 --- a/gdb/testsuite/gdb.mi/mi-stack.exp +++ /dev/null @@ -1,211 +0,0 @@ -# Copyright 2000-2002, 2004-2005, 2007-2012 Free Software Foundation, -# Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test essential Machine interface (MI) operations -# -# Verify that stack commands work. - -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-stack.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_stack_frame_listing {} { - global mi_gdb_prompt - global hex fullname_syntax srcfile - - set line_callee4_head [gdb_get_line_number "callee4 ("] - set line_callee4_body [expr $line_callee4_head + 2] - - # Obtain a stack trace - # Tests: - # -stack-list-frames - # -stack-list-frames 1 1 - # -stack-list-frames 1 3 - # -stack-info-frame - - mi_gdb_test "231-stack-list-frames" \ - "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_callee4_body\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \ - "stack frame listing" - mi_gdb_test "232-stack-list-frames 1 1" \ - "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \ - "stack frame listing 1 1" - mi_gdb_test "233-stack-list-frames 1 3" \ - "233\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\}\\\]" \ - "stack frame listing 1 3" - - mi_gdb_test "234-stack-list-frames 1" \ - "234\\^error,msg=\"-stack-list-frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \ - "stack frame listing wrong" - - mi_gdb_test "235-stack-info-frame" \ - "235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_callee4_body\"\}" \ - "selected frame listing" - - mi_gdb_test "236-stack-list-frames 1 300" \ - "236\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\}\\\]" \ - "stack frame listing 1 300" -} - -proc test_stack_args_listing {} { - global mi_gdb_prompt - global hex - - # Obtain lists for args for the stack frames - # Tests: - # -stack-list-arguments 0 - # -stack-list-arguments 0 1 1 - # -stack-list-arguments 0 1 3 - # -stack-list-arguments 1 - # -stack-list-arguments 1 1 1 - # -stack-list-arguments 1 1 3 - # -stack-list-arguments - - mi_gdb_test "231-stack-list-arguments 0" \ - "231\\^done,stack-args=\\\[frame=\{level=\"0\",args=\\\[\\\]\},frame=\{level=\"1\",args=\\\[name=\"strarg\"\\\]\},frame=\{level=\"2\",args=\\\[name=\"intarg\",name=\"strarg\"\\\]\},frame=\{level=\"3\",args=\\\[name=\"intarg\",name=\"strarg\",name=\"fltarg\"\\\]\},frame=\{level=\"4\",args=\\\[\\\]\}\\\]" \ - "stack args listing 0" - - mi_gdb_test "232-stack-list-arguments 0 1 1" \ - "232\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[name=\"strarg\"\\\]\}\\\]" \ - "stack args listing 0 1 1" - - mi_gdb_test "233-stack-list-arguments 0 1 3" \ - "233\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[name=\"strarg\"\\\]\},frame=\{level=\"2\",args=\\\[name=\"intarg\",name=\"strarg\"\\\]\},frame=\{level=\"3\",args=\\\[name=\"intarg\",name=\"strarg\",name=\"fltarg\"\\\]\}\\\]" \ - "stack args listing 0 1 3" - - mi_gdb_test "231-stack-list-arguments 1" \ - "231\\^done,stack-args=\\\[frame=\{level=\"0\",args=\\\[\\\]\},frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"2\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"3\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\\\]\},frame=\{level=\"4\",args=\\\[\\\]\}\\\]" \ - "stack args listing 1" - - mi_gdb_test "232-stack-list-arguments 1 1 1" \ - "232\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\}\\\]" \ - "stack args listing 1 1 1" - - mi_gdb_test "233-stack-list-arguments --all-values 1 3" \ - "233\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"2\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"3\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\\\]\}\\\]" \ - "stack args listing 1 1 3" - - mi_gdb_test "234-stack-list-arguments" \ - "234\\^error,msg=\"-stack-list-arguments: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \ - "stack args listing wrong" - - mi_gdb_test "235-stack-list-arguments 1 1 300" \ - "235\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"2\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"3\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\\\]\},frame=\{level=\"4\",args=\\\[\\\]\}\\\]" \ - "stack args listing 1 1 300" -} - -proc test_stack_info_depth {} { - global mi_gdb_prompt - global hex - - # Obtain depth of stack - # Tests: - # -stack-info-depth - # -stack-info-depth 3 - # -stack-info-depth 99 - - mi_gdb_test "231-stack-info-depth" \ - "231\\^done,depth=\"5\"" \ - "stack info-depth" - - mi_gdb_test "231-stack-info-depth 3" \ - "231\\^done,depth=\"3\"" \ - "stack info-depth 3" - - mi_gdb_test "231-stack-info-depth 99" \ - "231\\^done,depth=\"5\"" \ - "stack info-depth 99" - - mi_gdb_test "231-stack-info-depth 99 99" \ - "231\\^error,msg=\"-stack-info-depth: Usage: .MAX_DEPTH.\"" \ - "stack info-depth wrong usage" -} - -proc test_stack_locals_listing {} { - global mi_gdb_prompt - global hex fullname_syntax srcfile - - # Obtain lists for locals for the stack frames - # Tests: - # -stack-list-locals 0 (--no-values) - # -stack-list-locals 1 (--all-values) - # -stack-list-locals 2 (--simple-values) - # -stack-list-arguments - - mi_gdb_test "232-stack-list-locals 0" \ - "232\\^done,locals=\\\[name=\"A\",name=\"B\",name=\"C\",name=\"D\"\\\]" \ - "stack locals listing of names" - -set line_callee4_return_0 [gdb_get_line_number "return 0;"] - -# step until A, B, C, D have some reasonable values. -mi_execute_to "exec-next 4" "end-stepping-range" "callee4" "" ".*${srcfile}" $line_callee4_return_0 ""\ - "next's in callee4" - - mi_gdb_test "232-stack-list-locals 1" \ - "232\\^done,locals=\\\[\{name=\"A\",value=\"1\"\},\{name=\"B\",value=\"2\"\},\{name=\"C\",value=\"3\"\},\{name=\"D\",value=\"\\{0, 1, 2\\}\"\}\\\]" \ - "stack locals listing of names and values" - - mi_gdb_test "232-stack-list-locals --simple-values" \ - "232\\^done,locals=\\\[\{name=\"A\",type=\"int\",value=\"1\"\},\{name=\"B\",type=\"int\",value=\"2\"\},\{name=\"C\",type=\"int\",value=\"3\"\},\{name=\"D\",type=\"int \\\[3\\\]\"\}\\\]" \ - "stack locals listing, simple types: names and values, complex type: names and types" - - mi_gdb_test "234-stack-list-locals" \ - "234\\^error,msg=\"-stack-list-locals: Usage.*PRINT_VALUES.*\"" \ - "stack locals listing wrong" - - mi_gdb_test "232-stack-select-frame 1" \ - "232\\^done" \ - "stack select frame 1" - - mi_gdb_test "232-stack-list-locals 1" \ - "232\\^done,locals=\\\[\\\]" \ - "stack locals listing for new frame" - - mi_gdb_test "232-stack-list-locals 1" \ - "232\\^done,locals=\\\[\\\]" \ - "stack locals for same frame (level 1)" -} - -mi_runto callee4 -test_stack_frame_listing -test_stack_args_listing -test_stack_locals_listing -test_stack_info_depth - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-stack.exp b/gdb/testsuite/gdb.mi/mi2-stack.exp index 9b79f41..0d45293 100644 --- a/gdb/testsuite/gdb.mi/mi2-stack.exp +++ b/gdb/testsuite/gdb.mi/mi2-stack.exp @@ -113,7 +113,7 @@ proc test_stack_args_listing {} { "232\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\}\\\]" \ "stack args listing 1 1 1" - mi_gdb_test "233-stack-list-arguments 1 1 3" \ + mi_gdb_test "233-stack-list-arguments --all-values 1 3" \ "233\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"2\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"3\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\\\]\}\\\]" \ "stack args listing 1 1 3" @@ -178,7 +178,7 @@ mi_execute_to "exec-next 4" "end-stepping-range" "callee4" "" ".*${srcfile}" $li "232\\^done,locals=\\\[\{name=\"A\",value=\"1\"\},\{name=\"B\",value=\"2\"\},\{name=\"C\",value=\"3\"\},\{name=\"D\",value=\"\\{0, 1, 2\\}\"\}\\\]" \ "stack locals listing of names and values" - mi_gdb_test "232-stack-list-locals 2" \ + mi_gdb_test "232-stack-list-locals --simple-values" \ "232\\^done,locals=\\\[\{name=\"A\",type=\"int\",value=\"1\"\},\{name=\"B\",type=\"int\",value=\"2\"\},\{name=\"C\",type=\"int\",value=\"3\"\},\{name=\"D\",type=\"int \\\[3\\\]\"\}\\\]" \ "stack locals listing, simple types: names and values, complex type: names and types" -- 1.7.7.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 04/11] mi-basics.exp 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi ` (2 preceding siblings ...) 2012-09-28 0:05 ` [PATCH 10/11] mi-stack.exp Yao Qi @ 2012-09-28 0:05 ` Yao Qi 2012-09-28 0:05 ` [PATCH 03/11] mi-file.exp Yao Qi ` (7 subsequent siblings) 11 siblings, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-09-28 0:05 UTC (permalink / raw) To: gdb-patches gdb/testsuite: 2012-09-27 Yao Qi <yao@codesourcery.com> * gdb.mi/mi-basics.exp: Remove. * gdb.mi/mi2-basics.exp: Invoke mi_gdb_start with separate-inferior-tty. (test_path_specification): New. --- gdb/testsuite/gdb.mi/mi-basics.exp | 265 ----------------------------------- gdb/testsuite/gdb.mi/mi2-basics.exp | 41 ++++++- 2 files changed, 40 insertions(+), 266 deletions(-) delete mode 100644 gdb/testsuite/gdb.mi/mi-basics.exp diff --git a/gdb/testsuite/gdb.mi/mi-basics.exp b/gdb/testsuite/gdb.mi/mi-basics.exp deleted file mode 100644 index 564b835..0000000 --- a/gdb/testsuite/gdb.mi/mi-basics.exp +++ /dev/null @@ -1,265 +0,0 @@ -# Copyright 1999-2003, 2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# test basic Machine interface (MI) operations -# -# Verify that, using the MI, we can load a program and do -# other basic things that are used by all test files through mi_gdb_exit, -# mi_gdb_start, mi_delete_breakpoints, mi_gdb_reinitialize_dir and -# mi_gdb_load, so we can safely use those. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but the command syntax and correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start separate-inferior-tty] { - continue -} - -standard_testfile basics.c -set escapedobjdir [string_to_regexp ${objdir}] -set envirodir [string_to_regexp ${objdir}/${subdir}] - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-basics.exp - return -1 -} - -# In this file we want to test if the operations needed by the following -# procedures work, so it makes no sense using them here. - -# mi_delete_breakpoints -# mi_gdb_reinitialize_dir $srcdir/$subdir -# mi_gdb_load ${binfile} - -# Test if the MI interpreter has been configured - -proc test_mi_interpreter_selection {} { - global mi_gdb_prompt - global gdb_prompt - - # All this test expects is to get the prompt back - # with no syntax error message - if ![mi_gdb_test "-gdb-version" "~\"GNU gdb.*" "acceptance of MI operations"] { - return 1 - } - - note "Skipping all other MI tests." - return 0 -} - -proc test_exec_and_symbol_mi_operatons {} { - global mi_gdb_prompt - global binfile - - # Load symbols and specify executable on a single operation - # Tests: - # -file-exec-and-symbols - - if [mi_gdb_test "-file-exec-and-symbols ${binfile}" "\\\^done" \ - "file-exec-and-symbols operation"] { - note "Skipping all other MI tests." - return 0 - } - - # The following is not used by mi-support.exp, but we test here so - # we get done with loading a program basics. - - # Do it again, but now load symbols and specify executable with - # two separate operations - # Tests: - # -file-clear - # -file-exec-file - # -file-symbol-file - - # FIXME: file-clear is not implemented yet. -# mi_gdb_test "-file-clear" \ -# "\\\^done" \ -# "file-clear operation" - - mi_gdb_test "-file-exec-file ${binfile}" \ - "\\\^done" \ - "file-exec-file operation" - - mi_gdb_test "-file-symbol-file ${binfile}" \ - "\\\^done" \ - "file-symbol-file operation" - - # We need to return != 0. - return 1 -} - -proc test_breakpoints_deletion {} { - global mi_gdb_prompt - global srcfile - - # Clear all breakpoints and list to confirm - # Tests: - # -break-delete (all) - # -break-list - - # The all parameter is actually no parameter. - mi_gdb_test "200-break-delete" \ - "200\\\^done" \ - "break-delete (all) operation" - - mi_gdb_test "201-break-list" \ - ".*\\\^done,BreakpointTable=\\\{.*,body=\\\[\\\]\\\}" \ - "all breakpoints removed" -} - -proc test_dir_specification {} { - global mi_gdb_prompt - global objdir - global subdir - global envirodir - - # Add to the search directories, display, then reset back to default - # Tests: - # -environment-directory arg - # -environment-directory - # -environment-directory -r - - mi_gdb_test "202-environment-directory ${objdir}/${subdir}" \ - "202\\\^done,source-path=\"${envirodir}.\\\$cdir.\\\$cwd\"" \ - "environment-directory arg operation" - - mi_gdb_test "203-environment-directory" \ - "203\\\^done,source-path=\"${envirodir}.\\\$cdir.\\\$cwd\"" \ - "environment-directory empty-string operation" - - mi_gdb_test "204-environment-directory -r" \ - "204\\\^done,source-path=\"\\\$cdir.\\\$cwd\"" \ - "environment-directory operation" -} - -proc test_cwd_specification {} { - global mi_gdb_prompt - global objdir - global escapedobjdir - global subdir - - # Change the working directory, then print the current working directory - # Tests: - # -environment-cd ${objdir} - # -environment-pwd - - mi_gdb_test "205-environment-cd ${objdir}" \ - "205\\\^done" \ - "environment-cd arg operation" - - # The canonical name of the working directory may differ on a - # remote host from that on the build system. - if ![is_remote host] { - mi_gdb_test "206-environment-pwd" \ - "206\\\^done,cwd=\"${escapedobjdir}\"" \ - "environment-pwd operation" - } -} - -proc test_path_specification {} { - global mi_gdb_prompt - global orig_path - global objdir - global subdir - global escapedobjdir - global envirodir - global expect_out - - # Add to the path, display, then reset - # Tests: - # -environment-path - # -environment-path dir1 dir2 - # -environment-path -r dir - # -environment-path -r - - mi_gdb_test "-environment-path" "\\\^done,path=\"(.*)\"" "environment-path" - set orig_path $expect_out(3,string) - - set orig_path [string_to_regexp ${orig_path}] - set pathdir [string_to_regexp ${objdir}/${subdir}] - - mi_gdb_test "207-environment-path" \ - "207\\\^done,path=\"$orig_path\"" \ - "environment-path no-args operation" - - mi_gdb_test "208-environment-path $objdir ${objdir}/${subdir}" \ - "208\\\^done,path=\"$escapedobjdir.${envirodir}.$orig_path\"" \ - "environment-path dir1 dir2 operation" - - mi_gdb_test "209-environment-path -r $objdir" \ - "209\\\^done,path=\"$escapedobjdir.$orig_path\"" \ - "environment-path -r dir operation" - - mi_gdb_test "210-environment-path -r" \ - "210\\\^done,path=\"$orig_path\"" \ - "environment-path -r operation" - -} - -proc test_setshow_inferior_tty {} { - global mi_gdb_prompt - global mi_inferior_tty_name - - # Test that the commands, - # -inferior-tty-set - # -inferior-tty-show - # are setting/getting the same data in GDB. - - mi_gdb_test "301-inferior-tty-show" \ - "301\\\^done,inferior_tty_terminal=\"$mi_inferior_tty_name\"" \ - "initial tty is mi_inferior_tty_name" - - mi_gdb_test "302-inferior-tty-set /dev/pts/1" \ - "302\\\^done" \ - "set tty to /dev/pts/1" - - mi_gdb_test "303-inferior-tty-show" \ - "303\\\^done,inferior_tty_terminal=\"/dev/pts/1\"" \ - "tty was set correctly" - - mi_gdb_test "304-inferior-tty-set" \ - "304\\\^done" \ - "set tty to the empty string" - - mi_gdb_test "305-inferior-tty-show" \ - "305\\\^done" \ - "make sure tty is empty" - - mi_gdb_test "306-inferior-tty-set $mi_inferior_tty_name" \ - "306\\\^done" \ - "set tty to mi_inferior_tty_name (the way it was)" - - mi_gdb_test "307-inferior-tty-show" \ - "307\\\^done,inferior_tty_terminal=\"$mi_inferior_tty_name\"" \ - "verify tty is correct" -} - -if { [test_mi_interpreter_selection] - && [test_exec_and_symbol_mi_operatons] } { - test_breakpoints_deletion - test_dir_specification - test_cwd_specification - test_path_specification - test_setshow_inferior_tty -} - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-basics.exp b/gdb/testsuite/gdb.mi/mi2-basics.exp index 3a54f99..179a7d5 100644 --- a/gdb/testsuite/gdb.mi/mi2-basics.exp +++ b/gdb/testsuite/gdb.mi/mi2-basics.exp @@ -29,7 +29,7 @@ load_lib mi-support.exp set MIFLAGS "-i=mi2" gdb_exit -if [mi_gdb_start] { +if [mi_gdb_start separate-inferior-tty] { continue } @@ -217,12 +217,51 @@ proc test_path_specification {} { } +proc test_setshow_inferior_tty {} { + global mi_gdb_prompt + global mi_inferior_tty_name + + # Test that the commands, + # -inferior-tty-set + # -inferior-tty-show + # are setting/getting the same data in GDB. + + mi_gdb_test "301-inferior-tty-show" \ + "301\\\^done,inferior_tty_terminal=\"$mi_inferior_tty_name\"" \ + "initial tty is mi_inferior_tty_name" + + mi_gdb_test "302-inferior-tty-set /dev/pts/1" \ + "302\\\^done" \ + "set tty to /dev/pts/1" + + mi_gdb_test "303-inferior-tty-show" \ + "303\\\^done,inferior_tty_terminal=\"/dev/pts/1\"" \ + "tty was set correctly" + + mi_gdb_test "304-inferior-tty-set" \ + "304\\\^done" \ + "set tty to the empty string" + + mi_gdb_test "305-inferior-tty-show" \ + "305\\\^done" \ + "make sure tty is empty" + + mi_gdb_test "306-inferior-tty-set $mi_inferior_tty_name" \ + "306\\\^done" \ + "set tty to mi_inferior_tty_name (the way it was)" + + mi_gdb_test "307-inferior-tty-show" \ + "307\\\^done,inferior_tty_terminal=\"$mi_inferior_tty_name\"" \ + "verify tty is correct" +} + if { [test_mi_interpreter_selection] && [test_exec_and_symbol_mi_operatons] } { test_breakpoints_deletion test_dir_specification test_cwd_specification test_path_specification + test_setshow_inferior_tty } mi_gdb_exit -- 1.7.7.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 03/11] mi-file.exp 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi ` (3 preceding siblings ...) 2012-09-28 0:05 ` [PATCH 04/11] mi-basics.exp Yao Qi @ 2012-09-28 0:05 ` Yao Qi 2012-09-28 0:05 ` [PATCH 07/11] mi-var-cmd.exp Yao Qi ` (6 subsequent siblings) 11 siblings, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-09-28 0:05 UTC (permalink / raw) To: gdb-patches gdb/testsuite: 2012-09-27 Yao Qi <yao@codesourcery.com> * gdb.mi/mi-file.exp: Remove. * gdb.mi/mi2-file.exp (test_file_list_exec_source_files): New. Merged from mi-file.xp. --- gdb/testsuite/gdb.mi/mi-file.exp | 84 ------------------------------------- gdb/testsuite/gdb.mi/mi2-file.exp | 11 +++++ 2 files changed, 11 insertions(+), 84 deletions(-) delete mode 100644 gdb/testsuite/gdb.mi/mi-file.exp diff --git a/gdb/testsuite/gdb.mi/mi-file.exp b/gdb/testsuite/gdb.mi/mi-file.exp deleted file mode 100644 index b0df2cd..0000000 --- a/gdb/testsuite/gdb.mi/mi-file.exp +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright 1999, 2003-2004, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-file.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_file_cmd ${binfile} - -proc test_file_list_exec_source_file {} { - global srcfile - global srcdir - global subdir - global fullname_syntax - set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}] - - # get the path and absolute path to the current executable - # - # In gdb 6.2 (at least), the default line number is set by - # select_source_symtab to the first line of "main" minus - # the value of "lines_to_list" (which defaults to 10) plus one. - # --chastain 2004-08-13 - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - set gdb_lines_to_list 10 - set line_default [expr $line_main_body - $gdb_lines_to_list + 1] - - mi_gdb_test "111-file-list-exec-source-file" \ - "111\\\^done,line=\"$line_default\",file=\"${srcfilepath}\",fullname=\"$fullname_syntax${srcfile}\",macro-info=\"0\"" \ - "request path info of current source file (${srcfile})" -} - -proc test_file_list_exec_source_files {} { - global srcfile - global fullname_syntax - - # get the path and absolute path to the current executable - mi_gdb_test "222-file-list-exec-source-files" \ - "222\\\^done,files=\\\[\{file=\".*/${srcfile}\",fullname=\"$fullname_syntax${srcfile}\"\}.*]" \ - "Getting a list of source files." -} - -test_file_list_exec_source_file -test_file_list_exec_source_files - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-file.exp b/gdb/testsuite/gdb.mi/mi2-file.exp index 56ad708..45fe02a 100644 --- a/gdb/testsuite/gdb.mi/mi2-file.exp +++ b/gdb/testsuite/gdb.mi/mi2-file.exp @@ -67,7 +67,18 @@ proc test_file_list_exec_source_file {} { "request path info of current source file (${srcfile})" } +proc test_file_list_exec_source_files {} { + global srcfile + global fullname_syntax + + # get the path and absolute path to the current executable + mi_gdb_test "222-file-list-exec-source-files" \ + "222\\\^done,files=\\\[\{file=\".*/${srcfile}\",fullname=\"$fullname_syntax${srcfile}\"\}.*]" \ + "Getting a list of source files." +} + test_file_list_exec_source_file +test_file_list_exec_source_files mi_gdb_exit return 0 -- 1.7.7.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 07/11] mi-var-cmd.exp. 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi ` (4 preceding siblings ...) 2012-09-28 0:05 ` [PATCH 03/11] mi-file.exp Yao Qi @ 2012-09-28 0:05 ` Yao Qi 2012-09-28 0:05 ` [PATCH 06/11] mi-break.exp Yao Qi ` (5 subsequent siblings) 11 siblings, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-09-28 0:05 UTC (permalink / raw) To: gdb-patches gdb/testsuite: 2012-09-27 Yao Qi <yao@codesourcery.com> * gdb.mi/mi-var-cmd.exp: Remove. * gdb.mi/mi2-var-cmd.exp: Merged from mi-var-cmd.exp. --- gdb/testsuite/gdb.mi/mi-var-cmd.exp | 666 ---------------------------------- gdb/testsuite/gdb.mi/mi2-var-cmd.exp | 146 +++++++- 2 files changed, 141 insertions(+), 671 deletions(-) delete mode 100644 gdb/testsuite/gdb.mi/mi-var-cmd.exp diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp deleted file mode 100644 index 4c560a7..0000000 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ /dev/null @@ -1,666 +0,0 @@ -# Copyright 1999-2002, 2004-2005, 2007-2012 Free Software Foundation, -# Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can create, update, delete variables. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile var-cmd.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-var-cmd.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - - -##### ##### -# # -# Variable Creation tests # -# # -##### ##### - -# Test: c_variable-1.1 -# Desc: Create global variable - -mi_create_varobj "global_simple" "global_simple" "create global variable" - -# Test: c_variable-1.2 -# Desc: Create non-existent variable - -mi_gdb_test "112-var-create bogus_unknown_variable * bogus_unknown_variable" \ - "112\\^error,msg=\"-var-create: unable to create variable object\"" \ - "create non-existent variable" - -# Test: c_variable-1.3 -# Desc: Create out of scope variable - -mi_gdb_test "113-var-create argc * argc" \ - "113\\^error,msg=\"-var-create: unable to create variable object\"" \ - "create out of scope variable" - -mi_runto do_locals_tests - -set line_dlt_first_real [gdb_get_line_number "linteger = 1234;"] - -mi_continue_to_line $line_dlt_first_real "step to real start of do_locals_test" - - -# Test: c_variable-1.4 -# Desc: create local variables - -mi_create_varobj_checked linteger linteger int "create local variable linteger" - -mi_create_varobj_checked lpinteger lpinteger {int \*} "create local variable lpinteger" - -mi_create_varobj_checked lcharacter lcharacter\[0\] char "create local variable lcharacter" - -mi_create_varobj_checked lpcharacter lpcharacter {char \*} "create local variable lpcharacter" - -mi_create_varobj_checked llong llong "long int" "create local variable llong" - -mi_create_varobj_checked lplong lplong {long int \*} "create local variable lplong" - -mi_create_varobj_checked lfloat lfloat float "create local variable lfloat" - -mi_create_varobj_checked lpfloat lpfloat {float \*} "create local variable lpfloat" - -mi_create_varobj_checked ldouble ldouble double "create local variable ldouble" - -mi_create_varobj_checked lpdouble lpdouble {double \*} "create local variable lpdouble" - -mi_create_varobj_checked lsimple lsimple "struct _simple_struct" "create local variable lsimple" - -mi_create_varobj_checked lpsimple lpsimple {struct _simple_struct \*} "create local variable lpsimple" - -mi_create_varobj_checked func func {void \(\*\)\((void|)\)} "create local variable func" - -# Test: c_variable-1.5 -# Desc: create lsimple.character -mi_create_varobj_checked lsimple.character lsimple.character "char" \ - "create lsimple.character" - -# Test: c_variable-1.6 -# Desc: create lpsimple->integer -mi_create_varobj_checked lsimple->integer lsimple->integer "int" \ - "create lsimple->integer" - -# Test: c_variable-1.7 -# Desc: create lsimple.integer -mi_create_varobj_checked lsimple.integer lsimple.integer "int" \ - "create lsimple.integer" - - -# Test: c_variable-1.9 -# Desc: create type name -# Type names (like int, long, etc..) are all proper expressions to gdb. -# make sure variable code does not allow users to create variables, though. -mi_gdb_test "-var-create int * int" \ - "&\"Attempt to use a type name as an expression.\\\\n\".*\\^error,msg=\"-var-create: unable to create variable object\"" \ - "create int" - - -##### ##### -# # -# Value changed tests # -# # -##### ##### - -# Test: c_variable-2.1 -# Desc: check whether values changed at do_block_tests -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\\\]" \ - "update all vars" - -# Step over "linteger = 1234;" -set line_dlt_linteger [gdb_get_line_number "lpinteger = &linteger;"] -mi_step_to "do_locals_tests" "" "var-cmd.c" $line_dlt_linteger "step at do_locals_test" - -# Test: c_variable-2.2 -# Desc: check whether only linteger changed values -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: linteger changed" - -# Step over "lpinteger = &linteger;" -mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 1] "step at do_locals_tests (2)" - -# Test: c_variable-2.3 -# Desc: check whether only lpinteger changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: lpinteger changed" - -# Step over "lcharacter = 'a';" -mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 2] "step at do_locals_tests (3)" - -# Test: c_variable-2.4 -# Desc: check whether only lcharacter changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: lcharacter changed" - -# Step over "lpcharacter = &lcharacter;" -mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 3] "step at do_locals_tests (4)" - -# Test: c_variable-2.5 -# Desc: check whether only lpcharacter changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: lpcharacter changed" - - -# Step over: -# llong = 2121L; -# lplong = &llong; -# lfloat = 2.1; -# lpfloat = &lfloat; -# ldouble = 2.718281828459045; -# lpdouble = &ldouble; -# lsimple.integer = 1234; -# lsimple.unsigned_integer = 255; -# lsimple.character = 'a'; - -mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" [expr $line_dlt_linteger + 12] "" "step at do_locals_tests (5)" - -# Test: c_variable-2.6 -# Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer, -# lsimple.unsigned_character lsimple.integer lsimple.character changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lpdouble\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"ldouble\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lpfloat\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lfloat\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lplong\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"llong\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: many changed" - -# Step over: -# lsimple.signed_character = 21; -# lsimple.char_ptr = &lcharacter; -# lpsimple = &lsimple; -# func = nothing; - -set line_dlt_4321 [gdb_get_line_number "linteger = 4321;"] - -mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" $line_dlt_4321 "" "step at do_locals_tests (6)" - -# Test: c_variable-2.7 -# Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"func\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lpsimple\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: func and lpsimple changed" - -# Step over -# linteger = 4321; -# lcharacter = 'b'; -# llong = 1212L; -# lfloat = 1.2; -# ldouble = 5.498548281828172; -# lsimple.integer = 255; -# lsimple.unsigned_integer = 4321; -# lsimple.character = 'b'; - -mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" [expr $line_dlt_4321 + 8] "" "step at do_locals_tests (7)" - -# Test: c_variable-2.8 -# Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer, -# lpsimple.integer lsimple.character changed -# Note: this test also checks that lpsimple->integer and lsimple.integer have -# changed (they are the same) -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"ldouble\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lfloat\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"llong\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: lsimple and others changed" - - -### -# -# Test assignment to variables. More tests on assignment are in other files. -# -### -mi_gdb_test "-var-assign global_simple 0" \ - "\\^error,msg=\"-var-assign: Variable object is not editable\"" \ - "assign to global_simple" - -mi_gdb_test "-var-assign linteger 3333" \ - "\\^done,value=\"3333\"" \ - "assign to linteger" - -# Allow lpcharacter to update, optionally. Because it points to a -# char variable instead of a zero-terminated string, if linteger is -# directly after it in memory the printed characters may appear to -# change. -set lpchar_update "\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\}," -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[($lpchar_update)?\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: linteger changed after assign" - -mi_gdb_test "-var-assign linteger 3333" \ - "\\^done,value=\"3333\"" \ - "assign to linteger again, same value" - -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\\\]" \ - "update all vars: linteger not changed after same assign" - -mi_gdb_test "-var-evaluate-expression linteger" \ - "\\^done,value=\"3333\"" \ - "eval linteger" - -mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \ - "\\^done,value=\"$hex\"" \ - "assign to lpinteger" - -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: lpinteger changed after assign" - -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\\\]" \ - "update all vars: no changes on second update" - -mi_gdb_test "-var-evaluate-expression lpinteger" \ - "\\^done,value=\"$hex\"" \ - "eval lpinteger" - -# reset the values to the original ones so that the rest of the file doesn't suffer. - -mi_gdb_test "-var-assign linteger 4321" \ - "\\^done,value=\"4321\"" \ - "assign to linteger" - -mi_gdb_test "-var-assign lpinteger &linteger" \ - "\\^done,value=\"$hex\"" \ - "assign to lpinteger" - -mi_gdb_test "-var-assign lcharacter 'z'" \ - "\\^done,value=\"122 'z'\"" \ - "assign to lcharacter" - -mi_gdb_test "-var-evaluate-expression lcharacter" \ - "\\^done,value=\"122 'z'\"" \ - "eval lcharacter" - -mi_gdb_test "-var-assign llong 1313L" \ - "\\^done,value=\"1313\"" \ - "assign to llong" -mi_gdb_test "-var-evaluate-expression llong" \ - "\\^done,value=\"1313\"" \ - "eval llong" -mi_gdb_test "-var-assign llong 1212L" \ - "\\^done,value=\"1212\"" \ - "assign to llong" - -mi_gdb_test "-var-assign lplong &llong+4" \ - "\\^done,value=\"$hex\"" \ - "assign to lplong" -mi_gdb_test "-var-evaluate-expression lplong" \ - "\\^done,value=\"$hex\"" \ - "eval lplong" -mi_gdb_test "-var-assign lplong &llong" \ - "\\^done,value=\"$hex\"" \ - "assign to lplong" - -mi_gdb_test "-var-assign lfloat 3.4567" \ - "\\^done,value=\"3.45.*\"" \ - "assign to lfloat" -mi_gdb_test "-var-evaluate-expression lfloat" \ - "\\^done,value=\"3.45.*\"" \ - "eval lfloat" -mi_gdb_test "-var-assign lfloat 1.2345" \ - "\\^done,value=\"1.23.*\"" \ - "assign to lfloat" - -mi_gdb_test "-var-assign lpfloat &lfloat+4" \ - "\\^done,value=\"$hex\"" \ - "assign to lpfloat" - -mi_gdb_test "-var-assign ldouble 5.333318284590435" \ - "\\^done,value=\"5.333318284590435\"" \ - "assign to ldouble" - -mi_gdb_test "-var-assign func do_block_tests" \ - "\\^done,value=\"$hex <do_block_tests>\"" \ - "assign to func" - -mi_gdb_test "-var-assign lsimple.character 'd'" \ - "\\^done,value=\"100 'd'\"" \ - "assign to lsimple.character" - -mi_gdb_test "-var-assign lsimple->integer 222" \ - "\\^done,value=\"222\"" \ - "assign to lsimple->integer" - -mi_gdb_test "-var-assign lsimple.integer 333" \ - "\\^done,value=\"333\"" \ - "assign to lsimple.integer" - -mi_gdb_test "-var-update *" \ - "\\^done,changelist=.*" \ - "var update" - -# Check that assignment of function and array values -# promotes the assigned value to function pointer/data -# pointer before comparing with the existing value, -# and does not incorrectly make the value as changed. -mi_gdb_test "-var-assign func do_block_tests" \ - "\\^done,value=\"$hex <do_block_tests>\"" \ - "assign same value to func" - -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\\\]" \ - "assign same value to func (update)" - -mi_gdb_test "-var-create array_ptr * array_ptr" \ - "\\^done,name=\"array_ptr\",numchild=\"1\",value=\"$hex <array>\",type=\"int \\*\",has_more=\"0\"" \ - "create global variable array_ptr" - -mi_gdb_test "-var-assign array_ptr array2" \ - "\\^done,value=\"$hex <array2>\"" \ - "assign array to pointer" - -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"array_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "assign array to pointer (update)" - -mi_gdb_test "-var-assign array_ptr array2" \ - "\\^done,value=\"$hex <array2>\"" \ - "assign same array to pointer" - -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\\\]" \ - "assign same array to pointer (update)" - - -###### -# End of assign tests -##### - -set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"] - -mi_continue_to subroutine1 - -# Test: c_variable-2.10 -# Desc: create variable for locals i,l in subroutine1 -mi_create_varobj_checked i i int "create i" - -mi_create_varobj_checked l l {long int \*} "create l" - -# Test: c_variable-2.11 -# Desc: create do_locals_tests local in subroutine1 -mi_gdb_test "-var-create linteger * linteger" \ - "\\^error,msg=\"-var-create: unable to create variable object\"" \ - "create linteger" - -mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" [expr $line_subroutine1_body + 1] "step at subroutine1" - -# Test: c_variable-2.12 -# Desc: change global_simple.integer -# Note: This also tests whether we are reporting changes in structs properly. -# gdb normally would say that global_simple has changed, but we -# special case that, since it is not what a human expects to -# see. - -setup_xfail *-*-* -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{FIXME: WHAT IS CORRECT HERE\}" \ - "update all vars: changed FIXME" -clear_xfail *-*-* - -mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" [expr $line_subroutine1_body + 2] "step at subroutine1 (2)" - -# Test: c_variable-2.13 -# Desc: change subroutine1 local i -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"i\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: i changed" - -mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" [expr $line_subroutine1_body + 3] "step at subroutine1 (3)" - -# Test: c_variable-2.14 -# Desc: change do_locals_tests local llong -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"llong\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: llong changed" - -set line_dlt_call_subroutine1 [gdb_get_line_number "subroutine1 (linteger, &llong);"] -mi_next_to "do_locals_tests" "" "var-cmd.c" \ - [expr $line_dlt_call_subroutine1 + 1] "next out of subroutine1" - -# Test: c_variable-2.15 -# Desc: check for out of scope subroutine1 locals -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"l\",in_scope=\"false\"\,type_changed=\"false\",has_more=\"0\"},\{name=\"i\",in_scope=\"false\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: all now out of scope" - -# Done with locals/globals tests. Erase all variables -#delete_all_variables -mi_gdb_test "-var-delete global_simple" \ - "\\^done,ndeleted=\"1\"" \ - "delete var" - -mi_gdb_test "-var-delete linteger" \ - "\\^done,ndeleted=\"1\"" \ - "delete var linteger" - -mi_gdb_test "-var-delete lpinteger" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpinteger" - -mi_gdb_test "-var-delete lcharacter" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lcharacter" - -mi_gdb_test "-var-delete lpcharacter" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpcharacter" - -mi_gdb_test "-var-delete llong" \ - "\\^done,ndeleted=\"1\"" \ - "delete var llong" - -mi_gdb_test "-var-delete lplong" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lplong" - -mi_gdb_test "-var-delete lfloat" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lfloat" - -mi_gdb_test "-var-delete lpfloat" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpfloat" - -mi_gdb_test "-var-delete ldouble" \ - "\\^done,ndeleted=\"1\"" \ - "delete var ldouble" - -mi_gdb_test "-var-delete lpdouble" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpdouble" - -mi_gdb_test "-var-delete lsimple" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple" - -mi_gdb_test "-var-delete lpsimple" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpsimple" - -mi_gdb_test "-var-delete func" \ - "\\^done,ndeleted=\"1\"" \ - "delete var func" - -mi_gdb_test "-var-delete lsimple.character" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple.character" - -mi_gdb_test "-var-delete lsimple->integer" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple->integer" - -mi_gdb_test "-var-delete lsimple.integer" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple.integer" - -mi_gdb_test "-var-delete i" \ - "\\^done,ndeleted=\"1\"" \ - "delete var i" - -mi_gdb_test "-var-delete l" \ - "\\^done,ndeleted=\"1\"" \ - "delete var l" - -# Test whether we can follow the name of a variable through multiple -# stack frames. -mi_continue_to do_special_tests - -mi_gdb_test "-var-create selected_a @ a" \ - {\^done,name="selected_a",numchild="0",value=\".*\",type="int".*} \ - "create selected_a" - -mi_continue_to incr_a - -mi_gdb_test "-var-update selected_a" \ - "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"char\",new_num_children=\"0\",has_more=\"0\"\}\\\]" \ - "update selected_a in incr_a" - -mi_next "step a line in incr_a" -mi_next "return from incr_a to do_special_tests" - -mi_gdb_test "-var-update selected_a" \ - "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"int\",new_num_children=\"0\",has_more=\"0\"\}\\\]" \ - "update selected_a in do_special_tests" - -mi_gdb_test "-file-exec-and-symbols ${binfile}" "\\^done" \ - "floating varobj invalidation" - -mi_delete_varobj selected_a "delete selected_a" -mi_delete_varobj array_ptr "delete array_ptr" - -proc set_frozen {varobjs flag} { - foreach v $varobjs { - mi_gdb_test "-var-set-frozen $v $flag" \ - "\\^done" \ - "-var-set-frozen $v $flag" - } -} - -mi_prepare_inline_tests $srcfile -mi_run_inline_test frozen - -mi_run_inline_test bitfield - -# Since the inline test framework does not really work with -# function calls, first to inline tests and then do the reminder -# manually. -mi_run_inline_test floating -set do_at_tests_callee_breakpoint [gdb_get_line_number "breakpoint inside callee"] -mi_gdb_test "-break-insert var-cmd.c:$do_at_tests_callee_breakpoint" ".*" \ - "inside breakpoint inside callee" -mi_execute_to "exec-continue" "breakpoint-hit" do_at_tests_callee "" ".*" ".*" \ - { "" "disp=\"keep\"" } \ - "continue to where i is initialized" - -mi_varobj_update F {F} "update F inside callee" -mi_check_varobj_value F 7 "check F inside callee" - -# Test whether bad varobjs crash GDB. - -# A varobj we fail to read during -var-update should be considered -# out of scope. -mi_gdb_test "-var-create null_ptr * **0" \ - {\^done,name="null_ptr",numchild="0",value=".*",type="int",has_more="0"} \ - "create null_ptr" - -# Allow this to succeed, if address zero is readable, although it -# will not test what it was meant to. Most important is that GDB -# does not crash. -mi_gdb_test "-var-update null_ptr" \ - {\^done,changelist=\[.*\]} \ - "update null_ptr" - -mi_gdb_test "-var-delete null_ptr" \ - "\\^done,ndeleted=\"1\"" \ - "delete null_ptr" - -# When we fail to read a varobj created from a named variable, -# we evaluate its type instead. Make sure that doesn't blow -# up by trying to read it again. We can use _end when not running -# the program to simulate an unreadable variable, if this platform -# provides _end, but cope if it's missing. - -mi_gdb_test "kill" \ - {&"kill\\n".*\^done} \ - "kill program before endvar" - -mi_gdb_test "-var-create endvar * _end" \ - {(\^done,name="endvar",numchild="0",value=".*",type=".*"|&".*unable to.*".*\^error,msg=".*")} \ - "create endvar" - -# Allow this to succeed whether the value is readable, unreadable, or -# missing. Most important is that GDB does not crash. -mi_gdb_test "-var-update endvar" \ - {(\^done,changelist=\[.*\]|^".*".*\^error,msg=".*not found")} \ - "update endvar" - -mi_gdb_test "-var-delete endvar" \ - "\\^done,ndeleted=\"1\"" \ - "delete endvar" - -mi_delete_breakpoints - -mi_runto do_locals_tests - -mi_create_varobj "L" "lsimple" "in-and-out-of-scope: create varobj" -mi_check_varobj_value "L" "{...}" "in-and-out-of-scope: check initial value" - -mi_runto main - -mi_gdb_test "-var-update L" \ - {\^done,changelist=\[{name="L",in_scope="false",type_changed="false",has_more="0"}\]} \ - "in-and-out-of-scope: out of scope now" - -mi_gdb_test "-var-update L" \ - {\^done,changelist=\[]} \ - "in-and-out-of-scope: out of scope now, not changed" - -mi_continue_to do_locals_tests - -mi_gdb_test "-var-update L" \ - {\^done,changelist=\[{name="L",in_scope="true",type_changed="false",has_more="0"}\]} \ - "in-and-out-of-scope: in scope now" - -mi_gdb_test "-var-update L" \ - {\^done,changelist=\[\]} \ - "in-and-out-of-scope: in scope now, not changed" - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-var-cmd.exp b/gdb/testsuite/gdb.mi/mi2-var-cmd.exp index 5af2af8..f849bf0 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-cmd.exp @@ -111,7 +111,7 @@ mi_create_varobj_checked lsimple->integer lsimple->integer "int" \ "create lsimple->integer" # Test: c_variable-1.7 -# Desc: crate lsimple.integer +# Desc: create lsimple.integer mi_create_varobj_checked lsimple.integer lsimple.integer "int" \ "create lsimple.integer" @@ -358,13 +358,50 @@ mi_gdb_test "-var-assign lsimple.integer 333" \ "\\^done,value=\"333\"" \ "assign to lsimple.integer" +mi_gdb_test "-var-update *" \ + "\\^done,changelist=.*" \ + "var update" + +# Check that assignment of function and array values +# promotes the assigned value to function pointer/data +# pointer before comparing with the existing value, +# and does not incorrectly make the value as changed. +mi_gdb_test "-var-assign func do_block_tests" \ + "\\^done,value=\"$hex <do_block_tests>\"" \ + "assign same value to func" + +mi_gdb_test "-var-update *" \ + "\\^done,changelist=\\\[\\\]" \ + "assign same value to func (update)" + +mi_gdb_test "-var-create array_ptr * array_ptr" \ + "\\^done,name=\"array_ptr\",numchild=\"1\",value=\"$hex <array>\",type=\"int \\*\",has_more=\"0\"" \ + "create global variable array_ptr" + +mi_gdb_test "-var-assign array_ptr array2" \ + "\\^done,value=\"$hex <array2>\"" \ + "assign array to pointer" + +mi_gdb_test "-var-update *" \ + "\\^done,changelist=\\\[\{name=\"array_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ + "assign array to pointer (update)" + +mi_gdb_test "-var-assign array_ptr array2" \ + "\\^done,value=\"$hex <array2>\"" \ + "assign same array to pointer" + +mi_gdb_test "-var-update *" \ + "\\^done,changelist=\\\[\\\]" \ + "assign same array to pointer (update)" + + ###### # End of assign tests ##### set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"] -mi_continue_to "subroutine1" +mi_continue_to subroutine1 # Test: c_variable-2.10 # Desc: create variable for locals i,l in subroutine1 @@ -505,13 +542,13 @@ mi_gdb_test "-var-delete l" \ mi_continue_to do_special_tests mi_gdb_test "-var-create selected_a @ a" \ - {\^done,name="selected_a",numchild="0",value=".*",type="int".*} \ + {\^done,name="selected_a",numchild="0",value=\".*\",type="int".*} \ "create selected_a" mi_continue_to incr_a mi_gdb_test "-var-update selected_a" \ - "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"char\",new_num_children=\"0\"\,has_more=\"0\"}\\\]" \ + "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"char\",new_num_children=\"0\",has_more=\"0\"\}\\\]" \ "update selected_a in incr_a" mi_next "step a line in incr_a" @@ -522,8 +559,107 @@ mi_gdb_test "-var-update selected_a" \ "update selected_a in do_special_tests" mi_gdb_test "-file-exec-and-symbols ${binfile}" "\\^done" \ - "floating varobj invalidation" + "floating varobj invalidation" + +mi_delete_varobj selected_a "delete selected_a" +mi_delete_varobj array_ptr "delete array_ptr" + +proc set_frozen {varobjs flag} { + foreach v $varobjs { + mi_gdb_test "-var-set-frozen $v $flag" \ + "\\^done" \ + "-var-set-frozen $v $flag" + } +} + +mi_prepare_inline_tests $srcfile +mi_run_inline_test frozen + +mi_run_inline_test bitfield + +# Since the inline test framework does not really work with +# function calls, first to inline tests and then do the reminder +# manually. +mi_run_inline_test floating +set do_at_tests_callee_breakpoint [gdb_get_line_number "breakpoint inside callee"] +mi_gdb_test "-break-insert var-cmd.c:$do_at_tests_callee_breakpoint" ".*" \ + "inside breakpoint inside callee" +mi_execute_to "exec-continue" "breakpoint-hit" do_at_tests_callee "" ".*" ".*" \ + { "" "disp=\"keep\"" } \ + "continue to where i is initialized" + +mi_varobj_update F {F} "update F inside callee" +mi_check_varobj_value F 7 "check F inside callee" + +# Test whether bad varobjs crash GDB. + +# A varobj we fail to read during -var-update should be considered +# out of scope. +mi_gdb_test "-var-create null_ptr * **0" \ + {\^done,name="null_ptr",numchild="0",value=".*",type="int",has_more="0"} \ + "create null_ptr" + +# Allow this to succeed, if address zero is readable, although it +# will not test what it was meant to. Most important is that GDB +# does not crash. +mi_gdb_test "-var-update null_ptr" \ + {\^done,changelist=\[.*\]} \ + "update null_ptr" + +mi_gdb_test "-var-delete null_ptr" \ + "\\^done,ndeleted=\"1\"" \ + "delete null_ptr" + +# When we fail to read a varobj created from a named variable, +# we evaluate its type instead. Make sure that doesn't blow +# up by trying to read it again. We can use _end when not running +# the program to simulate an unreadable variable, if this platform +# provides _end, but cope if it's missing. + +mi_gdb_test "kill" \ + {&"kill\\n".*\^done} \ + "kill program before endvar" + +mi_gdb_test "-var-create endvar * _end" \ + {(\^done,name="endvar",numchild="0",value=".*",type=".*"|&".*unable to.*".*\^error,msg=".*")} \ + "create endvar" + +# Allow this to succeed whether the value is readable, unreadable, or +# missing. Most important is that GDB does not crash. +mi_gdb_test "-var-update endvar" \ + {(\^done,changelist=\[.*\]|^".*".*\^error,msg=".*not found")} \ + "update endvar" + +mi_gdb_test "-var-delete endvar" \ + "\\^done,ndeleted=\"1\"" \ + "delete endvar" + +mi_delete_breakpoints + +mi_runto do_locals_tests + +mi_create_varobj "L" "lsimple" "in-and-out-of-scope: create varobj" +mi_check_varobj_value "L" "{...}" "in-and-out-of-scope: check initial value" + +mi_runto main + +mi_gdb_test "-var-update L" \ + {\^done,changelist=\[{name="L",in_scope="false",type_changed="false",has_more="0"}\]} \ + "in-and-out-of-scope: out of scope now" + +mi_gdb_test "-var-update L" \ + {\^done,changelist=\[]} \ + "in-and-out-of-scope: out of scope now, not changed" + +mi_continue_to do_locals_tests + +mi_gdb_test "-var-update L" \ + {\^done,changelist=\[{name="L",in_scope="true",type_changed="false",has_more="0"}\]} \ + "in-and-out-of-scope: in scope now" +mi_gdb_test "-var-update L" \ + {\^done,changelist=\[\]} \ + "in-and-out-of-scope: in scope now, not changed" mi_gdb_exit return 0 -- 1.7.7.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 06/11] mi-break.exp. 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi ` (5 preceding siblings ...) 2012-09-28 0:05 ` [PATCH 07/11] mi-var-cmd.exp Yao Qi @ 2012-09-28 0:05 ` Yao Qi 2012-09-28 0:05 ` [PATCH 01/11] Remove mi-FOO.exp which are identical to mi2-FOO.exp Yao Qi ` (4 subsequent siblings) 11 siblings, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-09-28 0:05 UTC (permalink / raw) To: gdb-patches gdb/testsuite: 2012-09-27 Yao Qi <yao@codesourcery.com> * gdb.mi/mi-break.exp: Remove. * gdb.mi/mi2-break.exp: Merged from mi-break.exp. --- gdb/testsuite/gdb.mi/mi-break.exp | 260 ------------------------------------ gdb/testsuite/gdb.mi/mi2-break.exp | 128 ++++++++++++++++-- 2 files changed, 116 insertions(+), 272 deletions(-) delete mode 100644 gdb/testsuite/gdb.mi/mi-break.exp diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp deleted file mode 100644 index 573f484..0000000 --- a/gdb/testsuite/gdb.mi/mi-break.exp +++ /dev/null @@ -1,260 +0,0 @@ -# Copyright 1999, 2001, 2004, 2006-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-break.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -# Locate line numbers in basics.c. -set line_callee4_head [gdb_get_line_number "callee4 ("] -set line_callee4_body [expr $line_callee4_head + 2] -set line_callee3_head [gdb_get_line_number "callee3 ("] -set line_callee3_body [expr $line_callee3_head + 2] -set line_callee2_head [gdb_get_line_number "callee2 ("] -set line_callee2_body [expr $line_callee2_head + 2] -set line_callee1_head [gdb_get_line_number "callee1 ("] -set line_callee1_body [expr $line_callee1_head + 2] -set line_main_head [gdb_get_line_number "main ("] -set line_main_body [expr $line_main_head + 2] -set line_callme_head [gdb_get_line_number "callme ("] -set line_callme_body [expr $line_callme_head + 2] - -set fullname "fullname=\"${fullname_syntax}${srcfile}\"" - -proc test_tbreak_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - global line_callee4_head line_callee4_body - global line_callee3_head line_callee3_body - global line_callee2_head line_callee2_body - global line_callee1_head line_callee1_body - global line_main_head line_main_body - global fullname - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert -t main - # -break-insert -t basics.c:callee2 - # -break-insert -t basics.c:$line_callee3_head - # -break-insert -t srcfile:$line_callee4_head - # -break-list - - mi_create_breakpoint "-t main" 1 del main ".*basics.c" $line_main_body $hex \ - "break-insert -t operation" - - mi_create_breakpoint "-t basics.c:callee2" 2 del callee2 ".*basics.c" $line_callee2_body $hex \ - "insert temp breakpoint at basics.c:callee2" - - mi_create_breakpoint "-t basics.c:$line_callee3_head" 3 del callee3 ".*basics.c" $line_callee3_head $hex \ - "insert temp breakpoint at basics.c:\$line_callee3_head" - - # Getting the quoting right is tricky. That is "\"<file>\":$line_callee4_head" - mi_create_breakpoint "-t \"\\\"${srcfile}\\\":$line_callee4_head\"" 4 del callee4 ".*basics.c" $line_callee4_head $hex \ - "insert temp breakpoint at \"<fullfilename>\":\$line_callee4_head" - - mi_gdb_test "666-break-list" \ - "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\",original-location=\".*\"\}.*\\\]\}" \ - "list of breakpoints" - - mi_gdb_test "777-break-delete" \ - "777\\^done" \ - "delete temp breakpoints" -} - -proc test_rbreak_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - global line_callee4_head line_callee4_body - global line_callee3_head line_callee3_body - global line_callee2_head line_callee2_body - global line_callee1_head line_callee1_body - global line_main_head line_main_body - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert -r main - # -break-insert -r callee2 - # -break-insert -r callee - # -break-insert -r .*llee - # -break-list - - setup_kfail "*-*-*" mi/14270 - mi_gdb_test "122-break-insert -r main" \ - "122\\^done,bkpt=\{number=\"5\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_main_body\"\}" \ - "break-insert -r operation" - - setup_kfail "*-*-*" mi/14270 - mi_gdb_test "133-break-insert -r callee2" \ - "133\\^done,bkpt=\{number=\"6\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\}" \ - "insert breakpoint with regexp callee2" - - setup_kfail "*-*-*" mi/14270 - mi_gdb_test "144-break-insert -r callee" \ - "144\\^done,bkpt=\{number=\"7\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee1_body\"\},bkpt=\{number=\"8\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\},bkpt=\{number=\"9\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee3_body\"\},bkpt=\{number=\"10\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee4_body\"\}" \ - "insert breakpoint with regexp callee" - - setup_kfail "*-*-*" mi/14270 - mi_gdb_test "155-break-insert -r \.\*llee" \ - "155\\^done,bkpt=\{number=\"11\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee1_body\"\},bkpt=\{number=\"12\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\},bkpt=\{number=\"13\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee3_body\"\},bkpt=\{number=\"14\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee4_body\"\}" \ - "insert breakpoint with regexp .*llee" - - setup_kfail "*-*-*" mi/14270 - mi_gdb_test "166-break-list" \ - "1\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \ - "list of breakpoints" - - mi_gdb_test "177-break-delete" \ - "177\\^done" \ - "delete temp breakpoints" -} - -proc test_ignore_count {} { - global mi_gdb_prompt - global line_callme_body - - mi_gdb_test "-break-insert -i 1 callme" \ - "\\^done.*ignore=\"1\".*" \ - "insert breakpoint with ignore count at callme" - - mi_run_cmd - - mi_expect_stop "breakpoint-hit" "callme" "\{name=\"i\",value=\"2\"\}" ".*basics.c" $line_callme_body \ - {"" "disp=\"keep\"" } "run to breakpoint with ignore count" -} - -proc test_error {} { - global mi_gdb_prompt - - mi_gdb_test "-break-insert function_that_does_not_exist" \ - ".*\\^error,msg=\"Function \\\\\"function_that_does_not_exist\\\\\" not defined.\"" \ - "breakpoint at nonexistent function" - - # We used to have a bug whereby -break-insert that failed would not - # clear some event hooks. As result, whenever we evaluate expression - # containing function call, the internal breakpoint created to handle - # function call would be reported, messing up MI output. - mi_gdb_test "-var-create V * return_1()" \ - "\\^done,name=\"V\",numchild=\"0\",value=\"1\",type=\"int\",has_more=\"0\"" \ - "create varobj for function call" - - mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\\\]" \ - "update varobj for function call" -} - -proc test_disabled_creation {} { - global mi_gdb_prompt - global hex - global line_callee2_body - - mi_gdb_test "-break-insert -d basics.c:callee2" \ - "\\^done,bkpt=\{number=\"6\",type=\"breakpoint\",disp=\"keep\",enabled=\"n\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",fullname=\".*\",line=\"$line_callee2_body\",times=\"0\",original-location=\".*\"\}" \ - "test disabled creation" - - mi_gdb_test "-break-delete" \ - "\\^done" \ - "test disabled creation: cleanup" -} - -proc test_breakpoint_commands {} { - global line_callee2_body - global hex - global fullname - - mi_create_breakpoint "basics.c:callee2" 7 keep callee2 ".*basics.c" $line_callee2_body $hex \ - "breakpoint commands: insert breakpoint at basics.c:callee2" - - mi_gdb_test "-break-commands 7 \"print 10\" \"continue\"" \ - "\\^done" \ - "breakpoint commands: set commands" - - mi_gdb_test "-break-info 7" \ - "\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"7\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\",times=\"0\",script=\{\"print 10\",\"continue\"\},original-location=\".*\"\}.*\\\]\}" \ - "breakpoint commands: check that commands are set" - - mi_gdb_test "-break-commands 7" \ - "\\^done" \ - "breakpoint commands: clear commands" - - mi_list_breakpoints [list [list 7 "keep" "callee2" "basics.c" "$line_callee2_body" $hex]] \ - "breakpoint commands: check that commands are cleared" - - mi_run_to_main - - mi_create_breakpoint "basics.c:callee2" 9 keep callee2 ".*basics.c" $line_callee2_body $hex \ - "breakpoint commands: insert breakpoint at basics.c:callee2, again" - - mi_gdb_test "-break-commands 9 \"set \$i=0\" \"while \$i<10\" \"print \$i\" \"set \$i=\$i+1\" \"end\" \"continue\" " \ - "\\^done" \ - "breakpoint commands: set commands" - - mi_send_resuming_command "exec-continue" "breakpoint commands: continue" - - set test "intermediate stop and continue" - gdb_expect { - -re ".*\\\$1 = 0.*\\\$10 = 9.*\\*running" { - pass $test - } - timeout { - fail $test - } - } - - mi_expect_stop "exited-normally" "" "" "" "" "" "test hitting breakpoint with commands" -} - -test_tbreak_creation_and_listing -test_rbreak_creation_and_listing - -test_ignore_count - -test_error - -test_disabled_creation - -test_breakpoint_commands - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-break.exp b/gdb/testsuite/gdb.mi/mi2-break.exp index e1375e2..94bb347 100644 --- a/gdb/testsuite/gdb.mi/mi2-break.exp +++ b/gdb/testsuite/gdb.mi/mi2-break.exp @@ -55,6 +55,8 @@ set line_callee1_head [gdb_get_line_number "callee1 ("] set line_callee1_body [expr $line_callee1_head + 2] set line_main_head [gdb_get_line_number "main ("] set line_main_body [expr $line_main_head + 2] +set line_callme_head [gdb_get_line_number "callme ("] +set line_callme_body [expr $line_callme_head + 2] set fullname "fullname=\"${fullname_syntax}${srcfile}\"" @@ -92,7 +94,7 @@ proc test_tbreak_creation_and_listing {} { "insert temp breakpoint at \"<fullfilename>\":\$line_callee4_head" mi_gdb_test "666-break-list" \ - "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\",original-location=\".*\"\}.*\\\]\}" \ + "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\",original-location=\".*\"\}.*\\\]\}" \ "list of breakpoints" mi_gdb_test "777-break-delete" \ @@ -109,7 +111,6 @@ proc test_rbreak_creation_and_listing {} { global line_callee2_head line_callee2_body global line_callee1_head line_callee1_body global line_main_head line_main_body - global fullname # Insert some breakpoints and list them # Also, disable some so they do not interfere with other tests @@ -120,29 +121,29 @@ proc test_rbreak_creation_and_listing {} { # -break-insert -r .*llee # -break-list - setup_xfail "*-*-*" + setup_kfail "*-*-*" mi/14270 mi_gdb_test "122-break-insert -r main" \ - "122\\^done,bkpt=\{number=\"5\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_main_body\"\}" \ + "122\\^done,bkpt=\{number=\"5\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_main_body\"\}" \ "break-insert -r operation" - setup_xfail "*-*-*" + setup_kfail "*-*-*" mi/14270 mi_gdb_test "133-break-insert -r callee2" \ - "133\\^done,bkpt=\{number=\"6\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\"\}" \ + "133\\^done,bkpt=\{number=\"6\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\}" \ "insert breakpoint with regexp callee2" - setup_xfail "*-*-*" + setup_kfail "*-*-*" mi/14270 mi_gdb_test "144-break-insert -r callee" \ - "144\\^done,bkpt=\{number=\"7\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee1_body\"\},bkpt=\{number=\"8\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\"\},bkpt=\{number=\"9\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee3_body\"\},bkpt=\{number=\"10\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee4_body\"\}" \ + "144\\^done,bkpt=\{number=\"7\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee1_body\"\},bkpt=\{number=\"8\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\},bkpt=\{number=\"9\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee3_body\"\},bkpt=\{number=\"10\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee4_body\"\}" \ "insert breakpoint with regexp callee" - setup_xfail "*-*-*" + setup_kfail "*-*-*" mi/14270 mi_gdb_test "155-break-insert -r \.\*llee" \ - "155\\^done,bkpt=\{number=\"11\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee1_body\"\},bkpt=\{number=\"12\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\"\},bkpt=\{number=\"13\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee3_body\"\},bkpt=\{number=\"14\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee4_body\"\}" \ + "155\\^done,bkpt=\{number=\"11\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee1_body\"\},bkpt=\{number=\"12\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\},bkpt=\{number=\"13\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee3_body\"\},bkpt=\{number=\"14\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee4_body\"\}" \ "insert breakpoint with regexp .*llee" - setup_xfail "*-*-*" + setup_kfail "*-*-*" mi/14270 mi_gdb_test "166-break-list" \ - "1\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \ + "1\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \ "list of breakpoints" mi_gdb_test "177-break-delete" \ @@ -150,8 +151,111 @@ proc test_rbreak_creation_and_listing {} { "delete temp breakpoints" } +proc test_ignore_count {} { + global mi_gdb_prompt + global line_callme_body + + mi_gdb_test "-break-insert -i 1 callme" \ + "\\^done.*ignore=\"1\".*" \ + "insert breakpoint with ignore count at callme" + + mi_run_cmd + + mi_expect_stop "breakpoint-hit" "callme" "\{name=\"i\",value=\"2\"\}" ".*basics.c" $line_callme_body \ + {"" "disp=\"keep\"" } "run to breakpoint with ignore count" +} + +proc test_error {} { + global mi_gdb_prompt + + mi_gdb_test "-break-insert function_that_does_not_exist" \ + ".*\\^error,msg=\"Function \\\\\"function_that_does_not_exist\\\\\" not defined.\"" \ + "breakpoint at nonexistent function" + + # We used to have a bug whereby -break-insert that failed would not + # clear some event hooks. As result, whenever we evaluate expression + # containing function call, the internal breakpoint created to handle + # function call would be reported, messing up MI output. + mi_gdb_test "-var-create V * return_1()" \ + "\\^done,name=\"V\",numchild=\"0\",value=\"1\",type=\"int\",has_more=\"0\"" \ + "create varobj for function call" + + mi_gdb_test "-var-update *" \ + "\\^done,changelist=\\\[\\\]" \ + "update varobj for function call" +} + +proc test_disabled_creation {} { + global mi_gdb_prompt + global hex + global line_callee2_body + + mi_gdb_test "-break-insert -d basics.c:callee2" \ + "\\^done,bkpt=\{number=\"6\",type=\"breakpoint\",disp=\"keep\",enabled=\"n\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",fullname=\".*\",line=\"$line_callee2_body\",times=\"0\",original-location=\".*\"\}" \ + "test disabled creation" + + mi_gdb_test "-break-delete" \ + "\\^done" \ + "test disabled creation: cleanup" +} + +proc test_breakpoint_commands {} { + global line_callee2_body + global hex + global fullname + + mi_create_breakpoint "basics.c:callee2" 7 keep callee2 ".*basics.c" $line_callee2_body $hex \ + "breakpoint commands: insert breakpoint at basics.c:callee2" + + mi_gdb_test "-break-commands 7 \"print 10\" \"continue\"" \ + "\\^done" \ + "breakpoint commands: set commands" + + mi_gdb_test "-break-info 7" \ + "\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"7\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\",times=\"0\",script=\{\"print 10\",\"continue\"\},original-location=\".*\"\}.*\\\]\}" \ + "breakpoint commands: check that commands are set" + + mi_gdb_test "-break-commands 7" \ + "\\^done" \ + "breakpoint commands: clear commands" + + mi_list_breakpoints [list [list 7 "keep" "callee2" "basics.c" "$line_callee2_body" $hex]] \ + "breakpoint commands: check that commands are cleared" + + mi_run_to_main + + mi_create_breakpoint "basics.c:callee2" 9 keep callee2 ".*basics.c" $line_callee2_body $hex \ + "breakpoint commands: insert breakpoint at basics.c:callee2, again" + + mi_gdb_test "-break-commands 9 \"set \$i=0\" \"while \$i<10\" \"print \$i\" \"set \$i=\$i+1\" \"end\" \"continue\" " \ + "\\^done" \ + "breakpoint commands: set commands" + + mi_send_resuming_command "exec-continue" "breakpoint commands: continue" + + set test "intermediate stop and continue" + gdb_expect { + -re ".*\\\$1 = 0.*\\\$10 = 9.*\\*running" { + pass $test + } + timeout { + fail $test + } + } + + mi_expect_stop "exited-normally" "" "" "" "" "" "test hitting breakpoint with commands" +} + test_tbreak_creation_and_listing test_rbreak_creation_and_listing +test_ignore_count + +test_error + +test_disabled_creation + +test_breakpoint_commands + mi_gdb_exit return 0 -- 1.7.7.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 01/11] Remove mi-FOO.exp which are identical to mi2-FOO.exp 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi ` (6 preceding siblings ...) 2012-09-28 0:05 ` [PATCH 06/11] mi-break.exp Yao Qi @ 2012-09-28 0:05 ` Yao Qi 2012-09-28 0:05 ` [PATCH 11/11] mi-syn-frame.exp Yao Qi ` (3 subsequent siblings) 11 siblings, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-09-28 0:05 UTC (permalink / raw) To: gdb-patches gdb/testsuite: 2012-09-27 Yao Qi <yao@codesourcery.com> * gdb.mi/mi-disassemble.exp: Remove. * gdb.mi/mi-eval.exp, gdb.mi/mi-hack-cli.exp: Remove. * gdb.mi/mi-read-memory.exp: Remove. * gdb.mi/mi-regs.exp, gdb.mi/mi-return.exp: Remove. * gdb.mi/mi-simplerun.exp: Remove. * gdb.mi/mi-stepi.exp, gdb.mi/mi-until.exp: Remove. * gdb.mi/mi-watch.exp: Remove. --- gdb/testsuite/gdb.mi/mi-disassemble.exp | 239 ------------------------------- gdb/testsuite/gdb.mi/mi-eval.exp | 61 -------- gdb/testsuite/gdb.mi/mi-hack-cli.exp | 36 ----- gdb/testsuite/gdb.mi/mi-read-memory.exp | 82 ----------- gdb/testsuite/gdb.mi/mi-regs.exp | 121 ---------------- gdb/testsuite/gdb.mi/mi-return.exp | 67 --------- gdb/testsuite/gdb.mi/mi-simplerun.exp | 189 ------------------------ gdb/testsuite/gdb.mi/mi-stepi.exp | 78 ---------- gdb/testsuite/gdb.mi/mi-until.exp | 83 ----------- gdb/testsuite/gdb.mi/mi-watch.exp | 187 ------------------------ 10 files changed, 0 insertions(+), 1143 deletions(-) delete mode 100644 gdb/testsuite/gdb.mi/mi-disassemble.exp delete mode 100644 gdb/testsuite/gdb.mi/mi-eval.exp delete mode 100644 gdb/testsuite/gdb.mi/mi-hack-cli.exp delete mode 100644 gdb/testsuite/gdb.mi/mi-read-memory.exp delete mode 100644 gdb/testsuite/gdb.mi/mi-regs.exp delete mode 100644 gdb/testsuite/gdb.mi/mi-return.exp delete mode 100644 gdb/testsuite/gdb.mi/mi-simplerun.exp delete mode 100644 gdb/testsuite/gdb.mi/mi-stepi.exp delete mode 100644 gdb/testsuite/gdb.mi/mi-until.exp delete mode 100644 gdb/testsuite/gdb.mi/mi-watch.exp diff --git a/gdb/testsuite/gdb.mi/mi-disassemble.exp b/gdb/testsuite/gdb.mi/mi-disassemble.exp deleted file mode 100644 index 377ffde..0000000 --- a/gdb/testsuite/gdb.mi/mi-disassemble.exp +++ /dev/null @@ -1,239 +0,0 @@ -# Copyright 1999-2002, 2004-2005, 2007-2012 Free Software Foundation, -# Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test Machine interface (MI) operations for disassembly. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-disassemble.exp - return -1 -} - -proc test_disassembly_only {} { - global mi_gdb_prompt - global hex - global decimal - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Test disassembly more only for the current function. - # Tests: - # -data-disassemble -s $pc -e "$pc+8" -- 0 - # -data-disassembly -f basics.c -l $line_main_body -- 0 - - mi_gdb_test "print/x \$pc" "" "" - mi_gdb_test "111-data-disassemble -s \$pc -e \"\$pc + 12\" -- 0" \ - "111\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\},\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\]" \ - "data-disassemble from pc to pc+12 assembly only" - - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -- 0" \ - "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \ - "data-disassemble file & line, assembly only" -} - -proc test_disassembly_with_opcodes {} { - global mi_gdb_prompt - global hex - global decimal - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Test disassembly with opcodes for the current function. - # Tests: - # -data-disassemble -s $pc -e "$pc+8" -- 2 - # -data-disassembly -f basics.c -l $line_main_body -- 2 - - mi_gdb_test "print/x \$pc" "" "" - mi_gdb_test "111-data-disassemble -s \$pc -e \"\$pc + 12\" -- 2" \ - "111\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\},\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}.*\]" \ - "data-disassemble from pc to pc+12 assembly with opcodes" - - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -- 2" \ - "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",opcodes=\".*\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}\\\]" \ - "data-disassemble file & line, assembly with opcodes" -} - -proc test_disassembly_lines_limit {} { - global mi_gdb_prompt - global hex - global decimal - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Test disassembly more only for the current function. - # Tests: - # -data-disassembly -f basics.c -l $line_main_body -n 20 -- 0 - # -data-disassembly -f basics.c -l $line_main_body -n 0 -- 0 - # -data-disassembly -f basics.c -l $line_main_body -n 50 -- 0 - - mi_gdb_test "print/x \$pc" "" "" - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 20 -- 0" \ - "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \ - "data-disassemble file, line, number assembly only" - - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 0 -- 0" \ - "222\\^done,asm_insns=\\\[\\\]" \ - "data-disassemble file, line, number (zero lines) assembly only" - - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 50 -- 0" \ - "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \ - "data-disassemble file, line, number (more than main lines) assembly only" -} - - -proc test_disassembly_mixed {} { - global mi_gdb_prompt - global hex - global decimal - - set line_callee2_head [gdb_get_line_number "callee2 ("] - set line_callee2_open_brace [expr $line_callee2_head + 1] - - # Test disassembly more only for the current function. - # Tests: - # -data-disassembly -f basics.c -l $line_callee2_open_brace -- 1 - # -data-disassembly -s $pc -e "$pc+8" -- 1 - - mi_gdb_test "002-data-disassemble -f basics.c -l $line_callee2_open_brace -- 1" \ - "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_callee2_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \ - "data-disassemble file, line assembly mixed" - - # - # In mixed mode, the lowest level of granularity is the source line. - # So we are going to get the disassembly for the source line at - # which we are now, even if we have specified that the range is only 2 insns. - # - mi_gdb_test "003-data-disassemble -s \$pc -e \"\$pc+4\" -- 1" \ - "003\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \ - "data-disassemble range assembly mixed" -} - -proc test_disassembly_mixed_with_opcodes {} { - global mi_gdb_prompt - global hex - global decimal - - set line_callee2_head [gdb_get_line_number "callee2 ("] - set line_callee2_open_brace [expr $line_callee2_head + 1] - - # Test disassembly mixed with opcodes for the current function. - # Tests: - # -data-disassembly -f basics.c -l $line_callee2_open_brace -- 3 - # -data-disassembly -s $pc -e "$pc+8" -- 3 - - mi_gdb_test "002-data-disassemble -f basics.c -l $line_callee2_open_brace -- 3" \ - "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_callee2_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",opcodes=\".*\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}\\\]\}\\\]" \ - "data-disassemble file, line assembly mixed with opcodes" - - # - # In mixed mode, the lowest level of granularity is the source line. - # So we are going to get the disassembly for the source line at - # which we are now, even if we have specified that the range is only 2 insns. - # - mi_gdb_test "003-data-disassemble -s \$pc -e \"\$pc+4\" -- 3" \ - "003\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}.*\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}\\\]\}\\\]" \ - "data-disassemble range assembly mixed with opcodes" -} - -proc test_disassembly_mixed_lines_limit {} { - global mi_gdb_prompt - global hex - global decimal - - set line_main_head [gdb_get_line_number "main ("] - set line_main_open_brace [expr $line_main_head + 1] - set line_main_body [expr $line_main_head + 2] - - # Test disassembly more only for the current function. - # Tests: - # -data-disassembly -f basics.c -l $line_main_body -n 20 -- 1 - # -data-disassembly -f basics.c -l $line_main_body -n 0 -- 1 - # -data-disassembly -f basics.c -l $line_main_body -n 50 -- 1 - - mi_gdb_test "print/x \$pc" "" "" - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 20 -- 1" \ - "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \ - "data-disassemble file, line, number assembly mixed" - - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 0 -- 1" \ - "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_main_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\\\]\}\\\]" \ - "data-disassemble file, line, number (zero lines) assembly mixed" - - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 50 -- 1" \ - "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\}.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \ - "data-disassemble file, line, number (more than main lines) assembly mixed" -} - -proc test_disassembly_bogus_args {} { - global mi_gdb_prompt - global hex - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Test that bogus input to disassembly command is rejected. - # Tests: - # -data-disassembly -f foo -l abc -n 0 -- 0 - # -data-disassembly -s foo -e bar -- 0 - # -data-disassembly -s $pc -f basics.c -- 0 - # -data-disassembly -f basics.c -l 32 -- 9 - - mi_gdb_test "123-data-disassemble -f foo -l abc -n 0 -- 0" \ - "123\\^error,msg=\"-data-disassemble: Invalid filename.\"" \ - "data-disassemble bogus filename" - - mi_gdb_test "321-data-disassemble -s foo -e bar -- 0" \ - "321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \ - "data-disassemble bogus address" - - mi_gdb_test "456-data-disassemble -s \$pc -f basics.c -- 0" \ - "456\\^error,msg=\"-data-disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. \\| .-s startaddr -e endaddr.\\) .--. mode.\"" \ - "data-disassemble mix different args" - - mi_gdb_test "789-data-disassemble -f basics.c -l $line_main_body -- 9" \ - "789\\^error,msg=\"-data-disassemble: Mode argument must be 0, 1, 2, or 3.\"" \ - "data-disassemble wrong mode arg" - -} - -mi_run_to_main -test_disassembly_only -test_disassembly_with_opcodes -test_disassembly_mixed -test_disassembly_mixed_with_opcodes -test_disassembly_bogus_args -test_disassembly_lines_limit -test_disassembly_mixed_lines_limit - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi-eval.exp b/gdb/testsuite/gdb.mi/mi-eval.exp deleted file mode 100644 index ea20369..0000000 --- a/gdb/testsuite/gdb.mi/mi-eval.exp +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 1999-2002, 2004, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test essential Machine interface (MI) operations -# -# Verify -data-evaluate-expression. There are really minimal tests. - -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-eval.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -set line_callee4_head [gdb_get_line_number "callee4 ("] -set line_callee4_body [expr $line_callee4_head + 2] - -mi_runto callee4 -mi_next_to "callee4" "" "basics.c" [expr $line_callee4_body + 1] "next at callee4" - -mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A" - -mi_gdb_test "311-data-evaluate-expression &A" "311\\^done,value=\"$hex\"" "eval &A" - -mi_gdb_test "411-data-evaluate-expression A+3" "411\\^done,value=\"4\"" "eval A+3" - -mi_gdb_test "511-data-evaluate-expression \"A + 3\"" "511\\^done,value=\"4\"" "eval A + 3" - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi-hack-cli.exp b/gdb/testsuite/gdb.mi/mi-hack-cli.exp deleted file mode 100644 index 6e35f14..0000000 --- a/gdb/testsuite/gdb.mi/mi-hack-cli.exp +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 1999, 2001, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - - -# Some basic checks for the CLI. - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -mi_gdb_test "show architecture" \ - "&\"show architecture\\\\n\"\r\n~\"The target architecture.*\"\r\n\\^done" \ - "show architecture" - -mi_gdb_test "47show architecture" \ - "&\"show architecture\\\\n\"\r\n~\"The target architecture.*\"\r\n47\\^done" \ - "47show architecture" - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi-read-memory.exp b/gdb/testsuite/gdb.mi/mi-read-memory.exp deleted file mode 100644 index 5d154ba..0000000 --- a/gdb/testsuite/gdb.mi/mi-read-memory.exp +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright 1999-2002, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# test basic Machine interface (MI) operations -# -# Verify that, using the MI, we can load a program and do -# other basic things that are used by all test files through mi_gdb_exit, -# mi_gdb_start, mi_delete_breakpoints, mi_gdb_reinitialize_dir and -# mi_gdb_load, so we can safely use those. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but the command syntax and correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-read-memory.exp - return -1 -} - - -mi_run_to_main -mi_next_to "main" "" "mi-read-memory.c" "20" "next at main" - -mi_gdb_test "1-data-read-memory" \ - "1\\^error,msg=\".*\"" \ - "no arguments" - - -mi_gdb_test "2-data-read-memory bytes x 1 3 2" \ - "2\\^done,addr=\"$hex\",nr-bytes=\"6\",total-bytes=\"6\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x00\",\"0x01\"\\\]},{addr=\"$hex\",data=\\\[\"0x02\",\"0x03\"\\\]},{addr=\"$hex\",data=\\\[\"0x04\",\"0x05\"\\\]}\\\]" \ - "3x2, one byte" - - -mi_gdb_test "9-data-read-memory -o -6 -- -0+bytes+6 x 1 3 2" \ - "9\\^done,addr=\"$hex\",nr-bytes=\"6\",total-bytes=\"6\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x00\",\"0x01\"\\\]},{addr=\"$hex\",data=\\\[\"0x02\",\"0x03\"\\\]},{addr=\"$hex\",data=\\\[\"0x04\",\"0x05\"\\\]}\\\]" \ - "3x2, one byte offset by -6" - - -mi_gdb_test "3-data-read-memory \"(shorts + 128)\" x 2 1 2" \ - "3\\^done,addr=\"$hex\",nr-bytes=\"4\",total-bytes=\"4\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x0100\",\"0x0102\"\\\]}\\\]" \ - "expression in quotes" - - -mi_gdb_test "4-data-read-memory bytes+16 x 1 8 4 x" \ - "4\\^done,addr=\"$hex\",nr-bytes=\"32\",total-bytes=\"32\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x10\",\"0x11\",\"0x12\",\"0x13\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x14\",\"0x15\",\"0x16\",\"0x17\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x18\",\"0x19\",\"0x1a\",\"0x1b\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x1c\",\"0x1d\",\"0x1e\",\"0x1f\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x20\",\"0x21\",\"0x22\",\"0x23\"\\\],ascii=\" !\\\\\"#\"},{addr=\"$hex\",data=\\\[\"0x24\",\"0x25\",\"0x26\",\"0x27\"\\\],ascii=\"\\$%&'\"},{addr=\"$hex\",data=\\\[\"0x28\",\"0x29\",\"0x2a\",\"0x2b\"\\\],ascii=\"().+\"},{addr=\"$hex\",data=\\\[\"0x2c\",\"0x2d\",\"0x2e\",\"0x2f\"\\\],ascii=\",-\./\"}\\\]" \ - "ascii and data" - - -mi_gdb_test "5-data-read-memory shorts+64 d 2 1 1" \ - "5\\^done,addr=\"$hex\",nr-bytes=\"2\",total-bytes=\"2\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"128\"\\\]}\\\]" \ - "decimal" - -mi_gdb_test "6-data-read-memory shorts+64 o 2 1 1" \ - "6\\^done,addr=\"$hex\",nr-bytes=\"2\",total-bytes=\"2\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0200\"\\\]}\\\]" \ - "octal" - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi-regs.exp b/gdb/testsuite/gdb.mi/mi-regs.exp deleted file mode 100644 index 988f0c5..0000000 --- a/gdb/testsuite/gdb.mi/mi-regs.exp +++ /dev/null @@ -1,121 +0,0 @@ -# Copyright 1999-2002, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and look at registers. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-regs.exp - return -1 -} - -proc sparc_register_tests_no_exec { } { - # Test the generic IDT chip. - mi_gdb_test "111-data-list-register-values" \ - ".*111\\^error,msg=\"-data-list-register-values: Usage: -data-list-register-values <format> \\\[<regnum1>...<regnumN>\\\]\"" \ - "wrong arguments" - - mi_gdb_test "111-data-list-register-values x" \ - ".*111\\^error,msg=\"No registers\.\"" \ - "no executable" -} - -# These tests exercise IDT-specific MIPS registers for several -# different processor models. - -# This should detect the actual processor in use and change -# the expected results appropriately. FIXME - -proc sparc_register_tests { } { - global hex - global decimal - set octal "\[0-7\]+" - set binary "\[0-1\]+" - set float "\\-?((\[0-9\]+(\\.\[0-9\]+)?(e\[-+\]\[0-9\]+)?)|(nan\\($hex\\)))" - set float2 "\\-?\[0-9\]+" - - mi_gdb_test "111-data-list-register-names" \ - "111\\^done,register-names=\\\[\"g0\",\"g1\",\"g2\",\"g3\",\"g4\",\"g5\",\"g6\",\"g7\",\"o0\",\"o1\",\"o2\",\"o3\",\"o4\",\"o5\",\"sp\",\"o7\",\"l0\",\"l1\",\"l2\",\"l3\",\"l4\",\"l5\",\"l6\",\"l7\",\"i0\",\"i1\",\"i2\",\"i3\",\"i4\",\"i5\",\"fp\",\"i7\",\"f0\",\"f1\",\"f2\",\"f3\",\"f4\",\"f5\",\"f6\",\"f7\",\"f8\",\"f9\",\"f10\",\"f11\",\"f12\",\"f13\",\"f14\",\"f15\",\"f16\",\"f17\",\"f18\",\"f19\",\"f20\",\"f21\",\"f22\",\"f23\",\"f24\",\"f25\",\"f26\",\"f27\",\"f28\",\"f29\",\"f30\",\"f31\",\"y\",\"psr\",\"wim\",\"tbr\",\"pc\",\"npc\",\"fsr\",\"csr\",\"d0\",\"d2\",\"d4\",\"d6\",\"d8\",\"d10\",\"d12\",\"d14\",\"d16\",\"d18\",\"d20\",\"d22\",\"d24\",\"d26\",\"d28\",\"d30\"\\\]" \ - "list register names" - - mi_gdb_test "222-data-list-register-values x" \ - "222\\^done,register-values=\\\[\{number=\"0\",value=\"$hex\"\}.*\{number=\"87\",value=\"$hex\"\}\\\]" \ - "register values x" - - mi_gdb_test "333-data-list-register-values f" \ - "333\\^done,register-values=\\\[\{number=\"0\",value=\"$float\"\},\{number=\"1\",value=\"$float\"\},.*\{number=\"87\",value=\"$float\"\}\\\]" \ - "register values f" - - mi_gdb_test "444-data-list-register-values d" \ - "444\\^done,register-values=\\\[\{number=\"0\",value=\"-?$decimal\"\}.*\{number=\"87\",value=\"-?$decimal\"\}\\\]" \ - "register values d" - - mi_gdb_test "555-data-list-register-values o" \ - "555\\^done,register-values=\\\[\{number=\"0\",value=\"$octal\"\}.*\{number=\"87\",value=\"$octal\"\}\\\]" \ - "register values o" - - mi_gdb_test "666-data-list-register-values t" \ - "666\\^done,register-values=\\\[\{number=\"0\",value=\"$binary\"\}.*\{number=\"87\",value=\"$binary\"\}\\\]" \ - "register values t" - - # On the sparc, registers 0-31 are int, 32-63 float, 64-71 int, 72-87 float - - mi_gdb_test "777-data-list-register-values N" \ - "777\\^done,register-values=\\\[\{number=\"0\",value=\"-?$decimal\"\}.*\{number=\"31\",value=\"-?$decimal\"\},\{number=\"32\",value=\"$float\"\}.*\{number=\"63\",value=\"$float\"\},\{number=\"64\",value=\"-?$decimal\"\}.*\{number=\"71\",value=\"-?$decimal\"\},\{number=\"72\",value=\"$float\"\}.*\{number=\"87\",value=\"$float\"\}\\\]" \ - "register values N" - - mi_gdb_test "888-data-list-register-values r" \ - "888\\^done,register-values=\\\[\{number=\"0\",value=\"$hex\"\}.*\{number=\"87\",value=\"$hex\"\}\\\]" \ - "register values r" - - mi_gdb_test "999-data-list-register-names 68 69 70 71" \ - "999\\^done,register-names=\\\[\"pc\",\"npc\",\"fsr\",\"csr\"\\\]" \ - "list names of some regs" - - mi_gdb_test "001-data-list-register-values x 68 69 70 71" \ - "001\\^done,register-values=\\\[\{number=\"68\",value=\"$hex\"\},\{number=\"69\",value=\"$hex\"\},\{number=\"70\",value=\"$hex\"\},\{number=\"71\",value=\"$hex\"\}\\\]" \ - "list values of some regs" - - mi_gdb_test "002-data-list-changed-registers" \ - "002\\^done,changed-registers=\\\[(\"${decimal}\"(,\"${decimal}\")*)?\\\]" \ - "list changed registers" -} - -if [istarget "sparc-*-*"] then { - sparc_register_tests_no_exec - mi_run_to_main - sparc_register_tests -} else { - verbose "mi-regs.exp tests ignored for this target" -} - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi-return.exp b/gdb/testsuite/gdb.mi/mi-return.exp deleted file mode 100644 index e6b4e61..0000000 --- a/gdb/testsuite/gdb.mi/mi-return.exp +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright 1999-2002, 2004-2005, 2007-2012 Free Software Foundation, -# Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test Machine interface (MI) operations -# Verify that, using the MI, we can run a simple program and perform -# exec-return. - -# The goal is not to -# test gdb functionality, which is done by other tests, but to verify -# the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-return.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - - -proc test_return_simple {} { - global mi_gdb_prompt - global hex fullname_syntax srcfile - - set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_call [expr $line_callee3_head + 2] - set line_callee3_close_brace [expr $line_callee3_head + 3] - - mi_gdb_test "111-exec-return" "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\"\}" "return from callee4 now" -} - -mi_runto callee4 - -mi_gdb_test "205-break-delete" \ - "205\\^done.*" \ - "delete all breakpoints" - -test_return_simple - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi-simplerun.exp b/gdb/testsuite/gdb.mi/mi-simplerun.exp deleted file mode 100644 index a20d088..0000000 --- a/gdb/testsuite/gdb.mi/mi-simplerun.exp +++ /dev/null @@ -1,189 +0,0 @@ -# Copyright 1999-2002, 2004, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-simplerun.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_breakpoints_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - set line_callee4_head [gdb_get_line_number "callee4 ("] - set line_callee4_body [expr $line_callee4_head + 2] - set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_body [expr $line_callee3_head + 2] - set line_callee2_head [gdb_get_line_number "callee2 ("] - set line_callee2_body [expr $line_callee2_head + 2] - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert - # -break-list - # -break-disable - # -break-info - - mi_create_breakpoint "main" 1 keep main ".*basics.c" $line_main_body $hex \ - "break-insert operation" - - mi_create_breakpoint "basics.c:callee2" 2 keep callee2 ".*basics.c" $line_callee2_body $hex \ - "insert breakpoint at basics.c:callee2" - - mi_create_breakpoint "basics.c:$line_callee3_head" 3 keep callee3 ".*basics.c" $line_callee3_head $hex \ - "insert breakpoint at basics.c:\$line_callee3_head" - - mi_create_breakpoint "\"\\\"${srcfile}\\\":$line_callee4_head\"" 4 keep callee4 ".*basics.c" $line_callee4_head $hex \ - "insert breakpoint at \"<fullfilename>\":\$line_callee4_head" - - mi_gdb_test "204-break-list" \ - "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\",original-location=\".*\"\},.*\}\\\]\}" \ - "list of breakpoints" - - mi_gdb_test "205-break-disable 2 3 4" \ - "205\\^done.*" \ - "disabling of breakpoints" - - mi_gdb_test "206-break-info 2" \ - "206\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"2\",.*,enabled=\"n\",.*\}\\\]\}" \ - "list of breakpoints, 16 disabled" -} - -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Run the program without args, then specify srgs and rerun the program - # Tests: - # -exec-run - # -gdb-set - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" "$line_main_body" \ - { "" "disp=\"keep\"" } "run to main" -} - -proc test_controlled_execution {} { - global mi_gdb_prompt - global hex - - set line_callee4_head [gdb_get_line_number "callee4 ("] - set line_callee4_body [expr $line_callee4_head + 2] - set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_call [expr $line_callee3_head + 2] - set line_callee3_close_brace [expr $line_callee3_head + 3] - set line_callee1_head [gdb_get_line_number "callee1 ("] - set line_callee1_body [expr $line_callee1_head + 2] - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Continue execution until a breakpoint is reached, step into calls, verifying - # if the arguments are correctly shown, continue to the end of a called - # function, step over a call (next). - # Tests: - # -exec-continue - # -exec-next - # -exec-step - # -exec-finish - - mi_next_to "main" "" "basics.c" [expr $line_main_body + 1] "next at main" - - # FIXME: A string argument is not printed right; should be fixed and - # we should look for the right thing here. - # NOTE: The ``\\\\\"'' is for \". - mi_step_to "callee1" \ - "\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}" \ - "basics.c" "$line_callee1_body" "step at main" - - # FIXME: A string argument is not printed right; should be fixed and - # we should look for the right thing here. - mi_execute_to "exec-step 3" "end-stepping-range" "callee4" "" \ - "basics.c" $line_callee4_body "" "step to callee4" - - # FIXME: A string argument is not printed right; should be fixed and - # we should look for the right thing here. - # NOTE: The ``.'' is part of ``gdb-result-var="$1"'' - mi_finish_to "callee3" ".*" "basics.c" \ - "($line_callee3_call|$line_callee3_close_brace)" ".1" "0" "exec-finish" -} - -proc test_controlling_breakpoints {} { - global mi_gdb_prompt - - # Enable, delete, set ignore counts in breakpoints - # (disable was already tested above) - # Tests: - # -break-delete - # -break-enable - # -break-after - # -break-condition - -} - -proc test_program_termination {} { - global mi_gdb_prompt - - # Run to completion: normal and forced - # Tests: - # -exec-abort - # (normal termination of inferior) - - mi_execute_to "exec-continue" "exited-normally" "" "" "" "" "" "continue to end" -} - -test_breakpoints_creation_and_listing -test_running_the_program -test_controlled_execution -test_controlling_breakpoints -test_program_termination - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi-stepi.exp b/gdb/testsuite/gdb.mi/mi-stepi.exp deleted file mode 100644 index 245dc1c..0000000 --- a/gdb/testsuite/gdb.mi/mi-stepi.exp +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright 1999-2002, 2004-2005, 2007-2012 Free Software Foundation, -# Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test Machine interface (MI) operations -# Verify that, using the MI, we can run a simple program and perform -# exec-step-instruction and exec-next-instruction. - -# The goal is not to -# test gdb functionality, which is done by other tests, but to verify -# the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-stepi.exp - return -1 -} - -proc test_stepi_nexti {} { - global mi_gdb_prompt - global hex fullname_syntax srcfile - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - set line_main_hello [gdb_get_line_number "Hello, World!"] - - set line [mi_execute_to "exec-step-instruction" "end-stepping-range" "main" "" \ - ".*basics.c" "\[0-9\]+" "" "step-instruction at main"] - if { $line >= $line_main_body && $line <= $line_main_hello } { - pass "step-instruction at main (line check)" - } else { - fail "step-instruction at main (line check)" - } - - set line [mi_execute_to "exec-next-instruction" "end-stepping-range" "main" "" \ - ".*basics.c" "\[0-9\]+" "" "next-instruction at main"] - if { $line >= $line_main_body && $line <= $line_main_hello } { - pass "next-instruction at main (line check)" - } else { - fail "next-instruction at main (line check)" - } - - set line [mi_execute_to "exec-next-instruction" "end-stepping-range" "main" "" \ - ".*basics.c" "\[0-9\]+" "" "next-instruction at main 2"] - if { $line >= $line_main_body && $line <= $line_main_hello } { - pass "next-instruction at main 2 (line check)" - } else { - fail "next-instruction at main 2 (line check)" - } -} - -mi_run_to_main -test_stepi_nexti - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi-until.exp b/gdb/testsuite/gdb.mi/mi-until.exp deleted file mode 100644 index a1c97b1..0000000 --- a/gdb/testsuite/gdb.mi/mi-until.exp +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright 1999-2001, 2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test Machine interface (MI) operations -# Verify that, using the MI, we can run a simple program and perform -# exec-until. - -# The goal is not to -# test gdb functionality, which is done by other tests, but to verify -# the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile until.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-until.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_running_to_foo {} { - global mi_gdb_prompt - global hex - - mi_create_breakpoint "10" 1 "keep" foo ".*until.c" 10 ".*" \ - "break-insert operation" - - mi_run_cmd - mi_expect_stop "breakpoint-hit" "foo" "" ".*until.c" 10 \ - { "" "disp=\"keep\"" } "run to main" - - mi_gdb_test "100-break-delete 1" "100\\^done" "break-delete 1" - -} - -proc test_until {} { - global mi_gdb_prompt - global hex fullname_syntax srcfile - - setup_kfail gdb/2104 "*-*-*" - mi_execute_to "exec-until" "end-stepping-range" "foo" "" ".*until.c" "12" "" \ - "until after while loop" - - mi_execute_to "exec-until 15" "location-reached" "foo" "" ".*until.c" "15" ""\ - "until line number" - - mi_execute_to "exec-until until.c:17" "location-reached" "foo" "" ".*until.c" "17" ""\ - "until line number:file" - - # This is supposed to NOT stop at line 25. It stops right after foo is over. - mi_execute_to "exec-until until.c:25" "location-reached" "main" "" ".*until.c" "(23|24)" ""\ - "until after current function" -} - -test_running_to_foo -test_until - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp deleted file mode 100644 index 5ccff51..0000000 --- a/gdb/testsuite/gdb.mi/mi-watch.exp +++ /dev/null @@ -1,187 +0,0 @@ -# Copyright 1999-2002, 2004-2005, 2007-2012 Free Software Foundation, -# Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-watch.exp - return -1 -} - -proc test_watchpoint_creation_and_listing {type} { - global mi_gdb_prompt - global srcfile - global hex - - set line_callee4_head [gdb_get_line_number "callee4 ("] - set line_callee4_body [expr $line_callee4_head + 2] - - # Insert a watchpoint and list - # Tests: - # -break-watch C - # -break-list - - mi_gdb_test "111-break-watch C" \ - "111\\^done,wpt=\{number=\"2\",exp=\"C\"\}" \ - "break-watch operation" - - mi_gdb_test "222-break-list" \ - "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",what=\"C\",times=\"0\",original-location=\"C\"\}\\\]\}" \ - "list of watchpoints" - -} - -# UNUSED at the time -proc test_awatch_creation_and_listing {type} { - global mi_gdb_prompt - global srcfile - global hex - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Insert an access watchpoint and list it - # Tests: - # -break-watch -a A - # -break-list - - mi_gdb_test "333-break-watch -a A" \ - "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_main_body\"\}" \ - "break-watch -a operation" - - mi_gdb_test "444-break-list" \ - "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \ - "list of watchpoints awatch" - - mi_gdb_test "777-break-delete 3" \ - "777\\^done" \ - "delete access watchpoint" -} - -# UNUSED at the time -proc test_rwatch_creation_and_listing {type} { - global mi_gdb_prompt - global srcfile - global hex - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Insert a read watchpoint and list it. - # Tests: - # -break-insert -r B - # -break-list - - mi_gdb_test "200-break-watch -r C" \ - "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \ - "break-insert -r operation" - - mi_gdb_test "300-break-list" \ - "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\}\}" \ - "list of breakpoints" - - mi_gdb_test "177-break-delete 4" \ - "177\\^done" \ - "delete read watchpoint" -} - -proc test_watchpoint_triggering {type} { - global mi_gdb_prompt - global hex fullname_syntax srcfile - - set line_callee4_return_0 [gdb_get_line_number "return 0;"] - set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_close_brace [expr $line_callee3_head + 3] - - # Continue execution until the watchpoint is reached, continue again, - # to see the watchpoint go out of scope. - # Does: - # -exec-continue (Here wp triggers) - # -exec-continue (Here wp goes out of scope) - - mi_execute_to "exec-continue" "watchpoint-trigger" "callee4" "" \ - ".*basics.c" $line_callee4_return_0 \ - {"" "wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\}"} \ - "watchpoint trigger" - - if { $type == "sw" } { - setup_xfail *-*-* - } - mi_execute_to "exec-continue" "watchpoint-scope" "callee3" ".*" \ - ".*basics.c" $line_callee3_close_brace \ - {"" "wpnum=\"2\""} \ - "watchpoint trigger" - clear_xfail *-*-* -} - -proc test_watchpoint_all {type} { with_test_prefix "$type" { - upvar srcdir srcdir - upvar subdir subdir - upvar binfile binfile - - mi_delete_breakpoints - mi_gdb_reinitialize_dir $srcdir/$subdir - mi_gdb_load ${binfile} - - mi_runto callee4 - test_watchpoint_creation_and_listing $type - #test_rwatch_creation_and_listing $type - #test_awatch_creation_and_listing $type - test_watchpoint_triggering $type -}} - -# Run the tests twice, once using software watchpoints... -mi_gdb_test "567-gdb-set can-use-hw-watchpoints 0" \ - "567\\^done" \ - "hw watchpoints toggle (1)" -test_watchpoint_all sw - -mi_gdb_exit - -# ... and unless requested otherwise... -if [target_info exists gdb,no_hardware_watchpoints] { - return 0 -} - -mi_gdb_start - -# ... once using hardware watchpoints (if available). -mi_gdb_test "890-gdb-set can-use-hw-watchpoints 1" \ - "890\\^done" \ - "hw watchpoints toggle (2)" -test_watchpoint_all hw - -mi_gdb_exit -return 0 -- 1.7.7.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 11/11] mi-syn-frame.exp 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi ` (7 preceding siblings ...) 2012-09-28 0:05 ` [PATCH 01/11] Remove mi-FOO.exp which are identical to mi2-FOO.exp Yao Qi @ 2012-09-28 0:05 ` Yao Qi 2012-09-28 0:05 ` [PATCH 09/11] mi-console.exp Yao Qi ` (2 subsequent siblings) 11 siblings, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-09-28 0:05 UTC (permalink / raw) To: gdb-patches gdb/testsuite: 2012-09-27 Yao Qi <yao@codesourcery.com> * gdb.mi/mi-syn-frame.exp: Remove * gdb.mi/mi2-syn-frame.exp: Merged from mi-syn-frame.exp. --- gdb/testsuite/gdb.mi/mi-syn-frame.exp | 102 -------------------------------- gdb/testsuite/gdb.mi/mi2-syn-frame.exp | 10 ++-- 2 files changed, 5 insertions(+), 107 deletions(-) delete mode 100644 gdb/testsuite/gdb.mi/mi-syn-frame.exp diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.exp b/gdb/testsuite/gdb.mi/mi-syn-frame.exp deleted file mode 100644 index a19deb9..0000000 --- a/gdb/testsuite/gdb.mi/mi-syn-frame.exp +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright 2002-2003, 2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test MI output with synthetic frames on the stack (call dummies, -# signal handlers). - -if [target_info exists gdb,nosignals] { - verbose "Skipping mi-syn-frame.exp because of nosignals." - continue -} - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -standard_testfile - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-syn-frame.exp - return -1 -} - -mi_gdb_exit -mi_gdb_start -mi_run_to_main - -mi_create_breakpoint "foo" 2 keep foo ".*mi-syn-frame.c" $decimal $hex \ - "insert breakpoint foo" - -# -# Call foo() by hand, where we'll hit a breakpoint. -# - -mi_gdb_test "401-data-evaluate-expression foo()" ".*401\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nEvaluation of the expression containing the function\\\\n\\(foo\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \ - "call inferior's function with a breakpoint set in it" - - -mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame" - -# -# Continue back to main() -# -mi_send_resuming_command "exec-continue" "testing exec continue" - -mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue" - -mi_gdb_test "404-stack-list-frames 0 0" \ - "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \ - "list stack frames" - - -# -# Call have_a_very_merry_interrupt() which will eventually raise a signal -# that's caught by handler() which calls subroutine(). - -mi_create_breakpoint "subroutine" 3 keep subroutine ".*mi-syn-frame.c" $decimal $hex \ - "insert breakpoint subroutine" - -mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \ - ".*406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nEvaluation of the expression containing the function\\\\n\\(have_a_very_merry_interrupt\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \ - "data evaluate expression" - -# We should have both a signal handler and a call dummy frame -# in this next output. - -mi_gdb_test "407-stack-list-frames" \ - "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \ - "list stack frames" - - -mi_send_resuming_command "exec-continue" "testing exec continue" - -mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue" - -mi_gdb_test "409-stack-list-frames 0 0" \ - "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \ - "list stack frames" - -# -# Call bar() by hand, which should get an exception while running. -# - -mi_gdb_test "410-data-evaluate-expression bar()" \ - ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \ - "call inferior function which raises exception" - -mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception" - -mi_gdb_exit - -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-syn-frame.exp b/gdb/testsuite/gdb.mi/mi2-syn-frame.exp index 9c24cca..d26df7c 100644 --- a/gdb/testsuite/gdb.mi/mi2-syn-frame.exp +++ b/gdb/testsuite/gdb.mi/mi2-syn-frame.exp @@ -31,8 +31,6 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -set my_mi_gdb_prompt "\\(gdb\\)\[ \]*\[\r\n\]*" - mi_gdb_exit mi_gdb_start mi_run_to_main @@ -71,13 +69,13 @@ mi_create_breakpoint "subroutine" 3 keep subroutine ".*mi-syn-frame.c" $decimal mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \ ".*406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nEvaluation of the expression containing the function\\\\n\\(have_a_very_merry_interrupt\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \ - "evaluate expression have_a_very_merry_interrupt" + "data evaluate expression" # We should have both a signal handler and a call dummy frame # in this next output. mi_gdb_test "407-stack-list-frames" \ - "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" \ + "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \ "list stack frames" mi_send_resuming_command "exec-continue" "testing exec continue" @@ -92,7 +90,9 @@ mi_gdb_test "409-stack-list-frames 0 0" \ # Call bar() by hand, which should get an exception while running. # -mi_gdb_test "410-data-evaluate-expression bar()" ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" "call inferior function which raises exception" +mi_gdb_test "410-data-evaluate-expression bar()" \ + ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \ + "call inferior function which raises exception" mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception" -- 1.7.7.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 09/11] mi-console.exp 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi ` (8 preceding siblings ...) 2012-09-28 0:05 ` [PATCH 11/11] mi-syn-frame.exp Yao Qi @ 2012-09-28 0:05 ` Yao Qi 2012-09-28 0:05 ` [PATCH 08/11] mi-var-display.exp Yao Qi 2012-09-28 19:36 ` [PATCH 0/11] Cleanup MI test cases Pedro Alves 11 siblings, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-09-28 0:05 UTC (permalink / raw) To: gdb-patches gdb/testsuite: 2012-09-27 Yao Qi <yao@codesourcery.com> * gdb.mi/mi-console.exp: * gdb.mi/mi2-console.exp: Merged from mi-console.exp. --- gdb/testsuite/gdb.mi/mi-console.exp | 58 ---------------------------------- gdb/testsuite/gdb.mi/mi2-console.exp | 30 +++-------------- 2 files changed, 5 insertions(+), 83 deletions(-) delete mode 100644 gdb/testsuite/gdb.mi/mi-console.exp diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp deleted file mode 100644 index 891c743..0000000 --- a/gdb/testsuite/gdb.mi/mi-console.exp +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 1999-2003, 2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -# This test only works when talking to a target that routes its output -# through GDB. Check that we're either talking to a simulator or a -# remote target. - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start separate-inferior-tty] { - continue -} - -standard_testfile - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-console.exp - return -1 -} - -mi_run_to_main - -# Next over the hello() call which will produce lots of output -mi_gdb_test "220-exec-next" \ - "220\\^running(\r\n\\*running,thread-id=\"all\")?" \ - "Testing console output" \ - "Hello \\\\\"!\[\r\n\]+" - -mi_expect_stop "end-stepping-range" "main" "" ".*mi-console.c" "14" "" \ - "finished step over hello" - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-console.exp b/gdb/testsuite/gdb.mi/mi2-console.exp index e1e180b..472bea6 100644 --- a/gdb/testsuite/gdb.mi/mi2-console.exp +++ b/gdb/testsuite/gdb.mi/mi2-console.exp @@ -32,7 +32,7 @@ load_lib mi-support.exp set MIFLAGS "-i=mi2" gdb_exit -if [mi_gdb_start] { +if [mi_gdb_start separate-inferior-tty] { continue } @@ -46,30 +46,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb mi_run_to_main # Next over the hello() call which will produce lots of output -mi_gdb_test "220-exec-next" "220\\^running(\r\n)?(\\*running,thread-id=\"all\")?" \ - "Started step over hello" - -if { ![target_info exists gdb,noinferiorio] } { - gdb_expect { - -re "@\"H\"\r\n.*@\"e\"\r\n.*@\"l\"\r\n.*@\"l\"\r\n.*@\"o\"\r\n.*@\" \"\r\n.*@\"\\\\\\\\\"\r\n.*@\"\\\\\"\"\r\n.*@\"!\"\r\n.*@\"\\\\r\"\r\n.*@\"\\\\n\"\r\n" { - pass "Hello message" - } - -re "Hello" { - - # Probably a native system where GDB doesn't have direct # - # control over the inferior console. # For this to work, - # GDB would need to run the inferior process # under a PTY - # and then use the even-loops ability to wait on # - # multiple event sources to channel the output back - # through the # MI. - - kfail "gdb/623" "Hello message" - } - timeout { - fail "Hello message (timeout)" - } - } -} +mi_gdb_test "220-exec-next" \ + "220\\^running(\r\n\\*running,thread-id=\"all\")?" \ + "Testing console output" \ + "Hello \\\\\"!\[\r\n\]+" mi_expect_stop "end-stepping-range" "main" "" ".*mi-console.c" "14" "" \ "finished step over hello" -- 1.7.7.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 08/11] mi-var-display.exp 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi ` (9 preceding siblings ...) 2012-09-28 0:05 ` [PATCH 09/11] mi-console.exp Yao Qi @ 2012-09-28 0:05 ` Yao Qi 2012-09-28 19:36 ` [PATCH 0/11] Cleanup MI test cases Pedro Alves 11 siblings, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-09-28 0:05 UTC (permalink / raw) To: gdb-patches gdb/testsuite: 2012-09-27 Yao Qi <yao@codesourcery.com> * gdb.mi/mi-var-display.exp: Remove. * gdb.mi/mi2-var-display.exp: Merged from mi-var-display.exp. --- gdb/testsuite/gdb.mi/mi-var-display.exp | 636 ------------------------------ gdb/testsuite/gdb.mi/mi2-var-display.exp | 8 +- 2 files changed, 6 insertions(+), 638 deletions(-) delete mode 100644 gdb/testsuite/gdb.mi/mi-var-display.exp diff --git a/gdb/testsuite/gdb.mi/mi-var-display.exp b/gdb/testsuite/gdb.mi/mi-var-display.exp deleted file mode 100644 index 5cb5f26..0000000 --- a/gdb/testsuite/gdb.mi/mi-var-display.exp +++ /dev/null @@ -1,636 +0,0 @@ -# Copyright 1999-2005, 2007-2012 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can create, update, delete variables. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile var-cmd.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi-var-display.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -set line_dct_end [gdb_get_line_number "{int a = 0;}"] - -mi_create_breakpoint "$srcfile:$line_dct_end" 1 keep do_children_tests ".*var-cmd.c" $line_dct_end $hex \ - "break-insert operation" - -mi_run_cmd -mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" \ - $line_dct_end { "" "disp=\"keep\"" } "run to main" - -##### ##### -# # -# Display tests # -# # -##### ##### - -# Test: c_variable-6.1 -# Desc: create variable bar -mi_create_varobj bar bar "create local variable bar" - -# Test: c_variable-6.2 -# Desc: type of variable bar -mi_gdb_test "-var-info-type bar" \ - "\\^done,type=\"int\"" \ - "info type variable bar" - -# Test: c_variable-6.3 -# Desc: format of variable bar -mi_gdb_test "-var-show-format bar" \ - "\\^done,format=\"natural\"" \ - "show format variable bar" - -# Test: c_variable-6.4 -# Desc: value of variable bar -mi_gdb_test "-var-evaluate-expression bar" \ - "\\^done,value=\"2121\"" \ - "eval variable bar" - -# Test: c_variable-6.5 -# Desc: change format of bar to hex -mi_gdb_test "-var-set-format bar hexadecimal" \ - "\\^done,format=\"hexadecimal\",value=\"0x849\"" \ - "set format variable bar" - -# Test: c_variable-6.6 -# Desc: value of bar with new format -mi_gdb_test "-var-evaluate-expression bar" \ - "\\^done,value=\"0x849\"" \ - "eval variable bar with new format" - -# Test: c_variable-6.7 -# Desc: change value of bar -mi_gdb_test "-var-assign bar 3" \ - "\\^done,value=\"0x3\"" \ - "assing to variable bar" - -mi_gdb_test "-var-set-format bar decimal" \ - "\\^done,format=\"decimal\",value=\"3\"" \ - "set format variable bar" - -mi_gdb_test "-var-evaluate-expression bar" \ - "\\^done,value=\"3\"" \ - "eval variable bar with new value" - -mi_gdb_test "-var-delete bar" \ - "\\^done,ndeleted=\"1\"" \ - "delete var bar" - -# Test: c_variable-6.11 -# Desc: create variable foo -mi_create_varobj foo foo "create local variable foo" - -# Test: c_variable-6.12 -# Desc: type of variable foo -mi_gdb_test "-var-info-type foo" \ - "\\^done,type=\"int \\*\"" \ - "info type variable foo" - -# Test: c_variable-6.13 -# Desc: format of variable foo -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"natural\"" \ - "show format variable foo" - -# Test: c_variable-6.14 -# Desc: value of variable foo -mi_gdb_test "-var-evaluate-expression foo" \ - "\\^done,value=\"$hex\"" \ - "eval variable foo" - -# Test: c_variable-6.15 -# Desc: change format of var to octal -mi_gdb_test "-var-set-format foo octal" \ - "\\^done,format=\"octal\",value=\"$octal\"" \ - "set format variable foo" - -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"octal\"" \ - "show format variable foo" - -# Test: c_variable-6.16 -# Desc: value of foo with new format -mi_gdb_test "-var-evaluate-expression foo" \ - "\\^done,value=\"\[0-7\]+\"" \ - "eval variable foo" - -# Test: c_variable-6.17 -# Desc: change value of foo -mi_gdb_test "-var-assign foo 3" \ - "\\^done,value=\"03\"" \ - "assing to variable foo" - -mi_gdb_test "-var-set-format foo decimal" \ - "\\^done,format=\"decimal\",value=\"3\"" \ - "set format variable foo" - -# Test: c_variable-6.18 -# Desc: check new value of foo -mi_gdb_test "-var-evaluate-expression foo" \ - "\\^done,value=\"3\"" \ - "eval variable foo" - - -# Test: c_variable-6.19 -# Desc: check optional format parameter of var-evaluate-expression -# and check that current format is not changed -mi_gdb_test "-var-evaluate-expression -f hex foo" \ - "\\^done,value=\"0x3\"" \ - "eval variable foo in hex" - -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"decimal\"" \ - "show format variable foo after eval in hex" - -mi_gdb_test "-var-evaluate-expression -f octal foo" \ - "\\^done,value=\"03\"" \ - "eval variable foo in octal" - -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"decimal\"" \ - "show format variable foo after eval in octal" - -mi_gdb_test "-var-evaluate-expression -f decimal foo" \ - "\\^done,value=\"3\"" \ - "eval variable foo in decimal" - -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"decimal\"" \ - "show format variable foo after eval in decimal" - -mi_gdb_test "-var-evaluate-expression -f nat foo" \ - "\\^done,value=\"0x3\"" \ - "eval variable foo in natural" - -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"decimal\"" \ - "show format variable foo after eval in natural" - -mi_gdb_test "-var-evaluate-expression -f bin foo" \ - "\\^done,value=\"11\"" \ - "eval variable foo in binary" - -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"decimal\"" \ - "show format variable foo after eval in binary" - -mi_gdb_test "-var-delete foo" \ - "\\^done,ndeleted=\"1\"" \ - "delete var foo" - -# Test: c_variable-6.21 -# Desc: create variable weird and children -mi_create_varobj weird weird "create local variable weird" - -mi_list_varobj_children weird { - {weird.integer integer 0 int} - {weird.character character 0 char} - {weird.char_ptr char_ptr 1 "char \\*"} - {weird.long_int long_int 0 "long int"} - {weird.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"} - {weird.long_array long_array 10 "long int \\[10\\]"} - {weird.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"} - {weird.func_ptr_struct func_ptr_struct 0 \ - "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?"} - {weird.func_ptr_ptr func_ptr_ptr 0 \ - "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)"} - {weird.u1 u1 4 "union \\{\\.\\.\\.\\}"} - {weird.s2 s2 4 "struct \\{\\.\\.\\.\\}"} -} "get children local variable weird" - - -# Test: c_variable-6.23 -# Desc: change format of weird.func_ptr and weird.func_ptr_ptr -mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ - "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ - "set format variable weird.func_ptr" - -mi_gdb_test "-var-show-format weird.func_ptr" \ - "\\^done,format=\"hexadecimal\"" \ - "show format variable weird.func_ptr" - -mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \ - "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ - "set format variable weird.func_ptr_ptr" - -mi_gdb_test "-var-show-format weird.func_ptr_ptr" \ - "\\^done,format=\"hexadecimal\"" \ - "show format variable weird.func_ptr_ptr" - -# Test: c_variable-6.24 -# Desc: format of weird and children -mi_gdb_test "-var-set-format weird natural" \ - "\\^done,format=\"natural\",value=\"$hex\"" \ - "set format variable weird" - -mi_gdb_test "-var-set-format weird.integer natural" \ - "\\^done,format=\"natural\",value=\"123\"" \ - "set format variable weird.integer" - -mi_gdb_test "-var-set-format weird.character natural" \ - "\\^done,format=\"natural\",value=\"0 '\\\\\\\\000'\"" \ - "set format variable weird.character" - -mi_gdb_test "-var-set-format weird.char_ptr natural" \ - "\\^done,format=\"natural\",value=\"$hex \\\\\"hello\\\\\"\"" \ - "set format variable weird.char_ptr" - -mi_gdb_test "-var-set-format weird.long_int natural" \ - "\\^done,format=\"natural\",value=\"0\"" \ - "set format variable weird.long_int" - -mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \ - "\\^done,format=\"natural\",value=\"$hex\"" \ - "set format variable weird.int_ptr_ptr" - -mi_gdb_test "-var-set-format weird.long_array natural" \ - "\\^done,format=\"natural\",value=\"\\\[10\\\]\"" \ - "set format variable weird.long_array" - -mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ - "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ - "set format variable weird.func_ptr" - -mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \ - "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ - "set format variable weird.func_ptr_struct" - -mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \ - "\\^done,format=\"natural\",value=\"0x0\"" \ - "set format variable weird.func_ptr_ptr" - -mi_gdb_test "-var-set-format weird.u1 natural" \ - "\\^done,format=\"natural\",value=\"\{...\}\"" \ - "set format variable weird.u1" - -mi_gdb_test "-var-set-format weird.s2 natural" \ - "\\^done,format=\"natural\",value=\"\{...\}\"" \ - "set format variable weird.s2" - -# Test: c_variable-6.25 -# Desc: value of weird and children -#gdbtk_test c_variable-6.25 {value of weird and children} { -# set values {} -# foreach v [lsort [array names var]] f [list x "" "" x x x x d d d d d] { -# lappend values [value $v $f] -# } - -# set values -#} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1} - -# Test: c_variable-6.26 -# Desc: change format of weird and children to octal -#gdbtk_test c_variable-6.26 {change format of weird and children to octal} { -# set formats {} -# foreach v [lsort [array names var]] { -# $var($v) format octal -# lappend formats [$var($v) format] -# } - -# set formats -#} {octal octal octal octal octal octal octal octal octal octal octal octal} - -# Test: c_variable-6.27 -# Desc: value of weird and children with new format -#gdbtk_test c_variable-6.27 {value of foo with new format} { -# set values {} -# foreach v [lsort [array names var]] { -# lappend values [value $v o] -# } - -# set values -#} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1} - -# Test: c_variable-6.30 -# Desc: create more children of weird -#gdbtk_test c_variable-6.30 {create more children of weird} { -# foreach v [array names var] { -# get_children $v -# } - -# # Do it twice to get more children -# foreach v [array names var] { -# get_children $v -# } - -# lsort [array names var] -#} {weird weird.char_ptr weird.character weird.func_ptr weird.func_ptr_ptr weird.func_ptr_struct weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.integer weird.long_array weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.long_int weird.s2 weird.s2.g weird.s2.h weird.s2.i weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9 weird.s2.u2 weird.s2.u2.f weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.u1 weird.u1.a weird.u1.b weird.u1.c weird.u1.d} - -# Test: c_variable-6.31 -# Desc: check that all children of weird change -# Ok, obviously things like weird.s2 and weird.u1 will not change! -#gdbtk_test *c_variable-6.31 {check that all children of weird change (ops, we are now reporting array names as changed in this case - seems harmless though)} { -# $var(weird) value 0x2121 -# check_update -#} {{weird.integer weird.character weird.char_ptr weird.long_int weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.func_ptr weird.func_ptr_struct weird.func_ptr_ptr weird.u1.a weird.u1.b weird.u1.c weird.u1.d weird.s2.u2.f weird.s2.g weird.s2.h weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9} {weird.s2.i weird.s2.u2 weird weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.s2 weird.long_array weird.u1} {}} - -mi_gdb_test "-var-delete weird" \ - "\\^done,ndeleted=\"12\"" \ - "delete var weird" - - -##### ##### -# # -# Special Display Tests # -# # -##### ##### - -# Stop at the end of "do_special_tests" - -set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"] - -mi_create_breakpoint "$line_dst_incr_a_2" 2 keep do_special_tests ".*var-cmd.c" $line_dst_incr_a_2 $hex \ - "break-insert operation 2" - -mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" \ - ".*var-cmd.c" $line_dst_incr_a_2 { "" "disp=\"keep\"" } \ - "continue to do_special_tests" - -# Test: c_variable-7.10 -# Desc: create union u -mi_create_varobj u u "create local variable u" - -# Test: c_variable-7.11 -# Desc: value of u -mi_gdb_test "-var-evaluate-expression u" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable u" - -# Test: c_variable-7.12 -# Desc: type of u -mi_gdb_test "-var-info-type u" \ - "\\^done,type=\"union named_union\"" \ - "info type variable u" - -# Test: c_variable-7.13 -# Desc: is u editable -mi_gdb_test "-var-show-attributes u" \ - "\\^done,attr=\"noneditable\"" \ - "is u editable" - -# Test: c_variable-7.14 -# Desc: number of children of u -mi_gdb_test "-var-info-num-children u" \ - "\\^done,numchild=\"2\"" \ - "get number of children of u" - -# Test: c_variable-7.15 -# Desc: children of u -mi_list_varobj_children u { - {u.integer integer 0 int} - {u.char_ptr char_ptr 1 {char \*}} -} "get children of u" - -# Test: c_variable-7.20 -# Desc: create anonu -mi_create_varobj anonu anonu "create local variable anonu" - -# Test: c_variable-7.21 -# Desc: value of anonu -mi_gdb_test "-var-evaluate-expression anonu" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable anonu" - -# Test: c_variable-7.22 -# Desc: type of anonu -mi_gdb_test "-var-info-type anonu" \ - "\\^done,type=\"union \{\\.\\.\\.\}\"" \ - "info type variable anonu" - -# Test: c_variable-7.23 -# Desc: is anonu editable -mi_gdb_test "-var-show-attributes anonu" \ - "\\^done,attr=\"noneditable\"" \ - "is anonu editable" - -# Test: c_variable-7.24 -# Desc: number of children of anonu -mi_gdb_test "-var-info-num-children anonu" \ - "\\^done,numchild=\"3\"" \ - "get number of children of anonu" - -# Test: c_variable-7.25 -# Desc: children of anonu -mi_list_varobj_children "anonu" { - {anonu.a a 0 int} - {anonu.b b 0 char} - {anonu.c c 0 "long int"} -} "get children of anonu" - -# Test: c_variable-7.30 -# Desc: create struct s -mi_create_varobj s s "create local variable s" - - -# Test: c_variable-7.31 -# Desc: value of s -mi_gdb_test "-var-evaluate-expression s" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable s" - -# Test: c_variable-7.32 -# Desc: type of s -mi_gdb_test "-var-info-type s" \ - "\\^done,type=\"struct _simple_struct\"" \ - "info type variable s" - -# Test: c_variable-7.33 -# Desc: is s editable -mi_gdb_test "-var-show-attributes s" \ - "\\^done,attr=\"noneditable\"" \ - "is s editable" - -# Test: c_variable-7.34 -# Desc: number of children of s -mi_gdb_test "-var-info-num-children s" \ - "\\^done,numchild=\"6\"" \ - "get number of children of s" - -# Test: c_variable-7.35 -# Desc: children of s -mi_list_varobj_children s { - {s.integer integer 0 int} - {s.unsigned_integer unsigned_integer 0 "unsigned int"} - {s.character character 0 char} - {s.signed_character signed_character 0 "signed char"} - {s.char_ptr char_ptr 1 {char \*}} - {s.array_of_10 array_of_10 10 {int \[10\]}} -} "get children of s" -#} {integer unsigned_integer character signed_character char_ptr array_of_10} - -# Test: c_variable-7.40 -# Desc: create anons -mi_create_varobj anons anons "create local variable anons" - -# Test: c_variable-7.41 -# Desc: value of anons -mi_gdb_test "-var-evaluate-expression anons" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable anons" - -# Test: c_variable-7.42 -# Desc: type of anons -mi_gdb_test "-var-info-type anons" \ - "\\^done,type=\"struct \{\\.\\.\\.\}\"" \ - "info type variable anons" - -# Test: c_variable-7.43 -# Desc: is anons editable -mi_gdb_test "-var-show-attributes anons" \ - "\\^done,attr=\"noneditable\"" \ - "is anons editable" - -# Test: c_variable-7.44 -# Desc: number of children of anons -mi_gdb_test "-var-info-num-children anons" \ - "\\^done,numchild=\"3\"" \ - "get number of children of anons" - -# Test: c_variable-7.45 -# Desc: children of anons -mi_list_varobj_children anons { - {anons.a a 0 int} - {anons.b b 0 char} - {anons.c c 0 "long int"} -} "get children of anons" - -# Test: c_variable-7.50 -# Desc: create enum e -mi_create_varobj e e "create local variable e" - -# Test: c_variable-7.51 -# Desc: value of e -mi_gdb_test "-var-evaluate-expression e" \ - "\\^done,value=\"bar\"" \ - "eval variable e" - -# Test: c_variable-7.52 -# Desc: type of e -mi_gdb_test "-var-info-type e" \ - "\\^done,type=\"enum foo\"" \ - "info type variable e" - -# Test: c_variable-7.53 -# Desc: is e editable -mi_gdb_test "-var-show-attributes e" \ - "\\^done,attr=\"editable\"" \ - "is e editable" - -# Test: c_variable-7.54 -# Desc: number of children of e -mi_gdb_test "-var-info-num-children e" \ - "\\^done,numchild=\"0\"" \ - "get number of children of e" - -# Test: c_variable-7.55 -# Desc: children of e -mi_gdb_test "-var-list-children e" \ - "\\^done,numchild=\"0\",has_more=\"0\"" \ - "get children of e" - -# Test: c_variable-7.60 -# Desc: create anone -mi_create_varobj anone anone "create local variable anone" - -# Test: c_variable-7.61 -# Desc: value of anone -mi_gdb_test "-var-evaluate-expression anone" \ - "\\^done,value=\"A\"" \ - "eval variable anone" - -# Test: c_variable-7.70 -# Desc: create anone -mi_gdb_test "-var-create anone * anone" \ - "\\^error,msg=\"Duplicate variable object name\"" \ - "create duplicate local variable anone" - - -# Test: c_variable-7.72 -# Desc: type of anone -mi_gdb_test "-var-info-type anone" \ - "\\^done,type=\"enum \{\\.\\.\\.\}\"" \ - "info type variable anone" - - -# Test: c_variable-7.73 -# Desc: is anone editable -mi_gdb_test "-var-show-attributes anone" \ - "\\^done,attr=\"editable\"" \ - "is anone editable" - -# Test: c_variable-7.74 -# Desc: number of children of anone -mi_gdb_test "-var-info-num-children anone" \ - "\\^done,numchild=\"0\"" \ - "get number of children of anone" - -# Test: c_variable-7.75 -# Desc: children of anone -mi_gdb_test "-var-list-children anone" \ - "\\^done,numchild=\"0\",has_more=\"0\"" \ - "get children of anone" - - -# Record fp -if ![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"] { - set fp $expect_out(3,string) -} - -mi_continue_to "incr_a" - -# Test: c_variable-7.81 -# Desc: Create variables in different scopes -mi_gdb_test "-var-create a1 * a" \ - "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \ - "create local variable a1" - -if { [info exists fp] } { - mi_gdb_test "-var-create a2 $fp a" \ - "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \ - "create variable a2 in different scope" -} else { - untested "create variable a2 in different scope" -} - -#gdbtk_test c_variable-7.81 {create variables in different scopes} { -# set a1 [gdb_variable create -expr a] -# set a2 [gdb_variable create -expr a -frame $fp] - -# set vals {} -# lappend vals [$a1 value] -# lappend vals [$a2 value] -# set vals -#} {2 1} - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-var-display.exp b/gdb/testsuite/gdb.mi/mi2-var-display.exp index 4bb1cd8..49c2ec3 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-display.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-display.exp @@ -363,7 +363,7 @@ mi_gdb_test "-var-delete weird" \ # # ##### ##### -# Stop in "do_special_tests" +# Stop at the end of "do_special_tests" set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"] @@ -612,9 +612,13 @@ mi_gdb_test "-var-create a1 * a" \ "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \ "create local variable a1" -mi_gdb_test "-var-create a2 $fp a" \ +if { [info exists fp] } { + mi_gdb_test "-var-create a2 $fp a" \ "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \ "create variable a2 in different scope" +} else { + untested "create variable a2 in different scope" +} #gdbtk_test c_variable-7.81 {create variables in different scopes} { # set a1 [gdb_variable create -expr a] -- 1.7.7.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 0/11] Cleanup MI test cases 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi ` (10 preceding siblings ...) 2012-09-28 0:05 ` [PATCH 08/11] mi-var-display.exp Yao Qi @ 2012-09-28 19:36 ` Pedro Alves 2012-10-12 9:47 ` Yao Qi 11 siblings, 1 reply; 28+ messages in thread From: Pedro Alves @ 2012-09-28 19:36 UTC (permalink / raw) To: Yao Qi; +Cc: gdb-patches On 09/28/2012 01:04 AM, Yao Qi wrote: > Hi, > This is a follow up to this thread, > > Re: [RFC] Merge mi-cli.exp and mi2-cli.exp > http://sourceware.org/ml/gdb-patches/2012-09/msg00155.html > > in which we discussed that we are only using mi2 so far and some test > cases are redundant. This patch is to get rid of the redundancy in > test cases. > > Patch 01/11 simply removes mi-FOO.exp, because they are identical to > mi2-FOO.exp. The rest of the patches merge mi-foo.exp with mi2-foo.exp, > and remove mi-foo.exp. This is great, but I think it went the wrong direction. :-/ We have more mi-* files and more changes to mi-* files than the other way around: ls mi-* | wc -l 54 grep-changelog --text "gdb.mi/mi-" ../ChangeLog | grep "^2" | wc -l 412 vs ls mi2-* | wc -l 26 grep-changelog --text "gdb.mi/mi2-" ../ChangeLog | grep "^2" | wc -l 210 And that makes sense because the mi2-* files were originally created as copies of the existing mi-* files, and the mi-* files supposedly continued to evolve, until some point in the future when mi3 would be finalized (at which point we'd again fork the mi3-* copies). The mi2-* file were supposedly cast in stone once the copying was done (on 2003-08-07). Is it hard to redo things a bit to end up with only the mi- files instead? I'd think that something around "mv mi2-foo.exp mi-foo.exp", plus "git add mi-foo.exp", and maybe squash that commit back would get you that effect without needing to really redo things. > Note that this patch set doesn't cover mi2-var-child.exp and > mi-var-child.exp, because they diverge too much for me to handle. -- Pedro Alves ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 0/11] Cleanup MI test cases 2012-09-28 19:36 ` [PATCH 0/11] Cleanup MI test cases Pedro Alves @ 2012-10-12 9:47 ` Yao Qi 2012-10-12 10:05 ` Pedro Alves 0 siblings, 1 reply; 28+ messages in thread From: Yao Qi @ 2012-10-12 9:47 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches On 09/29/2012 03:36 AM, Pedro Alves wrote: > We have more mi-* files and more changes to mi-* files than the > other way around: > > ls mi-* | wc -l > 54 > > grep-changelog --text "gdb.mi/mi-" ../ChangeLog | grep "^2" | wc -l > 412 > > vs > > ls mi2-* | wc -l > 26 > > grep-changelog --text "gdb.mi/mi2-" ../ChangeLog | grep "^2" | wc -l > 210 > > And that makes sense because the mi2-* files were originally created as > copies of the existing mi-* files, and the mi-* files supposedly continued > to evolve, until some point in the future when mi3 would be finalized (at which > point we'd again fork the mi3-* copies). The mi2-* file were supposedly > cast in stone once the copying was done (on 2003-08-07). Looks I misread some discussions before. :) At the very beginning, my thought was to do "mi2-foo.exp -> mi-foo.exp". During the discussion, especially the patch 'mi-cli.exp -> mi2-cli.exp' patch was approved, I thought we like this approach because the current mi is mi2, so this patches does conversion "mi-foo.exp -> mi2-foo.exp". Like you, I feel quite natural to do "mi2-foo.exp -> mi-foo.exp", as we have quite few changes on "mi2-foo.exp". > > Is it hard to redo things a bit to end up with only the mi- files instead? > > I'd think that something around "mv mi2-foo.exp mi-foo.exp", plus > "git add mi-foo.exp", and maybe squash that commit back would get > you that effect without needing to really redo things. No, since we decide to keep "mi-foo.exp", the patch just removes "mi2-foo.exp" files, as they are identical to mi-foo.exp or sub-set of mi-foo.exp. How about this patch below? Note that this patch renames "mi2-cli.exp" to "mi-cli.exp". -- Yao gdb/testsuite: 2012-10-12 Yao Qi <yao@codesourcery.com> * gdb.mi/mi2-cli.exp: Move to mi-cli.exp. * gdb.mi/mi-cli.exp: New. * gdb.mi/mi2-basics.exp: Remove. * gdb.mi/mi2-break.exp: Remove. * gdb.mi/mi2-console.exp: Remove. * gdb.mi/mi2-disassemble.exp: Remove. * gdb.mi/mi2-eval.exp: Remove. * gdb.mi/mi2-file.exp: Remove. * gdb.mi/mi2-hack-cli.exp: Remove. * gdb.mi/mi2-pthreads.exp: Remove. * gdb.mi/mi2-read-memory.exp: Remove. * gdb.mi/mi2-regs.exp: Remove. * gdb.mi/mi2-return.exp: Remove. * gdb.mi/mi2-simplerun.exp: Remove. * gdb.mi/mi2-stack.exp: Remove. * gdb.mi/mi2-stepi.exp: Remove. * gdb.mi/mi2-syn-frame.exp: Remove. * gdb.mi/mi2-until.exp: Remove. * gdb.mi/mi2-watch.exp: Remove. * gdb.mi/mi2-var-block.exp: Remove. * gdb.mi/mi2-var-cmd.exp: Remove. * gdb.mi/mi2-var-display.exp: Remove. --- gdb/testsuite/gdb.mi/mi-cli.exp | 204 ++++++++++ gdb/testsuite/gdb.mi/mi2-basics.exp | 229 ----------- gdb/testsuite/gdb.mi/mi2-break.exp | 157 -------- gdb/testsuite/gdb.mi/mi2-cli.exp | 204 ---------- gdb/testsuite/gdb.mi/mi2-console.exp | 78 ---- gdb/testsuite/gdb.mi/mi2-disassemble.exp | 238 ----------- gdb/testsuite/gdb.mi/mi2-eval.exp | 61 --- gdb/testsuite/gdb.mi/mi2-file.exp | 73 ---- gdb/testsuite/gdb.mi/mi2-hack-cli.exp | 36 -- gdb/testsuite/gdb.mi/mi2-pthreads.exp | 71 ---- gdb/testsuite/gdb.mi/mi2-read-memory.exp | 82 ---- gdb/testsuite/gdb.mi/mi2-regs.exp | 121 ------ gdb/testsuite/gdb.mi/mi2-return.exp | 66 --- gdb/testsuite/gdb.mi/mi2-simplerun.exp | 189 --------- gdb/testsuite/gdb.mi/mi2-stack.exp | 210 ---------- gdb/testsuite/gdb.mi/mi2-stepi.exp | 77 ---- gdb/testsuite/gdb.mi/mi2-syn-frame.exp | 101 ----- gdb/testsuite/gdb.mi/mi2-until.exp | 84 ---- gdb/testsuite/gdb.mi/mi2-var-block.exp | 173 -------- gdb/testsuite/gdb.mi/mi2-var-cmd.exp | 529 ------------------------- gdb/testsuite/gdb.mi/mi2-var-display.exp | 631 ------------------------------ gdb/testsuite/gdb.mi/mi2-watch.exp | 186 --------- 22 files changed, 204 insertions(+), 3596 deletions(-) create mode 100644 gdb/testsuite/gdb.mi/mi-cli.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-basics.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-break.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-cli.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-console.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-disassemble.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-eval.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-file.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-hack-cli.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-pthreads.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-read-memory.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-regs.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-return.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-simplerun.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-stack.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-stepi.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-syn-frame.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-until.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-var-block.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-var-cmd.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-var-display.exp delete mode 100644 gdb/testsuite/gdb.mi/mi2-watch.exp diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp new file mode 100644 index 0000000..bab2373 --- /dev/null +++ b/gdb/testsuite/gdb.mi/mi-cli.exp @@ -0,0 +1,204 @@ +# Copyright 2002-2005, 2007-2012 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# This file tests that GDB's console can be accessed via the MI. +# Specifically, we are testing the "interpreter-exec" command and that +# the commands that are executed via this command are properly executed. +# Console commands executed via MI should use MI output wrappers, MI event +# handlers, etc. + +load_lib mi-support.exp +set MIFLAGS "-i=mi" + +gdb_exit +if [mi_gdb_start] { + continue +} + +standard_testfile basics.c + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + untested mi-cli.exp + return -1 +} + +mi_gdb_test "-interpreter-exec" \ + {\^error,msg="-interpreter-exec: Usage: -interpreter-exec interp command"} \ + "-interpreter-exec with no arguments" + +mi_gdb_test "-interpreter-exec console" \ + {\^error,msg="-interpreter-exec: Usage: -interpreter-exec interp command"} \ + "-interpreter-exec with one argument" + +mi_gdb_test "-interpreter-exec bogus command" \ + {\^error,msg="-interpreter-exec: could not find interpreter \\\"bogus\\\""} \ + "-interpreter-exec with bogus interpreter" + +set msg {Undefined command: \\\"bogus\\\"\. Try \\\"help\\\"\.} +mi_gdb_test "-interpreter-exec console bogus" \ + "&\\\"$msg\\\\n\\\".*\\^error,msg=\\\"$msg\\\".*" \ + "-interpreter-exec console bogus" + +# NOTE: cagney/2003-02-03: Not yet. +# mi_gdb_test "-interpreter-exec console \"file $binfile\"" \ +# {(=.*)+\^done} \ +# "-interpreter-exec console \"file \$binfile\"" +mi_gdb_test "-interpreter-exec console \"file $binfile\"" \ + {~"Reading symbols from .*mi-cli...".*\^done} \ + "-interpreter-exec console \"file \$binfile\"" + +mi_run_to_main + +set line_main_head [gdb_get_line_number "main ("] +set line_main_body [expr $line_main_head + 2] +set line_main_hello [gdb_get_line_number "Hello, World!"] +set line_main_return [expr $line_main_hello + 2] +set line_callee4_head [gdb_get_line_number "callee4 ("] +set line_callee4_body [expr $line_callee4_head + 2] +set line_callee4_next [expr $line_callee4_body + 1] + +mi_gdb_test "-interpreter-exec console \"set args foobar\"" \ + ".*=cmd-param-changed,param=\"args\",value=\"foobar\".*\\^done" \ + "-interpreter-exec console \"set args foobar\"" + +mi_gdb_test "-interpreter-exec console \"show args\"" \ + {\~"Argument list to give program being debugged when it is started is \\\"foobar\\\"\.\\n".*\^done} \ + "-interpreter-exec console \"show args\"" + +mi_gdb_test "-interpreter-exec console \"break callee4\"" \ + {(&.*)*.*~"Breakpoint 2 at.*\\n".*=breakpoint-created,bkpt=\{number="2",type="breakpoint".*\}.*\n\^done} \ + "-interpreter-exec console \"break callee4\"" + +mi_gdb_test "-interpreter-exec console \"info break\"" \ + {\~"Num[ \t]*Type[ \t]*Disp[ \t]*Enb[ \t]*Address[ \t]*What\\n".*~"2[ \t]*breakpoint[ \t]*keep[ \t]*y[ \t]*0x[0-9A-Fa-f]+[ \t]*in callee4 at .*basics.c:[0-9]+\\n".*\^done} \ + "-interpreter-exec console \"info break\"" + +mi_gdb_test "-interpreter-exec console \"set listsize 1\"" \ + ".*=cmd-param-changed,param=\"listsize\",value=\"1\".*\\^done" \ + "-interpreter-exec console \"set listsize 1\"" + +# {.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done } +mi_gdb_test "-interpreter-exec console \"list\"" \ + ".*\~\"$line_main_body\[\\\\t \]*callee1.*;\\\\n\".*\\^done" \ + "-interpreter-exec console \"list\"" + +mi_execute_to "exec-continue" "breakpoint-hit" "callee4" "" ".*basics.c" $line_callee4_body \ + { "" "disp=\"keep\"" } \ + "continue to callee4" + +mi_gdb_test "100-interpreter-exec console \"delete 2\"" \ + {.*=breakpoint-deleted,id=\"2\".*\^done} \ + "-interpreter-exec console \"delete 2\"" + +# NOTE: cagney/2003-02-03: Not yet. +# mi_gdb_test "200-interpreter-exec console \"up\"" \ +# {.*=selected-frame-level-changed,level="1".*\^done} \ +# "-interpreter-exec console \"up\"" +mi_gdb_test "200-interpreter-exec console \"up\"" \ + {~"#.*".*200\^done} \ + "-interpreter-exec console \"up\"" + +# NOTE: cagney/2003-02-03: Not yet. +# mi_gdb_test "300-interpreter-exec console \"down\"" \ +# {.*=selected-frame-level-changed,level="0".*\^done} \ +# "-interpreter-exec console \"down\"" +mi_gdb_test "300-interpreter-exec console \"down\"" \ + {~"#.*".*300\^done} \ + "-interpreter-exec console \"down\"" + +# NOTE: cagney/2003-02-03: Not yet. +# mi_gdb_test "-interpreter-exec console \"frame 2\"" \ +# {.*=selected-frame-level-changed,level="2".*\^done} \ +# "-interpreter-exec console \"frame 2\"" +mi_gdb_test "400-interpreter-exec console \"frame 2\"" \ + {~"#.*".*400\^done} \ + "-interpreter-exec console \"frame 2\"" + +# NOTE: cagney/2003-02-03: Not yet. +# mi_gdb_test "-stack-select-frame 0" \ +# {.*=selected-frame-level-changed,level="0".*\^done} \ +# "-stack-select-frame 0" +mi_gdb_test "500-stack-select-frame 0" \ + {500\^done} \ + "-stack-select-frame 0" + +# When a CLI command is entered in MI session, the respose is different in +# sync and async modes. In sync mode normal_stop is called when current +# interpreter is CLI. So: +# - print_stop_reason prints stop reason in CLI uiout, and we don't show it +# in MI +# - The stop position is printed, and appears in MI 'console' channel. +# +# In async mode the stop event is processed when we're back to MI interpreter, +# so the stop reason is printed into MI uiout an. +if {$async} { + set reason "end-stepping-range" +} else { + set reason "" +} + +mi_execute_to "interpreter-exec console step" $reason "callee4" "" ".*basics.c" $line_callee4_next \ + "" "check *stopped from CLI command" + +mi_gdb_test "600-break-insert -t basics.c:$line_main_hello" \ + {600\^done,bkpt=.number="3",type="breakpoint".*\}} \ + "-break-insert -t basics.c:\$line_main_hello" + +mi_execute_to "exec-continue" "breakpoint-hit" "main" "" ".*basics.c" \ + $line_main_hello { "" "disp=\"del\"" } \ + "-exec-continue to line \$line_main_hello" + +# Test that the token is output even for CLI commands +# Also test that *stopped includes frame information. +mi_gdb_test "34 next" \ + ".*34\\\^running.*\\*running,thread-id=\"all\"" \ + "34 next: run" + +if {!$async} { + gdb_expect { + -re "~\[^\r\n\]+\r\n" { + } + } +} + +# Note that the output does not include stop reason. This is fine. +# The purpose of *stopped notification for CLI command is to make +# sure that frontend knows that inferior is stopped, and knows where. +# Supplementary information is not necessary. +mi_expect_stop "$reason" "main" "" ".*basics.c" $line_main_return "" \ + "34 next: stop" + +mi_gdb_test "-interpreter-exec console \"list\"" \ + "\~\"$line_main_return\[\\\\t ]*callme \\(1\\);\\\\n\".*\\^done" \ + "-interpreter-exec console \"list\" at basics.c:\$line_main_return" + +mi_gdb_test "-interpreter-exec console \"help set args\"" \ + {\~"Set argument list to give program being debugged when it is started\.\\nFollow this command with any number of args, to be passed to the program\.".*\^done} \ + "-interpreter-exec console \"help set args\"" + +# NOTE: cagney/2003-02-03: Not yet. +# mi_gdb_test "-interpreter-exec console \"set \$pc=0x0\"" \ +# {.*=target-changed.*\^done} \ +# "-interpreter-exec console \"set \$pc=0x0\"" +mi_gdb_test "888-interpreter-exec console \"set \$pc=0x0\"" \ + {888\^done} \ + "-interpreter-exec console \"set \$pc=0x0\"" + +#mi_gdb_test "-interpreter-exec console \"\"" \ + {} \ + "-interpreter-exec console \"\"" + +mi_gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-basics.exp b/gdb/testsuite/gdb.mi/mi2-basics.exp deleted file mode 100644 index 3a54f99..0000000 --- a/gdb/testsuite/gdb.mi/mi2-basics.exp +++ /dev/null @@ -1,229 +0,0 @@ -# Copyright 1999-2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# test basic Machine interface (MI) operations -# -# Verify that, using the MI, we can load a program and do -# other basic things that are used by all test files through mi_gdb_exit, -# mi_gdb_start, mi_delete_breakpoints, mi_gdb_reinitialize_dir and -# mi_gdb_load, so we can safely use those. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but the command syntax and correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -set escapedobjdir [string_to_regexp ${objdir}] -set envirodir [string_to_regexp ${objdir}/${subdir}] - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-basics.exp - return -1 -} - -# In this file we want to test if the operations needed by the following -# procedures work, so it makes no sense using them here. - -# mi_delete_breakpoints -# mi_gdb_reinitialize_dir $srcdir/$subdir -# mi_gdb_load ${binfile} - -# Test if the MI interpreter has been configured - -proc test_mi_interpreter_selection {} { - global mi_gdb_prompt - global gdb_prompt - - # All this test expects is to get the prompt back - # with no syntax error message - if ![mi_gdb_test "-gdb-version" "~\"GNU gdb.*" "acceptance of MI operations"] { - return 1 - } - - note "Skipping all other MI tests." - return 0 -} - -proc test_exec_and_symbol_mi_operatons {} { - global mi_gdb_prompt - global binfile - - # Load symbols and specify executable on a single operation - # Tests: - # -file-exec-and-symbols - - if [mi_gdb_test "-file-exec-and-symbols ${binfile}" "\\\^done" \ - "file-exec-and-symbols operation"] { - note "Skipping all other MI tests." - return 0 - } - - # The following is not used by mi-support.exp, but we test here so - # we get done with loading a program basics. - - # Do it again, but now load symbols and specify executable with - # two separate operations - # Tests: - # -file-clear - # -file-exec-file - # -file-symbol-file - - # FIXME: file-clear is not implemented yet. -# mi_gdb_test "-file-clear" \ -# "\\\^done" \ -# "file-clear operation" - - mi_gdb_test "-file-exec-file ${binfile}" \ - "\\\^done" \ - "file-exec-file operation" - - mi_gdb_test "-file-symbol-file ${binfile}" \ - "\\\^done" \ - "file-symbol-file operation" - - # We need to return != 0. - return 1 -} - -proc test_breakpoints_deletion {} { - global mi_gdb_prompt - global srcfile - - # Clear all breakpoints and list to confirm - # Tests: - # -break-delete (all) - # -break-list - - # The all parameter is actually no parameter. - mi_gdb_test "200-break-delete" \ - "200\\\^done" \ - "break-delete (all) operation" - - mi_gdb_test "201-break-list" \ - ".*\\\^done,BreakpointTable=\\\{.*,body=\\\[\\\]\\\}" \ - "all breakpoints removed" -} - -proc test_dir_specification {} { - global mi_gdb_prompt - global objdir - global subdir - global envirodir - - # Add to the search directories, display, then reset back to default - # Tests: - # -environment-directory arg - # -environment-directory - # -environment-directory -r - - mi_gdb_test "202-environment-directory ${objdir}/${subdir}" \ - "202\\\^done,source-path=\"${envirodir}.\\\$cdir.\\\$cwd\"" \ - "environment-directory arg operation" - - mi_gdb_test "203-environment-directory" \ - "203\\\^done,source-path=\"${envirodir}.\\\$cdir.\\\$cwd\"" \ - "environment-directory empty-string operation" - - mi_gdb_test "204-environment-directory -r" \ - "204\\\^done,source-path=\"\\\$cdir.\\\$cwd\"" \ - "environment-directory operation" - -#exp_internal 0 -} - -proc test_cwd_specification {} { - global mi_gdb_prompt - global objdir - global subdir - global escapedobjdir - - # Change the working directory, then print the current working directory - # Tests: - # -environment-cd ${objdir} - # -environment-pwd - - mi_gdb_test "205-environment-cd ${objdir}" \ - "205\\\^done" \ - "environment-cd arg operation" - - # The canonical name of the working directory may differ on a - # remote host from that on the build system. - if ![is_remote host] { - mi_gdb_test "206-environment-pwd" \ - "206\\\^done,cwd=\"${escapedobjdir}\"" \ - "environment-pwd operation" - } -} - -proc test_path_specification {} { - global mi_gdb_prompt - global orig_path - global objdir - global subdir - global escapedobjdir - global envirodir - global expect_out - - # Add to the path, display, then reset - # Tests: - # -environment-path - # -environment-path dir1 dir2 - # -environment-path -r dir - # -environment-path -r - - mi_gdb_test "-environment-path" "\\\^done,path=\"(.*)\"" "-environment-path" - set orig_path $expect_out(3,string) - - set orig_path [string_to_regexp ${orig_path}] - set pathdir [string_to_regexp ${objdir}/${subdir}] - - mi_gdb_test "207-environment-path" \ - "207\\\^done,path=\"$orig_path\"" \ - "environment-path no-args operation" - - mi_gdb_test "208-environment-path $objdir ${objdir}/${subdir}" \ - "208\\\^done,path=\"$escapedobjdir.${envirodir}.$orig_path\"" \ - "environment-path dir1 dir2 operation" - - mi_gdb_test "209-environment-path -r $objdir" \ - "209\\\^done,path=\"$escapedobjdir.$orig_path\"" \ - "environment-path -r dir operation" - - mi_gdb_test "210-environment-path -r" \ - "210\\\^done,path=\"$orig_path\"" \ - "environment-path -r operation" - -} - -if { [test_mi_interpreter_selection] - && [test_exec_and_symbol_mi_operatons] } { - test_breakpoints_deletion - test_dir_specification - test_cwd_specification - test_path_specification -} - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-break.exp b/gdb/testsuite/gdb.mi/mi2-break.exp deleted file mode 100644 index e1375e2..0000000 --- a/gdb/testsuite/gdb.mi/mi2-break.exp +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright 1999, 2001, 2003-2004, 2006-2012 Free Software Foundation, -# Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-break.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -# Locate line numbers in basics.c. -set line_callee4_head [gdb_get_line_number "callee4 ("] -set line_callee4_body [expr $line_callee4_head + 2] -set line_callee3_head [gdb_get_line_number "callee3 ("] -set line_callee3_body [expr $line_callee3_head + 2] -set line_callee2_head [gdb_get_line_number "callee2 ("] -set line_callee2_body [expr $line_callee2_head + 2] -set line_callee1_head [gdb_get_line_number "callee1 ("] -set line_callee1_body [expr $line_callee1_head + 2] -set line_main_head [gdb_get_line_number "main ("] -set line_main_body [expr $line_main_head + 2] - -set fullname "fullname=\"${fullname_syntax}${srcfile}\"" - -proc test_tbreak_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - global line_callee4_head line_callee4_body - global line_callee3_head line_callee3_body - global line_callee2_head line_callee2_body - global line_callee1_head line_callee1_body - global line_main_head line_main_body - global fullname - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert -t main - # -break-insert -t basics.c:callee2 - # -break-insert -t basics.c:$line_callee3_head - # -break-insert -t srcfile:$line_callee4_head - # -break-list - - mi_create_breakpoint "-t main" 1 del main ".*basics.c" $line_main_body $hex \ - "break-insert -t operation" - - mi_create_breakpoint "-t basics.c:callee2" 2 del callee2 ".*basics.c" $line_callee2_body $hex \ - "insert temp breakpoint at basics.c:callee2" - - mi_create_breakpoint "-t basics.c:$line_callee3_head" 3 del callee3 ".*basics.c" $line_callee3_head $hex \ - "insert temp breakpoint at basics.c:\$line_callee3_head" - - # Getting the quoting right is tricky. That is "\"<file>\":$line_callee4_head" - mi_create_breakpoint "-t \"\\\"${srcfile}\\\":$line_callee4_head\"" 4 del callee4 ".*basics.c" $line_callee4_head $hex \ - "insert temp breakpoint at \"<fullfilename>\":\$line_callee4_head" - - mi_gdb_test "666-break-list" \ - "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\",original-location=\".*\"\}.*\\\]\}" \ - "list of breakpoints" - - mi_gdb_test "777-break-delete" \ - "777\\^done" \ - "delete temp breakpoints" -} - -proc test_rbreak_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - global line_callee4_head line_callee4_body - global line_callee3_head line_callee3_body - global line_callee2_head line_callee2_body - global line_callee1_head line_callee1_body - global line_main_head line_main_body - global fullname - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert -r main - # -break-insert -r callee2 - # -break-insert -r callee - # -break-insert -r .*llee - # -break-list - - setup_xfail "*-*-*" - mi_gdb_test "122-break-insert -r main" \ - "122\\^done,bkpt=\{number=\"5\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_main_body\"\}" \ - "break-insert -r operation" - - setup_xfail "*-*-*" - mi_gdb_test "133-break-insert -r callee2" \ - "133\\^done,bkpt=\{number=\"6\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\"\}" \ - "insert breakpoint with regexp callee2" - - setup_xfail "*-*-*" - mi_gdb_test "144-break-insert -r callee" \ - "144\\^done,bkpt=\{number=\"7\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee1_body\"\},bkpt=\{number=\"8\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\"\},bkpt=\{number=\"9\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee3_body\"\},bkpt=\{number=\"10\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee4_body\"\}" \ - "insert breakpoint with regexp callee" - - setup_xfail "*-*-*" - mi_gdb_test "155-break-insert -r \.\*llee" \ - "155\\^done,bkpt=\{number=\"11\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee1_body\"\},bkpt=\{number=\"12\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee2_body\"\},bkpt=\{number=\"13\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee3_body\"\},bkpt=\{number=\"14\",addr=\"$hex\",file=\".*basics.c\",${fullname},line=\"$line_callee4_body\"\}" \ - "insert breakpoint with regexp .*llee" - - setup_xfail "*-*-*" - mi_gdb_test "166-break-list" \ - "1\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",${fullname},line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \ - "list of breakpoints" - - mi_gdb_test "177-break-delete" \ - "177\\^done" \ - "delete temp breakpoints" -} - -test_tbreak_creation_and_listing -test_rbreak_creation_and_listing - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-cli.exp b/gdb/testsuite/gdb.mi/mi2-cli.exp deleted file mode 100644 index 03ede23..0000000 --- a/gdb/testsuite/gdb.mi/mi2-cli.exp +++ /dev/null @@ -1,204 +0,0 @@ -# Copyright 2002-2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# This file tests that GDB's console can be accessed via the MI. -# Specifically, we are testing the "interpreter-exec" command and that -# the commands that are executed via this command are properly executed. -# Console commands executed via MI should use MI output wrappers, MI event -# handlers, etc. - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-cli.exp - return -1 -} - -mi_gdb_test "-interpreter-exec" \ - {\^error,msg="-interpreter-exec: Usage: -interpreter-exec interp command"} \ - "-interpreter-exec with no arguments" - -mi_gdb_test "-interpreter-exec console" \ - {\^error,msg="-interpreter-exec: Usage: -interpreter-exec interp command"} \ - "-interpreter-exec with one argument" - -mi_gdb_test "-interpreter-exec bogus command" \ - {\^error,msg="-interpreter-exec: could not find interpreter \\\"bogus\\\""} \ - "-interpreter-exec with bogus interpreter" - -set msg {Undefined command: \\\"bogus\\\"\. Try \\\"help\\\"\.} -mi_gdb_test "-interpreter-exec console bogus" \ - "&\\\"$msg\\\\n\\\".*\\^error,msg=\\\"$msg\\\".*" \ - "-interpreter-exec console bogus" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "-interpreter-exec console \"file $binfile\"" \ -# {(=.*)+\^done} \ -# "-interpreter-exec console \"file \$binfile\"" -mi_gdb_test "-interpreter-exec console \"file $binfile\"" \ - {~"Reading symbols from .*mi2-cli...".*\^done} \ - "-interpreter-exec console \"file \$binfile\"" - -mi_run_to_main - -set line_main_head [gdb_get_line_number "main ("] -set line_main_body [expr $line_main_head + 2] -set line_main_hello [gdb_get_line_number "Hello, World!"] -set line_main_return [expr $line_main_hello + 2] -set line_callee4_head [gdb_get_line_number "callee4 ("] -set line_callee4_body [expr $line_callee4_head + 2] -set line_callee4_next [expr $line_callee4_body + 1] - -mi_gdb_test "-interpreter-exec console \"set args foobar\"" \ - ".*=cmd-param-changed,param=\"args\",value=\"foobar\".*\\^done" \ - "-interpreter-exec console \"set args foobar\"" - -mi_gdb_test "-interpreter-exec console \"show args\"" \ - {\~"Argument list to give program being debugged when it is started is \\\"foobar\\\"\.\\n".*\^done} \ - "-interpreter-exec console \"show args\"" - -mi_gdb_test "-interpreter-exec console \"break callee4\"" \ - {(&.*)*.*~"Breakpoint 2 at.*\\n".*=breakpoint-created,bkpt=\{number="2",type="breakpoint".*\}.*\n\^done} \ - "-interpreter-exec console \"break callee4\"" - -mi_gdb_test "-interpreter-exec console \"info break\"" \ - {\~"Num[ \t]*Type[ \t]*Disp[ \t]*Enb[ \t]*Address[ \t]*What\\n".*~"2[ \t]*breakpoint[ \t]*keep[ \t]*y[ \t]*0x[0-9A-Fa-f]+[ \t]*in callee4 at .*basics.c:[0-9]+\\n".*\^done} \ - "-interpreter-exec console \"info break\"" - -mi_gdb_test "-interpreter-exec console \"set listsize 1\"" \ - ".*=cmd-param-changed,param=\"listsize\",value=\"1\".*\\^done" \ - "-interpreter-exec console \"set listsize 1\"" - -# {.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done } -mi_gdb_test "-interpreter-exec console \"list\"" \ - ".*\~\"$line_main_body\[\\\\t \]*callee1.*;\\\\n\".*\\^done" \ - "-interpreter-exec console \"list\"" - -mi_execute_to "exec-continue" "breakpoint-hit" "callee4" "" ".*basics.c" $line_callee4_body \ - { "" "disp=\"keep\"" } \ - "continue to callee4" - -mi_gdb_test "100-interpreter-exec console \"delete 2\"" \ - {.*=breakpoint-deleted,id=\"2\".*\^done} \ - "-interpreter-exec console \"delete 2\"" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "200-interpreter-exec console \"up\"" \ -# {.*=selected-frame-level-changed,level="1".*\^done} \ -# "-interpreter-exec console \"up\"" -mi_gdb_test "200-interpreter-exec console \"up\"" \ - {~"#.*".*200\^done} \ - "-interpreter-exec console \"up\"" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "300-interpreter-exec console \"down\"" \ -# {.*=selected-frame-level-changed,level="0".*\^done} \ -# "-interpreter-exec console \"down\"" -mi_gdb_test "300-interpreter-exec console \"down\"" \ - {~"#.*".*300\^done} \ - "-interpreter-exec console \"down\"" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "-interpreter-exec console \"frame 2\"" \ -# {.*=selected-frame-level-changed,level="2".*\^done} \ -# "-interpreter-exec console \"frame 2\"" -mi_gdb_test "400-interpreter-exec console \"frame 2\"" \ - {~"#.*".*400\^done} \ - "-interpreter-exec console \"frame 2\"" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "-stack-select-frame 0" \ -# {.*=selected-frame-level-changed,level="0".*\^done} \ -# "-stack-select-frame 0" -mi_gdb_test "500-stack-select-frame 0" \ - {500\^done} \ - "-stack-select-frame 0" - -# When a CLI command is entered in MI session, the respose is different in -# sync and async modes. In sync mode normal_stop is called when current -# interpreter is CLI. So: -# - print_stop_reason prints stop reason in CLI uiout, and we don't show it -# in MI -# - The stop position is printed, and appears in MI 'console' channel. -# -# In async mode the stop event is processed when we're back to MI interpreter, -# so the stop reason is printed into MI uiout an. -if {$async} { - set reason "end-stepping-range" -} else { - set reason "" -} - -mi_execute_to "interpreter-exec console step" $reason "callee4" "" ".*basics.c" $line_callee4_next \ - "" "check *stopped from CLI command" - -mi_gdb_test "600-break-insert -t basics.c:$line_main_hello" \ - {600\^done,bkpt=.number="3",type="breakpoint".*\}} \ - "-break-insert -t basics.c:\$line_main_hello" - -mi_execute_to "exec-continue" "breakpoint-hit" "main" "" ".*basics.c" \ - $line_main_hello { "" "disp=\"del\"" } \ - "-exec-continue to line \$line_main_hello" - -# Test that the token is output even for CLI commands -# Also test that *stopped includes frame information. -mi_gdb_test "34 next" \ - ".*34\\\^running.*\\*running,thread-id=\"all\"" \ - "34 next: run" - -if {!$async} { - gdb_expect { - -re "~\[^\r\n\]+\r\n" { - } - } -} - -# Note that the output does not include stop reason. This is fine. -# The purpose of *stopped notification for CLI command is to make -# sure that frontend knows that inferior is stopped, and knows where. -# Supplementary information is not necessary. -mi_expect_stop "$reason" "main" "" ".*basics.c" $line_main_return "" \ - "34 next: stop" - -mi_gdb_test "-interpreter-exec console \"list\"" \ - "\~\"$line_main_return\[\\\\t ]*callme \\(1\\);\\\\n\".*\\^done" \ - "-interpreter-exec console \"list\" at basics.c:\$line_main_return" - -mi_gdb_test "-interpreter-exec console \"help set args\"" \ - {\~"Set argument list to give program being debugged when it is started\.\\nFollow this command with any number of args, to be passed to the program\.".*\^done} \ - "-interpreter-exec console \"help set args\"" - -# NOTE: cagney/2003-02-03: Not yet. -# mi_gdb_test "-interpreter-exec console \"set \$pc=0x0\"" \ -# {.*=target-changed.*\^done} \ -# "-interpreter-exec console \"set \$pc=0x0\"" -mi_gdb_test "888-interpreter-exec console \"set \$pc=0x0\"" \ - {888\^done} \ - "-interpreter-exec console \"set \$pc=0x0\"" - -#mi_gdb_test "-interpreter-exec console \"\"" \ - {} \ - "-interpreter-exec console \"\"" - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-console.exp b/gdb/testsuite/gdb.mi/mi2-console.exp deleted file mode 100644 index e1e180b..0000000 --- a/gdb/testsuite/gdb.mi/mi2-console.exp +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright 1999-2003, 2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -# This test only works when talking to a target that routes its output -# through GDB. Check that we're either talking to a simulator or a -# remote target. - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile mi-console.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-console.exp - return -1 -} - -mi_run_to_main - -# Next over the hello() call which will produce lots of output -mi_gdb_test "220-exec-next" "220\\^running(\r\n)?(\\*running,thread-id=\"all\")?" \ - "Started step over hello" - -if { ![target_info exists gdb,noinferiorio] } { - gdb_expect { - -re "@\"H\"\r\n.*@\"e\"\r\n.*@\"l\"\r\n.*@\"l\"\r\n.*@\"o\"\r\n.*@\" \"\r\n.*@\"\\\\\\\\\"\r\n.*@\"\\\\\"\"\r\n.*@\"!\"\r\n.*@\"\\\\r\"\r\n.*@\"\\\\n\"\r\n" { - pass "Hello message" - } - -re "Hello" { - - # Probably a native system where GDB doesn't have direct # - # control over the inferior console. # For this to work, - # GDB would need to run the inferior process # under a PTY - # and then use the even-loops ability to wait on # - # multiple event sources to channel the output back - # through the # MI. - - kfail "gdb/623" "Hello message" - } - timeout { - fail "Hello message (timeout)" - } - } -} - -mi_expect_stop "end-stepping-range" "main" "" ".*mi-console.c" "14" "" \ - "finished step over hello" - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-disassemble.exp b/gdb/testsuite/gdb.mi/mi2-disassemble.exp deleted file mode 100644 index 30e9129..0000000 --- a/gdb/testsuite/gdb.mi/mi2-disassemble.exp +++ /dev/null @@ -1,238 +0,0 @@ -# Copyright 1999-2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test Machine interface (MI) operations for disassembly. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-disassemble.exp - return -1 -} - -proc test_disassembly_only {} { - global mi_gdb_prompt - global hex - global decimal - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Test disassembly more only for the current function. - # Tests: - # -data-disassemble -s $pc -e "$pc+8" -- 0 - # -data-disassembly -f basics.c -l $line_main_body -- 0 - - mi_gdb_test "print/x \$pc" "" "" - mi_gdb_test "111-data-disassemble -s \$pc -e \"\$pc + 12\" -- 0" \ - "111\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\},\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\]" \ - "data-disassemble from pc to pc+12 assembly only" - - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -- 0" \ - "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \ - "data-disassemble file & line, assembly only" -} - -proc test_disassembly_with_opcodes {} { - global mi_gdb_prompt - global hex - global decimal - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Test disassembly with opcodes for the current function. - # Tests: - # -data-disassemble -s $pc -e "$pc+8" -- 2 - # -data-disassembly -f basics.c -l $line_main_body -- 2 - - mi_gdb_test "print/x \$pc" "" "" - mi_gdb_test "111-data-disassemble -s \$pc -e \"\$pc + 12\" -- 2" \ - "111\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\},\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}.*\]" \ - "data-disassemble from pc to pc+12 assembly with opcodes" - - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -- 2" \ - "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",opcodes=\".*\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}\\\]" \ - "data-disassemble file & line, assembly with opcodes" -} - -proc test_disassembly_lines_limit {} { - global mi_gdb_prompt - global hex - global decimal - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Test disassembly more only for the current function. - # Tests: - # -data-disassembly -f basics.c -l $line_main_body -n 20 -- 0 - # -data-disassembly -f basics.c -l $line_main_body -n 0 -- 0 - # -data-disassembly -f basics.c -l $line_main_body -n 50 -- 0 - - mi_gdb_test "print/x \$pc" "" "" - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 20 -- 0" \ - "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \ - "data-disassemble file, line, number assembly only" - - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 0 -- 0" \ - "222\\^done,asm_insns=\\\[\\\]" \ - "data-disassemble file, line, number (zero lines) assembly only" - - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 50 -- 0" \ - "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \ - "data-disassemble file, line, number (more than main lines) assembly only" -} - - -proc test_disassembly_mixed {} { - global mi_gdb_prompt - global hex - global decimal - - set line_callee2_head [gdb_get_line_number "callee2 ("] - set line_callee2_open_brace [expr $line_callee2_head + 1] - - # Test disassembly more only for the current function. - # Tests: - # -data-disassembly -f basics.c -l $line_callee2_open_brace -- 1 - # -data-disassembly -s $pc -e "$pc+8" -- 1 - - mi_gdb_test "002-data-disassemble -f basics.c -l $line_callee2_open_brace -- 1" \ - "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_callee2_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \ - "data-disassemble file, line assembly mixed" - - # - # In mixed mode, the lowest level of granularity is the source line. - # So we are going to get the disassembly for the source line at - # which we are now, even if we have specified that the range is only 2 insns. - # - mi_gdb_test "003-data-disassemble -s \$pc -e \"\$pc+4\" -- 1" \ - "003\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \ - "data-disassemble range assembly mixed" -} - -proc test_disassembly_mixed_with_opcodes {} { - global mi_gdb_prompt - global hex - global decimal - - set line_callee2_head [gdb_get_line_number "callee2 ("] - set line_callee2_open_brace [expr $line_callee2_head + 1] - - # Test disassembly mixed with opcodes for the current function. - # Tests: - # -data-disassembly -f basics.c -l $line_callee2_open_brace -- 3 - # -data-disassembly -s $pc -e "$pc+8" -- 3 - - mi_gdb_test "002-data-disassemble -f basics.c -l $line_callee2_open_brace -- 3" \ - "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_callee2_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",opcodes=\".*\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}\\\]\}\\\]" \ - "data-disassemble file, line assembly mixed with opcodes" - - # - # In mixed mode, the lowest level of granularity is the source line. - # So we are going to get the disassembly for the source line at - # which we are now, even if we have specified that the range is only 2 insns. - # - mi_gdb_test "003-data-disassemble -s \$pc -e \"\$pc+4\" -- 3" \ - "003\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}.*\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}\\\]\}\\\]" \ - "data-disassemble range assembly mixed with opcodes" -} - -proc test_disassembly_mixed_lines_limit {} { - global mi_gdb_prompt - global hex - global decimal - - set line_main_head [gdb_get_line_number "main ("] - set line_main_open_brace [expr $line_main_head + 1] - set line_main_body [expr $line_main_head + 2] - - # Test disassembly more only for the current function. - # Tests: - # -data-disassembly -f basics.c -l $line_main_body -n 20 -- 1 - # -data-disassembly -f basics.c -l $line_main_body -n 0 -- 1 - # -data-disassembly -f basics.c -l $line_main_body -n 50 -- 1 - - mi_gdb_test "print/x \$pc" "" "" - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 20 -- 1" \ - "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \ - "data-disassemble file, line, number assembly mixed" - - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 0 -- 1" \ - "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_main_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\\\]\}\\\]" \ - "data-disassemble file, line, number (zero lines) assembly mixed" - - mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 50 -- 1" \ - "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\}.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \ - "data-disassemble file, line, number (more than main lines) assembly mixed" -} - -proc test_disassembly_bogus_args {} { - global mi_gdb_prompt - global hex - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Test that bogus input to disassembly command is rejected. - # Tests: - # -data-disassembly -f foo -l abc -n 0 -- 0 - # -data-disassembly -s foo -e bar -- 0 - # -data-disassembly -s $pc -f basics.c -- 0 - # -data-disassembly -f basics.c -l 32 -- 9 - - mi_gdb_test "123-data-disassemble -f foo -l abc -n 0 -- 0" \ - "123\\^error,msg=\"-data-disassemble: Invalid filename.\"" \ - "data-disassemble bogus filename" - - mi_gdb_test "321-data-disassemble -s foo -e bar -- 0" \ - "321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \ - "data-disassemble bogus address" - - mi_gdb_test "456-data-disassemble -s \$pc -f basics.c -- 0" \ - "456\\^error,msg=\"-data-disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. \\| .-s startaddr -e endaddr.\\) .--. mode.\"" \ - "data-disassemble mix different args" - - mi_gdb_test "789-data-disassemble -f basics.c -l $line_main_body -- 9" \ - "789\\^error,msg=\"-data-disassemble: Mode argument must be 0, 1, 2, or 3.\"" \ - "data-disassemble wrong mode arg" - -} - -mi_run_to_main -test_disassembly_only -test_disassembly_with_opcodes -test_disassembly_mixed -test_disassembly_mixed_with_opcodes -test_disassembly_bogus_args -test_disassembly_lines_limit -test_disassembly_mixed_lines_limit - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-eval.exp b/gdb/testsuite/gdb.mi/mi2-eval.exp deleted file mode 100644 index cb82c73..0000000 --- a/gdb/testsuite/gdb.mi/mi2-eval.exp +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 1999-2004, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test essential Machine interface (MI) operations -# -# Verify -data-evaluate-expression. There are really minimal tests. - -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-eval.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -set line_callee4_head [gdb_get_line_number "callee4 ("] -set line_callee4_body [expr $line_callee4_head + 2] - -mi_runto callee4 -mi_next_to "callee4" "" "basics.c" [expr $line_callee4_body + 1] "next at callee4" - -mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A" - -mi_gdb_test "311-data-evaluate-expression &A" "311\\^done,value=\"$hex\"" "eval &A" - -mi_gdb_test "411-data-evaluate-expression A+3" "411\\^done,value=\"4\"" "eval A+3" - -mi_gdb_test "511-data-evaluate-expression \"A + 3\"" "511\\^done,value=\"4\"" "eval A + 3" - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-file.exp b/gdb/testsuite/gdb.mi/mi2-file.exp deleted file mode 100644 index 56ad708..0000000 --- a/gdb/testsuite/gdb.mi/mi2-file.exp +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 1999, 2003-2004, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-file.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_file_cmd ${binfile} - -proc test_file_list_exec_source_file {} { - global srcfile - global srcdir - global subdir - global fullname_syntax - set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}] - - # get the path and absolute path to the current executable - # - # In gdb 6.2 (at least), the default line number is set by - # select_source_symtab to the first line of "main" minus - # the value of "lines_to_list" (which defaults to 10) plus one. - # --chastain 2004-08-13 - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - set gdb_lines_to_list 10 - set line_default [expr $line_main_body - $gdb_lines_to_list + 1] - - mi_gdb_test "111-file-list-exec-source-file" \ - "111\\\^done,line=\"$line_default\",file=\"${srcfilepath}\",fullname=\"$fullname_syntax${srcfile}\",macro-info=\"0\"" \ - "request path info of current source file (${srcfile})" -} - -test_file_list_exec_source_file - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-hack-cli.exp b/gdb/testsuite/gdb.mi/mi2-hack-cli.exp deleted file mode 100644 index fb1e4d7..0000000 --- a/gdb/testsuite/gdb.mi/mi2-hack-cli.exp +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 1999, 2001, 2003, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - - -# Some basic checks for the CLI. - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -mi_gdb_test "show architecture" \ - "&\"show architecture\\\\n\"\r\n~\"The target architecture.*\"\r\n\\^done" \ - "show architecture" - -mi_gdb_test "47show architecture" \ - "&\"show architecture\\\\n\"\r\n~\"The target architecture.*\"\r\n47\\^done" \ - "47show architecture" - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-pthreads.exp b/gdb/testsuite/gdb.mi/mi2-pthreads.exp deleted file mode 100644 index 37f325e..0000000 --- a/gdb/testsuite/gdb.mi/mi2-pthreads.exp +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright 2002-2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# This file tests MI thread commands. -# Specifically, we are testing the MI command set and the console (in MI) -# command set ("interpreter-exec") and that the commands that are executed -# via these command pathways are properly executed. Console commands -# executed via MI should use MI output wrappers, MI event handlers, etc. - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if {[mi_gdb_start]} { - continue -} - -# This procedure tests the various thread commands in MI. -proc check_mi_thread_command_set {} { - - mi_runto done_making_threads - - set thread_list [get_mi_thread_list "in check_mi_thread_command_set"] - - mi_gdb_test "-thread-select" \ - {\^error,msg="-thread-select: USAGE: threadnum."} \ - "check_mi_thread_command_set: -thread-select" - - mi_gdb_test "-thread-select 123456789" \ - {&.*\^error,msg="Thread ID 123456789 not known\."} \ - "check_mi_thread_command_set: -thread-select 123456789" - - foreach thread $thread_list { - # line and file are optional. - # many of the threads are blocked in libc calls, - # and many people have libc's with no symbols. - mi_gdb_test "-thread-select $thread" \ - "\\^done,new-thread-id=\"$thread\",frame={.*}(,line=\"(-)?\[0-9\]+\",file=\".*\")?" \ - "check_mi_thread_command_set: -thread-select $thread" - } -} - -# -# Start here -# -standard_testfile pthreads.c - -set options [list debug] -if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } { - return -1 -} - -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load $binfile - -check_mi_thread_command_set - -mi_gdb_exit - diff --git a/gdb/testsuite/gdb.mi/mi2-read-memory.exp b/gdb/testsuite/gdb.mi/mi2-read-memory.exp deleted file mode 100644 index 17c9573..0000000 --- a/gdb/testsuite/gdb.mi/mi2-read-memory.exp +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright 1999-2003, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# test basic Machine interface (MI) operations -# -# Verify that, using the MI, we can load a program and do -# other basic things that are used by all test files through mi_gdb_exit, -# mi_gdb_start, mi_delete_breakpoints, mi_gdb_reinitialize_dir and -# mi_gdb_load, so we can safely use those. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but the command syntax and correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile mi-read-memory.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-read-memory.exp - return -1 -} - - -mi_run_to_main -mi_next_to "main" "" "mi-read-memory.c" "20" "next at main" - -mi_gdb_test "1-data-read-memory" \ - "1\\^error,msg=\".*\"" \ - "no arguments" - - -mi_gdb_test "2-data-read-memory bytes x 1 3 2" \ - "2\\^done,addr=\"$hex\",nr-bytes=\"6\",total-bytes=\"6\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x00\",\"0x01\"\\\]},{addr=\"$hex\",data=\\\[\"0x02\",\"0x03\"\\\]},{addr=\"$hex\",data=\\\[\"0x04\",\"0x05\"\\\]}\\\]" \ - "3x2, one byte" - - -mi_gdb_test "9-data-read-memory -o -6 -- -0+bytes+6 x 1 3 2" \ - "9\\^done,addr=\"$hex\",nr-bytes=\"6\",total-bytes=\"6\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x00\",\"0x01\"\\\]},{addr=\"$hex\",data=\\\[\"0x02\",\"0x03\"\\\]},{addr=\"$hex\",data=\\\[\"0x04\",\"0x05\"\\\]}\\\]" \ - "3x2, one byte offset by -6" - - -mi_gdb_test "3-data-read-memory \"(shorts + 128)\" x 2 1 2" \ - "3\\^done,addr=\"$hex\",nr-bytes=\"4\",total-bytes=\"4\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x0100\",\"0x0102\"\\\]}\\\]" \ - "expression in quotes" - - -mi_gdb_test "4-data-read-memory bytes+16 x 1 8 4 x" \ - "4\\^done,addr=\"$hex\",nr-bytes=\"32\",total-bytes=\"32\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x10\",\"0x11\",\"0x12\",\"0x13\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x14\",\"0x15\",\"0x16\",\"0x17\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x18\",\"0x19\",\"0x1a\",\"0x1b\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x1c\",\"0x1d\",\"0x1e\",\"0x1f\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x20\",\"0x21\",\"0x22\",\"0x23\"\\\],ascii=\" !\\\\\"#\"},{addr=\"$hex\",data=\\\[\"0x24\",\"0x25\",\"0x26\",\"0x27\"\\\],ascii=\"\\$%&'\"},{addr=\"$hex\",data=\\\[\"0x28\",\"0x29\",\"0x2a\",\"0x2b\"\\\],ascii=\"().+\"},{addr=\"$hex\",data=\\\[\"0x2c\",\"0x2d\",\"0x2e\",\"0x2f\"\\\],ascii=\",-\./\"}\\\]" \ - "ascii and data" - - -mi_gdb_test "5-data-read-memory shorts+64 d 2 1 1" \ - "5\\^done,addr=\"$hex\",nr-bytes=\"2\",total-bytes=\"2\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"128\"\\\]}\\\]" \ - "decimal" - -mi_gdb_test "6-data-read-memory shorts+64 o 2 1 1" \ - "6\\^done,addr=\"$hex\",nr-bytes=\"2\",total-bytes=\"2\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0200\"\\\]}\\\]" \ - "octal" - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-regs.exp b/gdb/testsuite/gdb.mi/mi2-regs.exp deleted file mode 100644 index 8ddf894..0000000 --- a/gdb/testsuite/gdb.mi/mi2-regs.exp +++ /dev/null @@ -1,121 +0,0 @@ -# Copyright 1999-2003, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and look at registers. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-regs.exp - return -1 -} - -proc sparc_register_tests_no_exec { } { - # Test the generic IDT chip. - mi_gdb_test "111-data-list-register-values" \ - ".*111\\^error,msg=\"-data-list-register-values: Usage: -data-list-register-values <format> \\\[<regnum1>...<regnumN>\\\]\"" \ - "wrong arguments" - - mi_gdb_test "111-data-list-register-values x" \ - ".*111\\^error,msg=\"No registers\.\"" \ - "no executable" -} - -# These tests exercise IDT-specific MIPS registers for several -# different processor models. - -# This should detect the actual processor in use and change -# the expected results appropriately. FIXME - -proc sparc_register_tests { } { - global hex - global decimal - set octal "\[0-7\]+" - set binary "\[0-1\]+" - set float "\\-?((\[0-9\]+(\\.\[0-9\]+)?(e\[-+\]\[0-9\]+)?)|(nan\\($hex\\)))" - set float2 "\\-?\[0-9\]+" - - mi_gdb_test "111-data-list-register-names" \ - "111\\^done,register-names=\\\[\"g0\",\"g1\",\"g2\",\"g3\",\"g4\",\"g5\",\"g6\",\"g7\",\"o0\",\"o1\",\"o2\",\"o3\",\"o4\",\"o5\",\"sp\",\"o7\",\"l0\",\"l1\",\"l2\",\"l3\",\"l4\",\"l5\",\"l6\",\"l7\",\"i0\",\"i1\",\"i2\",\"i3\",\"i4\",\"i5\",\"fp\",\"i7\",\"f0\",\"f1\",\"f2\",\"f3\",\"f4\",\"f5\",\"f6\",\"f7\",\"f8\",\"f9\",\"f10\",\"f11\",\"f12\",\"f13\",\"f14\",\"f15\",\"f16\",\"f17\",\"f18\",\"f19\",\"f20\",\"f21\",\"f22\",\"f23\",\"f24\",\"f25\",\"f26\",\"f27\",\"f28\",\"f29\",\"f30\",\"f31\",\"y\",\"psr\",\"wim\",\"tbr\",\"pc\",\"npc\",\"fsr\",\"csr\",\"d0\",\"d2\",\"d4\",\"d6\",\"d8\",\"d10\",\"d12\",\"d14\",\"d16\",\"d18\",\"d20\",\"d22\",\"d24\",\"d26\",\"d28\",\"d30\"\\\]" \ - "list register names" - - mi_gdb_test "222-data-list-register-values x" \ - "222\\^done,register-values=\\\[\{number=\"0\",value=\"$hex\"\}.*\{number=\"87\",value=\"$hex\"\}\\\]" \ - "register values x" - - mi_gdb_test "333-data-list-register-values f" \ - "333\\^done,register-values=\\\[\{number=\"0\",value=\"$float\"\},\{number=\"1\",value=\"$float\"\},.*\{number=\"87\",value=\"$float\"\}\\\]" \ - "register values f" - - mi_gdb_test "444-data-list-register-values d" \ - "444\\^done,register-values=\\\[\{number=\"0\",value=\"-?$decimal\"\}.*\{number=\"87\",value=\"-?$decimal\"\}\\\]" \ - "register values d" - - mi_gdb_test "555-data-list-register-values o" \ - "555\\^done,register-values=\\\[\{number=\"0\",value=\"$octal\"\}.*\{number=\"87\",value=\"$octal\"\}\\\]" \ - "register values o" - - mi_gdb_test "666-data-list-register-values t" \ - "666\\^done,register-values=\\\[\{number=\"0\",value=\"$binary\"\}.*\{number=\"87\",value=\"$binary\"\}\\\]" \ - "register values t" - - # On the sparc, registers 0-31 are int, 32-63 float, 64-71 int, 72-87 float - - mi_gdb_test "777-data-list-register-values N" \ - "777\\^done,register-values=\\\[\{number=\"0\",value=\"-?$decimal\"\}.*\{number=\"31\",value=\"-?$decimal\"\},\{number=\"32\",value=\"$float\"\}.*\{number=\"63\",value=\"$float\"\},\{number=\"64\",value=\"-?$decimal\"\}.*\{number=\"71\",value=\"-?$decimal\"\},\{number=\"72\",value=\"$float\"\}.*\{number=\"87\",value=\"$float\"\}\\\]" \ - "register values N" - - mi_gdb_test "888-data-list-register-values r" \ - "888\\^done,register-values=\\\[\{number=\"0\",value=\"$hex\"\}.*\{number=\"87\",value=\"$hex\"\}\\\]" \ - "register values r" - - mi_gdb_test "999-data-list-register-names 68 69 70 71" \ - "999\\^done,register-names=\\\[\"pc\",\"npc\",\"fsr\",\"csr\"\\\]" \ - "list names of some regs" - - mi_gdb_test "001-data-list-register-values x 68 69 70 71" \ - "001\\^done,register-values=\\\[\{number=\"68\",value=\"$hex\"\},\{number=\"69\",value=\"$hex\"\},\{number=\"70\",value=\"$hex\"\},\{number=\"71\",value=\"$hex\"\}\\\]" \ - "list values of some regs" - - mi_gdb_test "002-data-list-changed-registers" \ - "002\\^done,changed-registers=\\\[(\"${decimal}\"(,\"${decimal}\")*)?\\\]" \ - "list changed registers" -} - -if [istarget "sparc-*-*"] then { - sparc_register_tests_no_exec - mi_run_to_main - sparc_register_tests -} else { - verbose "mi-regs.exp tests ignored for this target" -} - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-return.exp b/gdb/testsuite/gdb.mi/mi2-return.exp deleted file mode 100644 index 8d32e13..0000000 --- a/gdb/testsuite/gdb.mi/mi2-return.exp +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 1999-2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test Machine interface (MI) operations -# Verify that, using the MI, we can run a simple program and perform -# exec-return. - -# The goal is not to -# test gdb functionality, which is done by other tests, but to verify -# the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-return.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - - -proc test_return_simple {} { - global mi_gdb_prompt - global hex fullname_syntax srcfile - - set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_call [expr $line_callee3_head + 2] - set line_callee3_close_brace [expr $line_callee3_head + 3] - - mi_gdb_test "111-exec-return" "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\"\}" "return from callee4 now" -} - -mi_runto callee4 - -mi_gdb_test "205-break-delete" \ - "205\\^done.*" \ - "delete all breakpoints" - -test_return_simple - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-simplerun.exp b/gdb/testsuite/gdb.mi/mi2-simplerun.exp deleted file mode 100644 index d4bbdab..0000000 --- a/gdb/testsuite/gdb.mi/mi2-simplerun.exp +++ /dev/null @@ -1,189 +0,0 @@ -# Copyright 1999-2004, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-simplerun.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_breakpoints_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - set line_callee4_head [gdb_get_line_number "callee4 ("] - set line_callee4_body [expr $line_callee4_head + 2] - set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_body [expr $line_callee3_head + 2] - set line_callee2_head [gdb_get_line_number "callee2 ("] - set line_callee2_body [expr $line_callee2_head + 2] - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert - # -break-list - # -break-disable - # -break-info - - mi_create_breakpoint "main" 1 keep main ".*basics.c" $line_main_body $hex \ - "break-insert operation" - - mi_create_breakpoint "basics.c:callee2" 2 keep callee2 ".*basics.c" $line_callee2_body $hex \ - "insert breakpoint at basics.c:callee2" - - mi_create_breakpoint "basics.c:$line_callee3_head" 3 keep callee3 ".*basics.c" $line_callee3_head $hex \ - "insert breakpoint at basics.c:\$line_callee3_head" - - mi_create_breakpoint "\"\\\"${srcfile}\\\":$line_callee4_head\"" 4 keep callee4 ".*basics.c" $line_callee4_head $hex \ - "insert breakpoint at \"<fullfilename>\":\$line_callee4_head" - - mi_gdb_test "204-break-list" \ - "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\",original-location=\".*\"\},.*\}\\\]\}" \ - "list of breakpoints" - - mi_gdb_test "205-break-disable 2 3 4" \ - "205\\^done.*" \ - "disabling of breakpoints" - - mi_gdb_test "206-break-info 2" \ - "206\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"2\",.*,enabled=\"n\",.*\}\\\]\}" \ - "list of breakpoints, 16 disabled" -} - -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Run the program without args, then specify srgs and rerun the program - # Tests: - # -exec-run - # -gdb-set - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" "$line_main_body" \ - {"" "disp=\"keep\"" } "run to main" -} - -proc test_controlled_execution {} { - global mi_gdb_prompt - global hex - - set line_callee4_head [gdb_get_line_number "callee4 ("] - set line_callee4_body [expr $line_callee4_head + 2] - set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_call [expr $line_callee3_head + 2] - set line_callee3_close_brace [expr $line_callee3_head + 3] - set line_callee1_head [gdb_get_line_number "callee1 ("] - set line_callee1_body [expr $line_callee1_head + 2] - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Continue execution until a breakpoint is reached, step into calls, verifying - # if the arguments are correctly shown, continue to the end of a called - # function, step over a call (next). - # Tests: - # -exec-continue - # -exec-next - # -exec-step - # -exec-finish - - mi_next_to "main" "" "basics.c" [expr $line_main_body + 1] "next at main" - - # FIXME: A string argument is not printed right; should be fixed and - # we should look for the right thing here. - # NOTE: The ``\\\\\"'' is for \". - mi_step_to "callee1" \ - "\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}" \ - "basics.c" "$line_callee1_body" "step at main" - - # FIXME: A string argument is not printed right; should be fixed and - # we should look for the right thing here. - mi_execute_to "exec-step 3" "end-stepping-range" "callee4" "" \ - "basics.c" $line_callee4_body "" "step to callee4" - - # FIXME: A string argument is not printed right; should be fixed and - # we should look for the right thing here. - # NOTE: The ``.'' is part of ``gdb-result-var="$1"'' - mi_finish_to "callee3" ".*" "basics.c" \ - "($line_callee3_call|$line_callee3_close_brace)" ".1" "0" "exec-finish" -} - -proc test_controlling_breakpoints {} { - global mi_gdb_prompt - - # Enable, delete, set ignore counts in breakpoints - # (disable was already tested above) - # Tests: - # -break-delete - # -break-enable - # -break-after - # -break-condition - -} - -proc test_program_termination {} { - global mi_gdb_prompt - - # Run to completion: normal and forced - # Tests: - # -exec-abort - # (normal termination of inferior) - - mi_execute_to "exec-continue" "exited-normally" "" "" "" "" "" "continue to end" -} - -test_breakpoints_creation_and_listing -test_running_the_program -test_controlled_execution -test_controlling_breakpoints -test_program_termination - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-stack.exp b/gdb/testsuite/gdb.mi/mi2-stack.exp deleted file mode 100644 index 9b79f41..0000000 --- a/gdb/testsuite/gdb.mi/mi2-stack.exp +++ /dev/null @@ -1,210 +0,0 @@ -# Copyright 2000-2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test essential Machine interface (MI) operations -# -# Verify that stack commands work. - -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile mi-stack.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-stack.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_stack_frame_listing {} { - global mi_gdb_prompt - global hex fullname_syntax srcfile - - set line_callee4_head [gdb_get_line_number "callee4 ("] - set line_callee4_body [expr $line_callee4_head + 2] - - # Obtain a stack trace - # Tests: - # -stack-list-frames - # -stack-list-frames 1 1 - # -stack-list-frames 1 3 - # -stack-info-frame - - mi_gdb_test "231-stack-list-frames" \ - "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_callee4_body\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \ - "stack frame listing" - mi_gdb_test "232-stack-list-frames 1 1" \ - "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \ - "stack frame listing 1 1" - mi_gdb_test "233-stack-list-frames 1 3" \ - "233\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\}\\\]" \ - "stack frame listing 1 3" - - mi_gdb_test "234-stack-list-frames 1" \ - "234\\^error,msg=\"-stack-list-frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \ - "stack frame listing wrong" - - mi_gdb_test "235-stack-info-frame" \ - "235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_callee4_body\"\}" \ - "selected frame listing" - - mi_gdb_test "236-stack-list-frames 1 300" \ - "236\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\}\\\]" \ - "stack frame listing 1 300" -} - -proc test_stack_args_listing {} { - global mi_gdb_prompt - global hex - - # Obtain lists for args for the stack frames - # Tests: - # -stack-list-arguments 0 - # -stack-list-arguments 0 1 1 - # -stack-list-arguments 0 1 3 - # -stack-list-arguments 1 - # -stack-list-arguments 1 1 1 - # -stack-list-arguments 1 1 3 - # -stack-list-arguments - - mi_gdb_test "231-stack-list-arguments 0" \ - "231\\^done,stack-args=\\\[frame=\{level=\"0\",args=\\\[\\\]\},frame=\{level=\"1\",args=\\\[name=\"strarg\"\\\]\},frame=\{level=\"2\",args=\\\[name=\"intarg\",name=\"strarg\"\\\]\},frame=\{level=\"3\",args=\\\[name=\"intarg\",name=\"strarg\",name=\"fltarg\"\\\]\},frame=\{level=\"4\",args=\\\[\\\]\}\\\]" \ - "stack args listing 0" - - mi_gdb_test "232-stack-list-arguments 0 1 1" \ - "232\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[name=\"strarg\"\\\]\}\\\]" \ - "stack args listing 0 1 1" - - mi_gdb_test "233-stack-list-arguments 0 1 3" \ - "233\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[name=\"strarg\"\\\]\},frame=\{level=\"2\",args=\\\[name=\"intarg\",name=\"strarg\"\\\]\},frame=\{level=\"3\",args=\\\[name=\"intarg\",name=\"strarg\",name=\"fltarg\"\\\]\}\\\]" \ - "stack args listing 0 1 3" - - mi_gdb_test "231-stack-list-arguments 1" \ - "231\\^done,stack-args=\\\[frame=\{level=\"0\",args=\\\[\\\]\},frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"2\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"3\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\\\]\},frame=\{level=\"4\",args=\\\[\\\]\}\\\]" \ - "stack args listing 1" - - mi_gdb_test "232-stack-list-arguments 1 1 1" \ - "232\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\}\\\]" \ - "stack args listing 1 1 1" - - mi_gdb_test "233-stack-list-arguments 1 1 3" \ - "233\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"2\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"3\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\\\]\}\\\]" \ - "stack args listing 1 1 3" - - mi_gdb_test "234-stack-list-arguments" \ - "234\\^error,msg=\"-stack-list-arguments: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \ - "stack args listing wrong" - - mi_gdb_test "235-stack-list-arguments 1 1 300" \ - "235\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"2\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"3\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\\\]\},frame=\{level=\"4\",args=\\\[\\\]\}\\\]" \ - "stack args listing 1 1 300" -} - -proc test_stack_info_depth {} { - global mi_gdb_prompt - global hex - - # Obtain depth of stack - # Tests: - # -stack-info-depth - # -stack-info-depth 3 - # -stack-info-depth 99 - - mi_gdb_test "231-stack-info-depth" \ - "231\\^done,depth=\"5\"" \ - "stack info-depth" - - mi_gdb_test "231-stack-info-depth 3" \ - "231\\^done,depth=\"3\"" \ - "stack info-depth 3" - - mi_gdb_test "231-stack-info-depth 99" \ - "231\\^done,depth=\"5\"" \ - "stack info-depth 99" - - mi_gdb_test "231-stack-info-depth 99 99" \ - "231\\^error,msg=\"-stack-info-depth: Usage: .MAX_DEPTH.\"" \ - "stack info-depth wrong usage" -} - -proc test_stack_locals_listing {} { - global mi_gdb_prompt - global hex fullname_syntax srcfile - - # Obtain lists for locals for the stack frames - # Tests: - # -stack-list-locals 0 (--no-values) - # -stack-list-locals 1 (--all-values) - # -stack-list-locals 2 (--simple-values) - # -stack-list-arguments - - mi_gdb_test "232-stack-list-locals 0" \ - "232\\^done,locals=\\\[name=\"A\",name=\"B\",name=\"C\",name=\"D\"\\\]" \ - "stack locals listing of names" - -set line_callee4_return_0 [gdb_get_line_number "return 0;"] - -# step until A, B, C, D have some reasonable values. -mi_execute_to "exec-next 4" "end-stepping-range" "callee4" "" ".*${srcfile}" $line_callee4_return_0 ""\ - "next's in callee4" - - mi_gdb_test "232-stack-list-locals 1" \ - "232\\^done,locals=\\\[\{name=\"A\",value=\"1\"\},\{name=\"B\",value=\"2\"\},\{name=\"C\",value=\"3\"\},\{name=\"D\",value=\"\\{0, 1, 2\\}\"\}\\\]" \ - "stack locals listing of names and values" - - mi_gdb_test "232-stack-list-locals 2" \ - "232\\^done,locals=\\\[\{name=\"A\",type=\"int\",value=\"1\"\},\{name=\"B\",type=\"int\",value=\"2\"\},\{name=\"C\",type=\"int\",value=\"3\"\},\{name=\"D\",type=\"int \\\[3\\\]\"\}\\\]" \ - "stack locals listing, simple types: names and values, complex type: names and types" - - mi_gdb_test "234-stack-list-locals" \ - "234\\^error,msg=\"-stack-list-locals: Usage.*PRINT_VALUES.*\"" \ - "stack locals listing wrong" - - mi_gdb_test "232-stack-select-frame 1" \ - "232\\^done" \ - "stack select frame 1" - - mi_gdb_test "232-stack-list-locals 1" \ - "232\\^done,locals=\\\[\\\]" \ - "stack locals listing for new frame" - - mi_gdb_test "232-stack-list-locals 1" \ - "232\\^done,locals=\\\[\\\]" \ - "stack locals for same frame (level 1)" -} - -mi_runto callee4 -test_stack_frame_listing -test_stack_args_listing -test_stack_locals_listing -test_stack_info_depth - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-stepi.exp b/gdb/testsuite/gdb.mi/mi2-stepi.exp deleted file mode 100644 index d2cbb0b..0000000 --- a/gdb/testsuite/gdb.mi/mi2-stepi.exp +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 1999-2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test Machine interface (MI) operations -# Verify that, using the MI, we can run a simple program and perform -# exec-step-instruction and exec-next-instruction. - -# The goal is not to -# test gdb functionality, which is done by other tests, but to verify -# the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-stepi.exp - return -1 -} - -proc test_stepi_nexti {} { - global mi_gdb_prompt - global hex fullname_syntax srcfile - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - set line_main_hello [gdb_get_line_number "Hello, World!"] - - set line [mi_execute_to "exec-step-instruction" "end-stepping-range" "main" "" \ - ".*basics.c" "\[0-9\]+" "" "step-instruction at main"] - if { $line >= $line_main_body && $line <= $line_main_hello } { - pass "step-instruction at main (line check)" - } else { - fail "step-instruction at main (line check)" - } - - set line [mi_execute_to "exec-next-instruction" "end-stepping-range" "main" "" \ - ".*basics.c" "\[0-9\]+" "" "next-instruction at main"] - if { $line >= $line_main_body && $line <= $line_main_hello } { - pass "next-instruction at main (line check)" - } else { - fail "next-instruction at main (line check)" - } - - set line [mi_execute_to "exec-next-instruction" "end-stepping-range" "main" "" \ - ".*basics.c" "\[0-9\]+" "" "next-instruction at main 2"] - if { $line >= $line_main_body && $line <= $line_main_hello } { - pass "next-instruction at main 2 (line check)" - } else { - fail "next-instruction at main 2 (line check)" - } -} - -mi_run_to_main -test_stepi_nexti - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-syn-frame.exp b/gdb/testsuite/gdb.mi/mi2-syn-frame.exp deleted file mode 100644 index 9c24cca..0000000 --- a/gdb/testsuite/gdb.mi/mi2-syn-frame.exp +++ /dev/null @@ -1,101 +0,0 @@ -# Copyright 2002-2003, 2005, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test MI output with synthetic frames on the stack (call dummies, -# signal handlers). - -if [target_info exists gdb,nosignals] { - verbose "Skipping mi-syn-frame.exp because of nosignals." - continue -} - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -standard_testfile mi-syn-frame.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-syn-frame.exp - return -1 -} - -set my_mi_gdb_prompt "\\(gdb\\)\[ \]*\[\r\n\]*" - -mi_gdb_exit -mi_gdb_start -mi_run_to_main - -mi_create_breakpoint "foo" 2 keep foo ".*mi-syn-frame.c" $decimal $hex \ - "insert breakpoint foo" - -# -# Call foo() by hand, where we'll hit a breakpoint. -# - -mi_gdb_test "401-data-evaluate-expression foo()" ".*401\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nEvaluation of the expression containing the function\\\\n\\(foo\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \ - "call inferior's function with a breakpoint set in it" - -mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame" - -# -# Continue back to main() -# - -mi_send_resuming_command "exec-continue" "testing exec continue" - -mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue" - -mi_gdb_test "404-stack-list-frames 0 0" \ - "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \ - "list stack frames" - - -# -# Call have_a_very_merry_interrupt() which will eventually raise a signal -# that's caught by handler() which calls subroutine(). - -mi_create_breakpoint "subroutine" 3 keep subroutine ".*mi-syn-frame.c" $decimal $hex \ - "insert breakpoint subroutine" - -mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \ - ".*406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nEvaluation of the expression containing the function\\\\n\\(have_a_very_merry_interrupt\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \ - "evaluate expression have_a_very_merry_interrupt" - -# We should have both a signal handler and a call dummy frame -# in this next output. - -mi_gdb_test "407-stack-list-frames" \ - "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" \ - "list stack frames" - -mi_send_resuming_command "exec-continue" "testing exec continue" - -mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue" - -mi_gdb_test "409-stack-list-frames 0 0" \ - "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \ - "list stack frames" - -# -# Call bar() by hand, which should get an exception while running. -# - -mi_gdb_test "410-data-evaluate-expression bar()" ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" "call inferior function which raises exception" - -mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception" - -mi_gdb_exit - -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-until.exp b/gdb/testsuite/gdb.mi/mi2-until.exp deleted file mode 100644 index e1abc4a..0000000 --- a/gdb/testsuite/gdb.mi/mi2-until.exp +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright 1999-2001, 2003, 2005, 2007-2012 Free Software Foundation, -# Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test Machine interface (MI) operations -# Verify that, using the MI, we can run a simple program and perform -# exec-until. - -# The goal is not to -# test gdb functionality, which is done by other tests, but to verify -# the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile until.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-until.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_running_to_foo {} { - global mi_gdb_prompt - global hex - - mi_create_breakpoint "10" 1 "keep" foo ".*until.c" 10 ".*" \ - "break-insert operation" - - mi_run_cmd - mi_expect_stop "breakpoint-hit" "foo" "" ".*until.c" 10 \ - { "" "disp=\"keep\"" } "run to main" - - mi_gdb_test "100-break-delete 1" "100\\^done" "break-delete 1" - -} - -proc test_until {} { - global mi_gdb_prompt - global hex fullname_syntax srcfile - - setup_kfail gdb/2104 "*-*-*" - mi_execute_to "exec-until" "end-stepping-range" "foo" "" ".*until.c" "12" "" \ - "until after while loop" - - mi_execute_to "exec-until 15" "location-reached" "foo" "" ".*until.c" "15" ""\ - "until line number" - - mi_execute_to "exec-until until.c:17" "location-reached" "foo" "" ".*until.c" "17" ""\ - "until line number:file" - - # This is supposed to NOT stop at line 25. It stops right after foo is over. - mi_execute_to "exec-until until.c:25" "location-reached" "main" "" ".*until.c" "(23|24)" ""\ - "until after current function" -} - -test_running_to_foo -test_until - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-var-block.exp b/gdb/testsuite/gdb.mi/mi2-var-block.exp deleted file mode 100644 index 6999db6..0000000 --- a/gdb/testsuite/gdb.mi/mi2-var-block.exp +++ /dev/null @@ -1,173 +0,0 @@ -# Copyright 1999-2004, 2007-2012 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can create, update, delete variables. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile var-cmd.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-var-block.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -mi_runto do_block_tests - -# Test: c_variable-3.2 -# Desc: create cb and foo -mi_create_varobj "cb" "cb" "create local variable cb" - -mi_gdb_test "-var-create foo * foo" \ - "\\^error,msg=\"-var-create: unable to create variable object\"" \ - "create local variable foo" - -# step to "foo = 123;" -mi_step_to "do_block_tests" "" "var-cmd.c" \ - [gdb_get_line_number "foo = 123;"] \ - "step at do_block_test" - - -# Be paranoid and assume 3.2 created foo -mi_gdb_test "-var-delete foo" \ - "\\^error,msg=\"Variable object not found\"" \ - "delete var foo" - - -# Test: c_variable-3.3 -# Desc: create foo -mi_create_varobj "foo" "foo" "create local variable foo" - -# step to "foo2 = 123;" -mi_step_to "do_block_tests" "" "var-cmd.c" \ - [gdb_get_line_number "foo2 = 123;"] \ - "step at do_block_test" - -# Test: c_variable-3.4 -# Desc: check foo, cb changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"foo\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"cb\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: cb foo changed" - -# step to "foo = 321;" -mi_step_to "do_block_tests" "" "var-cmd.c" \ - [gdb_get_line_number "foo = 321;"] \ - "step at do_block_test" - -# Test: c_variable-3.5 -# Desc: create inner block foo -mi_create_varobj "inner_foo" "foo" "create local variable inner_foo" - -# step to "foo2 = 0;" -mi_step_to "do_block_tests" "" "var-cmd.c" \ - [gdb_get_line_number "foo2 = 0;"] \ - "step at do_block_test" - -# Test: c_variable-3.6 -# Desc: create foo2 -mi_create_varobj "foo2" "foo2" "create local variable foo2" - -# Test: c_variable-3.7 -# Desc: check that outer foo in scope and inner foo out of scope -# Note: also a known gdb problem -setup_xfail *-*-* -mi_gdb_test "-var-update inner_foo" \ - "\\^done,changelist=\{FIXME\}" \ - "update inner_foo: should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* - -setup_xfail *-*-* -mi_gdb_test "-var-evaluate-expression inner_foo" \ - "\\^done,value=\{FIXME\}" \ - "evaluate inner_foo: should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* - -mi_gdb_test "-var-update foo" \ - "\\^done,changelist=\\\[\\\]" \ - "update foo: did not change" - -mi_gdb_test "-var-delete inner_foo" \ - "\\^done,ndeleted=\"1\"" \ - "delete var inner_foo" - -# step to "foo = 0;" -mi_step_to "do_block_tests" "" "var-cmd.c" \ - [gdb_get_line_number "foo = 0;"] \ - "step at do_block_test" - -# Test: c_variable-3.8 -# Desc: check that foo2 out of scope (known gdb problem) -setup_xfail *-*-* -mi_gdb_test "-var-update foo2" \ - "\\^done,changelist=\{FIXME\}" \ - "update foo2: should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* - -# step to "cb = 21;" -mi_step_to "do_block_tests" "" "var-cmd.c" \ - [gdb_get_line_number "cb = 21;"] \ - "step at do_block_test" - -# Test: c_variable-3.9 -# Desc: check that only cb is in scope (known gdb problem) -setup_xfail *-*-* -mi_gdb_test "-var-update foo2" \ - "\\^done,changelist=\\\[FIXME\\\]" \ - "update foo2 should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* -setup_xfail *-*-* -mi_gdb_test "-var-update foo" \ - "\\^done,changelist=\{FIXME\}" \ - "update foo should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* -mi_gdb_test "-var-update cb" \ - "\\^done,changelist=\\\[\\\]" \ - "update cb" - -# Test: c_variable-3.10 -# Desc: names of editable variables -#gdbtk_test c_variable-3.10 {names of editable variables} { -# editable_variables -#} {{foo cb foo2} {}} - -# Done with block tests -mi_gdb_test "-var-delete foo" \ - "\\^done,ndeleted=\"1\"" \ - "delete var foo" - -mi_gdb_test "-var-delete foo2" \ - "\\^done,ndeleted=\"1\"" \ - "delete var foo2" - -mi_gdb_test "-var-delete cb" \ - "\\^done,ndeleted=\"1\"" \ - "delete var cb" - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-var-cmd.exp b/gdb/testsuite/gdb.mi/mi2-var-cmd.exp deleted file mode 100644 index 5af2af8..0000000 --- a/gdb/testsuite/gdb.mi/mi2-var-cmd.exp +++ /dev/null @@ -1,529 +0,0 @@ -# Copyright 1999-2004, 2004, 2007-2012 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can create, update, delete variables. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile var-cmd.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-var-cmd.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - - -##### ##### -# # -# Variable Creation tests # -# # -##### ##### - -# Test: c_variable-1.1 -# Desc: Create global variable - -mi_create_varobj "global_simple" "global_simple" "create global variable" - -# Test: c_variable-1.2 -# Desc: Create non-existent variable - -mi_gdb_test "112-var-create bogus_unknown_variable * bogus_unknown_variable" \ - "112\\^error,msg=\"-var-create: unable to create variable object\"" \ - "create non-existent variable" - -# Test: c_variable-1.3 -# Desc: Create out of scope variable - -mi_gdb_test "113-var-create argc * argc" \ - "113\\^error,msg=\"-var-create: unable to create variable object\"" \ - "create out of scope variable" - -mi_runto do_locals_tests - -set line_dlt_first_real [gdb_get_line_number "linteger = 1234;"] - -mi_continue_to_line $line_dlt_first_real "step to real start of do_locals_test" - - -# Test: c_variable-1.4 -# Desc: create local variables - -mi_create_varobj_checked linteger linteger int "create local variable linteger" - -mi_create_varobj_checked lpinteger lpinteger {int \*} "create local variable lpinteger" - -mi_create_varobj_checked lcharacter lcharacter\[0\] char "create local variable lcharacter" - -mi_create_varobj_checked lpcharacter lpcharacter {char \*} "create local variable lpcharacter" - -mi_create_varobj_checked llong llong "long int" "create local variable llong" - -mi_create_varobj_checked lplong lplong {long int \*} "create local variable lplong" - -mi_create_varobj_checked lfloat lfloat float "create local variable lfloat" - -mi_create_varobj_checked lpfloat lpfloat {float \*} "create local variable lpfloat" - -mi_create_varobj_checked ldouble ldouble double "create local variable ldouble" - -mi_create_varobj_checked lpdouble lpdouble {double \*} "create local variable lpdouble" - -mi_create_varobj_checked lsimple lsimple "struct _simple_struct" "create local variable lsimple" - -mi_create_varobj_checked lpsimple lpsimple {struct _simple_struct \*} "create local variable lpsimple" - -mi_create_varobj_checked func func {void \(\*\)\((void|)\)} "create local variable func" - -# Test: c_variable-1.5 -# Desc: create lsimple.character -mi_create_varobj_checked lsimple.character lsimple.character "char" \ - "create lsimple.character" - -# Test: c_variable-1.6 -# Desc: create lpsimple->integer -mi_create_varobj_checked lsimple->integer lsimple->integer "int" \ - "create lsimple->integer" - -# Test: c_variable-1.7 -# Desc: crate lsimple.integer -mi_create_varobj_checked lsimple.integer lsimple.integer "int" \ - "create lsimple.integer" - - -# Test: c_variable-1.9 -# Desc: create type name -# Type names (like int, long, etc..) are all proper expressions to gdb. -# make sure variable code does not allow users to create variables, though. -mi_gdb_test "-var-create int * int" \ - "&\"Attempt to use a type name as an expression.\\\\n\".*\\^error,msg=\"-var-create: unable to create variable object\"" \ - "create int" - - -##### ##### -# # -# Value changed tests # -# # -##### ##### - -# Test: c_variable-2.1 -# Desc: check whether values changed at do_block_tests -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\\\]" \ - "update all vars" - -# Step over "linteger = 1234;" -set line_dlt_linteger [gdb_get_line_number "lpinteger = &linteger;"] -mi_step_to "do_locals_tests" "" "var-cmd.c" $line_dlt_linteger "step at do_locals_test" - -# Test: c_variable-2.2 -# Desc: check whether only linteger changed values -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: linteger changed" - -# Step over "lpinteger = &linteger;" -mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 1] "step at do_locals_tests (2)" - -# Test: c_variable-2.3 -# Desc: check whether only lpinteger changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: lpinteger changed" - -# Step over "lcharacter = 'a';" -mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 2] "step at do_locals_tests (3)" - -# Test: c_variable-2.4 -# Desc: check whether only lcharacter changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: lcharacter changed" - -# Step over "lpcharacter = &lcharacter;" -mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 3] "step at do_locals_tests (4)" - -# Test: c_variable-2.5 -# Desc: check whether only lpcharacter changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: lpcharacter changed" - - -# Step over: -# llong = 2121L; -# lplong = &llong; -# lfloat = 2.1; -# lpfloat = &lfloat; -# ldouble = 2.718281828459045; -# lpdouble = &ldouble; -# lsimple.integer = 1234; -# lsimple.unsigned_integer = 255; -# lsimple.character = 'a'; - -mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" [expr $line_dlt_linteger + 12] "" "step at do_locals_tests (5)" - -# Test: c_variable-2.6 -# Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer, -# lsimple.unsigned_character lsimple.integer lsimple.character changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lpdouble\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"ldouble\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lpfloat\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lfloat\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lplong\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"llong\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: many changed" - -# Step over: -# lsimple.signed_character = 21; -# lsimple.char_ptr = &lcharacter; -# lpsimple = &lsimple; -# func = nothing; - -set line_dlt_4321 [gdb_get_line_number "linteger = 4321;"] - -mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" $line_dlt_4321 "" "step at do_locals_tests (6)" - -# Test: c_variable-2.7 -# Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"func\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lpsimple\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: func and lpsimple changed" - -# Step over -# linteger = 4321; -# lcharacter = 'b'; -# llong = 1212L; -# lfloat = 1.2; -# ldouble = 5.498548281828172; -# lsimple.integer = 255; -# lsimple.unsigned_integer = 4321; -# lsimple.character = 'b'; - -mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" [expr $line_dlt_4321 + 8] "" "step at do_locals_tests (7)" - -# Test: c_variable-2.8 -# Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer, -# lpsimple.integer lsimple.character changed -# Note: this test also checks that lpsimple->integer and lsimple.integer have -# changed (they are the same) -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"ldouble\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lfloat\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"llong\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: lsimple and others changed" - - -### -# -# Test assignment to variables. More tests on assignment are in other files. -# -### -mi_gdb_test "-var-assign global_simple 0" \ - "\\^error,msg=\"-var-assign: Variable object is not editable\"" \ - "assign to global_simple" - -mi_gdb_test "-var-assign linteger 3333" \ - "\\^done,value=\"3333\"" \ - "assign to linteger" - -# Allow lpcharacter to update, optionally. Because it points to a -# char variable instead of a zero-terminated string, if linteger is -# directly after it in memory the printed characters may appear to -# change. -set lpchar_update "\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\}," -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[($lpchar_update)?\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: linteger changed after assign" - -mi_gdb_test "-var-assign linteger 3333" \ - "\\^done,value=\"3333\"" \ - "assign to linteger again, same value" - -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\\\]" \ - "update all vars: linteger not changed after same assign" - -mi_gdb_test "-var-evaluate-expression linteger" \ - "\\^done,value=\"3333\"" \ - "eval linteger" - -mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \ - "\\^done,value=\"$hex\"" \ - "assign to lpinteger" - -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: lpinteger changed after assign" - -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\\\]" \ - "update all vars: no changes on second update" - -mi_gdb_test "-var-evaluate-expression lpinteger" \ - "\\^done,value=\"$hex\"" \ - "eval lpinteger" - -# reset the values to the original ones so that the rest of the file doesn't suffer. - -mi_gdb_test "-var-assign linteger 4321" \ - "\\^done,value=\"4321\"" \ - "assign to linteger" - -mi_gdb_test "-var-assign lpinteger &linteger" \ - "\\^done,value=\"$hex\"" \ - "assign to lpinteger" - -mi_gdb_test "-var-assign lcharacter 'z'" \ - "\\^done,value=\"122 'z'\"" \ - "assign to lcharacter" - -mi_gdb_test "-var-evaluate-expression lcharacter" \ - "\\^done,value=\"122 'z'\"" \ - "eval lcharacter" - -mi_gdb_test "-var-assign llong 1313L" \ - "\\^done,value=\"1313\"" \ - "assign to llong" -mi_gdb_test "-var-evaluate-expression llong" \ - "\\^done,value=\"1313\"" \ - "eval llong" -mi_gdb_test "-var-assign llong 1212L" \ - "\\^done,value=\"1212\"" \ - "assign to llong" - -mi_gdb_test "-var-assign lplong &llong+4" \ - "\\^done,value=\"$hex\"" \ - "assign to lplong" -mi_gdb_test "-var-evaluate-expression lplong" \ - "\\^done,value=\"$hex\"" \ - "eval lplong" -mi_gdb_test "-var-assign lplong &llong" \ - "\\^done,value=\"$hex\"" \ - "assign to lplong" - -mi_gdb_test "-var-assign lfloat 3.4567" \ - "\\^done,value=\"3.45.*\"" \ - "assign to lfloat" -mi_gdb_test "-var-evaluate-expression lfloat" \ - "\\^done,value=\"3.45.*\"" \ - "eval lfloat" -mi_gdb_test "-var-assign lfloat 1.2345" \ - "\\^done,value=\"1.23.*\"" \ - "assign to lfloat" - -mi_gdb_test "-var-assign lpfloat &lfloat+4" \ - "\\^done,value=\"$hex\"" \ - "assign to lpfloat" - -mi_gdb_test "-var-assign ldouble 5.333318284590435" \ - "\\^done,value=\"5.333318284590435\"" \ - "assign to ldouble" - -mi_gdb_test "-var-assign func do_block_tests" \ - "\\^done,value=\"$hex <do_block_tests>\"" \ - "assign to func" - -mi_gdb_test "-var-assign lsimple.character 'd'" \ - "\\^done,value=\"100 'd'\"" \ - "assign to lsimple.character" - -mi_gdb_test "-var-assign lsimple->integer 222" \ - "\\^done,value=\"222\"" \ - "assign to lsimple->integer" - -mi_gdb_test "-var-assign lsimple.integer 333" \ - "\\^done,value=\"333\"" \ - "assign to lsimple.integer" - -###### -# End of assign tests -##### - -set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"] - -mi_continue_to "subroutine1" - -# Test: c_variable-2.10 -# Desc: create variable for locals i,l in subroutine1 -mi_create_varobj_checked i i int "create i" - -mi_create_varobj_checked l l {long int \*} "create l" - -# Test: c_variable-2.11 -# Desc: create do_locals_tests local in subroutine1 -mi_gdb_test "-var-create linteger * linteger" \ - "\\^error,msg=\"-var-create: unable to create variable object\"" \ - "create linteger" - -mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" [expr $line_subroutine1_body + 1] "step at subroutine1" - -# Test: c_variable-2.12 -# Desc: change global_simple.integer -# Note: This also tests whether we are reporting changes in structs properly. -# gdb normally would say that global_simple has changed, but we -# special case that, since it is not what a human expects to -# see. - -setup_xfail *-*-* -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{FIXME: WHAT IS CORRECT HERE\}" \ - "update all vars: changed FIXME" -clear_xfail *-*-* - -mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" [expr $line_subroutine1_body + 2] "step at subroutine1 (2)" - -# Test: c_variable-2.13 -# Desc: change subroutine1 local i -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"i\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: i changed" - -mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" [expr $line_subroutine1_body + 3] "step at subroutine1 (3)" - -# Test: c_variable-2.14 -# Desc: change do_locals_tests local llong -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"llong\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: llong changed" - -set line_dlt_call_subroutine1 [gdb_get_line_number "subroutine1 (linteger, &llong);"] -mi_next_to "do_locals_tests" "" "var-cmd.c" \ - [expr $line_dlt_call_subroutine1 + 1] "next out of subroutine1" - -# Test: c_variable-2.15 -# Desc: check for out of scope subroutine1 locals -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\\\[\{name=\"l\",in_scope=\"false\"\,type_changed=\"false\",has_more=\"0\"},\{name=\"i\",in_scope=\"false\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ - "update all vars: all now out of scope" - -# Done with locals/globals tests. Erase all variables -#delete_all_variables -mi_gdb_test "-var-delete global_simple" \ - "\\^done,ndeleted=\"1\"" \ - "delete var" - -mi_gdb_test "-var-delete linteger" \ - "\\^done,ndeleted=\"1\"" \ - "delete var linteger" - -mi_gdb_test "-var-delete lpinteger" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpinteger" - -mi_gdb_test "-var-delete lcharacter" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lcharacter" - -mi_gdb_test "-var-delete lpcharacter" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpcharacter" - -mi_gdb_test "-var-delete llong" \ - "\\^done,ndeleted=\"1\"" \ - "delete var llong" - -mi_gdb_test "-var-delete lplong" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lplong" - -mi_gdb_test "-var-delete lfloat" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lfloat" - -mi_gdb_test "-var-delete lpfloat" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpfloat" - -mi_gdb_test "-var-delete ldouble" \ - "\\^done,ndeleted=\"1\"" \ - "delete var ldouble" - -mi_gdb_test "-var-delete lpdouble" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpdouble" - -mi_gdb_test "-var-delete lsimple" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple" - -mi_gdb_test "-var-delete lpsimple" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpsimple" - -mi_gdb_test "-var-delete func" \ - "\\^done,ndeleted=\"1\"" \ - "delete var func" - -mi_gdb_test "-var-delete lsimple.character" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple.character" - -mi_gdb_test "-var-delete lsimple->integer" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple->integer" - -mi_gdb_test "-var-delete lsimple.integer" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple.integer" - -mi_gdb_test "-var-delete i" \ - "\\^done,ndeleted=\"1\"" \ - "delete var i" - -mi_gdb_test "-var-delete l" \ - "\\^done,ndeleted=\"1\"" \ - "delete var l" - -# Test whether we can follow the name of a variable through multiple -# stack frames. -mi_continue_to do_special_tests - -mi_gdb_test "-var-create selected_a @ a" \ - {\^done,name="selected_a",numchild="0",value=".*",type="int".*} \ - "create selected_a" - -mi_continue_to incr_a - -mi_gdb_test "-var-update selected_a" \ - "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"char\",new_num_children=\"0\"\,has_more=\"0\"}\\\]" \ - "update selected_a in incr_a" - -mi_next "step a line in incr_a" -mi_next "return from incr_a to do_special_tests" - -mi_gdb_test "-var-update selected_a" \ - "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"int\",new_num_children=\"0\",has_more=\"0\"\}\\\]" \ - "update selected_a in do_special_tests" - -mi_gdb_test "-file-exec-and-symbols ${binfile}" "\\^done" \ - "floating varobj invalidation" - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-var-display.exp b/gdb/testsuite/gdb.mi/mi2-var-display.exp deleted file mode 100644 index 4bb1cd8..0000000 --- a/gdb/testsuite/gdb.mi/mi2-var-display.exp +++ /dev/null @@ -1,631 +0,0 @@ -# Copyright 1999-2005, 2007-2012 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can create, update, delete variables. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile var-cmd.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-var-display.exp - return -1 -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -set line_dct_end [gdb_get_line_number "{int a = 0;}"] - -mi_create_breakpoint "$srcfile:$line_dct_end" 1 keep do_children_tests ".*var-cmd.c" $line_dct_end $hex \ - "break-insert operation" - -mi_run_cmd -mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" \ - $line_dct_end { "" "disp=\"keep\"" } "run to main" - -##### ##### -# # -# Display tests # -# # -##### ##### - -# Test: c_variable-6.1 -# Desc: create variable bar -mi_create_varobj bar bar "create local variable bar" - -# Test: c_variable-6.2 -# Desc: type of variable bar -mi_gdb_test "-var-info-type bar" \ - "\\^done,type=\"int\"" \ - "info type variable bar" - -# Test: c_variable-6.3 -# Desc: format of variable bar -mi_gdb_test "-var-show-format bar" \ - "\\^done,format=\"natural\"" \ - "show format variable bar" - -# Test: c_variable-6.4 -# Desc: value of variable bar -mi_gdb_test "-var-evaluate-expression bar" \ - "\\^done,value=\"2121\"" \ - "eval variable bar" - -# Test: c_variable-6.5 -# Desc: change format of bar to hex -mi_gdb_test "-var-set-format bar hexadecimal" \ - "\\^done,format=\"hexadecimal\",value=\"0x849\"" \ - "set format variable bar" - -# Test: c_variable-6.6 -# Desc: value of bar with new format -mi_gdb_test "-var-evaluate-expression bar" \ - "\\^done,value=\"0x849\"" \ - "eval variable bar with new format" - -# Test: c_variable-6.7 -# Desc: change value of bar -mi_gdb_test "-var-assign bar 3" \ - "\\^done,value=\"0x3\"" \ - "assing to variable bar" - -mi_gdb_test "-var-set-format bar decimal" \ - "\\^done,format=\"decimal\",value=\"3\"" \ - "set format variable bar" - -mi_gdb_test "-var-evaluate-expression bar" \ - "\\^done,value=\"3\"" \ - "eval variable bar with new value" - -mi_gdb_test "-var-delete bar" \ - "\\^done,ndeleted=\"1\"" \ - "delete var bar" - -# Test: c_variable-6.11 -# Desc: create variable foo -mi_create_varobj foo foo "create local variable foo" - -# Test: c_variable-6.12 -# Desc: type of variable foo -mi_gdb_test "-var-info-type foo" \ - "\\^done,type=\"int \\*\"" \ - "info type variable foo" - -# Test: c_variable-6.13 -# Desc: format of variable foo -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"natural\"" \ - "show format variable foo" - -# Test: c_variable-6.14 -# Desc: value of variable foo -mi_gdb_test "-var-evaluate-expression foo" \ - "\\^done,value=\"$hex\"" \ - "eval variable foo" - -# Test: c_variable-6.15 -# Desc: change format of var to octal -mi_gdb_test "-var-set-format foo octal" \ - "\\^done,format=\"octal\",value=\"$octal\"" \ - "set format variable foo" - -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"octal\"" \ - "show format variable foo" - -# Test: c_variable-6.16 -# Desc: value of foo with new format -mi_gdb_test "-var-evaluate-expression foo" \ - "\\^done,value=\"\[0-7\]+\"" \ - "eval variable foo" - -# Test: c_variable-6.17 -# Desc: change value of foo -mi_gdb_test "-var-assign foo 3" \ - "\\^done,value=\"03\"" \ - "assing to variable foo" - -mi_gdb_test "-var-set-format foo decimal" \ - "\\^done,format=\"decimal\",value=\"3\"" \ - "set format variable foo" - -# Test: c_variable-6.18 -# Desc: check new value of foo -mi_gdb_test "-var-evaluate-expression foo" \ - "\\^done,value=\"3\"" \ - "eval variable foo" - -# Test: c_variable-6.19 -# Desc: check optional format parameter of var-evaluate-expression -# and check that current format is not changed -mi_gdb_test "-var-evaluate-expression -f hex foo" \ - "\\^done,value=\"0x3\"" \ - "eval variable foo in hex" - -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"decimal\"" \ - "show format variable foo after eval in hex" - -mi_gdb_test "-var-evaluate-expression -f octal foo" \ - "\\^done,value=\"03\"" \ - "eval variable foo in octal" - -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"decimal\"" \ - "show format variable foo after eval in octal" - -mi_gdb_test "-var-evaluate-expression -f decimal foo" \ - "\\^done,value=\"3\"" \ - "eval variable foo in decimal" - -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"decimal\"" \ - "show format variable foo after eval in decimal" - -mi_gdb_test "-var-evaluate-expression -f nat foo" \ - "\\^done,value=\"0x3\"" \ - "eval variable foo in natural" - -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"decimal\"" \ - "show format variable foo after eval in natural" - -mi_gdb_test "-var-evaluate-expression -f bin foo" \ - "\\^done,value=\"11\"" \ - "eval variable foo in binary" - -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"decimal\"" \ - "show format variable foo after eval in binary" - -mi_gdb_test "-var-delete foo" \ - "\\^done,ndeleted=\"1\"" \ - "delete var foo" - -# Test: c_variable-6.21 -# Desc: create variable weird and children -mi_create_varobj weird weird "create local variable weird" - -mi_list_varobj_children weird { - {weird.integer integer 0 int} - {weird.character character 0 char} - {weird.char_ptr char_ptr 1 "char \\*"} - {weird.long_int long_int 0 "long int"} - {weird.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"} - {weird.long_array long_array 10 "long int \\[10\\]"} - {weird.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"} - {weird.func_ptr_struct func_ptr_struct 0 \ - "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?"} - {weird.func_ptr_ptr func_ptr_ptr 0 \ - "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)"} - {weird.u1 u1 4 "union \\{\\.\\.\\.\\}"} - {weird.s2 s2 4 "struct \\{\\.\\.\\.\\}"} -} "get children local variable weird" - - -# Test: c_variable-6.23 -# Desc: change format of weird.func_ptr and weird.func_ptr_ptr -mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ - "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ - "set format variable weird.func_ptr" - -mi_gdb_test "-var-show-format weird.func_ptr" \ - "\\^done,format=\"hexadecimal\"" \ - "show format variable weird.func_ptr" - -mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \ - "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ - "set format variable weird.func_ptr_ptr" - -mi_gdb_test "-var-show-format weird.func_ptr_ptr" \ - "\\^done,format=\"hexadecimal\"" \ - "show format variable weird.func_ptr_ptr" - -# Test: c_variable-6.24 -# Desc: format of weird and children -mi_gdb_test "-var-set-format weird natural" \ - "\\^done,format=\"natural\",value=\"$hex\"" \ - "set format variable weird" - -mi_gdb_test "-var-set-format weird.integer natural" \ - "\\^done,format=\"natural\",value=\"123\"" \ - "set format variable weird.integer" - -mi_gdb_test "-var-set-format weird.character natural" \ - "\\^done,format=\"natural\",value=\"0 '\\\\\\\\000'\"" \ - "set format variable weird.character" - -mi_gdb_test "-var-set-format weird.char_ptr natural" \ - "\\^done,format=\"natural\",value=\"$hex \\\\\"hello\\\\\"\"" \ - "set format variable weird.char_ptr" - -mi_gdb_test "-var-set-format weird.long_int natural" \ - "\\^done,format=\"natural\",value=\"0\"" \ - "set format variable weird.long_int" - -mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \ - "\\^done,format=\"natural\",value=\"$hex\"" \ - "set format variable weird.int_ptr_ptr" - -mi_gdb_test "-var-set-format weird.long_array natural" \ - "\\^done,format=\"natural\",value=\"\\\[10\\\]\"" \ - "set format variable weird.long_array" - -mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ - "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ - "set format variable weird.func_ptr" - -mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \ - "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ - "set format variable weird.func_ptr_struct" - -mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \ - "\\^done,format=\"natural\",value=\"0x0\"" \ - "set format variable weird.func_ptr_ptr" - -mi_gdb_test "-var-set-format weird.u1 natural" \ - "\\^done,format=\"natural\",value=\"\{...\}\"" \ - "set format variable weird.u1" - -mi_gdb_test "-var-set-format weird.s2 natural" \ - "\\^done,format=\"natural\",value=\"\{...\}\"" \ - "set format variable weird.s2" - -# Test: c_variable-6.25 -# Desc: value of weird and children -#gdbtk_test c_variable-6.25 {value of weird and children} { -# set values {} -# foreach v [lsort [array names var]] f [list x "" "" x x x x d d d d d] { -# lappend values [value $v $f] -# } - -# set values -#} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1} - -# Test: c_variable-6.26 -# Desc: change format of weird and children to octal -#gdbtk_test c_variable-6.26 {change format of weird and children to octal} { -# set formats {} -# foreach v [lsort [array names var]] { -# $var($v) format octal -# lappend formats [$var($v) format] -# } - -# set formats -#} {octal octal octal octal octal octal octal octal octal octal octal octal} - -# Test: c_variable-6.27 -# Desc: value of weird and children with new format -#gdbtk_test c_variable-6.27 {value of foo with new format} { -# set values {} -# foreach v [lsort [array names var]] { -# lappend values [value $v o] -# } - -# set values -#} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1} - -# Test: c_variable-6.30 -# Desc: create more children of weird -#gdbtk_test c_variable-6.30 {create more children of weird} { -# foreach v [array names var] { -# get_children $v -# } - -# # Do it twice to get more children -# foreach v [array names var] { -# get_children $v -# } - -# lsort [array names var] -#} {weird weird.char_ptr weird.character weird.func_ptr weird.func_ptr_ptr weird.func_ptr_struct weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.integer weird.long_array weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.long_int weird.s2 weird.s2.g weird.s2.h weird.s2.i weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9 weird.s2.u2 weird.s2.u2.f weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.u1 weird.u1.a weird.u1.b weird.u1.c weird.u1.d} - -# Test: c_variable-6.31 -# Desc: check that all children of weird change -# Ok, obviously things like weird.s2 and weird.u1 will not change! -#gdbtk_test *c_variable-6.31 {check that all children of weird change (ops, we are now reporting array names as changed in this case - seems harmless though)} { -# $var(weird) value 0x2121 -# check_update -#} {{weird.integer weird.character weird.char_ptr weird.long_int weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.func_ptr weird.func_ptr_struct weird.func_ptr_ptr weird.u1.a weird.u1.b weird.u1.c weird.u1.d weird.s2.u2.f weird.s2.g weird.s2.h weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9} {weird.s2.i weird.s2.u2 weird weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.s2 weird.long_array weird.u1} {}} - -mi_gdb_test "-var-delete weird" \ - "\\^done,ndeleted=\"12\"" \ - "delete var weird" - - -##### ##### -# # -# Special Display Tests # -# # -##### ##### - -# Stop in "do_special_tests" - -set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"] - -mi_create_breakpoint "$line_dst_incr_a_2" 2 keep do_special_tests ".*var-cmd.c" $line_dst_incr_a_2 $hex \ - "break-insert operation 2" - -mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" \ - ".*var-cmd.c" $line_dst_incr_a_2 { "" "disp=\"keep\"" } \ - "continue to do_special_tests" - -# Test: c_variable-7.10 -# Desc: create union u -mi_create_varobj u u "create local variable u" - -# Test: c_variable-7.11 -# Desc: value of u -mi_gdb_test "-var-evaluate-expression u" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable u" - -# Test: c_variable-7.12 -# Desc: type of u -mi_gdb_test "-var-info-type u" \ - "\\^done,type=\"union named_union\"" \ - "info type variable u" - -# Test: c_variable-7.13 -# Desc: is u editable -mi_gdb_test "-var-show-attributes u" \ - "\\^done,attr=\"noneditable\"" \ - "is u editable" - -# Test: c_variable-7.14 -# Desc: number of children of u -mi_gdb_test "-var-info-num-children u" \ - "\\^done,numchild=\"2\"" \ - "get number of children of u" - -# Test: c_variable-7.15 -# Desc: children of u -mi_list_varobj_children u { - {u.integer integer 0 int} - {u.char_ptr char_ptr 1 {char \*}} -} "get children of u" - -# Test: c_variable-7.20 -# Desc: create anonu -mi_create_varobj anonu anonu "create local variable anonu" - -# Test: c_variable-7.21 -# Desc: value of anonu -mi_gdb_test "-var-evaluate-expression anonu" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable anonu" - -# Test: c_variable-7.22 -# Desc: type of anonu -mi_gdb_test "-var-info-type anonu" \ - "\\^done,type=\"union \{\\.\\.\\.\}\"" \ - "info type variable anonu" - -# Test: c_variable-7.23 -# Desc: is anonu editable -mi_gdb_test "-var-show-attributes anonu" \ - "\\^done,attr=\"noneditable\"" \ - "is anonu editable" - -# Test: c_variable-7.24 -# Desc: number of children of anonu -mi_gdb_test "-var-info-num-children anonu" \ - "\\^done,numchild=\"3\"" \ - "get number of children of anonu" - -# Test: c_variable-7.25 -# Desc: children of anonu -mi_list_varobj_children "anonu" { - {anonu.a a 0 int} - {anonu.b b 0 char} - {anonu.c c 0 "long int"} -} "get children of anonu" - -# Test: c_variable-7.30 -# Desc: create struct s -mi_create_varobj s s "create local variable s" - - -# Test: c_variable-7.31 -# Desc: value of s -mi_gdb_test "-var-evaluate-expression s" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable s" - -# Test: c_variable-7.32 -# Desc: type of s -mi_gdb_test "-var-info-type s" \ - "\\^done,type=\"struct _simple_struct\"" \ - "info type variable s" - -# Test: c_variable-7.33 -# Desc: is s editable -mi_gdb_test "-var-show-attributes s" \ - "\\^done,attr=\"noneditable\"" \ - "is s editable" - -# Test: c_variable-7.34 -# Desc: number of children of s -mi_gdb_test "-var-info-num-children s" \ - "\\^done,numchild=\"6\"" \ - "get number of children of s" - -# Test: c_variable-7.35 -# Desc: children of s -mi_list_varobj_children s { - {s.integer integer 0 int} - {s.unsigned_integer unsigned_integer 0 "unsigned int"} - {s.character character 0 char} - {s.signed_character signed_character 0 "signed char"} - {s.char_ptr char_ptr 1 {char \*}} - {s.array_of_10 array_of_10 10 {int \[10\]}} -} "get children of s" -#} {integer unsigned_integer character signed_character char_ptr array_of_10} - -# Test: c_variable-7.40 -# Desc: create anons -mi_create_varobj anons anons "create local variable anons" - -# Test: c_variable-7.41 -# Desc: value of anons -mi_gdb_test "-var-evaluate-expression anons" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable anons" - -# Test: c_variable-7.42 -# Desc: type of anons -mi_gdb_test "-var-info-type anons" \ - "\\^done,type=\"struct \{\\.\\.\\.\}\"" \ - "info type variable anons" - -# Test: c_variable-7.43 -# Desc: is anons editable -mi_gdb_test "-var-show-attributes anons" \ - "\\^done,attr=\"noneditable\"" \ - "is anons editable" - -# Test: c_variable-7.44 -# Desc: number of children of anons -mi_gdb_test "-var-info-num-children anons" \ - "\\^done,numchild=\"3\"" \ - "get number of children of anons" - -# Test: c_variable-7.45 -# Desc: children of anons -mi_list_varobj_children anons { - {anons.a a 0 int} - {anons.b b 0 char} - {anons.c c 0 "long int"} -} "get children of anons" - -# Test: c_variable-7.50 -# Desc: create enum e -mi_create_varobj e e "create local variable e" - -# Test: c_variable-7.51 -# Desc: value of e -mi_gdb_test "-var-evaluate-expression e" \ - "\\^done,value=\"bar\"" \ - "eval variable e" - -# Test: c_variable-7.52 -# Desc: type of e -mi_gdb_test "-var-info-type e" \ - "\\^done,type=\"enum foo\"" \ - "info type variable e" - -# Test: c_variable-7.53 -# Desc: is e editable -mi_gdb_test "-var-show-attributes e" \ - "\\^done,attr=\"editable\"" \ - "is e editable" - -# Test: c_variable-7.54 -# Desc: number of children of e -mi_gdb_test "-var-info-num-children e" \ - "\\^done,numchild=\"0\"" \ - "get number of children of e" - -# Test: c_variable-7.55 -# Desc: children of e -mi_gdb_test "-var-list-children e" \ - "\\^done,numchild=\"0\",has_more=\"0\"" \ - "get children of e" - -# Test: c_variable-7.60 -# Desc: create anone -mi_create_varobj anone anone "create local variable anone" - -# Test: c_variable-7.61 -# Desc: value of anone -mi_gdb_test "-var-evaluate-expression anone" \ - "\\^done,value=\"A\"" \ - "eval variable anone" - -# Test: c_variable-7.70 -# Desc: create anone -mi_gdb_test "-var-create anone * anone" \ - "\\^error,msg=\"Duplicate variable object name\"" \ - "create duplicate local variable anone" - - -# Test: c_variable-7.72 -# Desc: type of anone -mi_gdb_test "-var-info-type anone" \ - "\\^done,type=\"enum \{\\.\\.\\.\}\"" \ - "info type variable anone" - - -# Test: c_variable-7.73 -# Desc: is anone editable -mi_gdb_test "-var-show-attributes anone" \ - "\\^done,attr=\"editable\"" \ - "is anone editable" - -# Test: c_variable-7.74 -# Desc: number of children of anone -mi_gdb_test "-var-info-num-children anone" \ - "\\^done,numchild=\"0\"" \ - "get number of children of anone" - -# Test: c_variable-7.75 -# Desc: children of anone -mi_gdb_test "-var-list-children anone" \ - "\\^done,numchild=\"0\",has_more=\"0\"" \ - "get children of anone" - - -# Record fp -if ![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"] { - set fp $expect_out(3,string) -} - -mi_continue_to "incr_a" - -# Test: c_variable-7.81 -# Desc: Create variables in different scopes -mi_gdb_test "-var-create a1 * a" \ - "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \ - "create local variable a1" - -mi_gdb_test "-var-create a2 $fp a" \ - "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \ - "create variable a2 in different scope" - -#gdbtk_test c_variable-7.81 {create variables in different scopes} { -# set a1 [gdb_variable create -expr a] -# set a2 [gdb_variable create -expr a -frame $fp] - -# set vals {} -# lappend vals [$a1 value] -# lappend vals [$a2 value] -# set vals -#} {2 1} - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi2-watch.exp b/gdb/testsuite/gdb.mi/mi2-watch.exp deleted file mode 100644 index 5a56c8e..0000000 --- a/gdb/testsuite/gdb.mi/mi2-watch.exp +++ /dev/null @@ -1,186 +0,0 @@ -# Copyright 1999-2004, 2007-2012 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi2" - -gdb_exit -if [mi_gdb_start] { - continue -} - -standard_testfile basics.c - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mi2-watch.exp - return -1 -} - -proc test_watchpoint_creation_and_listing {type} { - global mi_gdb_prompt - global srcfile - global hex - - set line_callee4_head [gdb_get_line_number "callee4 ("] - set line_callee4_body [expr $line_callee4_head + 2] - - # Insert a watchpoint and list - # Tests: - # -break-watch C - # -break-list - - mi_gdb_test "111-break-watch C" \ - "111\\^done,wpt=\{number=\"2\",exp=\"C\"\}" \ - "break-watch operation" - - mi_gdb_test "222-break-list" \ - "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",what=\"C\",times=\"0\",original-location=\"C\"\}\\\]\}" \ - "list of watchpoints" - -} - -# UNUSED at the time -proc test_awatch_creation_and_listing {type} { - global mi_gdb_prompt - global srcfile - global hex - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Insert an access watchpoint and list it - # Tests: - # -break-watch -a A - # -break-list - - mi_gdb_test "333-break-watch -a A" \ - "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_main_body\"\}" \ - "break-watch -a operation" - - mi_gdb_test "444-break-list" \ - "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \ - "list of watchpoints awatch" - - mi_gdb_test "777-break-delete 3" \ - "777\\^done" \ - "delete access watchpoint" -} - -# UNUSED at the time -proc test_rwatch_creation_and_listing {type} { - global mi_gdb_prompt - global srcfile - global hex - - set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - - # Insert a read watchpoint and list it. - # Tests: - # -break-insert -r B - # -break-list - - mi_gdb_test "200-break-watch -r C" \ - "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \ - "break-insert -r operation" - - mi_gdb_test "300-break-list" \ - "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\}\}" \ - "list of breakpoints" - - mi_gdb_test "177-break-delete 4" \ - "177\\^done" \ - "delete read watchpoint" -} - -proc test_watchpoint_triggering {type} { - global mi_gdb_prompt - global hex - - set line_callee4_return_0 [gdb_get_line_number "return 0;"] - set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_close_brace [expr $line_callee3_head + 3] - - # Continue execution until the watchpoint is reached, continue again, - # to see the watchpoint go out of scope. - # Does: - # -exec-continue (Here wp triggers) - # -exec-continue (Here wp goes out of scope) - - mi_execute_to "exec-continue" "watchpoint-trigger" "callee4" "" \ - ".*basics.c" $line_callee4_return_0 \ - {"" "wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\}"} \ - "watchpoint trigger" - - if { $type == "sw" } { - setup_xfail *-*-* - } - mi_execute_to "exec-continue" "watchpoint-scope" "callee3" ".*" \ - ".*basics.c" $line_callee3_close_brace \ - {"" "wpnum=\"2\""} \ - "watchpoint trigger" - clear_xfail *-*-* -} - -proc test_watchpoint_all {type} { with_test_prefix "$type" { - upvar srcdir srcdir - upvar subdir subdir - upvar binfile binfile - - mi_delete_breakpoints - mi_gdb_reinitialize_dir $srcdir/$subdir - mi_gdb_load ${binfile} - - mi_runto callee4 - test_watchpoint_creation_and_listing $type - #test_rwatch_creation_and_listing $type - #test_awatch_creation_and_listing $type - test_watchpoint_triggering $type -}} - -# Run the tests twice, once using software watchpoints... -mi_gdb_test "567-gdb-set can-use-hw-watchpoints 0" \ - "567\\^done" \ - "hw watchpoints toggle (1)" -test_watchpoint_all sw - -mi_gdb_exit - -# ... and unless requested otherwise... -if [target_info exists gdb,no_hardware_watchpoints] { - return 0 -} - -mi_gdb_start - -# ... once using hardware watchpoints (if available). -mi_gdb_test "890-gdb-set can-use-hw-watchpoints 1" \ - "890\\^done" \ - "hw watchpoints toggle (2)" -test_watchpoint_all hw - -mi_gdb_exit -return 0 -- 1.7.7.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 0/11] Cleanup MI test cases 2012-10-12 9:47 ` Yao Qi @ 2012-10-12 10:05 ` Pedro Alves 2012-10-14 12:25 ` [committed] : " Yao Qi 0 siblings, 1 reply; 28+ messages in thread From: Pedro Alves @ 2012-10-12 10:05 UTC (permalink / raw) To: Yao Qi; +Cc: gdb-patches On 10/12/2012 10:46 AM, Yao Qi wrote: > Looks I misread some discussions before. :) At the very beginning, my > thought was to do "mi2-foo.exp -> mi-foo.exp". During the discussion, > especially the patch 'mi-cli.exp -> mi2-cli.exp' patch was approved, Whoops. I didn't really pay attention to the final naming of that file then. Sorry about that. > No, since we decide to keep "mi-foo.exp", the patch just removes > "mi2-foo.exp" files, as they are identical to mi-foo.exp or sub-set of > mi-foo.exp. Great. > How about this patch below? Note that this patch renames "mi2-cli.exp" > to "mi-cli.exp". Looks OK to me. Thanks! -- Pedro Alves ^ permalink raw reply [flat|nested] 28+ messages in thread
* [committed] : [PATCH 0/11] Cleanup MI test cases 2012-10-12 10:05 ` Pedro Alves @ 2012-10-14 12:25 ` Yao Qi 0 siblings, 0 replies; 28+ messages in thread From: Yao Qi @ 2012-10-14 12:25 UTC (permalink / raw) To: gdb-patches On 10/12/2012 06:05 PM, Pedro Alves wrote: >> How about this patch below? Note that this patch renames "mi2-cli.exp" >> >to "mi-cli.exp". > Looks OK to me. Thanks! Committed. -- Yao ^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2012-10-14 12:25 UTC | newest] Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-08-31 13:29 [RFC] Merge mi-cli.exp and mi2-cli.exp Yao Qi 2012-09-03 9:08 ` Vladimir Prus 2012-09-03 15:55 ` Yao Qi 2012-09-05 0:29 ` Stan Shebs 2012-09-10 20:09 ` Tom Tromey 2012-09-11 15:15 ` Pedro Alves 2012-09-11 21:53 ` Stan Shebs 2012-09-12 15:28 ` Pedro Alves 2012-09-12 13:59 ` Yao Qi 2012-09-19 11:22 ` Yao Qi 2012-09-19 13:47 ` Pedro Alves 2012-09-21 8:40 ` Yao Qi 2012-09-28 0:04 ` [PATCH 0/11] Cleanup MI test cases Yao Qi 2012-09-28 0:04 ` [PATCH 02/11] mi-var-block.exp Yao Qi 2012-09-28 0:04 ` [PATCH 05/11] mi-pthreads.exp Yao Qi 2012-09-28 0:05 ` [PATCH 10/11] mi-stack.exp Yao Qi 2012-09-28 0:05 ` [PATCH 04/11] mi-basics.exp Yao Qi 2012-09-28 0:05 ` [PATCH 03/11] mi-file.exp Yao Qi 2012-09-28 0:05 ` [PATCH 07/11] mi-var-cmd.exp Yao Qi 2012-09-28 0:05 ` [PATCH 06/11] mi-break.exp Yao Qi 2012-09-28 0:05 ` [PATCH 01/11] Remove mi-FOO.exp which are identical to mi2-FOO.exp Yao Qi 2012-09-28 0:05 ` [PATCH 11/11] mi-syn-frame.exp Yao Qi 2012-09-28 0:05 ` [PATCH 09/11] mi-console.exp Yao Qi 2012-09-28 0:05 ` [PATCH 08/11] mi-var-display.exp Yao Qi 2012-09-28 19:36 ` [PATCH 0/11] Cleanup MI test cases Pedro Alves 2012-10-12 9:47 ` Yao Qi 2012-10-12 10:05 ` Pedro Alves 2012-10-14 12:25 ` [committed] : " Yao Qi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox