summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2018-05-24 15:20:25 +0200
committerMark Wielaard <[email protected]>2018-05-24 15:20:25 +0200
commitc2d14cc492aa7fd28740d5789fede64ce81a063b (patch)
tree8dc6ce6af3e6720848debfabb4cde5ad2e1361b4 /tests
parent144b73c49acf3ed894e4635aedb9b0d1208ade2e (diff)
libdw: Initialize ranges_base, add invalid DWARF test and fix expected output.
We never initialized the CU ranges_base, which meant we didn't actually calculate it correctly. This caused bad ranges on some DIEs. The expected output in the testcase was wrong. We also crashed on invalid dwarf. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog7
-rw-r--r--tests/get-units-invalid.c7
-rwxr-xr-xtests/run-all-dwarf-ranges.sh7
3 files changed, 17 insertions, 4 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index a021a019..86bcf9db 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,6 +1,11 @@
+2018-05-24 Mark Wielaard <[email protected]>
+
+ * get-units-invalid.c (main): Add check for invalid dwarf_ranges.
+ * run-all-dwarf-ranges.sh: Correct expected output.
+
2018-05-18 Mark Wielaard <[email protected]>
- * tests/Makefiles.am (check_PROGRAMS): Add all-dwarf-ranges.
+ * Makefiles.am (check_PROGRAMS): Add all-dwarf-ranges.
(TESTS): Add run-all-dwarf-ranges.sh.
(EXTRA_DIST): Add run-all-dwarf-ranges.sh,
testfilesplitranges4.debug.bz2, testfile-ranges-hello.dwo.bz2
diff --git a/tests/get-units-invalid.c b/tests/get-units-invalid.c
index 9ec16ee0..58b32c0e 100644
--- a/tests/get-units-invalid.c
+++ b/tests/get-units-invalid.c
@@ -79,6 +79,13 @@ main (int argc, char *argv[])
dwarf_diename (&result));
return -1;
}
+ Dwarf_Addr base, start, end;
+ if (dwarf_ranges (&subdie, 0, &base, &start, &end) != -1)
+ {
+ printf ("Should NOT have a ranges: %s\n",
+ dwarf_diename (&result));
+ return -1;
+ }
}
else if (unit_type == DW_UT_type)
printf ("subdie: %s\n", dwarf_diename (&subdie));
diff --git a/tests/run-all-dwarf-ranges.sh b/tests/run-all-dwarf-ranges.sh
index 0bd641b0..ba5528d2 100755
--- a/tests/run-all-dwarf-ranges.sh
+++ b/tests/run-all-dwarf-ranges.sh
@@ -37,11 +37,12 @@ die: world.c (11)
400500..400567
die: happy (1d)
- 8009e0..8009ff
- 8008e0..8008f7
+ 40051c..400526
+ 400530..400534
+ 400535..40053f
die: sad (1d)
- 400530..400534
+ 40051c..400526
400535..40053f
EOF