Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-5270: post-review GP-5720: engine options GP-5720: engine options

d-millar0b13f8de50e5
diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/data/debugger-launchers/local-dbgeng-ext.bat b/Ghidra/Debug/Debugger-agent-dbgeng/data/debugger-launchers/local-dbgeng-ext.bat
index db407068d1..224f6ea2a4 100644
--- a/Ghidra/Debug/Debugger-agent-dbgeng/data/debugger-launchers/local-dbgeng-ext.bat
+++ b/Ghidra/Debug/Debugger-agent-dbgeng/data/debugger-launchers/local-dbgeng-ext.bat
@@ -21,6 +21,7 @@
::@env OPT_CREATE_FLAGS:int="1" "Create flags" "Creation flags"
::@env OPT_CREATE_ENGFLAGS:int="0" "Create flags (Engine)" "Engine-specific creation flags"
::@env OPT_VERIFIER_FLAGS:int="0" "Verifier flags" "Verifier flags"
+::@env OPT_ENG_OPTIONS:int="0x20" "Engine options" "Options for AddEngineOptions (e.g. INITIAL_BREAK=0x20)"
@echo off
diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/data/support/local-dbgeng-ext.py b/Ghidra/Debug/Debugger-agent-dbgeng/data/support/local-dbgeng-ext.py
index 819902b203..e48f36c60a 100644
--- a/Ghidra/Debug/Debugger-agent-dbgeng/data/support/local-dbgeng-ext.py
+++ b/Ghidra/Debug/Debugger-agent-dbgeng/data/support/local-dbgeng-ext.py
@@ -1,17 +1,17 @@
## ###
-# 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.
+# 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.
##
import os
@@ -57,7 +57,8 @@ def main():
os.getenv('OPT_TARGET_ENV'),
os.getenv('OPT_CREATE_FLAGS'),
os.getenv('OPT_CREATE_ENGFLAGS'),
- os.getenv('OPT_VERIFIER_FLAGS'),
+ os.getenv('OPT_VERIFIER_FLAGS'),
+ os.getenv('OPT_ENG_OPTIONS'),
start_trace=False)
# TODO: HACK
diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/commands.py b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/commands.py
index bfdf199f4e..2c53afa67a 100644
--- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/commands.py
+++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/commands.py
@@ -270,7 +270,7 @@ def ghidra_trace_create(command=None, initial_break=True, timeout=DbgEng.WAIT_IN
@util.dbg.eng_thread
-def ghidra_trace_create_ext(command=None, initialDirectory='.', envVariables="\0\0", create_flags=1, create_flags_eng=0, verifier_flags=0, initial_break=True, timeout=DbgEng.WAIT_INFINITE, start_trace=True):
+def ghidra_trace_create_ext(command=None, initialDirectory='.', envVariables="\0\0", create_flags=1, create_flags_eng=0, verifier_flags=0, engine_options=0x20, timeout=DbgEng.WAIT_INFINITE, start_trace=True):
"""
Create a session.
"""
@@ -295,8 +295,7 @@ def ghidra_trace_create_ext(command=None, initialDirectory='.', envVariables="\0
if envVariables is not None and envVariables.endswith("/0/0") is False:
envVariables += "/0/0"
dbg._client.CreateProcess2(command, options, initialDirectory, envVariables)
- if initial_break:
- dbg._control.AddEngineOptions(DbgEng.DEBUG_ENGINITIAL_BREAK)
+ dbg._control.AddEngineOptions(int(engine_options))
if start_trace:
ghidra_trace_start(command)