mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-31 18:38:11 +08:00
Merge remote-tracking branch 'origin/GP-0_Dan_testFixes-2025-04-04-1'
This commit is contained in:
@@ -741,97 +741,115 @@ def break_access_expression(expression: str) -> None:
|
|||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(action='break_ext', display='Catch Event')
|
@REGISTRY.method(action='break_ext', display='Catch Event')
|
||||||
def break_ext_event(inferior: Inferior, spec: Annotated[str, ParamDesc(display='Type')]) -> None:
|
def break_ext_event(inferior: Inferior,
|
||||||
|
spec: Annotated[str, ParamDesc(display='Type')]) -> None:
|
||||||
"""Set a generic catchpoint (catch)."""
|
"""Set a generic catchpoint (catch)."""
|
||||||
gdb.execute(f'catch {spec}')
|
gdb.execute(f'catch {spec}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(display='Catch Event')
|
@REGISTRY.method(display='Catch Event')
|
||||||
def break_event(container: BreakpointContainer, spec: Annotated[str, ParamDesc(display='Type')], desc: Annotated[str, ParamDesc(display='Desc')]):
|
def break_event(container: BreakpointContainer,
|
||||||
|
spec: Annotated[str, ParamDesc(display='Type')],
|
||||||
|
desc: Annotated[str, ParamDesc(display='Desc')]) -> None:
|
||||||
"""Set a generic catchpoint (catch)."""
|
"""Set a generic catchpoint (catch)."""
|
||||||
gdb.execute(f'catch {spec} {desc}')
|
gdb.execute(f'catch {spec} {desc}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(action='break_ext', display='Catch Signal')
|
@REGISTRY.method(action='break_ext', display='Catch Signal')
|
||||||
def break_ext_signal(inferior: Inferior, signal: Annotated[str, ParamDesc(display='Signal (opt)')]):
|
def break_ext_signal(inferior: Inferior, signal: Annotated[
|
||||||
|
str, ParamDesc(display='Signal (opt)')]) -> None:
|
||||||
"""Set a signal catchpoint (catch signal)."""
|
"""Set a signal catchpoint (catch signal)."""
|
||||||
gdb.execute(f'catch signal {signal}')
|
gdb.execute(f'catch signal {signal}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(display='Catch Signal')
|
@REGISTRY.method(display='Catch Signal')
|
||||||
def break_signal(container: BreakpointContainer, signal: Annotated[str, ParamDesc(display='Signal (opt)')]):
|
def break_signal(container: BreakpointContainer, signal: Annotated[
|
||||||
|
str, ParamDesc(display='Signal (opt)')]) -> None:
|
||||||
"""Set a signal catchpoint (catch signal))."""
|
"""Set a signal catchpoint (catch signal))."""
|
||||||
gdb.execute(f'catch signal {signal}')
|
gdb.execute(f'catch signal {signal}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(action='break_ext', display='Catch Syscall')
|
@REGISTRY.method(action='break_ext', display='Catch Syscall')
|
||||||
def break_ext_syscall(inferior: Inferior, syscall: Annotated[str, ParamDesc(display='Syscall (opt)')]):
|
def break_ext_syscall(inferior: Inferior, syscall: Annotated[
|
||||||
|
str, ParamDesc(display='Syscall (opt)')]) -> None:
|
||||||
"""Set a syscall catchpoint (catch syscall))."""
|
"""Set a syscall catchpoint (catch syscall))."""
|
||||||
gdb.execute(f'catch syscall {syscall}')
|
gdb.execute(f'catch syscall {syscall}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(display='Catch Syscall')
|
@REGISTRY.method(display='Catch Syscall')
|
||||||
def break_syscall(container: BreakpointContainer, syscall: Annotated[str, ParamDesc(display='Syscall (opt)')]):
|
def break_syscall(container: BreakpointContainer, syscall: Annotated[
|
||||||
|
str, ParamDesc(display='Syscall (opt)')]) -> None:
|
||||||
"""Set a syscall catchpoint (catch syscall)."""
|
"""Set a syscall catchpoint (catch syscall)."""
|
||||||
gdb.execute(f'catch syscall {syscall}')
|
gdb.execute(f'catch syscall {syscall}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(action='break_ext', display='Catch Load')
|
@REGISTRY.method(action='break_ext', display='Catch Load')
|
||||||
def break_ext_load(inferior: Inferior, library: Annotated[str, ParamDesc(display='Library (opt)')]):
|
def break_ext_load(inferior: Inferior, library: Annotated[
|
||||||
|
str, ParamDesc(display='Library (opt)')]) -> None:
|
||||||
"""Set a load catchpoint (catch load))."""
|
"""Set a load catchpoint (catch load))."""
|
||||||
gdb.execute(f'catch load {library}')
|
gdb.execute(f'catch load {library}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(display='Catch Load')
|
@REGISTRY.method(display='Catch Load')
|
||||||
def break_load(container: BreakpointContainer, library: Annotated[str, ParamDesc(display='Library (opt)')]):
|
def break_load(container: BreakpointContainer, library: Annotated[
|
||||||
|
str, ParamDesc(display='Library (opt)')]) -> None:
|
||||||
"""Set a load catchpoint (catch load)."""
|
"""Set a load catchpoint (catch load)."""
|
||||||
gdb.execute(f'catch load {library}')
|
gdb.execute(f'catch load {library}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(action='break_ext', display='Catch Unload')
|
@REGISTRY.method(action='break_ext', display='Catch Unload')
|
||||||
def break_ext_unload(inferior: Inferior, library: Annotated[str, ParamDesc(display='Library (opt)')]):
|
def break_ext_unload(inferior: Inferior,
|
||||||
|
library: Annotated[
|
||||||
|
str, ParamDesc(display='Library (opt)')]) -> None:
|
||||||
"""Set a unload catchpoint (catch unload))."""
|
"""Set a unload catchpoint (catch unload))."""
|
||||||
gdb.execute(f'catch unload {library}')
|
gdb.execute(f'catch unload {library}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(display='Catch Unload')
|
@REGISTRY.method(display='Catch Unload')
|
||||||
def break_unload(container: BreakpointContainer, library: Annotated[str, ParamDesc(display='Library (opt)')]):
|
def break_unload(container: BreakpointContainer, library: Annotated[
|
||||||
|
str, ParamDesc(display='Library (opt)')]) -> None:
|
||||||
"""Set a unload catchpoint (catch unload)."""
|
"""Set a unload catchpoint (catch unload)."""
|
||||||
gdb.execute(f'catch unload {library}')
|
gdb.execute(f'catch unload {library}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(action='break_ext', display='Catch Catch')
|
@REGISTRY.method(action='break_ext', display='Catch Catch')
|
||||||
def break_ext_catch(inferior: Inferior, exception: Annotated[str, ParamDesc(display='Exception (opt)')]):
|
def break_ext_catch(inferior: Inferior, exception: Annotated[
|
||||||
|
str, ParamDesc(display='Exception (opt)')]) -> None:
|
||||||
"""Set a catch catchpoint (catch catch))."""
|
"""Set a catch catchpoint (catch catch))."""
|
||||||
gdb.execute(f'catch catch {exception}')
|
gdb.execute(f'catch catch {exception}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(display='Catch Catch')
|
@REGISTRY.method(display='Catch Catch')
|
||||||
def break_catch(container: BreakpointContainer, exception: Annotated[str, ParamDesc(display='Exception (opt)')]):
|
def break_catch(container: BreakpointContainer, exception: Annotated[
|
||||||
|
str, ParamDesc(display='Exception (opt)')]) -> None:
|
||||||
"""Set a catch catchpoint (catch catch)."""
|
"""Set a catch catchpoint (catch catch)."""
|
||||||
gdb.execute(f'catch catch {exception}')
|
gdb.execute(f'catch catch {exception}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(action='break_ext', display='Catch Throw')
|
@REGISTRY.method(action='break_ext', display='Catch Throw')
|
||||||
def break_ext_throw(inferior: Inferior, exception: Annotated[str, ParamDesc(display='Exception (opt)')]):
|
def break_ext_throw(inferior: Inferior, exception: Annotated[
|
||||||
|
str, ParamDesc(display='Exception (opt)')]) -> None:
|
||||||
"""Set a throw catchpoint (catch throw))."""
|
"""Set a throw catchpoint (catch throw))."""
|
||||||
gdb.execute(f'catch throw {exception}')
|
gdb.execute(f'catch throw {exception}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(display='Catch Throw')
|
@REGISTRY.method(display='Catch Throw')
|
||||||
def break_throw(container: BreakpointContainer, exception: Annotated[str, ParamDesc(display='Exception (opt)')]):
|
def break_throw(container: BreakpointContainer, exception: Annotated[
|
||||||
|
str, ParamDesc(display='Exception (opt)')]) -> None:
|
||||||
"""Set a throw catchpoint (catch throw)."""
|
"""Set a throw catchpoint (catch throw)."""
|
||||||
gdb.execute(f'catch throw {exception}')
|
gdb.execute(f'catch throw {exception}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(action='break_ext', display='Catch Rethrow')
|
@REGISTRY.method(action='break_ext', display='Catch Rethrow')
|
||||||
def break_ext_rethrow(inferior: Inferior, exception: Annotated[str, ParamDesc(display='Exception (opt)')]):
|
def break_ext_rethrow(inferior: Inferior, exception: Annotated[
|
||||||
|
str, ParamDesc(display='Exception (opt)')]) -> None:
|
||||||
"""Set a rethrow catchpoint (catch rethrow))."""
|
"""Set a rethrow catchpoint (catch rethrow))."""
|
||||||
gdb.execute(f'catch rethrow {exception}')
|
gdb.execute(f'catch rethrow {exception}')
|
||||||
|
|
||||||
|
|
||||||
@REGISTRY.method(display='Catch Rethrow')
|
@REGISTRY.method(display='Catch Rethrow')
|
||||||
def break_rethrow(container: BreakpointContainer, exception: Annotated[str, ParamDesc(display='Exception (opt)')]):
|
def break_rethrow(container: BreakpointContainer, exception: Annotated[
|
||||||
|
str, ParamDesc(display='Exception (opt)')]) -> None:
|
||||||
"""Set a rethrow catchpoint (catch rethrow)."""
|
"""Set a rethrow catchpoint (catch rethrow)."""
|
||||||
gdb.execute(f'catch rethrow {exception}')
|
gdb.execute(f'catch rethrow {exception}')
|
||||||
|
|
||||||
@@ -844,7 +862,8 @@ def break_describe(breakpoint: BreakpointSpec):
|
|||||||
lines = desc.split('\n')
|
lines = desc.split('\n')
|
||||||
index = lines[0].index('What')
|
index = lines[0].index('What')
|
||||||
if index is not None:
|
if index is not None:
|
||||||
breakpoint.set_value('_display', "[{key}] {desc}".format(key=bpt.number, desc=lines[1][index:]))
|
breakpoint.set_value('_display', "[{key}] {desc}".format(
|
||||||
|
key=bpt.number, desc=lines[1][index:]))
|
||||||
with commands.open_tracked_tx('Refresh Breakpoints'):
|
with commands.open_tracked_tx('Refresh Breakpoints'):
|
||||||
gdb.execute('ghidra trace put-breakpoints')
|
gdb.execute('ghidra trace put-breakpoints')
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -1143,7 +1143,7 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBreakEvent() throws Exception {
|
public void testBreakExtEvent() throws Exception {
|
||||||
try (GdbAndConnection conn = startAndConnectGdb()) {
|
try (GdbAndConnection conn = startAndConnectGdb()) {
|
||||||
conn.execute("""
|
conn.execute("""
|
||||||
file bash
|
file bash
|
||||||
@@ -1151,13 +1151,15 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest {
|
|||||||
%s
|
%s
|
||||||
start"""
|
start"""
|
||||||
.formatted(INSTRUMENT_STOPPED));
|
.formatted(INSTRUMENT_STOPPED));
|
||||||
RemoteMethod breakEvent = conn.getMethod("break_event");
|
RemoteMethod breakEvent = conn.getMethod("break_ext_event");
|
||||||
try (ManagedDomainObject mdo = openDomainObject("/New Traces/gdb/bash")) {
|
try (ManagedDomainObject mdo = openDomainObject("/New Traces/gdb/bash")) {
|
||||||
tb = new ToyDBTraceBuilder((Trace) mdo.get());
|
tb = new ToyDBTraceBuilder((Trace) mdo.get());
|
||||||
waitStopped();
|
waitStopped();
|
||||||
|
|
||||||
TraceObject inf = Objects.requireNonNull(tb.obj("Inferiors[1]"));
|
TraceObject inf = Objects.requireNonNull(tb.obj("Inferiors[1]"));
|
||||||
breakEvent.invoke(Map.of("inferior", inf, "spec", "load"));
|
breakEvent.invoke(Map.ofEntries(
|
||||||
|
Map.entry("inferior", inf),
|
||||||
|
Map.entry("spec", "load")));
|
||||||
|
|
||||||
String out = conn.executeCapture("info break");
|
String out = conn.executeCapture("info break");
|
||||||
assertThat(out, containsString("load of library"));
|
assertThat(out, containsString("load of library"));
|
||||||
|
|||||||
-1
@@ -308,7 +308,6 @@ public class LldbHooksTest extends AbstractLldbTraceRmiTest {
|
|||||||
start(conn, getSpecimenPrint());
|
start(conn, getSpecimenPrint());
|
||||||
|
|
||||||
conn.execute("cont");
|
conn.execute("cont");
|
||||||
waitRunning(conn.conn);
|
|
||||||
|
|
||||||
waitForPass(() -> {
|
waitForPass(() -> {
|
||||||
TraceSnapshot snapshot =
|
TraceSnapshot snapshot =
|
||||||
|
|||||||
Reference in New Issue
Block a user