mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GP-1288: Objects view for events/exceptions working
This commit is contained in:
parent
4b98c30ff1
commit
2c5b8d5863
9 changed files with 127 additions and 41 deletions
|
@ -206,38 +206,41 @@ public class WrapIDebugControl extends UnknownWithUtils implements IDebugControl
|
|||
@Override
|
||||
public HRESULT GetSpecificFilterParameters(ULONG Start, ULONG Count,
|
||||
DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params) {
|
||||
return _invokeHR(VTIndices.SET_EVENT_FILTER_COMMAND, getPointer(), Start, Count, Params);
|
||||
return _invokeHR(VTIndices.GET_SPECIFIC_FILTER_PARAMETERS, getPointer(), Start, Count,
|
||||
Params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT SetSpecificFilterParameters(ULONG Start, ULONG Count,
|
||||
DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params) {
|
||||
return _invokeHR(VTIndices.SET_EVENT_FILTER_COMMAND, getPointer(), Start, Count, Params);
|
||||
return _invokeHR(VTIndices.SET_SPECIFIC_FILTER_PARAMETERS, getPointer(), Start, Count,
|
||||
Params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT GetSpecificFilterArgument(ULONG Index, byte[] Buffer, ULONG BufferSize,
|
||||
ULONGByReference ArgumentSize) {
|
||||
return _invokeHR(VTIndices.SET_EVENT_FILTER_COMMAND, getPointer(), Index, Buffer,
|
||||
return _invokeHR(VTIndices.GET_SPECIFIC_FILTER_ARGUMENT, getPointer(), Index, Buffer,
|
||||
BufferSize, ArgumentSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT SetSpecificFilterArgument(ULONG Index, String Argument) {
|
||||
return _invokeHR(VTIndices.SET_EVENT_FILTER_COMMAND, getPointer(), Index, Argument);
|
||||
return _invokeHR(VTIndices.SET_SPECIFIC_FILTER_ARGUMENT, getPointer(), Index, Argument);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT GetExceptionFilterParameters(ULONG Count, ULONG[] Codes, ULONG Start,
|
||||
DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params) {
|
||||
return _invokeHR(VTIndices.SET_EVENT_FILTER_COMMAND, getPointer(), Count, Codes, Start,
|
||||
return _invokeHR(VTIndices.GET_EXCEPTION_FILTER_PARAMETERS, getPointer(), Count, Codes,
|
||||
Start,
|
||||
Params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT SetExceptionFilterParameters(ULONG Count,
|
||||
DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params) {
|
||||
return _invokeHR(VTIndices.SET_EVENT_FILTER_COMMAND, getPointer(), Count, Params);
|
||||
return _invokeHR(VTIndices.SET_EXCEPTION_FILTER_PARAMETERS, getPointer(), Count, Params);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,4 +21,12 @@ public interface DbgEventFilter {
|
|||
|
||||
String getCmd();
|
||||
|
||||
int getExecutionOption();
|
||||
|
||||
void setExecutionOption(int executionOption);
|
||||
|
||||
int getContinueOption();
|
||||
|
||||
void setContinueOption(int continueOption);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,17 @@ public interface DbgExceptionFilter {
|
|||
|
||||
String getName();
|
||||
|
||||
String getArg();
|
||||
String getCmd();
|
||||
|
||||
String getSecondCmd();
|
||||
|
||||
int getExecutionOption();
|
||||
|
||||
void setExecutionOption(int executionOption);
|
||||
|
||||
int getContinueOption();
|
||||
|
||||
void setContinueOption(int continueOption);
|
||||
|
||||
long getExceptionCode();
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ package agent.dbgeng.manager.cmd;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import agent.dbgeng.dbgeng.DebugControl;
|
||||
import agent.dbgeng.dbgeng.DebugFilterInformation;
|
||||
import agent.dbgeng.dbgeng.*;
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.DEBUG_SPECIFIC_FILTER_PARAMETERS;
|
||||
import agent.dbgeng.manager.DbgEventFilter;
|
||||
import agent.dbgeng.manager.impl.DbgEventFilterImpl;
|
||||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
|
@ -42,10 +42,14 @@ public class DbgListEventFiltersCommand
|
|||
result = new ArrayList<>();
|
||||
DebugControl control = manager.getControl();
|
||||
DebugFilterInformation info = control.getNumberEventFilters();
|
||||
DebugSpecificFilterInformation exc =
|
||||
control.getSpecificFilterParameters(0, info.getNumberEvents());
|
||||
for (int i = 0; i < info.getNumberEvents(); i++) {
|
||||
String text = control.getEventFilterText(i);
|
||||
String cmd = control.getEventFilterCommand(i);
|
||||
DbgEventFilterImpl f = new DbgEventFilterImpl(text, cmd);
|
||||
DEBUG_SPECIFIC_FILTER_PARAMETERS p = exc.getParameter(i);
|
||||
DbgEventFilterImpl f = new DbgEventFilterImpl(text, cmd, p.ExecutionOption.intValue(),
|
||||
p.ContinueOption.intValue());
|
||||
result.add(f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import agent.dbgeng.dbgeng.*;
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.DEBUG_EXCEPTION_FILTER_PARAMETERS;
|
||||
import agent.dbgeng.manager.DbgExceptionFilter;
|
||||
import agent.dbgeng.manager.impl.DbgExceptionFilterImpl;
|
||||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
|
||||
public class DbgListExceptionFiltersCommand
|
||||
|
@ -42,9 +44,18 @@ public class DbgListExceptionFiltersCommand
|
|||
DebugFilterInformation info = control.getNumberEventFilters();
|
||||
int nEvents = info.getNumberEvents();
|
||||
int nExcs = info.getNumberSpecificExceptions();
|
||||
DebugSpecificFilterInformation spec = control.getSpecificFilterParameters(0, nEvents);
|
||||
//DebugSpecificFilterInformation spec = control.getSpecificFilterParameters(0, nEvents);
|
||||
DebugExceptionFilterInformation exc =
|
||||
control.getExceptionFilterParameters(nEvents, null, nExcs);
|
||||
result = new ArrayList<>();
|
||||
for (int i = 0; i < exc.getParameters().length; i++) {
|
||||
DEBUG_EXCEPTION_FILTER_PARAMETERS p = exc.getParameter(i);
|
||||
String text = control.getEventFilterText(nEvents + i);
|
||||
String cmd = control.getEventFilterCommand(nEvents + i);
|
||||
String cmd2 = control.getExceptionFilterSecondCommand(nEvents + i);
|
||||
DbgExceptionFilterImpl filter = new DbgExceptionFilterImpl(text, cmd, cmd2,
|
||||
p.ExecutionOption.intValue(), p.ContinueOption.intValue(),
|
||||
p.ExceptionCode.longValue());
|
||||
result.add(filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,14 @@ import agent.dbgeng.manager.DbgEventFilter;
|
|||
public class DbgEventFilterImpl implements DbgEventFilter {
|
||||
private final String text;
|
||||
private final String cmd;
|
||||
private int executionOption;
|
||||
private int continueOption;
|
||||
|
||||
public DbgEventFilterImpl(String text, String cmd) {
|
||||
public DbgEventFilterImpl(String text, String cmd, int executionOption, int continueOption) {
|
||||
this.text = text;
|
||||
this.cmd = cmd;
|
||||
this.setExecutionOption(executionOption);
|
||||
this.setContinueOption(continueOption);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,4 +40,24 @@ public class DbgEventFilterImpl implements DbgEventFilter {
|
|||
return cmd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExecutionOption() {
|
||||
return executionOption;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExecutionOption(int executionOption) {
|
||||
this.executionOption = executionOption;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getContinueOption() {
|
||||
return continueOption;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContinueOption(int continueOption) {
|
||||
this.continueOption = continueOption;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,10 +20,19 @@ import agent.dbgeng.manager.DbgExceptionFilter;
|
|||
public class DbgExceptionFilterImpl implements DbgExceptionFilter {
|
||||
private final String text;
|
||||
private final String cmd;
|
||||
private final String cmd2;
|
||||
private int executionOption;
|
||||
private int continueOption;
|
||||
private long exceptionCode;
|
||||
|
||||
public DbgExceptionFilterImpl(String text, String cmd) {
|
||||
public DbgExceptionFilterImpl(String text, String cmd, String cmd2, int executionOption,
|
||||
int continueOption, long exceptionCode) {
|
||||
this.text = text;
|
||||
this.cmd = cmd;
|
||||
this.cmd2 = cmd2;
|
||||
this.setExecutionOption(executionOption);
|
||||
this.setContinueOption(continueOption);
|
||||
this.exceptionCode = exceptionCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,8 +41,32 @@ public class DbgExceptionFilterImpl implements DbgExceptionFilter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getArg() {
|
||||
public String getCmd() {
|
||||
return cmd;
|
||||
}
|
||||
|
||||
public String getSecondCmd() {
|
||||
return cmd2;
|
||||
}
|
||||
|
||||
public int getExecutionOption() {
|
||||
return executionOption;
|
||||
}
|
||||
|
||||
public void setExecutionOption(int executionOption) {
|
||||
this.executionOption = executionOption;
|
||||
}
|
||||
|
||||
public int getContinueOption() {
|
||||
return continueOption;
|
||||
}
|
||||
|
||||
public void setContinueOption(int continueOption) {
|
||||
this.continueOption = continueOption;
|
||||
}
|
||||
|
||||
public long getExceptionCode() {
|
||||
return exceptionCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package agent.dbgeng.model.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import agent.dbgeng.manager.DbgEventFilter;
|
||||
import agent.dbgeng.model.iface2.DbgModelTargetEvent;
|
||||
import agent.dbgeng.model.iface2.DbgModelTargetEventContainer;
|
||||
|
@ -26,7 +29,7 @@ import ghidra.dbg.util.PathUtils;
|
|||
elements = {
|
||||
@TargetElementType(type = Void.class) },
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class) })
|
||||
@TargetAttributeType(type = Object.class) })
|
||||
public class DbgModelTargetEventImpl extends DbgModelTargetObjectImpl
|
||||
implements DbgModelTargetEvent {
|
||||
protected static String indexFilter(DbgEventFilter filter) {
|
||||
|
@ -44,20 +47,12 @@ public class DbgModelTargetEventImpl extends DbgModelTargetObjectImpl
|
|||
this.getModel().addModelObject(filter, this);
|
||||
this.filter = filter;
|
||||
|
||||
/*
|
||||
changeAttributes(List.of(), List.of( //
|
||||
symbols //
|
||||
// sections.getName(), sections, //
|
||||
), Map.of( //
|
||||
changeAttributes(List.of(), List.of(), Map.of( //
|
||||
DISPLAY_ATTRIBUTE_NAME, getIndex(), //
|
||||
SHORT_DISPLAY_ATTRIBUTE_NAME, module.getName(), //
|
||||
MODULE_NAME_ATTRIBUTE_NAME, module.getImageName(), //
|
||||
"BaseAddress", space.getAddress(module.getKnownBase()), //
|
||||
"ImageName", module.getImageName(), //
|
||||
"TimeStamp", module.getTimeStamp(), //
|
||||
"Len", Integer.toHexString(module.getSize()) //
|
||||
"Command", filter.getCmd(), //
|
||||
"Execute", filter.getExecutionOption(), //
|
||||
"Continue", filter.getContinueOption() //
|
||||
), "Initialized");
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package agent.dbgeng.model.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import agent.dbgeng.manager.DbgExceptionFilter;
|
||||
import agent.dbgeng.model.iface2.DbgModelTargetException;
|
||||
import agent.dbgeng.model.iface2.DbgModelTargetExceptionContainer;
|
||||
|
@ -26,7 +29,7 @@ import ghidra.dbg.util.PathUtils;
|
|||
elements = {
|
||||
@TargetElementType(type = Void.class) },
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class) })
|
||||
@TargetAttributeType(type = Object.class) })
|
||||
public class DbgModelTargetExceptionImpl extends DbgModelTargetObjectImpl
|
||||
implements DbgModelTargetException {
|
||||
protected static String indexFilter(DbgExceptionFilter filter) {
|
||||
|
@ -45,20 +48,14 @@ public class DbgModelTargetExceptionImpl extends DbgModelTargetObjectImpl
|
|||
this.getModel().addModelObject(filter, this);
|
||||
this.filter = filter;
|
||||
|
||||
/*
|
||||
changeAttributes(List.of(), List.of( //
|
||||
symbols //
|
||||
// sections.getName(), sections, //
|
||||
), Map.of( //
|
||||
changeAttributes(List.of(), List.of(), Map.of( //
|
||||
DISPLAY_ATTRIBUTE_NAME, getIndex(), //
|
||||
SHORT_DISPLAY_ATTRIBUTE_NAME, module.getName(), //
|
||||
MODULE_NAME_ATTRIBUTE_NAME, module.getImageName(), //
|
||||
"BaseAddress", space.getAddress(module.getKnownBase()), //
|
||||
"ImageName", module.getImageName(), //
|
||||
"TimeStamp", module.getTimeStamp(), //
|
||||
"Len", Integer.toHexString(module.getSize()) //
|
||||
"Command", filter.getCmd(), //
|
||||
"SecondCmd", filter.getCmd(), //
|
||||
"Execute", filter.getExecutionOption(), //
|
||||
"Continue", filter.getContinueOption(), //
|
||||
"Exception", Long.toHexString(filter.getExceptionCode()) //
|
||||
), "Initialized");
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue