From 9edb3e1bebd4387eeb00aefc7ea4486989d5dbc6 Mon Sep 17 00:00:00 2001 From: Javier Honduvilla Coto Date: Mon, 25 Mar 2019 23:35:41 +0000 Subject: [PATCH] usdt: add hint when pid is not running --- src/list.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/list.cpp b/src/list.cpp index cdadddf90f0..3a27ff1a4d9 100644 --- a/src/list.cpp +++ b/src/list.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -148,6 +149,9 @@ void list_probes(const std::string &search_input, int pid) void *ctx = bcc_usdt_new_frompid(pid, nullptr); if (ctx == nullptr) { std::cerr << "failed to initialize usdt context for pid: " << pid << std::endl; + if (kill(pid, 0) == -1 && errno == ESRCH) { + std::cerr << "hint: process not running" << std::endl; + } return; } bcc_usdt_foreach(ctx, usdt_each);