Re: [RFC/RFA] (testsuite/Ada) Add gdb_compile_ada

Joel Brobecker
2004-02-25T18:32:14Z

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

Continuing my fascinating monologous with myself :)

> - Object files are placed in the testsuite directory. I'd rather
> see them being placed in gdb.ada.
>
> I managed to do this, but I a not completely sure that it's such
> a good idea after all. See patch below. On the one hand, the object
> files et al are placed in gdb.ada rather than gdb/testsuite, but
> on the other hand this has a slight impact in the debug info generated
> by the compiler, since the source file name is no longer absolute.
> So this change is not completely transparent for the debugger...
> What do you think?

Actually, I just noticed that the few tests that do generate object
files and other compilation artifacts actually leave them in the
testsuite directory, not inside the gdb.* directories.

So I would be tempted to discard the idea above of making sure that
all these artifacts be placed in the gdb.ada directory for all Ada
testcases. Hence the attached patch. One note, however: contrary to
C where temporary .o files are automatically deleted, gnatmake leaves
behind. This is to allow incremental builds, similar what make does.
This will cause a much higher number of object files to be created
in the testsuite directory. I hope this is fine? Otherwise, we'll
can use the previous approach, but I believe it should be done
consistently across all languages.

2004-02-24 J. Brobecker <brobecker@gnat.com>

* lib/gdb.exp (gdb_compile_ada): New function.

Tested on x86-linux.

--
Joel

[-- Attachment #2: gdb.exp.diff --]
[-- Type: text/plain, Size: 886 bytes --]

Index: lib/gdb.exp
===================================================================
RCS file: /nile.c/cvs/Dev/gdb/gdb-6.0/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 gdb.exp
--- lib/gdb.exp 5 Oct 2003 10:40:20 -0000 1.1.1.1
+++ lib/gdb.exp 25 Feb 2004 18:24:38 -0000
@@ -1323,6 +1323,23 @@ proc gdb_compile_objc {source dest type
}
}

+#
+# Compile some Ada code.
+#
+proc gdb_compile_ada {source dest type options} {
+
+ lappend options "compiler=gnatmake"
+
+ set result [target_compile $source $dest $type $options]
+
+ # Make sure that the dest file has been created. Otherwise,
+ # the build has failed.
+ if ![file exists $dest] {
+ verbose "Ada compilation failed: $result"
+ return "Ada compilation failed."
+ }
+}
+
proc send_gdb { string } {
global suppress_flag;
if { $suppress_flag } {