Zero StackFrames throughout the program!
Hi,
I am trying to obtain Stack Frames from the main thread by setting StepEventRequest in the following way:
List threads = vm.allThreads();
ThreadReference tr=null;
for (Iterator iterThreads=threads.iterator();iterThreads.hasNext();){
tr = ((ThreadReference)iterThreads.next());
if(tr.name().equals("main")){
System.out.println("THREADREFERENCE name is "+tr.name());
break;
}//end of if
}//end of for
EventRequestManager mgr = vm.eventRequestManager();
StepRequest stepReq = mgr.createStepRequest(tr, StepRequest.STEP_LINE, StepRequest.STEP_INTO);
When I handle this event I try to get stack frames:
try{
ThreadReference tr = event.thread();
System.out.println("THREAD'S FRAME COUNT IS "+tr.frameCount());
}catch(Exception ex){ex.printStackTrace();}
I always get 0 stack frames at each and every step.
I need to see local variables of the stack frames for testing purposes. Please, help! Here's the target program:
public class TestLocalVars{
public int d;
private void m(String s){
String b = s;
int a=51;
a=1001;
}
public static void main(String[] args){
TestLocalVars tlv = new TestLocalVars();
tlv.m("Vika");
}
}
Thanks a lot for your help!
Vicki

