mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-25 18:55:36 +08:00
Merge remote-tracking branch 'origin/GP-1288_d-millar_exceptions'
Conflicts: Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/manager/impl/DbgDebugEventCallbacksAdapter.java Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/manager/impl/DbgManagerImpl.java Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/DebuggerResources.java
This commit is contained in:
+1
-1
@@ -362,7 +362,7 @@ public interface DebugClient extends DebugClientReentrant {
|
||||
Description getProcessDescription(DebugServerId si, int systemId,
|
||||
BitmaskSet<ProcessDescriptionFlags> flags);
|
||||
|
||||
void attachProcess(DebugServerId si, int processId, BitmaskSet<DebugAttachFlags> attachFlags);
|
||||
void attachProcess(DebugServerId si, long processId, BitmaskSet<DebugAttachFlags> attachFlags);
|
||||
|
||||
void createProcess(DebugServerId si, String commandLine,
|
||||
BitmaskSet<DebugCreateFlags> createFlags);
|
||||
|
||||
+88
@@ -114,6 +114,69 @@ public interface DebugControl extends DebugControlReentrant {
|
||||
;
|
||||
}
|
||||
|
||||
public static enum DebugFilterOrdinals {
|
||||
DEBUG_FILTER_CREATE_THREAD, //
|
||||
DEBUG_FILTER_EXIT_THREAD, //
|
||||
DEBUG_FILTER_CREATE_PROCESS, //
|
||||
DEBUG_FILTER_EXIT_PROCESS, //
|
||||
DEBUG_FILTER_LOAD_MODULE, //
|
||||
DEBUG_FILTER_UNLOAD_MODULE, //
|
||||
DEBUG_FILTER_SYSTEM_ERROR, //
|
||||
DEBUG_FILTER_INITIAL_BREAKPOINT, //
|
||||
DEBUG_FILTER_INITIAL_MODULE_LOAD, //
|
||||
DEBUG_FILTER_DEBUGGEE_OUTPUT, //
|
||||
;
|
||||
}
|
||||
|
||||
public static enum DebugFilterExecutionOption {
|
||||
DEBUG_FILTER_BREAK(0, "Break"), //
|
||||
DEBUG_FILTER_SECOND_CHANCE_BREAK(1, "Second-chance Break"), //
|
||||
DEBUG_FILTER_OUTPUT(2, "Output-only"), //
|
||||
DEBUG_FILTER_IGNORE(3, "Ignore"), //
|
||||
DEBUG_FILTER_REMOVE(4, "Remove"), //
|
||||
;
|
||||
|
||||
public static DebugFilterExecutionOption getByNumber(int val) {
|
||||
for (DebugFilterExecutionOption m : DebugFilterExecutionOption.values()) {
|
||||
if (m.val == val) {
|
||||
return m;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
DebugFilterExecutionOption(int val, String description) {
|
||||
this.val = val;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public final int val;
|
||||
public final String description;
|
||||
}
|
||||
|
||||
public static enum DebugFilterContinuationOption {
|
||||
DEBUG_FILTER_GO_HANDLED(0, "Handled"), //
|
||||
DEBUG_FILTER_GO_NOT_HANDLED(1, "Not Handled"), //
|
||||
;
|
||||
|
||||
public static DebugFilterContinuationOption getByNumber(int val) {
|
||||
for (DebugFilterContinuationOption m : DebugFilterContinuationOption.values()) {
|
||||
if (m.val == val) {
|
||||
return m;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
DebugFilterContinuationOption(int val, String description) {
|
||||
this.val = val;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public final int val;
|
||||
public final String description;
|
||||
}
|
||||
|
||||
boolean getInterrupt();
|
||||
|
||||
int getInterruptTimeout();
|
||||
@@ -356,4 +419,29 @@ public interface DebugControl extends DebugControlReentrant {
|
||||
int getExecutingProcessorType();
|
||||
|
||||
int getDebuggeeType();
|
||||
|
||||
DebugFilterInformation getNumberEventFilters();
|
||||
|
||||
String getEventFilterText(int index, int size);
|
||||
|
||||
String getEventFilterCommand(int index, int size);
|
||||
|
||||
void setEventFilterCommand(int index, String text);
|
||||
|
||||
DebugSpecificFilterInformation getSpecificFilterParameters(int start, int count);
|
||||
|
||||
void setSpecificFilterParameters(int start, int count, DebugSpecificFilterInformation info);
|
||||
|
||||
String getSpecificFilterArgument(int index, int size);
|
||||
|
||||
void setSpecificFilterArgument(int index, String arg);
|
||||
|
||||
DebugExceptionFilterInformation getExceptionFilterParameters(int start, int[] codes, int count);
|
||||
|
||||
void setExceptionFilterParameters(int count, DebugExceptionFilterInformation info);
|
||||
|
||||
String getExceptionFilterSecondCommand(int index, int size);
|
||||
|
||||
void setExceptionFilterSecondCommand(int index, String cmd);
|
||||
|
||||
}
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.dbgeng;
|
||||
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.DEBUG_EXCEPTION_FILTER_PARAMETERS;
|
||||
|
||||
public class DebugExceptionFilterInformation {
|
||||
|
||||
private int nParams;
|
||||
private DEBUG_EXCEPTION_FILTER_PARAMETERS[] parameters;
|
||||
|
||||
public DebugExceptionFilterInformation(int nParams,
|
||||
DEBUG_EXCEPTION_FILTER_PARAMETERS[] parameters) {
|
||||
this.nParams = nParams;
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
public int getNumberOfParameters() {
|
||||
return nParams;
|
||||
}
|
||||
|
||||
public DEBUG_EXCEPTION_FILTER_PARAMETERS getParameter(int paramNumber) {
|
||||
return parameters[paramNumber];
|
||||
}
|
||||
|
||||
public DEBUG_EXCEPTION_FILTER_PARAMETERS[] getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.dbgeng;
|
||||
|
||||
public class DebugFilterInformation {
|
||||
|
||||
private int nEvents;
|
||||
private int nSpecificExceptions;
|
||||
private int nArbitraryExceptions;
|
||||
|
||||
public DebugFilterInformation(int nEvents, int nSpecificExceptions, int nArbitraryExceptions) {
|
||||
this.nEvents = nEvents;
|
||||
this.nSpecificExceptions = nSpecificExceptions;
|
||||
this.nArbitraryExceptions = nArbitraryExceptions;
|
||||
}
|
||||
|
||||
public int getNumberEvents() {
|
||||
return nEvents;
|
||||
}
|
||||
|
||||
public int getNumberSpecificExceptions() {
|
||||
return nSpecificExceptions;
|
||||
}
|
||||
|
||||
public int getNumberArbitraryExceptions() {
|
||||
return nArbitraryExceptions;
|
||||
}
|
||||
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.dbgeng;
|
||||
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.DEBUG_SPECIFIC_FILTER_PARAMETERS;
|
||||
|
||||
public class DebugSpecificFilterInformation {
|
||||
|
||||
private int nParams;
|
||||
private DEBUG_SPECIFIC_FILTER_PARAMETERS[] parameters;
|
||||
|
||||
public DebugSpecificFilterInformation(int nParams,
|
||||
DEBUG_SPECIFIC_FILTER_PARAMETERS[] parameters) {
|
||||
this.nParams = nParams;
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
public int getNumberOfParameters() {
|
||||
return nParams;
|
||||
}
|
||||
|
||||
public DEBUG_SPECIFIC_FILTER_PARAMETERS getParameter(int paramNumber) {
|
||||
return parameters[paramNumber];
|
||||
}
|
||||
|
||||
public DEBUG_SPECIFIC_FILTER_PARAMETERS[] getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -183,7 +183,7 @@ public class DebugClientImpl1 implements DebugClientInternal {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachProcess(DebugServerId si, int processId,
|
||||
public void attachProcess(DebugServerId si, long processId,
|
||||
BitmaskSet<DebugAttachFlags> attachFlags) {
|
||||
ULONGLONG ullServer = new ULONGLONG(si.id);
|
||||
ULONG ulPid = new ULONG(processId);
|
||||
|
||||
+143
-2
@@ -31,8 +31,7 @@ import agent.dbgeng.dbgeng.DebugClient.DebugStatus;
|
||||
import agent.dbgeng.dbgeng.DebugValue.DebugValueType;
|
||||
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
|
||||
import agent.dbgeng.impl.dbgeng.breakpoint.DebugBreakpointInternal;
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.DEBUG_STACK_FRAME;
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.DEBUG_VALUE;
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.*;
|
||||
import agent.dbgeng.jna.dbgeng.breakpoint.IDebugBreakpoint;
|
||||
import agent.dbgeng.jna.dbgeng.breakpoint.WrapIDebugBreakpoint;
|
||||
import agent.dbgeng.jna.dbgeng.control.IDebugControl;
|
||||
@@ -301,4 +300,146 @@ public class DebugControlImpl1 implements DebugControlInternal {
|
||||
COMUtils.checkRC(jnaControl.GetDebuggeeType(ulClass, ulQualifier));
|
||||
return ulClass.getValue().intValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DebugFilterInformation getNumberEventFilters() {
|
||||
ULONGByReference ulSpecificEvents = new ULONGByReference();
|
||||
ULONGByReference ulSpecificExceptions = new ULONGByReference();
|
||||
ULONGByReference ulArbitraryExceptions = new ULONGByReference();
|
||||
COMUtils.checkRC(jnaControl.GetNumberEventFilters(ulSpecificEvents, ulSpecificExceptions,
|
||||
ulArbitraryExceptions));
|
||||
return new DebugFilterInformation(
|
||||
ulSpecificEvents.getValue().intValue(),
|
||||
ulSpecificExceptions.getValue().intValue(),
|
||||
ulArbitraryExceptions.getValue().intValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventFilterText(int index, int size) {
|
||||
ULONG ulIndex = new ULONG(index);
|
||||
ULONG ulBufferSize = new ULONG(size);
|
||||
ULONGByReference ulTextSize = new ULONGByReference();
|
||||
if (size == 0) {
|
||||
COMUtils.checkRC(
|
||||
jnaControl.GetEventFilterText(ulIndex, null, new ULONG(0), ulTextSize));
|
||||
ulBufferSize = ulTextSize.getValue();
|
||||
}
|
||||
byte[] buffer = new byte[ulBufferSize.intValue()];
|
||||
COMUtils.checkRC(jnaControl.GetEventFilterText(ulIndex, buffer, ulBufferSize, null));
|
||||
return Native.toString(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventFilterCommand(int index, int size) {
|
||||
ULONG ulIndex = new ULONG(index);
|
||||
ULONG ulBufferSize = new ULONG(size);
|
||||
ULONGByReference ulCommandSize = new ULONGByReference();
|
||||
if (size == 0) {
|
||||
COMUtils.checkRC(
|
||||
jnaControl.GetEventFilterCommand(ulIndex, null, new ULONG(0), ulCommandSize));
|
||||
ulBufferSize = ulCommandSize.getValue();
|
||||
}
|
||||
byte[] buffer = new byte[ulBufferSize.intValue()];
|
||||
COMUtils.checkRC(jnaControl.GetEventFilterCommand(ulIndex, buffer, ulBufferSize, null));
|
||||
return Native.toString(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventFilterCommand(int index, String text) {
|
||||
ULONG ulIndex = new ULONG(index);
|
||||
COMUtils.checkRC(jnaControl.SetEventFilterCommand(ulIndex, text));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DebugSpecificFilterInformation getSpecificFilterParameters(int start, int count) {
|
||||
ULONG ulStart = new ULONG(start);
|
||||
ULONG ulCount = new ULONG(count);
|
||||
DEBUG_SPECIFIC_FILTER_PARAMETERS[] pParams = new DEBUG_SPECIFIC_FILTER_PARAMETERS[count];
|
||||
COMUtils.checkRC(jnaControl.GetSpecificFilterParameters(ulStart, ulCount, pParams));
|
||||
return new DebugSpecificFilterInformation(count, pParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpecificFilterParameters(int start, int count,
|
||||
DebugSpecificFilterInformation info) {
|
||||
ULONG ulStart = new ULONG(start);
|
||||
ULONG ulCount = new ULONG(count);
|
||||
COMUtils.checkRC(
|
||||
jnaControl.SetSpecificFilterParameters(ulStart, ulCount, info.getParameters()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSpecificFilterArgument(int index, int size) {
|
||||
ULONG ulIndex = new ULONG(index);
|
||||
ULONG ulBufferSize = new ULONG(size);
|
||||
ULONGByReference ulArgumentSize = new ULONGByReference();
|
||||
if (size == 0) {
|
||||
HRESULT hr =
|
||||
jnaControl.GetSpecificFilterArgument(ulIndex, null, ulBufferSize, ulArgumentSize);
|
||||
if (hr.equals(COMUtilsExtra.E_INVALID_PARAM)) {
|
||||
return null;
|
||||
}
|
||||
COMUtils.checkRC(hr);
|
||||
ulBufferSize = ulArgumentSize.getValue();
|
||||
}
|
||||
byte[] buffer = new byte[ulBufferSize.intValue()];
|
||||
COMUtils.checkRC(
|
||||
jnaControl.GetSpecificFilterArgument(ulIndex, buffer, ulBufferSize, null));
|
||||
return Native.toString(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpecificFilterArgument(int index, String arg) {
|
||||
if (arg != null) {
|
||||
ULONG ulIndex = new ULONG(index);
|
||||
COMUtils.checkRC(jnaControl.SetSpecificFilterArgument(ulIndex, arg));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DebugExceptionFilterInformation getExceptionFilterParameters(int start, int[] codes,
|
||||
int count) {
|
||||
ULONG ulStart = new ULONG(start);
|
||||
//ULONG[] ulCodes = new ULONG[codes.length];
|
||||
//for (int i = 0; i < codes.length; i++) {
|
||||
// ulCodes[i] = new ULONG(codes[i]);
|
||||
//}
|
||||
ULONG ulCount = new ULONG(count);
|
||||
DEBUG_EXCEPTION_FILTER_PARAMETERS[] pParams = new DEBUG_EXCEPTION_FILTER_PARAMETERS[count];
|
||||
COMUtils.checkRC(
|
||||
jnaControl.GetExceptionFilterParameters(ulCount, null, ulStart, pParams));
|
||||
return new DebugExceptionFilterInformation(count, pParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExceptionFilterParameters(int count,
|
||||
DebugExceptionFilterInformation info) {
|
||||
ULONG ulCount = new ULONG(count);
|
||||
COMUtils.checkRC(
|
||||
jnaControl.SetExceptionFilterParameters(ulCount, info.getParameters()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExceptionFilterSecondCommand(int index, int size) {
|
||||
ULONG ulIndex = new ULONG(index);
|
||||
ULONG ulBufferSize = new ULONG(size);
|
||||
ULONGByReference ulCommandSize = new ULONGByReference();
|
||||
if (size == 0) {
|
||||
COMUtils.checkRC(
|
||||
jnaControl.GetExceptionFilterSecondCommand(ulIndex, null, ulBufferSize,
|
||||
ulCommandSize));
|
||||
ulBufferSize = ulCommandSize.getValue();
|
||||
}
|
||||
byte[] buffer = new byte[ulBufferSize.intValue()];
|
||||
COMUtils.checkRC(
|
||||
jnaControl.GetExceptionFilterSecondCommand(ulIndex, buffer, ulBufferSize, null));
|
||||
return Native.toString(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExceptionFilterSecondCommand(int index, String cmd) {
|
||||
ULONG ulIndex = new ULONG(index);
|
||||
COMUtils.checkRC(jnaControl.SetExceptionFilterSecondCommand(ulIndex, cmd));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+44
@@ -459,4 +459,48 @@ public interface DbgEngNative extends StdCallLibrary {
|
||||
return FIELDS;
|
||||
}
|
||||
}
|
||||
|
||||
public class DEBUG_SPECIFIC_FILTER_PARAMETERS extends Structure {
|
||||
public static class ByReference extends DEBUG_SPECIFIC_FILTER_PARAMETERS
|
||||
implements Structure.ByReference {
|
||||
}
|
||||
|
||||
public static final List<String> FIELDS =
|
||||
createFieldsOrder("ExecutionOption", "ContinueOption", "TextSize", "CommandSize",
|
||||
"ArgumentSize");
|
||||
|
||||
public ULONG ExecutionOption;
|
||||
public ULONG ContinueOption;
|
||||
public ULONG TextSize;
|
||||
public ULONG CommandSize;
|
||||
public ULONG ArgumentSize;
|
||||
|
||||
@Override
|
||||
protected List<String> getFieldOrder() {
|
||||
return FIELDS;
|
||||
}
|
||||
}
|
||||
|
||||
public class DEBUG_EXCEPTION_FILTER_PARAMETERS extends Structure {
|
||||
public static class ByReference extends DEBUG_EXCEPTION_FILTER_PARAMETERS
|
||||
implements Structure.ByReference {
|
||||
}
|
||||
|
||||
public static final List<String> FIELDS =
|
||||
createFieldsOrder("ExecutionOption", "ContinueOption", "TextSize", "CommandSize",
|
||||
"SecondCommandSize", "ExceptionCode");
|
||||
|
||||
public ULONG ExecutionOption;
|
||||
public ULONG ContinueOption;
|
||||
public ULONG TextSize;
|
||||
public ULONG CommandSize;
|
||||
public ULONG SecondCommandSize;
|
||||
public ULONG ExceptionCode;
|
||||
|
||||
@Override
|
||||
protected List<String> getFieldOrder() {
|
||||
return FIELDS;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+35
-2
@@ -21,8 +21,7 @@ import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.platform.win32.COM.IUnknown;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.DEBUG_STACK_FRAME;
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.DEBUG_VALUE;
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.*;
|
||||
import agent.dbgeng.jna.dbgeng.UnknownWithUtils.VTableIndex;
|
||||
import agent.dbgeng.jna.dbgeng.breakpoint.IDebugBreakpoint;
|
||||
|
||||
@@ -184,4 +183,38 @@ public interface IDebugControl extends IUnknown {
|
||||
HRESULT GetExecutingProcessorType(ULONGByReference Type);
|
||||
|
||||
HRESULT GetDebuggeeType(ULONGByReference Class, ULONGByReference Qualifier);
|
||||
|
||||
HRESULT GetNumberEventFilters(ULONGByReference SpecificEvents,
|
||||
ULONGByReference SpecificExceptions, ULONGByReference ArbitraryExceptions);
|
||||
|
||||
HRESULT GetEventFilterText(ULONG Index, byte[] Buffer, ULONG BufferSize,
|
||||
ULONGByReference TextSize);
|
||||
|
||||
HRESULT GetEventFilterCommand(ULONG Index, byte[] Buffer, ULONG BufferSize,
|
||||
ULONGByReference CommandSize);
|
||||
|
||||
HRESULT SetEventFilterCommand(ULONG Index, String Command);
|
||||
|
||||
HRESULT GetSpecificFilterParameters(ULONG Start, ULONG Count,
|
||||
DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params);
|
||||
|
||||
HRESULT SetSpecificFilterParameters(ULONG Start, ULONG Count,
|
||||
DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params);
|
||||
|
||||
HRESULT GetSpecificFilterArgument(ULONG Index, byte[] Buffer, ULONG BufferSize,
|
||||
ULONGByReference ArgumentSize);
|
||||
|
||||
HRESULT SetSpecificFilterArgument(ULONG Index, String Argument);
|
||||
|
||||
HRESULT GetExceptionFilterParameters(ULONG Count, ULONG[] Codes, ULONG Start,
|
||||
DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params);
|
||||
|
||||
HRESULT SetExceptionFilterParameters(ULONG Count,
|
||||
DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params);
|
||||
|
||||
HRESULT GetExceptionFilterSecondCommand(ULONG Index, byte[] Buffer, ULONG BufferSize,
|
||||
ULONGByReference CommandSize);
|
||||
|
||||
HRESULT SetExceptionFilterSecondCommand(ULONG Index, String Command);
|
||||
|
||||
}
|
||||
|
||||
+79
-2
@@ -23,8 +23,7 @@ import com.sun.jna.platform.win32.WinDef.*;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.DEBUG_STACK_FRAME;
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.DEBUG_VALUE;
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.*;
|
||||
import agent.dbgeng.jna.dbgeng.UnknownWithUtils;
|
||||
import agent.dbgeng.jna.dbgeng.breakpoint.IDebugBreakpoint;
|
||||
|
||||
@@ -178,4 +177,82 @@ public class WrapIDebugControl extends UnknownWithUtils implements IDebugControl
|
||||
return _invokeHR(VTIndices.GET_DEBUGGEE_TYPE, getPointer(), Class, Qualifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT GetNumberEventFilters(ULONGByReference SpecificEvents,
|
||||
ULONGByReference SpecificExceptions, ULONGByReference ArbitraryExceptions) {
|
||||
return _invokeHR(VTIndices.GET_NUMBER_EVENT_FILTERS, getPointer(), SpecificEvents,
|
||||
SpecificExceptions, ArbitraryExceptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT GetEventFilterText(ULONG Index, byte[] Buffer, ULONG BufferSize,
|
||||
ULONGByReference TextSize) {
|
||||
return _invokeHR(VTIndices.GET_EVENT_FILTER_TEXT, getPointer(), Index, Buffer,
|
||||
BufferSize, TextSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT GetEventFilterCommand(ULONG Index, byte[] Buffer, ULONG BufferSize,
|
||||
ULONGByReference CommandSize) {
|
||||
return _invokeHR(VTIndices.GET_EVENT_FILTER_COMMAND, getPointer(), Index, Buffer,
|
||||
BufferSize, CommandSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT SetEventFilterCommand(ULONG Index, String Command) {
|
||||
return _invokeHR(VTIndices.SET_EVENT_FILTER_COMMAND, getPointer(), Index, Command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT GetSpecificFilterParameters(ULONG Start, ULONG Count,
|
||||
DEBUG_SPECIFIC_FILTER_PARAMETERS[] 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_SPECIFIC_FILTER_PARAMETERS, getPointer(), Start, Count,
|
||||
Params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT GetSpecificFilterArgument(ULONG Index, byte[] Buffer, ULONG BufferSize,
|
||||
ULONGByReference ArgumentSize) {
|
||||
return _invokeHR(VTIndices.GET_SPECIFIC_FILTER_ARGUMENT, getPointer(), Index, Buffer,
|
||||
BufferSize, ArgumentSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT SetSpecificFilterArgument(ULONG Index, String 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.GET_EXCEPTION_FILTER_PARAMETERS, getPointer(), Count, Codes,
|
||||
Start,
|
||||
Params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT SetExceptionFilterParameters(ULONG Count,
|
||||
DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params) {
|
||||
return _invokeHR(VTIndices.SET_EXCEPTION_FILTER_PARAMETERS, getPointer(), Count, Params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT GetExceptionFilterSecondCommand(ULONG Index, byte[] Buffer, ULONG BufferSize,
|
||||
ULONGByReference CommandSize) {
|
||||
return _invokeHR(VTIndices.GET_EXCEPTION_FILTER_SECOND_COMMAND, getPointer(), Index, Buffer,
|
||||
BufferSize, CommandSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT SetExceptionFilterSecondCommand(ULONG Index, String Command) {
|
||||
return _invokeHR(VTIndices.SET_EXCEPTION_FILTER_SECOND_COMMAND, getPointer(), Index,
|
||||
Command);
|
||||
}
|
||||
}
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager;
|
||||
|
||||
public interface DbgEventFilter {
|
||||
|
||||
int getIndex();
|
||||
|
||||
String getName();
|
||||
|
||||
String getArg();
|
||||
|
||||
String getCmd();
|
||||
|
||||
int getExecutionOption();
|
||||
|
||||
void setExecutionOption(int executionOption);
|
||||
|
||||
int getContinueOption();
|
||||
|
||||
void setContinueOption(int continueOption);
|
||||
|
||||
}
|
||||
+9
@@ -17,6 +17,7 @@ package agent.dbgeng.manager;
|
||||
|
||||
import agent.dbgeng.dbgeng.*;
|
||||
import agent.dbgeng.manager.breakpoint.DbgBreakpointInfo;
|
||||
import agent.dbgeng.manager.evt.AbstractDbgEvent;
|
||||
|
||||
public interface DbgEventsListener {
|
||||
|
||||
@@ -123,6 +124,14 @@ public interface DbgEventsListener {
|
||||
*/
|
||||
void threadSelected(DbgThread thread, DbgStackFrame frame, DbgCause cause);
|
||||
|
||||
/**
|
||||
* A system event has occurred (gained focus)
|
||||
*
|
||||
* @param event a handle to the current event
|
||||
* @param cause the cause of this event
|
||||
*/
|
||||
void eventSelected(AbstractDbgEvent<?> event, DbgCause cause);
|
||||
|
||||
/**
|
||||
* A module has been loaded by an process
|
||||
*
|
||||
|
||||
+6
@@ -17,6 +17,7 @@ package agent.dbgeng.manager;
|
||||
|
||||
import agent.dbgeng.dbgeng.*;
|
||||
import agent.dbgeng.manager.breakpoint.DbgBreakpointInfo;
|
||||
import agent.dbgeng.manager.evt.AbstractDbgEvent;
|
||||
|
||||
public interface DbgEventsListenerAdapter extends DbgEventsListener {
|
||||
|
||||
@@ -82,6 +83,11 @@ public interface DbgEventsListenerAdapter extends DbgEventsListener {
|
||||
// Extension point
|
||||
}
|
||||
|
||||
@Override
|
||||
public default void eventSelected(AbstractDbgEvent<?> event, DbgCause cause) {
|
||||
// Extension point
|
||||
}
|
||||
|
||||
@Override
|
||||
public default void moduleLoaded(DbgProcess process, DebugModuleInfo info, DbgCause cause) {
|
||||
// Extension point
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager;
|
||||
|
||||
public interface DbgExceptionFilter extends DbgEventFilter {
|
||||
|
||||
String getSecondCmd();
|
||||
|
||||
String getExceptionCode();
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager.cmd;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
|
||||
public class DbgListEventFiltersCommand
|
||||
extends AbstractDbgCommand<List<DbgEventFilter>> {
|
||||
private List<DbgEventFilter> result;
|
||||
|
||||
public DbgListEventFiltersCommand(DbgManagerImpl manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DbgEventFilter> complete(DbgPendingCommand<?> pending) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke() {
|
||||
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++) {
|
||||
DEBUG_SPECIFIC_FILTER_PARAMETERS p = exc.getParameter(i);
|
||||
String text = control.getEventFilterText(i, p.TextSize.intValue());
|
||||
String cmd = control.getEventFilterCommand(i, p.CommandSize.intValue());
|
||||
String arg = control.getSpecificFilterArgument(i, p.ArgumentSize.intValue());
|
||||
DbgEventFilterImpl f =
|
||||
new DbgEventFilterImpl(i, text, cmd, arg, p.ExecutionOption.intValue(),
|
||||
p.ContinueOption.intValue());
|
||||
result.add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager.cmd;
|
||||
|
||||
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
|
||||
extends AbstractDbgCommand<List<DbgExceptionFilter>> {
|
||||
private List<DbgExceptionFilter> result;
|
||||
|
||||
public DbgListExceptionFiltersCommand(DbgManagerImpl manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DbgExceptionFilter> complete(DbgPendingCommand<?> pending) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke() {
|
||||
result = new ArrayList<>();
|
||||
DebugControl control = manager.getControl();
|
||||
DebugFilterInformation info = control.getNumberEventFilters();
|
||||
int nEvents = info.getNumberEvents();
|
||||
int nExcs = info.getNumberSpecificExceptions();
|
||||
int nExcsA = info.getNumberArbitraryExceptions();
|
||||
DebugExceptionFilterInformation exc =
|
||||
control.getExceptionFilterParameters(nEvents, null, nExcs);
|
||||
for (int i = 0; i < exc.getParameters().length; i++) {
|
||||
DEBUG_EXCEPTION_FILTER_PARAMETERS p = exc.getParameter(i);
|
||||
String text = control.getEventFilterText(nEvents + i, p.TextSize.intValue());
|
||||
String cmd = control.getEventFilterCommand(nEvents + i, p.CommandSize.intValue());
|
||||
String cmd2 = control.getExceptionFilterSecondCommand(nEvents + i,
|
||||
p.SecondCommandSize.intValue());
|
||||
DbgExceptionFilterImpl filter = new DbgExceptionFilterImpl(i, text, cmd, cmd2,
|
||||
p.ExecutionOption.intValue(), p.ContinueOption.intValue(),
|
||||
p.ExceptionCode.longValue());
|
||||
result.add(filter);
|
||||
}
|
||||
if (nExcsA > 0) {
|
||||
DebugExceptionFilterInformation excA =
|
||||
control.getExceptionFilterParameters(nEvents + nExcs, null, nExcsA);
|
||||
for (int i = 0; i < excA.getParameters().length; i++) {
|
||||
DEBUG_EXCEPTION_FILTER_PARAMETERS p = excA.getParameter(i);
|
||||
String text = Long.toHexString(p.ExceptionCode.longValue());
|
||||
// control.getEventFilterText(nEvents + nExcs + i, p.TextSize.intValue());
|
||||
String cmd =
|
||||
control.getEventFilterCommand(nEvents + nExcs + i, p.CommandSize.intValue());
|
||||
String cmd2 = control.getExceptionFilterSecondCommand(nEvents + nExcs + i,
|
||||
p.SecondCommandSize.intValue());
|
||||
DbgExceptionFilterImpl filter = new DbgExceptionFilterImpl(i, text, cmd, cmd2,
|
||||
p.ExecutionOption.intValue(), p.ContinueOption.intValue(),
|
||||
p.ExceptionCode.longValue());
|
||||
result.add(filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager.cmd;
|
||||
|
||||
import agent.dbgeng.dbgeng.DebugControl;
|
||||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
|
||||
public class DbgSetFilterArgumentCommand
|
||||
extends AbstractDbgCommand<Void> {
|
||||
|
||||
private int index;
|
||||
private String cmd;
|
||||
|
||||
public DbgSetFilterArgumentCommand(DbgManagerImpl manager, int index,
|
||||
String cmd) {
|
||||
super(manager);
|
||||
this.index = index;
|
||||
this.cmd = cmd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke() {
|
||||
DebugControl control = manager.getControl();
|
||||
control.setEventFilterCommand(index, cmd);
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager.cmd;
|
||||
|
||||
import agent.dbgeng.dbgeng.DebugControl;
|
||||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
|
||||
public class DbgSetFilterCommandCommand
|
||||
extends AbstractDbgCommand<Void> {
|
||||
|
||||
private int index;
|
||||
private String cmd;
|
||||
|
||||
public DbgSetFilterCommandCommand(DbgManagerImpl manager, int index,
|
||||
String cmd) {
|
||||
super(manager);
|
||||
this.index = index;
|
||||
this.cmd = cmd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke() {
|
||||
DebugControl control = manager.getControl();
|
||||
control.setEventFilterCommand(index, cmd);
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager.cmd;
|
||||
|
||||
import agent.dbgeng.dbgeng.DebugControl;
|
||||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
|
||||
public class DbgSetFilterSecondChanceCmdCommand
|
||||
extends AbstractDbgCommand<Void> {
|
||||
|
||||
private int index;
|
||||
private String cmd;
|
||||
|
||||
public DbgSetFilterSecondChanceCmdCommand(DbgManagerImpl manager, int index,
|
||||
String cmd) {
|
||||
super(manager);
|
||||
this.index = index;
|
||||
this.cmd = cmd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke() {
|
||||
DebugControl control = manager.getControl();
|
||||
control.setExceptionFilterSecondCommand(index, cmd);
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager.cmd;
|
||||
|
||||
import com.sun.jna.platform.win32.WinDef.ULONG;
|
||||
|
||||
import agent.dbgeng.dbgeng.*;
|
||||
import agent.dbgeng.dbgeng.DebugControl.DebugFilterContinuationOption;
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.DEBUG_EXCEPTION_FILTER_PARAMETERS;
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.DEBUG_SPECIFIC_FILTER_PARAMETERS;
|
||||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
|
||||
public class DbgToggleContinuationCommand
|
||||
extends AbstractDbgCommand<Void> {
|
||||
|
||||
private int index;
|
||||
private DebugFilterContinuationOption optionCont;
|
||||
|
||||
public DbgToggleContinuationCommand(DbgManagerImpl manager, int index,
|
||||
DebugFilterContinuationOption optionCont) {
|
||||
super(manager);
|
||||
this.index = index;
|
||||
this.optionCont = optionCont;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke() {
|
||||
DebugControl control = manager.getControl();
|
||||
DebugFilterInformation info = control.getNumberEventFilters();
|
||||
int nEvents = info.getNumberEvents();
|
||||
int nExcs = info.getNumberSpecificExceptions();
|
||||
if (index < nEvents) {
|
||||
DebugSpecificFilterInformation exc =
|
||||
control.getSpecificFilterParameters(0, nEvents);
|
||||
DEBUG_SPECIFIC_FILTER_PARAMETERS p = exc.getParameter(index);
|
||||
p.ContinueOption = new ULONG(optionCont.ordinal());
|
||||
control.setSpecificFilterParameters(0, nEvents, exc);
|
||||
}
|
||||
else {
|
||||
DebugExceptionFilterInformation exc =
|
||||
control.getExceptionFilterParameters(nEvents, null, nExcs);
|
||||
DEBUG_EXCEPTION_FILTER_PARAMETERS p = exc.getParameter(index);
|
||||
p.ContinueOption = new ULONG(optionCont.ordinal());
|
||||
control.setExceptionFilterParameters(nExcs, exc);
|
||||
}
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager.cmd;
|
||||
|
||||
import com.sun.jna.platform.win32.WinDef.ULONG;
|
||||
|
||||
import agent.dbgeng.dbgeng.*;
|
||||
import agent.dbgeng.dbgeng.DebugControl.DebugFilterExecutionOption;
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.DEBUG_EXCEPTION_FILTER_PARAMETERS;
|
||||
import agent.dbgeng.jna.dbgeng.DbgEngNative.DEBUG_SPECIFIC_FILTER_PARAMETERS;
|
||||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
|
||||
public class DbgToggleExecutionCommand
|
||||
extends AbstractDbgCommand<Void> {
|
||||
|
||||
private int index;
|
||||
private DebugFilterExecutionOption optionCont;
|
||||
|
||||
public DbgToggleExecutionCommand(DbgManagerImpl manager, int index,
|
||||
DebugFilterExecutionOption optionCont) {
|
||||
super(manager);
|
||||
this.index = index;
|
||||
this.optionCont = optionCont;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke() {
|
||||
DebugControl control = manager.getControl();
|
||||
DebugFilterInformation info = control.getNumberEventFilters();
|
||||
int nEvents = info.getNumberEvents();
|
||||
int nExcs = info.getNumberSpecificExceptions();
|
||||
if (index < nEvents) {
|
||||
DebugSpecificFilterInformation exc =
|
||||
control.getSpecificFilterParameters(0, nEvents);
|
||||
DEBUG_SPECIFIC_FILTER_PARAMETERS p = exc.getParameter(index);
|
||||
p.ExecutionOption = new ULONG(optionCont.ordinal());
|
||||
control.setSpecificFilterParameters(0, nEvents, exc);
|
||||
}
|
||||
else {
|
||||
DebugExceptionFilterInformation exc =
|
||||
control.getExceptionFilterParameters(nEvents, null, nExcs);
|
||||
DEBUG_EXCEPTION_FILTER_PARAMETERS p = exc.getParameter(index);
|
||||
p.ExecutionOption = new ULONG(optionCont.ordinal());
|
||||
control.setExceptionFilterParameters(nExcs, exc);
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-7
@@ -17,16 +17,11 @@ package agent.dbgeng.manager.evt;
|
||||
|
||||
import agent.dbgeng.manager.breakpoint.DbgBreakpointInfo;
|
||||
|
||||
/**
|
||||
* The event corresponding with "{@code =breakpoint-created}"
|
||||
*/
|
||||
public class DbgBreakpointCreatedEvent extends AbstractDbgEvent<DbgBreakpointInfo> {
|
||||
private final DbgBreakpointInfo bkptInfo;
|
||||
|
||||
/**
|
||||
* Construct a new event by parsing the tail for information
|
||||
*
|
||||
* The breakpoint information must be specified by GDB.
|
||||
* Construct a new event from the given info
|
||||
*
|
||||
* @param info breakpoint info
|
||||
*
|
||||
@@ -39,7 +34,7 @@ public class DbgBreakpointCreatedEvent extends AbstractDbgEvent<DbgBreakpointInf
|
||||
/**
|
||||
* Get the breakpoint information
|
||||
*
|
||||
* @return the parsed, but not processed, breakpoint information
|
||||
* @return the breakpoint information
|
||||
*/
|
||||
public DbgBreakpointInfo getBreakpointInfo() {
|
||||
return bkptInfo;
|
||||
|
||||
+1
-6
@@ -17,16 +17,11 @@ package agent.dbgeng.manager.evt;
|
||||
|
||||
import agent.dbgeng.manager.breakpoint.DbgBreakpointInfo;
|
||||
|
||||
/**
|
||||
* The event corresponding with "{@code =breakpoint-deleted}"
|
||||
*/
|
||||
public class DbgBreakpointDeletedEvent extends AbstractDbgEvent<DbgBreakpointInfo> {
|
||||
private final long number;
|
||||
|
||||
/**
|
||||
* Construct a new event by parsing the tail for information
|
||||
*
|
||||
* The breakpoint number must be specified by GDB.
|
||||
* Construct a new event from the given info
|
||||
*
|
||||
* @param info breakpoint info
|
||||
*/
|
||||
|
||||
+2
-7
@@ -17,17 +17,12 @@ package agent.dbgeng.manager.evt;
|
||||
|
||||
import agent.dbgeng.manager.breakpoint.DbgBreakpointInfo;
|
||||
|
||||
/**
|
||||
* The event corresponding with "{@code =breakpoint-modified}"
|
||||
*/
|
||||
public class DbgBreakpointModifiedEvent extends AbstractDbgEvent<DbgBreakpointInfo> {
|
||||
|
||||
private long bptId;
|
||||
|
||||
/**
|
||||
* Construct a new event by parsing the tail for information
|
||||
*
|
||||
* The breakpoint information must be specified by GDB.
|
||||
* Construct a new event from the given info
|
||||
*
|
||||
* @param info breakpoint info
|
||||
*/
|
||||
@@ -44,7 +39,7 @@ public class DbgBreakpointModifiedEvent extends AbstractDbgEvent<DbgBreakpointIn
|
||||
/**
|
||||
* Get the breakpoint information
|
||||
*
|
||||
* @return the parsed, but not processed, breakpoint information
|
||||
* @return the breakpoint information
|
||||
*/
|
||||
public DbgBreakpointInfo getBreakpointInfo() {
|
||||
return getInfo();
|
||||
|
||||
-6
@@ -18,16 +18,10 @@ package agent.dbgeng.manager.evt;
|
||||
import agent.dbgeng.manager.DbgCommand;
|
||||
import agent.dbgeng.manager.DbgState;
|
||||
|
||||
/**
|
||||
* The event corresponding with "{@code ^done}"
|
||||
*/
|
||||
public class DbgCommandDoneEvent extends AbstractDbgCompletedCommandEvent {
|
||||
|
||||
private DbgCommand<?> cmd;
|
||||
|
||||
/**
|
||||
* Construct a new event, parsing the tail for information
|
||||
*/
|
||||
public DbgCommandDoneEvent() {
|
||||
super();
|
||||
}
|
||||
|
||||
-3
@@ -18,9 +18,6 @@ package agent.dbgeng.manager.evt;
|
||||
import agent.dbgeng.manager.DbgEvent;
|
||||
import agent.dbgeng.manager.DbgState;
|
||||
|
||||
/**
|
||||
* The event corresponding with "{@code ^error}"
|
||||
*/
|
||||
public class DbgCommandErrorEvent extends AbstractDbgCompletedCommandEvent {
|
||||
|
||||
/**
|
||||
|
||||
-6
@@ -17,14 +17,8 @@ package agent.dbgeng.manager.evt;
|
||||
|
||||
import agent.dbgeng.manager.DbgState;
|
||||
|
||||
/**
|
||||
* The event corresponding with "{@code ^running}"
|
||||
*/
|
||||
public class DbgCommandRunningEvent extends AbstractDbgCompletedCommandEvent {
|
||||
|
||||
/**
|
||||
* Construct a new event, parsing the tail for information
|
||||
*/
|
||||
public DbgCommandRunningEvent() {
|
||||
super();
|
||||
}
|
||||
|
||||
-3
@@ -15,9 +15,6 @@
|
||||
*/
|
||||
package agent.dbgeng.manager.evt;
|
||||
|
||||
/**
|
||||
* The event corresponding with "{@code ~""}" output records
|
||||
*/
|
||||
public class DbgConsoleOutputEvent extends AbstractDbgEvent<String> {
|
||||
|
||||
private int mask;
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager.evt;
|
||||
|
||||
import agent.dbgeng.dbgeng.DebugBreakpoint;
|
||||
|
||||
public class DbgInitialBreakpointEvent extends AbstractDbgEvent<DebugBreakpoint> {
|
||||
|
||||
public DbgInitialBreakpointEvent(DebugBreakpoint info) {
|
||||
super(info);
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager.evt;
|
||||
|
||||
import agent.dbgeng.dbgeng.DebugModuleInfo;
|
||||
|
||||
public class DbgInitialModuleLoadEvent extends AbstractDbgEvent<DebugModuleInfo> {
|
||||
|
||||
public DbgInitialModuleLoadEvent(DebugModuleInfo info) {
|
||||
super(info);
|
||||
}
|
||||
}
|
||||
-3
@@ -18,9 +18,6 @@ package agent.dbgeng.manager.evt;
|
||||
import agent.dbgeng.dbgeng.DebugProcessId;
|
||||
import agent.dbgeng.manager.impl.DbgProcessImpl;
|
||||
|
||||
/**
|
||||
* The event corresponding with "{@code =thread-selected}"
|
||||
*/
|
||||
public class DbgProcessSelectedEvent extends AbstractDbgEvent<DebugProcessId> {
|
||||
private final DebugProcessId id;
|
||||
private DbgProcessImpl process;
|
||||
|
||||
+1
-6
@@ -18,16 +18,11 @@ package agent.dbgeng.manager.evt;
|
||||
import agent.dbgeng.dbgeng.DebugThreadId;
|
||||
import agent.dbgeng.manager.DbgState;
|
||||
|
||||
/**
|
||||
* The event corresponding with "{@code *running}"
|
||||
*/
|
||||
public class DbgRunningEvent extends AbstractDbgEvent<DebugThreadId> {
|
||||
private final DebugThreadId id;
|
||||
|
||||
/**
|
||||
* Construct a new event, parsing the tail for information
|
||||
*
|
||||
* A thread ID must be specified by dbgeng.
|
||||
* Construct a new event with the given thread ID
|
||||
*
|
||||
* @param id the event info
|
||||
*/
|
||||
|
||||
-3
@@ -18,9 +18,6 @@ package agent.dbgeng.manager.evt;
|
||||
import agent.dbgeng.dbgeng.DebugSessionId;
|
||||
import agent.dbgeng.manager.impl.DbgSessionImpl;
|
||||
|
||||
/**
|
||||
* The event corresponding with "{@code =thread-selected}"
|
||||
*/
|
||||
public class DbgSessionSelectedEvent extends AbstractDbgEvent<DebugSessionId> {
|
||||
private final DebugSessionId id;
|
||||
private DbgSessionImpl session;
|
||||
|
||||
+2
-7
@@ -20,18 +20,13 @@ import agent.dbgeng.manager.DbgState;
|
||||
import agent.dbgeng.manager.impl.DbgStackFrameImpl;
|
||||
import agent.dbgeng.manager.impl.DbgThreadImpl;
|
||||
|
||||
/**
|
||||
* The event corresponding with "{@code *stopped}"
|
||||
*/
|
||||
public class DbgStoppedEvent extends AbstractDbgEvent<DebugThreadId> {
|
||||
private final DebugThreadId id;
|
||||
|
||||
/**
|
||||
* Construct a new event, parsing the tail for information
|
||||
* Construct a new event with the given thread ID
|
||||
*
|
||||
* A thread ID must be specified by dbgeng.
|
||||
*
|
||||
* @param id the event info
|
||||
* @param id the thread ID
|
||||
*/
|
||||
public DbgStoppedEvent(DebugThreadId id) {
|
||||
super(id);
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager.evt;
|
||||
|
||||
public class DbgSystemErrorEvent extends AbstractDbgEvent<Integer> {
|
||||
private final int error;
|
||||
private final int level;
|
||||
|
||||
/**
|
||||
* The selected error ID must be specified by dbgeng.
|
||||
*
|
||||
* @param error dbgeng-provided id
|
||||
*/
|
||||
public DbgSystemErrorEvent(int error, int level) {
|
||||
super(error);
|
||||
this.error = error;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public int getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
}
|
||||
-3
@@ -15,9 +15,6 @@
|
||||
*/
|
||||
package agent.dbgeng.manager.evt;
|
||||
|
||||
/**
|
||||
* The event corresponding with "{@code =thread-selected}"
|
||||
*/
|
||||
public class DbgSystemsEvent extends AbstractDbgEvent<Long> {
|
||||
private final long id;
|
||||
|
||||
|
||||
-3
@@ -21,9 +21,6 @@ import agent.dbgeng.manager.DbgThread;
|
||||
import agent.dbgeng.manager.impl.DbgStackFrameImpl;
|
||||
import agent.dbgeng.manager.impl.DbgThreadImpl;
|
||||
|
||||
/**
|
||||
* The event corresponding with "{@code =thread-selected}"
|
||||
*/
|
||||
public class DbgThreadSelectedEvent extends AbstractDbgEvent<DebugThreadId> {
|
||||
private final DebugThreadId id;
|
||||
private DbgState state;
|
||||
|
||||
+8
-1
@@ -18,7 +18,8 @@ package agent.dbgeng.manager.impl;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import agent.dbgeng.dbgeng.*;
|
||||
import agent.dbgeng.dbgeng.DebugClient.*;
|
||||
import agent.dbgeng.dbgeng.DebugClient.ChangeEngineState;
|
||||
import agent.dbgeng.dbgeng.DebugClient.DebugStatus;
|
||||
import agent.dbgeng.dbgeng.util.DebugEventCallbacksAdapter;
|
||||
import agent.dbgeng.manager.DbgState;
|
||||
import agent.dbgeng.manager.evt.*;
|
||||
@@ -131,6 +132,12 @@ public class DbgDebugEventCallbacksAdapter extends DebugEventCallbacksAdapter {
|
||||
return checkInterrupt(DebugStatus.NO_CHANGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DebugStatus systemError(int error, int level) {
|
||||
return checkInterrupt(manager.processEvent(new DbgSystemErrorEvent(error, level)));
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public DebugStatus changeDebuggeeState(BitmaskSet<ChangeDebuggeeState> flags, long argument) {
|
||||
//System.err.println("CHANGE_DEBUGGEE_STATE: " + flags + ":" + argument);
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager.impl;
|
||||
|
||||
import agent.dbgeng.manager.DbgEventFilter;
|
||||
|
||||
public class DbgEventFilterImpl implements DbgEventFilter {
|
||||
|
||||
protected int index;
|
||||
protected final String text;
|
||||
protected final String arg;
|
||||
protected final String cmd;
|
||||
protected int executionOption;
|
||||
protected int continueOption;
|
||||
|
||||
public DbgEventFilterImpl(int index, String text, String cmd, String arg, int executionOption,
|
||||
int continueOption) {
|
||||
this.index = index;
|
||||
this.text = text;
|
||||
this.cmd = cmd;
|
||||
this.arg = arg;
|
||||
this.setExecutionOption(executionOption);
|
||||
this.setContinueOption(continueOption);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArg() {
|
||||
return arg == null ? "N/A" : arg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCmd() {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager.impl;
|
||||
|
||||
import agent.dbgeng.manager.DbgExceptionFilter;
|
||||
|
||||
public class DbgExceptionFilterImpl extends DbgEventFilterImpl implements DbgExceptionFilter {
|
||||
|
||||
private final String cmd2;
|
||||
private long exceptionCode;
|
||||
|
||||
public DbgExceptionFilterImpl(int index, String text, String cmd, String cmd2,
|
||||
int executionOption,
|
||||
int continueOption, long exceptionCode) {
|
||||
super(index, text, cmd, null, executionOption, continueOption);
|
||||
this.cmd2 = cmd2;
|
||||
this.exceptionCode = exceptionCode;
|
||||
}
|
||||
|
||||
public String getSecondCmd() {
|
||||
return cmd2;
|
||||
}
|
||||
|
||||
public String getExceptionCode() {
|
||||
return Long.toHexString(exceptionCode);
|
||||
}
|
||||
|
||||
}
|
||||
+17
-3
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package agent.dbgeng.manager.impl;
|
||||
|
||||
import static ghidra.async.AsyncUtils.sequence;
|
||||
import static ghidra.async.AsyncUtils.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -595,6 +595,7 @@ public class DbgManagerImpl implements DbgManager {
|
||||
handlerMap.put(DbgSessionSelectedEvent.class, this::processSessionSelected);
|
||||
handlerMap.put(DbgSystemsEvent.class, this::processSystemsEvent);
|
||||
handlerMap.putVoid(DbgDebuggeeStateChangeEvent.class, this::processDebuggeeStateChanged);
|
||||
handlerMap.putVoid(DbgSystemErrorEvent.class, this::processSystemErrorEvent);
|
||||
handlerMap.putVoid(DbgCommandDoneEvent.class, this::processDefault);
|
||||
handlerMap.putVoid(DbgStoppedEvent.class, this::processDefault);
|
||||
handlerMap.putVoid(DbgRunningEvent.class, this::processDefault);
|
||||
@@ -686,6 +687,7 @@ public class DbgManagerImpl implements DbgManager {
|
||||
*/
|
||||
protected DebugStatus processException(DbgExceptionEvent evt, Void v) {
|
||||
DebugThreadId eventId = updateState();
|
||||
getEventListeners().fire.eventSelected(evt, evt.getCause());
|
||||
getEventListeners().fire.threadSelected(eventThread, null, evt.getCause());
|
||||
|
||||
DebugExceptionRecord64 info = evt.getInfo();
|
||||
@@ -711,6 +713,7 @@ public class DbgManagerImpl implements DbgManager {
|
||||
DbgProcessImpl process = getCurrentProcess();
|
||||
int tid = so.getCurrentThreadSystemId();
|
||||
DbgThreadImpl thread = getThreadComputeIfAbsent(eventId, process, tid);
|
||||
getEventListeners().fire.eventSelected(evt, evt.getCause());
|
||||
getEventListeners().fire.threadCreated(thread, DbgCause.Causes.UNCLAIMED);
|
||||
getEventListeners().fire.threadSelected(thread, null, evt.getCause());
|
||||
|
||||
@@ -736,6 +739,7 @@ public class DbgManagerImpl implements DbgManager {
|
||||
thread.remove();
|
||||
}
|
||||
process.threadExited(eventId);
|
||||
getEventListeners().fire.eventSelected(evt, evt.getCause());
|
||||
getEventListeners().fire.threadExited(eventId, process, evt.getCause());
|
||||
|
||||
String key = Integer.toHexString(eventId.id);
|
||||
@@ -784,6 +788,7 @@ public class DbgManagerImpl implements DbgManager {
|
||||
//so.setCurrentProcessId(id);
|
||||
int pid = so.getCurrentProcessSystemId();
|
||||
DbgProcessImpl proc = getProcessComputeIfAbsent(id, pid);
|
||||
getEventListeners().fire.eventSelected(evt, evt.getCause());
|
||||
getEventListeners().fire.processAdded(proc, evt.getCause());
|
||||
getEventListeners().fire.processSelected(proc, evt.getCause());
|
||||
|
||||
@@ -816,8 +821,9 @@ public class DbgManagerImpl implements DbgManager {
|
||||
DbgThreadImpl thread = getCurrentThread();
|
||||
DbgProcessImpl process = getCurrentProcess();
|
||||
process.setExitCode(Long.valueOf(evt.getInfo()));
|
||||
getEventListeners().fire.threadExited(eventId, process, evt.getCause());
|
||||
|
||||
getEventListeners().fire.eventSelected(evt, evt.getCause());
|
||||
getEventListeners().fire.threadExited(eventId, process, evt.getCause());
|
||||
getEventListeners().fire.processExited(process, evt.getCause());
|
||||
|
||||
for (DebugBreakpoint bpt : getBreakpoints()) {
|
||||
@@ -868,6 +874,7 @@ public class DbgManagerImpl implements DbgManager {
|
||||
DbgProcessImpl process = getCurrentProcess();
|
||||
DebugModuleInfo info = evt.getInfo();
|
||||
process.moduleLoaded(info);
|
||||
getEventListeners().fire.eventSelected(evt, evt.getCause());
|
||||
getEventListeners().fire.moduleLoaded(process, info, evt.getCause());
|
||||
|
||||
String key = info.getModuleName();
|
||||
@@ -889,6 +896,7 @@ public class DbgManagerImpl implements DbgManager {
|
||||
DbgProcessImpl process = getCurrentProcess();
|
||||
DebugModuleInfo info = evt.getInfo();
|
||||
process.moduleUnloaded(info);
|
||||
getEventListeners().fire.eventSelected(evt, evt.getCause());
|
||||
getEventListeners().fire.moduleUnloaded(process, info, evt.getCause());
|
||||
|
||||
String key = info.getModuleName();
|
||||
@@ -1041,7 +1049,14 @@ public class DbgManagerImpl implements DbgManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected void processSystemErrorEvent(DbgSystemErrorEvent evt, Void v) {
|
||||
getEventListeners().fire.eventSelected(evt, evt.getCause());
|
||||
String error = "SystemError " + evt.getError() + ":" + evt.getLevel();
|
||||
getEventListeners().fire.consoleOutput(error, 0);
|
||||
}
|
||||
|
||||
protected void processConsoleOutput(DbgConsoleOutputEvent evt, Void v) {
|
||||
getEventListeners().fire.eventSelected(evt, evt.getCause());
|
||||
getEventListeners().fire.consoleOutput(evt.getInfo(), evt.getMask());
|
||||
}
|
||||
|
||||
@@ -1591,5 +1606,4 @@ public class DbgManagerImpl implements DbgManager {
|
||||
public long getProcessCount() {
|
||||
return processCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
@@ -42,4 +42,6 @@ public abstract class AbstractDbgModel extends AbstractDebuggerObjectModel {
|
||||
|
||||
public abstract TargetObject getModelObject(Object object);
|
||||
|
||||
public abstract void deleteModelObject(Object object);
|
||||
|
||||
}
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.model.iface2;
|
||||
|
||||
import agent.dbgeng.manager.*;
|
||||
import agent.dbgeng.manager.evt.AbstractDbgEvent;
|
||||
import agent.dbgeng.model.iface1.DbgModelSelectableObject;
|
||||
import agent.dbgeng.model.iface1.DbgModelTargetConfigurable;
|
||||
|
||||
public interface DbgModelTargetEvent extends
|
||||
DbgModelSelectableObject, //
|
||||
DbgModelTargetConfigurable, //
|
||||
DbgEventsListenerAdapter //
|
||||
{
|
||||
|
||||
public DbgEventFilter getFilter();
|
||||
|
||||
public int getEventIndex();
|
||||
|
||||
@Override
|
||||
void eventSelected(AbstractDbgEvent<?> event, DbgCause cause);
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.model.iface2;
|
||||
|
||||
import ghidra.dbg.target.TargetAggregate;
|
||||
import ghidra.dbg.target.schema.*;
|
||||
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "EventContainer",
|
||||
elements = {
|
||||
@TargetElementType(type = DbgModelTargetEvent.class) },
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class) },
|
||||
canonicalContainer = true)
|
||||
public interface DbgModelTargetEventContainer extends DbgModelTargetObject, TargetAggregate {
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.model.iface2;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import ghidra.dbg.target.TargetTogglable;
|
||||
|
||||
public interface DbgModelTargetEventOption extends DbgModelTargetObject, TargetTogglable {
|
||||
|
||||
Integer getOption();
|
||||
|
||||
CompletableFuture<Void> setOption(int ordinal);
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.model.iface2;
|
||||
|
||||
import agent.dbgeng.manager.DbgExceptionFilter;
|
||||
|
||||
public interface DbgModelTargetException extends DbgModelTargetEvent {
|
||||
|
||||
public DbgExceptionFilter getFilter();
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.model.iface2;
|
||||
|
||||
import ghidra.dbg.target.TargetAggregate;
|
||||
import ghidra.dbg.target.schema.*;
|
||||
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "ExceptionContainer",
|
||||
elements = {
|
||||
@TargetElementType(type = DbgModelTargetException.class) },
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class) },
|
||||
canonicalContainer = true)
|
||||
public interface DbgModelTargetExceptionContainer extends DbgModelTargetObject, TargetAggregate {
|
||||
|
||||
}
|
||||
+1
@@ -164,6 +164,7 @@ public class DbgModelImpl extends AbstractDbgModel implements DebuggerObjectMode
|
||||
return objectMap.get(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteModelObject(Object object) {
|
||||
objectMap.remove(object);
|
||||
}
|
||||
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.model.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import agent.dbgeng.dbgeng.DebugControl.DebugFilterContinuationOption;
|
||||
import agent.dbgeng.manager.cmd.DbgToggleContinuationCommand;
|
||||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
import agent.dbgeng.model.iface2.*;
|
||||
import ghidra.dbg.target.schema.*;
|
||||
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "ContinuationFilter",
|
||||
elements = {
|
||||
@TargetElementType(type = Void.class) },
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Object.class) })
|
||||
public class DbgModelTargetContinuationOptionImpl extends DbgModelTargetObjectImpl
|
||||
implements DbgModelTargetEventOption {
|
||||
|
||||
private DbgModelTargetEvent event;
|
||||
private DebugFilterContinuationOption optionCont;
|
||||
|
||||
public DbgModelTargetContinuationOptionImpl(DbgModelTargetEvent event,
|
||||
DebugFilterContinuationOption option) {
|
||||
super(event.getModel(), event, "Continue", "ContinuationFilter");
|
||||
this.getModel().addModelObject(option, this);
|
||||
this.event = event;
|
||||
this.optionCont = option;
|
||||
setAttributes();
|
||||
}
|
||||
|
||||
public DbgModelTargetContinuationOptionImpl(DbgModelTargetException exc,
|
||||
DebugFilterContinuationOption option) {
|
||||
super(exc.getModel(), exc, "Continue", "ContinuationFilter");
|
||||
this.event = exc;
|
||||
this.getModel().addModelObject(option, this);
|
||||
this.optionCont = option;
|
||||
setAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> disable() {
|
||||
return setOption(DebugFilterContinuationOption.DEBUG_FILTER_GO_NOT_HANDLED.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> enable() {
|
||||
return setOption(DebugFilterContinuationOption.DEBUG_FILTER_GO_HANDLED.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getOption() {
|
||||
return optionCont.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> setOption(int ordinal) {
|
||||
DbgManagerImpl manager = getManager();
|
||||
optionCont = DebugFilterContinuationOption.getByNumber(ordinal);
|
||||
setAttributes();
|
||||
return manager.execute(
|
||||
new DbgToggleContinuationCommand(manager, event.getEventIndex(), optionCont));
|
||||
}
|
||||
|
||||
public void setAttributes() {
|
||||
changeAttributes(List.of(), List.of(), Map.of( //
|
||||
DISPLAY_ATTRIBUTE_NAME, getName() + " : " + optionCont.description, //
|
||||
VALUE_ATTRIBUTE_NAME, optionCont, //
|
||||
ENABLED_ATTRIBUTE_NAME,
|
||||
optionCont.equals(DebugFilterContinuationOption.DEBUG_FILTER_GO_HANDLED)),
|
||||
"Refreshed");
|
||||
}
|
||||
|
||||
}
|
||||
+18
-1
@@ -31,6 +31,16 @@ import ghidra.dbg.target.schema.TargetObjectSchemaInfo;
|
||||
type = DbgModelTargetBreakpointContainerImpl.class,
|
||||
required = true,
|
||||
fixed = true),
|
||||
@TargetAttributeType(
|
||||
name = "Events",
|
||||
type = DbgModelTargetEventContainerImpl.class,
|
||||
required = true,
|
||||
fixed = true),
|
||||
@TargetAttributeType(
|
||||
name = "Exceptions",
|
||||
type = DbgModelTargetExceptionContainerImpl.class,
|
||||
required = true,
|
||||
fixed = true),
|
||||
@TargetAttributeType(type = Void.class)
|
||||
},
|
||||
canonicalContainer = true)
|
||||
@@ -38,6 +48,9 @@ public class DbgModelTargetDebugContainerImpl extends DbgModelTargetObjectImpl
|
||||
implements DbgModelTargetDebugContainer {
|
||||
|
||||
protected final DbgModelTargetBreakpointContainerImpl breakpoints;
|
||||
protected DbgModelTargetEventContainerImpl events;
|
||||
protected DbgModelTargetExceptionContainerImpl exceptions;
|
||||
|
||||
private DbgModelTargetProcess process;
|
||||
|
||||
public DbgModelTargetDebugContainerImpl(DbgModelTargetProcess process) {
|
||||
@@ -45,9 +58,13 @@ public class DbgModelTargetDebugContainerImpl extends DbgModelTargetObjectImpl
|
||||
this.process = process;
|
||||
|
||||
this.breakpoints = new DbgModelTargetBreakpointContainerImpl(this);
|
||||
this.events = new DbgModelTargetEventContainerImpl(this);
|
||||
this.exceptions = new DbgModelTargetExceptionContainerImpl(this);
|
||||
|
||||
changeAttributes(List.of(), List.of( //
|
||||
breakpoints //
|
||||
breakpoints, //
|
||||
events, //
|
||||
exceptions //
|
||||
), Map.of(), "Initialized");
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user