aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2013-11-04 19:55:06 +0100
committerPetr Machata <pmachata@redhat.com>2013-11-05 01:58:07 +0100
commitce011e2111524f8cc5e246f2bcfa9eb20984d4bf (patch)
tree59f44631057b81e5a111ceac8059044ff198ca9e
parent0ed5399f5cbb2b505a95bcac634c0ad5d7bbd6b8 (diff)
downloadltrace-ce011e2111524f8cc5e246f2bcfa9eb20984d4bf.tar.gz
The irelative test case should check for IFUNC in shared library as well
-rw-r--r--testsuite/ltrace.minor/trace-irelative.exp45
1 files changed, 27 insertions, 18 deletions
diff --git a/testsuite/ltrace.minor/trace-irelative.exp b/testsuite/ltrace.minor/trace-irelative.exp
index 567be24..f19cd62 100644
--- a/testsuite/ltrace.minor/trace-irelative.exp
+++ b/testsuite/ltrace.minor/trace-irelative.exp
@@ -16,7 +16,26 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA
-set bin [ltraceCompile {} [ltraceSource c {
+proc do_tests {bin appendage} {
+ ltraceMatch1 [ltraceRun -e xyz -- $bin] {xyz\(} == 2
+
+ # If the actual entry point that xyz resolves to is not traced, it
+ # should get xyz's name. But we don't mind if somebody implements
+ # the late lookup and actually names the symbol properly.
+
+ set log [ltraceRun -L -x xyz -- $bin]
+ ltraceMatch1 $log [format {xyz\.IFUNC%s\(\)} $appendage] == 1
+ ltraceMatch1 $log [format {(xyz|abc)%s\(} $appendage] == 2
+
+ # If we request abc's tracing explicitly, than it definitely needs
+ # to be presented as abc, not as xyz.
+
+ set log [ltraceRun -L -x xyz+abc -- $bin]
+ ltraceMatch1 $log [format {xyz\.IFUNC%s\(\)} $appendage] == 1
+ ltraceMatch1 $log [format {abc%s\(} $appendage] == 2
+}
+
+set src [ltraceSource c {
int abc (int a) { return a + 1; }
__asm__(".type xyz, \%gnu_indirect_function");
@@ -24,7 +43,7 @@ set bin [ltraceCompile {} [ltraceSource c {
int xyz (int a);
extern void *xyz_ifunc(void) __asm__("xyz");
extern void *xyz_ifunc(void) {
- return abc;
+ return &abc;
}
int
@@ -32,25 +51,15 @@ set bin [ltraceCompile {} [ltraceSource c {
{
return xyz (xyz (argc));
}
-}]]
-
-ltraceMatch1 [ltraceRun -e xyz -- $bin] {xyz\(} == 2
+}]
-# If the actual entry point that xyz resolves to is not traced, it
-# should get xyz's name. But we don't mind if somebody implements the
-# late lookup and actually names the symbol properly.
+set bin1 [ltraceCompile {} $src]
-ltraceMatch [ltraceRun -L -x xyz -- $bin] {
- {{xyz\.IFUNC\(\)} == 1}
- {{(xyz|abc)\(} == 2}
-}
+do_tests $bin1 ""
-# If we request abc's tracing explicitly, than it definitely needs to
-# be presented as abc, not as xyz.
+set lib [ltraceCompile lib.so $src]
+set bin2 [ltraceCompile {} $lib [ltraceSource c {/* Empty. */}]]
-ltraceMatch [ltraceRun -L -x xyz+abc -- $bin] {
- {{xyz\.IFUNC\(\)} == 1}
- {{abc\(} == 2}
-}
+do_tests $bin2 @lib.so
ltraceDone