This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]