Hi Azat, Thanks your patches. On Thu, Nov 14, 2013 at 3:13 AM, Azat Khuzhin <a3at.mail@xxxxxxxxx> wrote: > Old find_symbol() just find symbol by name, the new one > get_dso_symbols() will return all symbols/notes. > > And user of this functions, will match name/pattern by itself. > > For now get_dso_symbols() used like find_symbol(), this behaviour will > be changed in next patches. > > Signed-off-by: Azat Khuzhin <a3at.mail@xxxxxxxxx> > --- > userspace/eventdef.c | 13 ++++++- > userspace/symbol.c | 105 > +++++++++++++++++++++++++++++++++++++++++---------- > userspace/symbol.h | 25 +++++++++--- > 3 files changed, 117 insertions(+), 26 deletions(-) > > diff --git a/userspace/eventdef.c b/userspace/eventdef.c > index 748ca10..13703c6 100644 > --- a/userspace/eventdef.c > +++ b/userspace/eventdef.c > @@ -333,6 +333,8 @@ static char *parse_events_resolve_symbol(char *event, int > type) > { > char *colon, *end, *tail, *binary, *symbol; > vaddr_t symbol_address; > + struct dso_symbol *symbols = NULL; > + size_t symbols_count, i; > > colon = strchr(event, ':'); > if (!colon) > @@ -357,7 +359,16 @@ static char *parse_events_resolve_symbol(char *event, > int type) > symbol = strdup(colon + 1 /* skip ":" */); > } > > - symbol_address = find_symbol(binary, symbol, type); > + symbols_count = get_dso_symbols(&symbols, binary, type); > + for (i = 0; i < symbols_count; ++i) { > + if (strcmp(symbols[i].name, symbol)) > + continue; > + > + symbol_address = symbols[i].addr; > + break; > + } > + free_dso_symbols(symbols, symbols_count); > + I have some concern on function get_dso_symbol, imagine one big binary have 10000+ symbols, then it's quite inefficient to allocate that symbols array, and probably not necessarily. How about use actor function? like below: int uprobe_symbol_actor(const char *binary, const char *symbol, unsigned long addr) { /* write to debufs */ ... } nr = symbol_parse(binary, symbol, type, uprobe_symbol_actor); if (!nr) { /* no symbol found */ } Then there don't need any dynamic memory allocation for symbols array. (probably this would be more proper when consider to parse function arguments and local variable in future, return a big symbols array cannot handle this feature easily) Jovi