Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-debug-dev] Tracing excecution/Adding breakpoints to compilation units


This sort of question would be more suitable for the jdt news group.

The Java debugger provides an API for creating breakpoints that can optionally be hidden from the breakpoints view (unregistered). See the class JDIDebugModel and the create* methods for breakpoint creation. I'm not sure that you will be able to do exactly what you want with breakpoints. The Java debugger does not provide an API for being notified of all class loads, so setting breakpoints in all classes/methods will be difficult unless you know what they are up front.

Watchpoints only provide change notification on fields - not local variables, so you would need to step thru code to record changes in local variables.

You can query an IJavaProject for all its package fragments and then gather all compilation units from the package fragments. See IJavaProject, IPackageFragment.

You will need to do some experimenting. Using the debugger for tracing is not ideal. Alternatively, you may want to look at the JVMTI (Java VM Tools Interface) that provides additional interfaces for debugging/profiling/tracing.

Darin

jdt-debug-dev-bounces@xxxxxxxxxxx wrote on 08/29/2005 12:30:45 PM:

> Hi everybody.
>
> I need to do this: trace execution, variable changes and throwed
> exceptions to detect responsability fails based on a components
> diagram (mapped to classes/methods)
>
> This is my idea: When a launch configuration is launched I want to
> add (hiden) breakpoints to trace the executution of (probably) any
> class in the project, including exceptions and method inputs monitoring.
> Is this a good approach? What other alternatives do I have?
>
>
> In the case this alternative is fine: How do I get all the
> compilation units?, can I add at least method breakpoints to
> external .class files?
>
>
> public class LCTLaunchConfigurationType extends JavaLaunchDelegate  {
>   public void launch(ILaunchConfiguration configuration, String
> mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
>     ICompilationUnit[] compilationUnits=[--code needed goes here--]
>     addBreakPoints(compilationUnits);
>     ...
>     runner.run(runConfig, launch, monitor);
>   }
> }
>
>
> Thank you for your time.
>
> Enrique da Costa Cambio
> University of the Centre of Buenos Aires Province, Argentina
> _______________________________________________
> jdt-debug-dev mailing list
> jdt-debug-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jdt-debug-dev

Back to the top