/*
Returns:
+ -2 in case of error that we have to note and return, but for now
+ we can carry on
-1 in case of error
+0 in case of no error, but the chain only consisted of a
terminating zero die.
struct abbrev *abbrev = NULL;
struct where where = WHERE (sec_info, NULL);
unsigned long die_count = 0;
+ int retval = 0;
struct value_check_cb_ctx cb_ctx = {
ctx, &where, cu,
<< "toplevel DIE chain contains more than one DIE."
<< std::endl;
else if (!is_cudie)
- wr_error (cu->head->where)
- << "toplevel DIE must be either compile_unit or partial_unit."
- << std::endl;
+ {
+ wr_error (cu->head->where)
+ << "toplevel DIE must be either compile_unit or partial_unit."
+ << std::endl;
+ retval = -2;
+ }
}
addr_record_add (&cu->die_addrs, cu->head->offset + die_off);
pc_coverage, need_rangesp, level + 1);
if (st == -1)
return -1;
+ else if (st == -2)
+ retval = -2;
else if (st == 0)
wr_message (mc_impact_3 | mc_acc_suboptimal | mc_die_rel,
&where,
<< "this DIE should have had its sibling at " << pri::hex (sibling_addr)
<< ", but the DIE chain ended." << std::endl;
- return got_die ? 1 : 0;
+ if (retval != 0)
+ return retval;
+ else
+ return got_die ? 1 : 0;
}
}
srcdir=$srcdir/tests
-testfiles hello.bad-1 hello.bad-3 garbage-1
+testfiles hello.bad-1 hello.bad-3 garbage-1 garbage-2
testrun_compare ./dwarflint hello.bad-1 <<EOF
error: .debug_info: DIE 0x83: abbrev section at 0x0 doesn't contain code 83.
error: .debug_abbrev: data not found.
error: .debug_info: data not found.
EOF
+
+testrun_compare ./dwarflint garbage-2 <<EOF
+error: .debug_info: CU 0: toplevel DIE must be either compile_unit or partial_unit.
+EOF