Commit dd04536d authored by Sasha Goldshtein's avatar Sasha Goldshtein

trace: Avoid passing -1 as the pid to USDT

When the `-p` switch is used with `trace`, it would set
the tgid to the value passed to `-p` and set the pid to
-1. The result would be incorrect logic that passed the -1
pid value to the `USDT` context constructor, which fails
for probes that require the pid to enable (because they
have a semaphore that needs a poke). This commit fixes it.
parent 333ccf20
......@@ -157,7 +157,8 @@ class Probe(object):
self.function = parts[2]
def _find_usdt_probe(self):
target = Probe.pid if Probe.pid else Probe.tgid
target = Probe.pid if Probe.pid and Probe.pid != -1 \
else Probe.tgid
self.usdt = USDT(path=self.library, pid=target)
for probe in self.usdt.enumerate_probes():
if probe.name == self.usdt_name:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment