Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] gdb.mi tests
@ 2008-03-11 19:32 Aleksandar Ristovski
  2008-03-12 19:18 ` Aleksandar Ristovski
  0 siblings, 1 reply; 12+ messages in thread
From: Aleksandar Ristovski @ 2008-03-11 19:32 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1152 bytes --]

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

[-- Attachment #2: mitests.diff --]
[-- Type: text/plain, Size: 1837 bytes --]

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
 


[-- Attachment #3: gdb669.exp.diff --]
[-- Type: text/plain, Size: 440 bytes --]

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

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: [RFC] gdb.mi tests
@ 2008-03-28 15:24 Aleksandar Ristovski
  2008-03-28 15:59 ` Daniel Jacobowitz
  2008-03-28 16:00 ` Daniel Jacobowitz
  0 siblings, 2 replies; 12+ messages in thread
From: Aleksandar Ristovski @ 2008-03-28 15:24 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1102 bytes --]

Daniel Jacobowitz wrote:
> On Wed, Mar 12, 2008 at 03:18:15PM -0400, Aleksandar Ristovski wrote:
>> Attached working diff. Comments welcome.
> 
> I think this patch is OK, if you add a changelog entry for it.  Do
> you have write access?  If not, would you like to?
> 

In the context of this thread, I have reduced the originally proposed diff.
Now 
it is a simple change in mi-support.exp, diff attached.

I gave up the removal of "load_lib mi-support.exp" from all tests since, as 
Daniel pointed out, the overriding can still be done by loading the file in
your 
board file, and after the load_lib statement redefining the functions of 
interest; load_lib makes sure to not reload already loaded file.

Leaving "load_lib mi-support.exp" maybe makes it a bit more clear what file 
contains functions that can be overridden.

Thanks,

Aleksandar Ristovski
QNX Software Systems



2008-03-28  Aleksandar Ristovski  <aristovski@qnx.com>

	* lib/mi-support.exp: Rename mi_gdb_start to default_mi_gdb_start
and
	add mi_gdb_start to simply call the default one. Brings mi-support
	in line with gdb.exp.



[-- Attachment #2: mi-support.diff --]
[-- Type: text/plain, Size: 1492 bytes --]

Index: gdb/testsuite/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
--- gdb/testsuite/lib/mi-support.exp	29 Jan 2008 19:36:58 -0000	1.51
+++ gdb/testsuite/lib/mi-support.exp	28 Mar 2008 15:07:52 -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 

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: [RFC] gdb.mi tests
@ 2008-03-28 16:16 Aleksandar Ristovski
  0 siblings, 0 replies; 12+ messages in thread
From: Aleksandar Ristovski @ 2008-03-28 16:16 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]

Daniel Jacobowitz wrote:
> By the way, since you now have write access, please add yourself
> to gdb/MAINTAINERS in the write-after-approval section.  Thanks.
>
>   
2008-03-28  Aleksandar Ristovski  <aristovski@qnx.com>

    * MAINTAINERS: Added myself.





[-- Attachment #2: MAINTAINERS.diff --]
[-- Type: text/plain, Size: 628 bytes --]

Index: MAINTAINERS
===================================================================
RCS file: /cvs/src/src/gdb/MAINTAINERS,v
retrieving revision 1.391
diff -u -p -r1.391 MAINTAINERS
--- MAINTAINERS	7 Mar 2008 11:17:45 -0000	1.391
+++ MAINTAINERS	28 Mar 2008 16:09:10 -0000
@@ -546,6 +546,7 @@ Denis Pilat					denis.pilat@st.com
 Vladimir Prus                                   vladimir@codesourcery.com
 Qinwei						qinwei@sunnorth.com.cn
 Frederic Riss					frederic.riss@st.com
+Aleksandar Ristovski				aristovski@qnx.com
 Tom Rix						trix@redhat.com
 Nick Roberts					nickrob@snap.net.nz
 Bob Rossi 					bob_rossi@cox.net

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-03-28 16:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-11 19:32 [RFC] gdb.mi tests Aleksandar Ristovski
2008-03-12 19:18 ` Aleksandar Ristovski
2008-03-12 19:25   ` Vladimir Prus
2008-03-12 19:34     ` Daniel Jacobowitz
2008-03-12 20:49       ` Aleksandar Ristovski
2008-03-12 21:05         ` Daniel Jacobowitz
2008-03-14 18:07           ` Aleksandar Ristovski
2008-03-21 15:07   ` Daniel Jacobowitz
2008-03-28 15:24 Aleksandar Ristovski
2008-03-28 15:59 ` Daniel Jacobowitz
2008-03-28 16:00 ` Daniel Jacobowitz
2008-03-28 16:16 Aleksandar Ristovski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox