This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC] gdb.mi tests
- From: Aleksandar Ristovski <aristovski at qnx dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 11 Mar 2008 15:32:24 -0400
- Subject: [RFC] gdb.mi tests
Hello,
By looking at gdb.mi I have noticed that (unfortunately) the way they are
written, they do not allow baseboard files to override mi_* functions.
gdb.base allows overriding which is great. For example, we override gdb_start
and gdb_load. In overriden functions we call default_ versions and then we
perform some additional tasks.
For gdb.mi, that is not possible since mi-support.exp is going to be loaded
after baseboard file.
I would propose the following changes (only one test from gdb.mi is given as an
example) and would ask you to, please, comment.
Changes:
1. gdb.exp loads mi-support.exp
2. mi-support.exp to "export" overridable functions. By this I mean to have
mi_cmd and default_mi_cmd pairs, where mi_cmd calls default_mi_cmd. Baseboard
can override mi_cmd (well, it can override anything, but this would be meant to
be overriden).
3. gdb.mi/* do not load explicitly mi-support.exp
Something like the diffs attached (I manually removed some things from my diff
so the diff may not be patchable, but it should be sufficient to illustrate what
am I talking about.
Thanks,
Aleksandar Ristovski
QNX Software Systems
Index: lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.51
diff -u -p -r1.51 mi-support.exp
--- lib/mi-support.exp 29 Jan 2008 19:36:58 -0000 1.51
+++ lib/mi-support.exp 11 Mar 2008 19:20:13 -0000
@@ -84,7 +84,7 @@ proc mi_uncatched_gdb_exit {} {
}
#
-# mi_gdb_start [INFERIOR_PTY] -- start gdb running, default procedure
+# default_mi_gdb_start [INFERIOR_PTY] -- start gdb running, default procedure
#
# INFERIOR_PTY should be set to separate-inferior-tty to have the inferior work
# with it's own PTY. If set to same-inferior-tty, the inferior shares GDB's PTY.
@@ -94,7 +94,7 @@ proc mi_uncatched_gdb_exit {} {
# tests on different hosts all using the same server, things can
# get really slow. Give gdb at least 3 minutes to start up.
#
-proc mi_gdb_start { args } {
+proc default_mi_gdb_start { args } {
global verbose
global GDB
global GDBFLAGS
@@ -230,6 +230,14 @@ proc mi_gdb_start { args } {
return 0;
}
+#
+# Overridable function. You can override this function in your
+# baseboard file.
+#
+proc mi_gdb_start { args } {
+ return [default_mi_gdb_start $args]
+}
+
# Many of the tests depend on setting breakpoints at various places and
# running until that breakpoint is reached. At times, we want to start
# with a clean-slate with respect to breakpoints, so this utility proc
Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.96
diff -u -p -r1.96 gdb.exp
--- lib/gdb.exp 23 Jan 2008 06:20:34 -0000 1.96
+++ lib/gdb.exp 11 Mar 2008 19:20:24 -0000
@@ -27,6 +27,7 @@ if {$tool == ""} {
}
load_lib libgloss.exp
+load_lib mi-support.exp
global GDB
Index: gdb.mi/gdb669.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/gdb669.exp,v
retrieving revision 1.9
diff -u -p -r1.9 gdb669.exp
--- gdb.mi/gdb669.exp 1 Jan 2008 22:53:20 -0000 1.9
+++ gdb.mi/gdb669.exp 11 Mar 2008 19:28:38 -0000
@@ -25,7 +25,7 @@ if {![isnative]} {
return
}
-load_lib mi-support.exp
+# load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit