aboutsummaryrefslogtreecommitdiff
path: root/libbacktrace/btest.c
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2013-11-28 16:19:57 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-11-28 16:19:57 +0000
commitb8ddd61b7400465ee87613c11831e38962ec6ed2 (patch)
tree2ae4d566474dc53783ba4c92cf34eaa4638d28e4 /libbacktrace/btest.c
parentf5c8b24c731e1b0343cbdcc3438ab4c40e82fc71 (diff)
downloadgcc-b8ddd61b7400465ee87613c11831e38962ec6ed2.zip
gcc-b8ddd61b7400465ee87613c11831e38962ec6ed2.tar.gz
gcc-b8ddd61b7400465ee87613c11831e38962ec6ed2.tar.bz2
dwarf.c (find_address_ranges): New static function, broken out of build_address_map.
* dwarf.c (find_address_ranges): New static function, broken out of build_address_map. (build_address_map): Call it. * btest.c (check): Check for missing filename or function, rather than crashing. (f3): Check that enough frames were returned. From-SVN: r205490
Diffstat (limited to 'libbacktrace/btest.c')
-rw-r--r--libbacktrace/btest.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libbacktrace/btest.c b/libbacktrace/btest.c
index 22b08e0..17fea30 100644
--- a/libbacktrace/btest.c
+++ b/libbacktrace/btest.c
@@ -129,6 +129,13 @@ check (const char *name, int index, const struct info *all, int want_lineno,
{
if (*failed)
return;
+ if (all[index].filename == NULL || all[index].function == NULL)
+ {
+ fprintf (stderr, "%s: [%d]: missing file name or function name\n",
+ name, index);
+ *failed = 1;
+ return;
+ }
if (strcmp (base (all[index].filename), "btest.c") != 0)
{
fprintf (stderr, "%s: [%d]: got %s expected test.c\n", name, index,
@@ -310,6 +317,14 @@ f3 (int f1line, int f2line)
data.failed = 1;
}
+ if (data.index < 3)
+ {
+ fprintf (stderr,
+ "test1: not enough frames; got %zu, expected at least 3\n",
+ data.index);
+ data.failed = 1;
+ }
+
check ("test1", 0, all, f3line, "f3", &data.failed);
check ("test1", 1, all, f2line, "f2", &data.failed);
check ("test1", 2, all, f1line, "test1", &data.failed);