This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
RE: user mode backtrace
- From: "Stone, Joshua I" <joshua dot i dot stone at intel dot com>
- To: <david_list at boreham dot org>
- Cc: "SystemTap" <systemtap at sources dot redhat dot com>
- Date: Thu, 19 Oct 2006 19:02:19 -0700
- Subject: RE: user mode backtrace
On Thursday, October 19, 2006 4:25 PM, David Boreham wrote:
>> pid = fork_ptraceme_exec("myapp"); // start the app paused
>> stappid = fork_exec("stap myscript.stp -x " + pid); // start
>> systemtap ptrace(DETACH, pid, ...); // let the app run
>>
>>
> Actually I don't think this will help me because it looks like
> it assumes a specific target process. That's the specific problem that
> I have : I don't know which processes are going to be interesting
> in advance.
I just filter on a single tid because it's convenient. The thing you
have to avoid is probing any of the processes you kick off, like the
pstack. Otherwise you get yourself in a recursive loop, and
congratulations, you've just fork-bombed the system. So it's hard to be
smart about which processes NOT to probe. You could try filtering by
execname, if that's known.
If you can manage that your application is spawned from a central
process, you could try to follow forks from that process:
-----------------------------------------------
global filter
probe begin {
filter[target()] = 1
}
probe process.create {
if (filter[tid()])
filter[new_pid] = 1
}
probe process.exit {
delete filter[tid()]
}
-----------------------------------------------
Then instead of "if (target() != tid()) next;" you have "if
(!filter[tid()]) next;".
Josh