• Post Reply Bookmark Topic Watch Topic
  • New Topic

need help with stack frames  RSS feed

 
ciaran Hurst
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i'm writing a visual debugger in java for java programs. I believe that the only way i can get local variables in a method is via the stack frame. I get a reference to the thread suspend it and get a stack frame (code is below). I know that there are local variables in the methods cause i put them there but each time i check to see the number of frames on the stack it returns 0. This cannot be (well it is but i haven't figured out what's wrong) Any help would be appreciated. Am i doing anything wrong.

public void getLocalVariables(){
//suspend the vm ang get the stack frame

threadRef.suspend();
try{
List list = threadRef.frames();
JOptionPane.showMessageDialog(null,"frame count"+ threadRef.frameCount());
Iterator it = list.iterator();
while(it.hasNext()){
stackFrame = (StackFrame) it.next();
JOptionPane.showMessageDialog(null,"values ->" + it.next());
}
}catch(IncompatibleThreadStateException itse){
JOptionPane.showMessageDialog(null,"IncompatibleThreadStateException");
}



:roll:
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
see this:
http://forum.java.sun.com/thread.jsp?forum=54&thread=312837&message=1374869#1374869
in reply 14, azzoti mentions this problem with the JDK 1.4.1_01 - and fixes it with a JDK update
good luck !
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!