Ada compile with -fvar-tracking

Carl Love
2023-11-14T19:25:18Z

Tom:

Per our conversation on HexChat about using -fvar-tracking when
compiling Ada programs.

I tried adding the -fvar-tracking option based on the examples we
talked about. Here are the changes I used:

gdb/testsuite/gdb.ada/finish-large.exp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.ada/finish-large.exp b/gdb/testsuite/gdb.ada/finish-large.exp
index 5661d132a18..affb2a497fa 100644
--- a/gdb/testsuite/gdb.ada/finish-large.exp
+++ b/gdb/testsuite/gdb.ada/finish-large.exp
@@ -19,7 +19,12 @@ require allow_ada_tests

standard_ada_testfile p

-if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
+set additional_flags {}
+
+set flags [list debug additional_flags=-fvar-tracking]
+
+if {[gdb_compile_ada "${srcfile}" "${binfile} " executable $flags] != ""} {
+
return -1
}

When I try to run the test with:

make check RUNTESTFLAGS='GDB=/home/carll/bin/gdb gdb.ada/finish-large.exp ' > out

I get the following, edited a little to make it easier to read, in
gdb/testsuite/gdb.log:

Executing on host: gnatmake p.adb -largs -margs -fvar-tracking -f
-I/home/.../gdb/testsuite/gdb.ada/finish-large -g -largs -lm -margs -o /.../gdb/testsuite

compilation failed: gcc -c -I./ -fvar-tracking -I/.../gdb/testsuite/gdb.ada/finish-large -g
-I- /.../testsuite/gdb.ada/finish-large/p.adb

gcc -c -I./ -fvar-tracking -I/..../gdb/testsuite/gdb.ada/finish-large -g -I-
/.../gdb/testsuite/gdb.ada/finish-large/pck.adb

gnatbind -I/..../gdb/testsuite/gdb.ada/finish-large -x p.ali

gnatlink p.ali -fvar-tracking -g -lm -o /..../gdb/testsuite/outputs/gdb.ada/finish-large/p

FAIL: gdb.ada/finish-large.exp: compilation p.adb

If I remove the "additional_flags=-fvar-tracking" from the flags line,
i.e.

set flags [list debug additional_flags=""]

Then the test compiles and runs as before. So, I still don't seem to
be able to get Ada to take the -fvar-tracking option. I just seem to
get a compilation error which I guess is due to the compiler not
recognizing "-fvar-tracking". Thoughts?

Thanks for the time and effort on this.

Carl