From ed0bfd31692f6e7d6bca2eeec87582025ada29aa Mon Sep 17 00:00:00 2001 From: pancake Date: Thu, 1 Feb 2024 17:34:16 +0900 Subject: [PATCH] Fix #417 - Implement db-* command to delete all breakpoints --- src/agent/index.ts | 1 + src/agent/lib/debug/index.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/agent/index.ts b/src/agent/index.ts index ead1a095..e9db4c4b 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -71,6 +71,7 @@ const commandHandlers = { dbj: debug.breakpointJson, dbc: [debug.breakpointNativeCommand, 'associate an r2 command when the native breakpoint is hit', '[addr] [cmd]'], 'db-': [debug.breakpointUnset, 'unset the native breakpoint in the given address', '[addr]'], + 'db-*': [debug.breakpointUnsetAll, 'unset all the breakpoints'], dc: [debug.breakpointContinue, 'continue execution of the interrupted child'], dcu: [debug.breakpointContinueUntil, 'continue execution until given address', '[addr]'], dk: [debug.sendSignal, 'send signal to process in the target process', '[signal]|([pid] [signum])'], diff --git a/src/agent/lib/debug/index.ts b/src/agent/lib/debug/index.ts index 6a8dcc14..980ae947 100644 --- a/src/agent/lib/debug/index.ts +++ b/src/agent/lib/debug/index.ts @@ -201,6 +201,12 @@ export function breakpointNativeCommand(args: string[]) { } } +export function breakpointUnsetAll(args: string[]) { + for (const [address, bp] of newBreakpoints.entries()) { + breakpointUnset([address]); + } +} + export function breakpointUnset(args: string[]) { const addr = getPtr(args[0]).toString(); const bp = newBreakpoints.get(addr);