This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Question about java probe
- From: David Smith <dsmith at redhat dot com>
- To: Shuxin Yang <shuxinyang dot oss at gmail dot com>
- Cc: systemtap at sourceware dot org
- Date: Mon, 27 Mar 2017 16:39:42 -0500
- Subject: Re: Question about java probe
- Authentication-results: sourceware.org; auth=none
- References: <5b55c7d2-6ff7-8b89-1572-171186a8dfe2@gmail.com>
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)