ref_record_add (&ctx->cu->decl_file_refs, value, ctx->where);
}
- /// Read value depending on the form width and storage class.
- bool
- read_sc_value (uint64_t *valuep, form const *form, cu const *cu,
- read_ctx *ctx, where *wherep)
- {
- form_width_t width = form->width (cu);
- switch (width)
- {
- case fw_0:
- // Who knows, DW_FORM_flag_absent might turn up one day...
- assert (form->name () == DW_FORM_flag_present);
- *valuep = 1;
- return true;
-
- case fw_1:
- case fw_2:
- case fw_4:
- case fw_8:
- return read_ctx_read_var (ctx, width, valuep);
-
- case fw_uleb:
- case fw_sleb:
- return checked_read_leb128 (ctx, width, valuep,
- wherep, "attribute value");
-
- case fw_unknown:
- ;
- }
- UNREACHABLE;
- }
-
/*
Returns:
-1 in case of error
if (ver->form_class (form, attribute) == cl_indirect)
{
uint64_t value;
- if (!read_sc_value (&value, form, cu, ctx, &where))
+ if (!read_sc_value (&value, form->width (cu), ctx, &where))
return -1;
form_name = value;
form = check_debug_abbrev::check_form
}
else
{
- if (!read_sc_value (&value, form, cu, ctx, &where))
+ if (!read_sc_value (&value, form->width (cu), ctx, &where))
{
// Note that for fw_uleb and fw_sleb we report the
// error the second time now.
#include "checked_read.hh"
#include "messages.hh"
+#include "misc.hh"
bool
read_size_extra (struct read_ctx *ctx, uint32_t size32, uint64_t *sizep,
else
return checked_read_uleb128 (ctx, ret, where, what);
}
+
+bool
+read_sc_value (uint64_t *valuep, form_width_t width,
+ read_ctx *ctx, where const *where)
+{
+ switch (width)
+ {
+ case fw_0:
+ *valuep = 1;
+ return true;
+
+ case fw_1:
+ case fw_2:
+ case fw_4:
+ case fw_8:
+ return read_ctx_read_var (ctx, width, valuep);
+
+ case fw_uleb:
+ case fw_sleb:
+ return checked_read_leb128 (ctx, width, valuep,
+ where, "attribute value");
+
+ case fw_unknown:
+ ;
+ }
+ UNREACHABLE;
+}
bool checked_read_leb128 (read_ctx *ctx, form_width_t width, uint64_t *ret,
where const *where, const char *what);
+/// Read value depending on the form width and storage class.
+bool read_sc_value (uint64_t *valuep, form_width_t width,
+ read_ctx *ctx, where const *where);
+
#endif//DWARFLINT_CHECKED_READ_HH