From 1adf8ef1ca448709a7a4527b916d65ada0b3fc04 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 15 May 2009 14:26:32 -0700 Subject: Break the dwflpp dependence on query_cu --- dwflpp.cxx | 7 +++---- dwflpp.h | 3 +-- tapsets.cxx | 8 ++++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dwflpp.cxx b/dwflpp.cxx index c884a3ab..c7dfc5a0 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -181,8 +181,8 @@ dwflpp::focus_on_function(Dwarf_Die * f) } -void -dwflpp::query_cu_containing_address(Dwarf_Addr a, void *arg) +Dwarf_Die * +dwflpp::query_cu_containing_address(Dwarf_Addr a) { Dwarf_Addr bias; assert(dwfl); @@ -194,9 +194,8 @@ dwflpp::query_cu_containing_address(Dwarf_Addr a, void *arg) a += module_start; Dwarf_Die* cudie = dwfl_module_addrdie(module, a, &bias); - if (cudie) // address could be wildly out of range - query_cu (cudie, arg); assert(bias == module_bias); + return cudie; } diff --git a/dwflpp.h b/dwflpp.h index 3cd2a444..649d241b 100644 --- a/dwflpp.h +++ b/dwflpp.h @@ -62,7 +62,6 @@ typedef std::vector inline_instance_map_t; /* XXX FIXME functions that dwflpp needs from tapsets.cxx */ -int query_cu (Dwarf_Die * cudie, void * arg); func_info_map_t *get_filtered_functions(dwarf_query *q); inline_instance_map_t *get_filtered_inlines(dwarf_query *q); void add_label_name(dwarf_query *q, const char *name); @@ -195,7 +194,7 @@ struct dwflpp void focus_on_cu(Dwarf_Die * c); void focus_on_function(Dwarf_Die * f); - void query_cu_containing_address(Dwarf_Addr a, void *arg); + Dwarf_Die *query_cu_containing_address(Dwarf_Addr a); bool module_name_matches(std::string pattern); bool name_has_wildcard(std::string pattern); diff --git a/tapsets.cxx b/tapsets.cxx index 25b729d8..eeccb90b 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -260,6 +260,8 @@ static string TOK_MARK("mark"); static string TOK_TRACE("trace"); static string TOK_LABEL("label"); +static int query_cu (Dwarf_Die * cudie, void * arg); + // Can we handle this query with just symbol-table info? enum dbinfo_reqt { @@ -751,7 +753,9 @@ dwarf_query::query_module_dwarf() // NB: we don't need to add the module base address or bias // value here (for reasons that may be coincidental). - dw.query_cu_containing_address(addr, this); + Dwarf_Die* cudie = dw.query_cu_containing_address(addr); + if (cudie) // address could be wildly out of range + query_cu(cudie, this); } else { @@ -1638,7 +1642,7 @@ query_dwarf_func (Dwarf_Die * func, base_query * bq) } } -int +static int query_cu (Dwarf_Die * cudie, void * arg) { dwarf_query * q = static_cast(arg); -- cgit