public final class NIDebugger extends Object
Modifier and Type | Class and Description |
---|---|
static class |
NIDebugger.Builder
A builder that creates a Native Image debugger with optional displayers.
|
Modifier and Type | Method and Description |
---|---|
Breakpoint |
addLineBreakpoint(Object id,
NILineBreakpointDescriptor breakpointDescriptor)
Add or change a line breakpoint into the debugger.
|
CompletableFuture<Void> |
attach(String executablePath,
long processId,
String debugger,
java.util.function.Consumer<DebuggerEngine> startedEngine)
Deprecated.
|
NIVariable |
evaluate(String expression,
String resultName,
NIFrame frame)
A synchronous expression evaluation.
|
CompletableFuture<NIVariable> |
evaluateAsync(String expression,
String resultName,
NIFrame frame)
An asynchronous expression evaluation.
|
String |
getVersion()
Get version of the underlying native debugger.
|
Map<SourceInfo,List<Symbol>> |
listFunctions(String name,
boolean includeNondebug,
int maxResults)
Get functions of a given name.
|
List<Location> |
listLocations(String filePath)
Get a list of locations for a given file path.
|
Map<SourceInfo,List<Symbol>> |
listVariables(String name,
boolean includeNondebug,
int maxResults)
Get variables of a given name.
|
static NIDebugger.Builder |
newBuilder()
Creates a builder of a new debugger instance.
|
String |
readMemory(String address,
long offset,
int length)
Read data from memory.
|
void |
removeBreakpoint(Object id)
Remove breakpoint with the given id.
|
CompletableFuture<Void> |
start(List<String> command,
File workingDirectory,
String debugger,
String displayName,
ExecutionDescriptor executionDescriptor,
java.util.function.Consumer<DebuggerEngine> startedEngine)
|
CompletableFuture<Void> |
start(StartDebugParameters debugParameters,
java.util.function.Consumer<DebuggerEngine> startedEngine)
Start the actual debugging session.
|
public static NIDebugger.Builder newBuilder() throws IllegalStateException
IllegalStateException
- when the native debugger is not available
(there is not an implementation of NIDebuggerServiceProvider
registered in the default lookup).public Breakpoint addLineBreakpoint(Object id, NILineBreakpointDescriptor breakpointDescriptor)
id
- a unique ID of the breakpointbreakpointDescriptor
- the breakpoint descriptorpublic void removeBreakpoint(Object id)
id
- the ID of the breakpoint to remove@Deprecated public CompletableFuture<Void> start(List<String> command, File workingDirectory, String debugger, String displayName, ExecutionDescriptor executionDescriptor, java.util.function.Consumer<DebuggerEngine> startedEngine)
NIDebugger.start(org.netbeans.modules.nativeimage.api.debug.StartDebugParameters, java.util.function.Consumer)
command
- a command to run the native imageworkingDirectory
- working directorydebugger
- the native debugger commanddisplayName
- display name of the debugger taskexecutionDescriptor
- execution descriptor that describes the runtime attributesstartedEngine
- the corresponding DebuggerEngine is passed to this consumerpublic CompletableFuture<Void> start(StartDebugParameters debugParameters, java.util.function.Consumer<DebuggerEngine> startedEngine)
debugParameters
- parameters to start the debugging withstartedEngine
- the corresponding DebuggerEngine is passed to this consumer@Deprecated public CompletableFuture<Void> attach(String executablePath, long processId, String debugger, java.util.function.Consumer<DebuggerEngine> startedEngine)
NIDebugger.start(StartDebugParameters, Consumer)
and set StartDebugParameters.Builder.processID(Long)
.executablePath
- path to an executable representing the native imageprocessId
- a process to attach todebugger
- the native debugger commandstartedEngine
- the corresponding DebuggerEngine is passed to this consumerpublic CompletableFuture<NIVariable> evaluateAsync(String expression, String resultName, NIFrame frame)
expression
- the expression to evaluateresultName
- preferred name of the result variable,
when null
the expression is used as the nameframe
- the frame to evaluate atpublic NIVariable evaluate(String expression, String resultName, NIFrame frame) throws EvaluateException
expression
- the expression to evaluateresultName
- preferred name of the result variable,
when null
the expression is used as the nameframe
- the frame to evaluate atEvaluateException
- when evaluation failspublic String readMemory(String address, long offset, int length)
address
- address where to read the data fromoffset
- offset relative to the address where to start readinglength
- number of bytes to readnull
when the read is not successfulpublic String getVersion()
@CheckForNull public List<Location> listLocations(String filePath)
filePath
- a file pathnull
when there's no location
information about such file.@CheckForNull public Map<SourceInfo,List<Symbol>> listFunctions(String name, boolean includeNondebug, int maxResults)
name
- a name patternincludeNondebug
- include also symbols from the symbol tablemaxResults
- maximum number of resultsnull
when there are no matching symbols.@CheckForNull public Map<SourceInfo,List<Symbol>> listVariables(String name, boolean includeNondebug, int maxResults)
name
- a name patternincludeNondebug
- include also symbols from the symbol tablemaxResults
- maximum number of resultsnull
when there are no matching symbols.