trace: Use correct argument index and tgid for filters
authorSasha Goldshtein <goldshtn@gmail.com>
Mon, 16 Jan 2017 18:43:11 +0000 (18:43 +0000)
committerSasha Goldshtein <goldshtn@gmail.com>
Tue, 17 Jan 2017 07:42:39 +0000 (07:42 +0000)
commitb630092fdb53ed19352db567ef7c92bb67865f03
treecaf67ce1cc810c81096785f8a5bca8a7f0a829cd
parentb9aec34d9ad620feede3a60068b4edc3d172cad5
trace: Use correct argument index and tgid for filters

`trace` would use the incorrect argument index for USDT probes when
filtering specifically, e.g. `trace u:lib:tp (arg1 != 0) ...` would
actually use the type of the 2nd argument, and not the 1st argument
for the type of the filter variable in the generated program. This
could cause compilation errors or subtle bugs where the data would
be either extended or contracted to fit the wrong argument's type.

Additionally, `trace` would use the pid (thread id, `-L`) filter
with the `attach_uprobe` API, which expects a tgid (process id).
As a result, incorrect filtering would happen.
tools/trace.py