X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=output.c;h=b63befeb647ccaea58b9a4501fb251e8863d91f0;hb=refs%2Ftags%2Faccepted%2Ftizen%2F4.0%2Funified%2F20170816.014018;hp=f7d23ceb9a197a26ef4b1ef0fc2035d728ca7617;hpb=f0ff9ff9af33ef420b3bdc6fd47d3648b09d5ec8;p=platform%2Fupstream%2Fltrace.git diff --git a/output.c b/output.c index f7d23ce..b63befe 100644 --- a/output.c +++ b/output.c @@ -50,6 +50,7 @@ #include "value.h" #include "value_dict.h" #include "filter.h" +#include "debug.h" #if defined(HAVE_LIBDW) #include "dwarf_prototypes.h" @@ -196,6 +197,28 @@ snip_period(char *buf) } } +struct lookup_prototype_alias_context +{ + struct library *lib; + struct prototype *result; // output +}; +static enum callback_status +lookup_prototype_alias_cb(const char *name, void *data) +{ + struct lookup_prototype_alias_context *context = + (struct lookup_prototype_alias_context*)data; + + struct library *lib = context->lib; + + context->result = + protolib_lookup_prototype(lib->protolib, name, + lib->type != LT_LIBTYPE_SYSCALL); + if (context->result != NULL) + return CBS_STOP; + + return CBS_CONT; +} + static struct prototype * library_get_prototype(struct library *lib, const char *name) { @@ -213,11 +236,18 @@ library_get_prototype(struct library *lib, const char *name) && snip_period(buf)); #if defined(HAVE_LIBDW) - if (lib->protolib == NULL && lib->dwfl != NULL && - (filter_matches_library(options.plt_filter, lib ) || - filter_matches_library(options.static_filter, lib ) || - filter_matches_library(options.export_filter, lib ))) + // DWARF data fills in the gaps in the .conf files, so I don't + // check for lib->protolib==NULL here + if (lib->dwfl_module != NULL && + (filter_matches_library(options.plt_filter, lib ) || + filter_matches_library(options.static_filter, lib ) || + filter_matches_library(options.export_filter, lib ))) import_DWARF_prototypes(lib); + else + debug(DEBUG_FUNCTION, + "Filter didn't match prototype '%s' in lib '%s'. " + "Not importing", + name, lib->soname); #endif if (lib->protolib == NULL) @@ -227,8 +257,21 @@ library_get_prototype(struct library *lib, const char *name) if (lib->protolib == NULL) return NULL; - return protolib_lookup_prototype(lib->protolib, name, - lib->type != LT_LIBTYPE_SYSCALL); + struct prototype *result = + protolib_lookup_prototype(lib->protolib, name, + lib->type != LT_LIBTYPE_SYSCALL); + if (result != NULL) + return result; + + // prototype not found. Is it aliased? + struct lookup_prototype_alias_context context = {.lib = lib, + .result = NULL}; + library_exported_names_each_alias(&lib->exported_names, name, + NULL, lookup_prototype_alias_cb, + &context); + + // if found, the prototype is stored here, otherwise it's NULL + return context.result; } struct find_proto_data {