Adds `.` as a new `breakpt-id` syntax. Users can specify `.` to mean the breakpoint location(s) that caused the current thread to stop. I selected `.` to mean the current breakpoint locations for two reasons. In a shells, period means <ins>current</ins> directory. In prose, a period is a <ins>stop</ins>. My workflow often starts with multiple breakpoint locations, such as with regex breakpoints, or basename breakpoints for overloaded/overridden names. As locations are hit, I realize which locations are no longer needed. This new syntax makes it quick and easy to disable the currently stopped location(s). Another use case for this is to quickly repeat commands for the current location: ``` break com add -o 'p someVar' . ``` Usage example: ``` (lldb) b main.c:2 Process 47071 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 frame #0: ... main`main at main.c:2:3 1 int main() { -> 2 return 0; 3 } Target 0: (main) stopped. (lldb) breakpoint disable . 1 breakpoints disabled. (lldb) breakpoint list Current breakpoints: 1: file = 'main.c', line = 2, exact_match = 0, locations = 1 1.1: where = main`main + 12 at main.c:2:3, address = ..., hit count = 1 Options: disabled ``` rdar://73047170 Assisted-by: claude
49 lines
1.8 KiB
C++
49 lines
1.8 KiB
C++
//===-- CommandObjectBreakpoint.h -------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTBREAKPOINT_H
|
|
#define LLDB_SOURCE_COMMANDS_COMMANDOBJECTBREAKPOINT_H
|
|
|
|
#include "lldb/Breakpoint/BreakpointName.h"
|
|
#include "lldb/Interpreter/CommandObjectMultiword.h"
|
|
|
|
namespace lldb_private {
|
|
|
|
// CommandObjectMultiwordBreakpoint
|
|
|
|
class CommandObjectMultiwordBreakpoint : public CommandObjectMultiword {
|
|
public:
|
|
CommandObjectMultiwordBreakpoint(CommandInterpreter &interpreter);
|
|
|
|
~CommandObjectMultiwordBreakpoint() override;
|
|
|
|
static void VerifyBreakpointOrLocationIDs(
|
|
Args &args, ExecutionContext &exe_ctx, CommandReturnObject &result,
|
|
BreakpointIDList *valid_ids,
|
|
BreakpointName::Permissions ::PermissionKinds purpose) {
|
|
VerifyIDs(args, exe_ctx, true, result, valid_ids, purpose);
|
|
}
|
|
|
|
static void
|
|
VerifyBreakpointIDs(Args &args, ExecutionContext &exe_ctx,
|
|
CommandReturnObject &result, BreakpointIDList *valid_ids,
|
|
BreakpointName::Permissions::PermissionKinds purpose) {
|
|
VerifyIDs(args, exe_ctx, false, result, valid_ids, purpose);
|
|
}
|
|
|
|
private:
|
|
static void VerifyIDs(Args &args, ExecutionContext &exe_ctx,
|
|
bool allow_locations, CommandReturnObject &result,
|
|
BreakpointIDList *valid_ids,
|
|
BreakpointName::Permissions::PermissionKinds purpose);
|
|
};
|
|
|
|
} // namespace lldb_private
|
|
|
|
#endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTBREAKPOINT_H
|