}
}
-bool
-check_matching_ranges (Dwarf *dwarf)
+struct hl_ctx
+{
+ elfutils::dwarf dw;
+
+ hl_ctx (Dwarf *dwarf)
+ : dw (dwarf)
+ {
+ }
+};
+
+hl_ctx *
+hl_ctx_new (Dwarf *dwarf)
{
- elfutils::dwarf dw(dwarf);
+ return new hl_ctx (dwarf);
+}
+
+void
+hl_ctx_delete (hl_ctx *hlctx)
+{
+ delete hlctx;
+}
+bool
+check_matching_ranges (struct hl_ctx *hlctx)
+{
struct where where_ref = WHERE (sec_info, NULL);
struct where where_ar = WHERE (sec_aranges, NULL);
where_ar.ref = &where_ref;
struct where where_r = WHERE (sec_ranges, NULL);
where_r.ref = &where_ref;
- const elfutils::dwarf::aranges_map &aranges = dw.aranges ();
+ const elfutils::dwarf::aranges_map &aranges = hlctx->dw.aranges ();
for (elfutils::dwarf::aranges_map::const_iterator i = aranges.begin ();
i != aranges.end (); ++i)
{
it->first, it->second);
}
- return dwarf != NULL;
+ return true;
}
if (loc_data.data != NULL && cu_chain != NULL)
check_loc_or_range_structural (dwarf, &loc_data, cu_chain);
+ struct hl_ctx *hlctx = hl_ctx_new (dwarf);
+
if (aranges_data.data != NULL)
{
read_ctx_init (&ctx, dwarf, aranges_data.data);
if (check_aranges_structural (&ctx, cu_chain)
&& ranges_sound)
- check_matching_ranges (dwarf);
+ check_matching_ranges (hlctx);
}
if (pubnames_data.data != NULL)
if (file.ebl != NULL)
ebl_closebackend (file.ebl);
free (file.sec);
+ hl_ctx_delete (hlctx);
}
static void
/* Entry points for high-level checks. */
+ struct hl_ctx;
+
/* Check that .debug_aranges and .debug_ranges match. */
- extern bool check_matching_ranges (Dwarf *dwarf);
+ extern struct hl_ctx *hl_ctx_new (Dwarf *dwarf);
+ extern void hl_ctx_delete (struct hl_ctx *hlctx);
+ extern bool check_matching_ranges (struct hl_ctx *hlctx);
/* Functions and data structures describing location in Dwarf. */