Re: Capturing User-Level Function Calls/Returns
ahmadkhorrami <[email protected]> Thu, 16 Jul 2020 20:37:13 +0430
| Newsgroups | org.kernel.vger.linux-trace-users,org.lttng.lists.lttng-dev |
|---|---|
| Message-ID | <[email protected]> |
Hi Namhyung, This seems really interesting and is what I am looking for. Can it capture all function entries/exits? I mean does it fully handle variable instruction sizes in dynamic mode? In any case, thanks! and I hope that it becomes stable as soon as possible, so that everyone can use it. Regards. On 2020-07-16 05:34, Namhyung Kim wrote: > Hi all, > > On Thu, Jul 16, 2020 at 3:28 AM Steven Rostedt <[email protected]> > wrote: > On Wed, 15 Jul 2020 20:37:16 +0430 > ahmadkhorrami <[email protected]> wrote: > > Hi, > What is the most efficient way to capture occurrence of a function > call/return of a binary program in userspace? > It seems the answer is Uprobes. 1) Am I right? > But Uprobes use "int" instruction which leads to a switch into kernel > mode. 2) Wouldn't it be better to avoid this transition? > I'm looking forward to your reply and will be happy to read your > opinions. > Regards. > > Hi, I believe LTTng has utilities that can help you trace user space > programs. > > I think there's also a users ftrace like utility that Namhyung was > working on. But I don't know where in the development that is. It's in https://github.com/namhyung/uftrace Basically it also requires recompilation to add mcount calls for each function. But it now also supports dynamic tracing without any recompilation.. :) It's still experimental and has some limitation, but the idea is to copy first 5 bytes (on x86_64) somewhere and replace it to a call instruction. Thanks Namhyung