Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-debug-dev] Common Questions about functionality in jdt.debug.core

Thanks Darin.
            Below is the code I use to set the MethodEntryBreakpoint.

IResource resource = unit.getResource();
String typeName = unit.findPrimaryType().getFullyQualifiedName();
String methodName = "stateChanged";
String methodSig = "";
IMethod[] meths = unit.findPrimaryType().getMethods();
for(int i=0;i < meths.length;i++){
   if(meths[i].getElementName().equalsIgnoreCase(methodName)){
       methodName = meths[i].getElementName();
       methodSig = meths[i].getSignature();
   }
}
int line = 111;

Map attributes = new HashMap(3);
attributes.put("PATTINFO","This is just a marker explanation");;
attributes.put(IMarker.LINE_NUMBER,"111");
attributes.put(IMarker.MESSAGE,"This is a message for the hover");
BreakpointUtils.addJavaBreakpointAttributes(attributes, unit);

IJavaMethodEntryBreakpoint br = JDIDebugModel.createMethodEntryBreakpoint(resource,typeName, methodName, methodSig, line, -1, -1,0,true,null);

Is there something I need to do after this to install the breakpoint? Even if I call

DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(br);

it still doesn't install the breakpoint, or call the breakpointHit() method of my java breakpoint listener.

Thank you for the information on the IJavaStackFrames. This will hopefully let me solve the problem of tracking the parameters passed to a method and what happens to those parameters in that method.



Joe.

Darin Wright wrote:
For some reason LineBreakpoints and Watchpoints show as hitting the breakpointHit() method of my listener however MethodBreakpoints do not.


If your method breakpoints are not being "hit" I'd suspect that they are not being installed properly. It could be that you specified the signature of the method incorrectly. Do you have an example method and corresponding code that sets the breakpoint in that method?
When I check the .isInstalled() property for my breakpoints, it shows them as not installed - which seems fine for everything but MethodBreakpoints.


If they are not showing as installed, it would support the theory that the signature has been incorrectly specified.


Plus how do I gain access to objects of the type JavaValue, JavaVariable, JavaClassObject, JavaClassType etc. I need to do some decisions based on whether certain fields have been accessed, added to etc to identify the dynamic behaviour of a design pattern.


You get access to IJavaVariable from IJavaStackFrame.getVariables() - it returns an array of IJavaVariables. From there, the value of a variable is an IJavaValue. From a value, you can get its variables, etc. From a value you can get an IJavaType...

Darin



_______________________________________________
jdt-debug-dev mailing list
jdt-debug-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/jdt-debug-dev




Back to the top