Re: [rvm-research] Getting user thread's stack trace

Michael Bond <[email protected]>
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <[email protected]>
Hi Matthew,

To dump the stack of the currently thread:

RVMThread.getCurrentThread().dumpStack();

Dumping the stack of one thread from another thread is tricky because 
the first thread might be in the middle of executing. From Linux, you 
can send a signal to the Jikes RVM process that requests that all 
threads dump their stacks:

pkill -3 JikesRVM

Or, from within Jikes RVM, a thread can bring another thread to a stop 
and then dump its stack. There are various potential ways to do this. 
Here's one way (simple, but rather unsafe since multiple threads doing 
it can easily deadlock each other):

RVMThread otherThread = ...;
otherThread.block(RVMThread.suspendBlockAdapter);
otherThread.dumpStack(otherThread.contextRegister.getInnermostFramePointer());
otherThread.unblock(RVMThread.suspendBlockAdapter);

Anyway, as usual, we can suggest better solutions if you provide details 
about exactly what you're trying to do.

Cheers,
Mike

On 07/15/2014 11:10 AM, Matthew Ma wrote:
> Hi,
> I am having a runtime verifier implemented in RVM, and I’d like to know if there is a way for me to get the user program thread from “RVM space” (ie. I am inside of RVM, and want to get stack frame of the user program running on JikesRVM).
>
> Thanks,
>
> Matthew
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Jikesrvm-researchers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.