cc: Don't parse the same module multiple times for USDT probes
authorSasha Goldshtein <goldshtn@gmail.com>
Fri, 3 Mar 2017 13:00:55 +0000 (08:00 -0500)
committerSasha Goldshtein <goldshtn@gmail.com>
Fri, 3 Mar 2017 13:00:55 +0000 (08:00 -0500)
commit69948a69537c8e867c163ddf0705870ffde81306
tree3c29928ca0985ac7ac8ee0d0ae68687afcade2e1
parent601a13fdf73da02305cfbf0f43999d04fe974168
cc: Don't parse the same module multiple times for USDT probes

If a module has more than one executable region, it is reported
multiple times by `bcc_procutils_each_module`. This is fine for
symbol resolution, but we don't need the duplicates for parsing
the ELF header looking for USDT probes: the first appearance of
that module is enough. This also prevents issues with the same
probe appearing multiple times with the same location, which
results in an invalid program when reading USDT arguments.

Fix by storing each visited module in the USDT::Context class,
and ignoring modules that were already visited.
src/cc/usdt.cc
src/cc/usdt.h