Extend GNU ifunc testcases
authorPedro Alves <palves@redhat.com>
Thu, 26 Apr 2018 12:01:27 +0000 (13:01 +0100)
committerPedro Alves <palves@redhat.com>
Thu, 26 Apr 2018 12:11:09 +0000 (13:11 +0100)
commitc7075ad5030c4c2e79a04f3517689b751ff41860
tree56c9f7a828468310dc0ce42319f220f4cb938bf5
parentbfa5bd2ab31a8abb23cb442d51fe6c3836028880
Extend GNU ifunc testcases

This patch extends/rewrites the gdb.base/gnu-ifunc.exp testcase to
cover the many different fixes in earlier patches.  (This was actually
what encovered most of the problems.)

The current testcase uses an ifunc symbol with the same name as the
ifunc resolver symbol and makes sure to compile the ifunc resolver
without debug info.  That does not model how ifuncs are implemented in
gcc/ifunc nowadays.  Instead, what we have is that the glibc ifunc
resolvers nowadays are written in C and end up with debug info.

Also, in some cases the ifunc target is written in assembly, but in
other cases it's written in C.  In the case of target function written
in C, if the target function has debug info, when we set a break on
the ifunc, we want to set it past the prologue of the target function.
Currently GDB gets that wrong.

To make sure we cover all the different scenarios, the testcase is
tweaked to cover all the different combinations of

 - An ifunc resolver with the same name as the user-visible symbol vs
   an ifunc resolver with a different name as the user-visible symbol.

 - ifunc resolver compiled with and without debug info.

 - ifunc target function compiled with and without debug info.

The testcase currently sets breakpoints on ifuncs, calls ifunc
functions, steps into ifunc functions, etc.  After this series, this
all works and the testcase passes cleanly.

While working on this, I noticed that "b gnu_ifunc" before and after
the inferior resolved the ifunc would end up with a breakpoint with
different locations.  That's now covered by new tests inside the new
"set-break" procedure.

It also tests other things like making sure we can't call an ifunc
without a return-type case if we don't know the type of the target.
And making sure that we pass enough arguments when we do know the
type.

gdb/testsuite/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* gdb.base/gnu-ifunc-final.c: New file.
* gdb.base/gnu-ifunc.c (final): Delete, moved to gnu-ifunc-final.c.
* gdb.base/gnu-ifunc.exp (executable): Delete.
(staticexecutable): Adjust.
(lib_opts, exec_opts): Delete.
(make_binsuffix, build, set-break): New procedures.
(misc_tests): New, with tests factored out from the top level.
(top level): Test different combinations of ifunc resolver name,
resolver with and with debug info, and ifunc target with and
without debug info.  Wrap static tests with with_target_prefix.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/gnu-ifunc-final.c [new file with mode: 0644]
gdb/testsuite/gdb.base/gnu-ifunc-lib.c
gdb/testsuite/gdb.base/gnu-ifunc.c
gdb/testsuite/gdb.base/gnu-ifunc.exp
This page took 0.026129 seconds and 4 git commands to generate.