[PATCH 0/2] Fix a couple gdb.ada/minsyms.exp problems

Pedro Alves
2017-11-21T16:11:05Z

Hi Joel, all,

The new gdb.ada/minsyms.exp testcase fails for me like this:

FAIL: gdb.ada/minsyms.exp: print integer(some_minsym)
FAIL: gdb.ada/minsyms.exp: print &some_minsym
FAIL: gdb.ada/minsyms.exp: print /x integer(&some_minsym)

There are two problems here.

One's obvious: the testcase hardcodes an expected address for the
"some_minsym" variable, which obviously can't work everywhere.

The other problem is that if you have debug info for glibc, GDB
loses track of the fact that the program is a Ada program, and
switches the current language to C, where Ada's cast syntax doesn't
work:

print integer(some_minsym)
A syntax error in expression, near `some_minsym)'.
(gdb) FAIL: gdb.ada/minsyms.exp: print integer(some_minsym)
print &some_minsym

I first thought of doing "set language ada" in the testcase, but
looking deeper, I realized that before running to main, GDB knows the
program is Ada, and is losing that when handling a shared library
event. That looks like a GDB bug, so I'm proposing fixing GDB
instead.

WDYT?

Pedro Alves (2):
gdb.ada/minsyms.exp: Don't hardcode the variable's address
Don't lose language determined from the "main" name (fix
gdb.ada/minsyms.exp)

gdb/solib-svr4.c | 15 +++++++++++++++
gdb/testsuite/gdb.ada/minsyms.exp | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)

--
2.5.5