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: Question about java probe


On Mon, Mar 27, 2017 at 11:45 AM, Shuxin Yang <shuxinyang.oss@gmail.com> wrote:
> Hi, There:
>
>   I have bunch of questions about java probe. The stap I'm using is built
> from the most recent release without any special flags.Tons thanks in
> advance for the help!
>
>   Q1: I find an example here:
> https://developers.redhat.com/blog/2014/01/10/probing-java-w-systemtap/
>
>         The statement 'printf("hit ... %d\n", $arg1)' print a wrong value.
> However, if I change this statement to 'printf("hit ... %s\n", arg1)', then
> it works. Why so?

It looks like this behavior was changed in version 3.1 (see sourceware
PR21020 <https://sourceware.org/bugzilla/show_bug.cgi?id=21020>). If
you want the original behavior, you'd add the command line argument
'--compatible=3.0'.

>   Q2: follow the example in Q1. What if the function being probed has a
> non-primitive typed parameter. Say argument foo of type Foo. Is it possible
> to access foo's data member, or call its member function.

I'm not sure (this isn't really my area).

>   Q3: Look like print_java_stack() only prints the stack of the thread in
> question; It does *not* print all threads' stack. Am I right?

I believe that to be correct.

>   Q4: How to print java stack when a system call is hit? I try to call
> print_java_stack() inside system call probe function, and get nothing.
> Should I call other function? Or it's impossible for now?

Trying to get a java backtrace when a system call is hit is an
interesting question. It is a question of context. When you aren't in
a java probe, you don't have the information around to do a java-level
backtrace.

So, what can you do? Basically probe up a level (or several). Let's
say you want a java backtrace when java opens a file. You'd need to
put java probes in methods that open files.

> If this is the
> case, is it possible to hack the systemtap to take advantage of the perf-jit
> support (https://lwn.net/Articles/633846/) to print the java stack of JIT-ed
> code?

>From my reading of that link, it is possible that systemtap could use
the JVMTI interface in a manner similar to how perf is using it. If
you'd like to take that on, we can try to guide you through the
process.

(Now like I said before java probing really isn't my area of
expertise, but I believe the above to be reasonably correct.)

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)


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