ref_record_add (&ctx->cu->decl_file_refs, value, ctx->where);
}
+ /* The real sibling checking takes place down in read_die_chain.
+ Here we just make sure that the value is non-zero. That value is
+ clearly invalid, and we use it to mark absent DW_AT_sibling. */
+ void
+ check_sibling_non0 (uint64_t addr, struct value_check_cb_ctx const *ctx)
+ {
+ if (addr == 0)
+ {
+ wr_error (*ctx->where)
+ << "DW_AT_sibling with a value of 0." << std::endl;
+ // Don't let this up.
+ *ctx->retval_p = -2;
+ }
+ }
+
/*
Returns:
-2 in case of error that we have to note and return, but for now
siblings. */
assert (value_check_cb == check_die_ref_local
|| value_check_cb == check_die_ref_global);
+ value_check_cb = check_sibling_non0;
valuep = &sibling_addr;
}
- else if (value_check_cb != NULL)
+
+ if (value_check_cb != NULL)
value_check_cb (value, &cb_ctx);
/* Store the relocated value. Note valuep may point to
srcdir=$srcdir/tests
testfiles hello.bad-1 hello.bad-3 garbage-1 garbage-2 garbage-3 garbage-4 \
- garbage-5 garbage-6 garbage-7
+ garbage-5 garbage-6 garbage-7 garbage-8
testrun_compare ./dwarflint hello.bad-1 <<EOF
error: .debug_info: DIE 0x83: abbrev section at 0x0 doesn't contain code 83.
error: .debug_abbrev: abbr. attribute 0x7e: invalid form 0x0.
error: .debug_abbrev: abbreviation 122: missing zero to mark end-of-table.
EOF
+
+testrun_compare ./dwarflint garbage-8 <<EOF
+error: .debug_info: DIE 0x6c (abbr. attribute 0x43): DW_AT_sibling with a value of 0.
+EOF