summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2014-12-27 16:16:29 +0100
committerMark Wielaard <[email protected]>2015-01-16 09:01:57 +0100
commitf8198f2322b93dea4efbcf491b073a89e8aab1bf (patch)
tree8fd39b0f2f54649e0fe8398cb0ef891b3cf1e03d /tests
parentb4b2de9f1f1fb694b77371a61f808a1641bbafea (diff)
libdwfl: dwfl_module_getsrc should never match end_sequence line.
The line with end_sequence set has an address outside the current line sequence. An end_sequence line has no other useful information except marking the address as out of range. Two tests, addrscopes and funcscopes, depended on matching the end_sequence line. But that was because they included the high_pc address in the scope. However the high_pc attributes has as address the first location past the range associated with a given DIE. Adjust the tests to use high_pc - 1 as end of the scope. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog7
-rw-r--r--tests/addrscopes.c6
-rw-r--r--tests/funcscopes.c6
-rwxr-xr-xtests/run-addrscopes.sh10
-rwxr-xr-xtests/run-funcscopes.sh6
5 files changed, 21 insertions, 14 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index c05e8079..b81e83c1 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,10 @@
+2014-12-27 Mark Wielaard <[email protected]>
+
+ * addrscopes.c (handle_address): Last address in scope is highpc - 1.
+ * funcscopes.c (handle_function): Likewise.
+ * run-addrscopes.sh: Adjust last address in scope.
+ * run-funcscopes.sh: Likewise.
+
2015-01-07 Mark Wielaard <[email protected]>
* run-addrcfi.sh: Add test for ppc32 eh_frame_hdr address search.
diff --git a/tests/addrscopes.c b/tests/addrscopes.c
index fca61d33..2285d2ca 100644
--- a/tests/addrscopes.c
+++ b/tests/addrscopes.c
@@ -1,5 +1,5 @@
/* Test program for dwarf_getscopes.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2014 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -125,10 +125,10 @@ handle_address (GElf_Addr pc, Dwfl *dwfl)
lowpc += cubias;
highpc += cubias;
Dwfl_Line *loline = dwfl_getsrc (dwfl, lowpc);
- Dwfl_Line *hiline = dwfl_getsrc (dwfl, highpc);
+ Dwfl_Line *hiline = dwfl_getsrc (dwfl, highpc - 1);
paddr (": ", lowpc, loline);
if (highpc != lowpc)
- paddr (" .. ", lowpc, hiline == loline ? NULL : hiline);
+ paddr (" .. ", highpc - 1, hiline == loline ? NULL : hiline);
}
puts ("");
diff --git a/tests/funcscopes.c b/tests/funcscopes.c
index 720ff3b9..55cb4fac 100644
--- a/tests/funcscopes.c
+++ b/tests/funcscopes.c
@@ -1,5 +1,5 @@
/* Test program for dwarf_getscopes.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2014 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -153,10 +153,10 @@ handle_function (Dwarf_Die *funcdie, void *arg)
lowpc += a->dwbias;
highpc += a->dwbias;
Dwfl_Line *loline = dwfl_getsrc (a->dwfl, lowpc);
- Dwfl_Line *hiline = dwfl_getsrc (a->dwfl, highpc);
+ Dwfl_Line *hiline = dwfl_getsrc (a->dwfl, highpc - 1);
paddr (": ", lowpc, loline);
if (highpc != lowpc)
- paddr (" .. ", lowpc, hiline == loline ? NULL : hiline);
+ paddr (" .. ", highpc - 1, hiline == loline ? NULL : hiline);
}
puts ("");
diff --git a/tests/run-addrscopes.sh b/tests/run-addrscopes.sh
index 4f5c9d7f..8f1bf0e3 100755
--- a/tests/run-addrscopes.sh
+++ b/tests/run-addrscopes.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2005 Red Hat, Inc.
+# Copyright (C) 2005, 2014 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -21,9 +21,9 @@ testfiles testfile22
testrun_compare ${abs_builddir}/addrscopes -e testfile22 0x8048353 <<\EOF
0x8048353:
- tests/foo.c (0x11): 0x8048348 (tests/foo.c:5) .. 0x804837e (tests/foo.c:16)
+ tests/foo.c (0x11): 0x8048348 (tests/foo.c:5) .. 0x804837c (tests/foo.c:16)
global [ be]
- function (0x2e): 0x8048348 (tests/foo.c:5) .. 0x804835b (tests/foo.c:14)
+ function (0x2e): 0x8048348 (tests/foo.c:5) .. 0x8048359 (tests/foo.c:11)
local [ 8f]
EOF
@@ -32,8 +32,8 @@ test_cleanup
testfiles testfile24
testrun_compare ${abs_builddir}/addrscopes -e testfile24 0x804834e <<\EOF
0x804834e:
- inline-test.c (0x11): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x8048364 (/home/roland/build/stock-elfutils/inline-test.c:16)
- add (0x1d): 0x804834e (/home/roland/build/stock-elfutils/inline-test.c:3) .. 0x8048350 (/home/roland/build/stock-elfutils/inline-test.c:9)
+ inline-test.c (0x11): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x8048360 (/home/roland/build/stock-elfutils/inline-test.c:16)
+ add (0x1d): 0x804834e (/home/roland/build/stock-elfutils/inline-test.c:3) .. 0x804834f
y [ 9d]
x [ a2]
x (abstract)
diff --git a/tests/run-funcscopes.sh b/tests/run-funcscopes.sh
index d236f5c3..367729a7 100755
--- a/tests/run-funcscopes.sh
+++ b/tests/run-funcscopes.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2005 Red Hat, Inc.
+# Copyright (C) 2005, 2014 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -21,8 +21,8 @@ testfiles testfile25
testrun_compare ${abs_builddir}/funcscopes -e testfile25 incr <<\EOF
testfile25: 0x8048000 .. 0x8049528
- inline-test.c (0x11): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x804834f (/home/roland/build/stock-elfutils/inline-test.c:9)
- incr (0x2e): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x804834f (/home/roland/build/stock-elfutils/inline-test.c:9)
+ inline-test.c (0x11): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x804834e (/home/roland/build/stock-elfutils/inline-test.c:9)
+ incr (0x2e): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x804834e (/home/roland/build/stock-elfutils/inline-test.c:9)
x [ 66]
EOF