Skip to content

Commit

Permalink
Allow to have duplicated address for multiple symbol
Browse files Browse the repository at this point in the history
In certain condition, it is possible to have multiple functions with the
same address on kallsyms. We have treated that kind of the case as
error, but relax it and generate log in verbose mode instead.

Signed-off-by: Yutaro Hayakawa <yhayakawa3720@gmail.com>
  • Loading branch information
YutaroHayakawa committed Jan 28, 2023
1 parent 63fb5d9 commit bd35869
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/symsdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static int
put_addr2sym(struct ipft_symsdb *sdb, uint64_t addr, char *symname,
char *modname)
{
int missing;
int error;
khint_t iter;
struct ipft_sym *sym;
khash_t(addr2sym) * db;
Expand All @@ -102,9 +102,13 @@ put_addr2sym(struct ipft_symsdb *sdb, uint64_t addr, char *symname,

db = ((struct ipft_symsdb *)sdb)->addr2symname;

iter = kh_put(addr2sym, db, addr, &missing);
if (!missing) {
iter = kh_put(addr2sym, db, addr, &error);
if (error == -1) {
return -1;
} else if (error == 0) {
VERBOSE("Duplicated address found %p for symbol %s at module %s\n",
(void *)addr, symname, modname);
return 0;
}

kh_value(db, iter) = sym;
Expand Down

0 comments on commit bd35869

Please sign in to comment.