u* tools: Gracefully handle missing probes
authorSasha Goldshtein <goldshtn@gmail.com>
Wed, 8 Feb 2017 21:02:11 +0000 (16:02 -0500)
committerSasha Goldshtein <goldshtn@gmail.com>
Mon, 13 Feb 2017 17:05:07 +0000 (17:05 +0000)
commitdc3a57cc7531655d96206fc11cfa8659b6af07d7
tree1ae1c257cb9cee89b9f3b267f1fe265a9419d824
parent6e1fac411707fc1fdb050019fc2f675b0ba361b3
u* tools: Gracefully handle missing probes

When the target process is missing the required USDT probes, it can
be a simple mistake (e.g. attaching a script as Java to a Python
process), or a runtime that is not instrumented with the required
probes. Attempt to gracefully handle the error and print a helpful
message instructing the user why the error might have occurred.

```
$ uthreads -l java $(pidof python)
Error attaching USDT probes: the specified pid might not contain
the given language's runtime, or the runtime was not built with the
required USDT probes. Look for a configure flag similar to
--with-dtrace or --enable-dtrace. To check which probes are present
in the process, use the tplist tool.
```
src/python/bcc/__init__.py
src/python/bcc/usdt.py
tools/ucalls.py
tools/uflow.py
tools/ugc.py
tools/uobjnew.py
tools/uthreads.py