binutils-gdb/gdb/testsuite/gdb.trace
Simon Marchi 952ebca583 ftrace tests: Use gdb_load_shlib result to lookup IPA in info sharedlibrary
Some fast tracepoints tests make sure that the in-process agent library
is properly loaded, by searching for the library name in "info
sharedlibrary".

Originally, it would search for the full path.  Since patch "Make ftrace
tests work with remote targets" [1], the "runtime" location of the IPA,
in the standard output directory, is not the same as the original
location, in the gdbserver build directory.  Therefore, the patch
changed the checks:

  gdb_test "info sharedlibrary" ".*${libipa}.*" "IPA loaded"

to

  gdb_test "info sharedlibrary" ".*[file tail ${libipa}].*" "IPA loaded"

so that only the "libinproctrace.so" part would be searched for.
Antoine (in CC) pointed out that I missed some, so I have to update
them.  In the mean time, I noticed that I missed a few test failures:
adding the SONAME to the IPA makes it possible for the test executable
to erroneously pick up libinproctrace.so from /usr/lib if the test
harness failed to put the libinproctrace.so we want to test in the right
place.  To mitigate that kind of error in the future, we can use the
return value of gdb_load_shlib (the path of the "runtime" version of the
library) and use that to search in the output of info sharedlibrary.

When testing locally, gdb_load_shlib returns the full normalized path of
the destination library, which the test executable should use e.g.:

  /path/to/gdb/testsuite/outputs/gdb.trace/thetest/libinproctrace.so

My testing showed that it was the same path that gdb displayed in info
sharedlibrary.  If the test executable picks up another
libinproctrace.so, the test will fail.

When testing remotely, gdb_load_shlib/gdb_remote_download only returns
us "libinproctrace.so", so the situation doesn't really change.  If
there is a rogue libinproctrace.so in /usr/lib on the target and we fail
to download ours, it might cover up a test failure.  But that situation
is probably still better than the original one, where it wasn't possible
to test remotely using the IPA at all.

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=6e774b13c3b81ac2599812adf058796948ce7e95

gdb/testsuite/ChangeLog:

	* gdb.arch/ftrace-insn-reloc.exp: Save gdb_load_shlib result,
	use it in info sharedlibrary test.
	* gdb.trace/ftrace-lock.exp: Likewise.
	* gdb.trace/ftrace.exp: Likewise.
	* gdb.trace/range-stepping.exp: Likewise.
	* gdb.trace/trace-break.exp: Likewise.
	* gdb.trace/trace-condition.exp: Likewise.
	* gdb.trace/trace-mt.exp: Likewise.
2016-04-28 09:49:01 -04:00
..
actions-changed.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
actions-changed.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
actions.c gdb.trace/tfind.exp: Force call via global entry point on ppc64le. 2016-03-09 18:46:12 +01:00
actions.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
ax.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
backtrace.exp gdb.trace/testsuite: Bump stack collection fudge factor. 2016-01-25 13:19:22 +01:00
change-loc-1.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
change-loc-2.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
change-loc.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
change-loc.exp Rename gdb_load_shlibs to gdb_load_shlib 2016-04-27 18:09:14 -04:00
change-loc.h GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
circ.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
circ.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
collection.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
collection.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
deltrace.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
disconnected-tracing.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
disconnected-tracing.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
entry-values.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
entry-values.exp gdb.trace/entry-values.exp: Fixes for powerpc64. 2016-03-09 18:47:11 +01:00
ftrace-lock.c Fix gdb.trace/ftrace-lock.c compilation 2016-03-01 17:42:47 +00:00
ftrace-lock.exp ftrace tests: Use gdb_load_shlib result to lookup IPA in info sharedlibrary 2016-04-28 09:49:01 -04:00
ftrace.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
ftrace.exp ftrace tests: Use gdb_load_shlib result to lookup IPA in info sharedlibrary 2016-04-28 09:49:01 -04:00
infotrace.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-trace-frame-collected.exp gdbserver/s390: Switch on tracepoint support. 2016-03-29 23:08:05 +02:00
mi-trace-unavailable.exp gdbserver/s390: Switch on tracepoint support. 2016-03-29 23:08:05 +02:00
mi-traceframe-changed.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-tracepoint-changed.exp Rename gdb_load_shlibs to gdb_load_shlib 2016-04-27 18:09:14 -04:00
mi-tsv-changed.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
no-attach-trace.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
no-attach-trace.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
packetlen.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
passc-dyn.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
passcount.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
pending.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
pending.exp Rename gdb_load_shlibs to gdb_load_shlib 2016-04-27 18:09:14 -04:00
pendshr1.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
pendshr2.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
pr16508.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
qtro.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
qtro.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
range-stepping.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
range-stepping.exp ftrace tests: Use gdb_load_shlib result to lookup IPA in info sharedlibrary 2016-04-28 09:49:01 -04:00
read-memory.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
read-memory.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
report.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
save-trace.exp testsuite: Fix save-trace.exp writing outside standard output directory 2016-02-16 09:01:38 -05:00
signal.c New test case gdb.trace/signal.exp 2016-04-22 11:59:18 +01:00
signal.exp Deliver signal in hardware single step 2016-04-22 11:59:18 +01:00
stap-trace.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
stap-trace.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
status-stop.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
status-stop.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
strace.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
strace.exp Rename gdb_load_shlibs to gdb_load_shlib 2016-04-27 18:09:14 -04:00
tfile.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
tfile.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
tfind.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
trace-break.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
trace-break.exp ftrace tests: Use gdb_load_shlib result to lookup IPA in info sharedlibrary 2016-04-28 09:49:01 -04:00
trace-buffer-size.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
trace-buffer-size.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
trace-common.h gdbserver/s390: Switch on tracepoint support. 2016-03-29 23:08:05 +02:00
trace-condition.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
trace-condition.exp ftrace tests: Use gdb_load_shlib result to lookup IPA in info sharedlibrary 2016-04-28 09:49:01 -04:00
trace-mt.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
trace-mt.exp ftrace tests: Use gdb_load_shlib result to lookup IPA in info sharedlibrary 2016-04-28 09:49:01 -04:00
trace-unavailable.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
tracecmd.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
tracefile-pseudo-reg.c Move tfile-avx.exp to tracefile-pseudo-reg.exp 2016-02-24 14:23:47 -05:00
tracefile-pseudo-reg.exp Move tfile-avx.exp to tracefile-pseudo-reg.exp 2016-02-24 14:23:47 -05:00
tspeed.c Determine the iteration count based on wallclock instead of user+system time. 2016-02-18 20:23:00 +01:00
tspeed.exp Fix missing IPA lib in tspeed.exp in some configurations. 2016-01-20 12:30:53 -05:00
tstatus.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
tsv.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
unavailable-dwarf-piece.c gdb.trace: Use manually-defined start labels in unavailable-dwarf-piece.exp 2016-03-09 18:44:57 +01:00
unavailable-dwarf-piece.exp gdb.trace: Use manually-defined start labels in unavailable-dwarf-piece.exp 2016-03-09 18:44:57 +01:00
unavailable.cc GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
unavailable.exp Fix fails in gdb.trace/unavailable.exp 2016-04-22 17:23:23 +01:00
while-dyn.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
while-stepping.exp GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00