Skip to content

Commit 2c39c99

Browse files
committed
add all breakpoint requests JSON types
1 parent d0d8c7e commit 2c39c99

File tree

2 files changed

+145
-0
lines changed

2 files changed

+145
-0
lines changed

lldb/tools/lldb-dap/Protocol/ProtocolRequests.h

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,91 @@ bool fromJSON(const llvm::json::Value &, StepOutArguments &, llvm::json::Path);
377377
/// body field is required.
378378
using StepOutResponse = VoidResponse;
379379

380+
/// Arguments for `setBreakpoints` request.
381+
struct SetBreakpointsArguments {
382+
/// The source location of the breakpoints; either `source.path` or
383+
/// `source.sourceReference` must be specified.
384+
Source source;
385+
386+
/// The code locations of the breakpoints.
387+
std::optional<std::vector<SourceBreakpoint>> breakpoints;
388+
389+
/// Deprecated: The code locations of the breakpoints.
390+
std::optional<std::vector<uint32_t>> lines;
391+
392+
/// A value of true indicates that the underlying source has been modified
393+
/// which results in new breakpoint locations.
394+
std::optional<bool> sourceModified;
395+
};
396+
bool fromJSON(const llvm::json::Value &, SetBreakpointsArguments &,
397+
llvm::json::Path);
398+
399+
/// Response to `setBreakpoints` request.
400+
/// Returned is information about each breakpoint created by this request.
401+
/// This includes the actual code location and whether the breakpoint could be verified.
402+
/// The breakpoints returned are in the same order as the elements of the breakpoints
403+
/// (or the deprecated lines) array in the arguments.
404+
struct SetBreakpointsResponseBody {
405+
/// Information about the breakpoints.
406+
/// The array elements are in the same order as the elements of the
407+
/// `breakpoints` (or the deprecated `lines`) array in the arguments.
408+
std::vector<Breakpoint> breakpoints;
409+
};
410+
llvm::json::Value toJSON(const SetBreakpointsResponseBody &);
411+
412+
/// Arguments for `setFunctionBreakpoints` request.
413+
struct SetFunctionBreakpointsArguments {
414+
/// The function names of the breakpoints.
415+
std::vector<FunctionBreakpoint> breakpoints;
416+
};
417+
bool fromJSON(const llvm::json::Value &, SetFunctionBreakpointsArguments &,
418+
llvm::json::Path);
419+
420+
/// Response to `setFunctionBreakpoints` request.
421+
/// Returned is information about each breakpoint created by this request.
422+
struct SetFunctionBreakpointsResponseBody {
423+
/// Information about the breakpoints. The array elements correspond to the
424+
/// elements of the `breakpoints` array.
425+
std::vector<Breakpoint> breakpoints;
426+
};
427+
llvm::json::Value toJSON(const SetFunctionBreakpointsResponseBody &);
428+
429+
/// Arguments for `setExceptionBreakpoints` request.
430+
struct SetExceptionBreakpointsArguments {
431+
/// Set of exception filters specified by their ID. The set of all possible
432+
/// exception filters is defined by the `exceptionBreakpointFilters`
433+
/// capability. The `filter` and `filterOptions` sets are additive.
434+
std::vector<std::string> filters;
435+
436+
/// Set of exception filters and their options. The set of all possible
437+
/// exception filters is defined by the `exceptionBreakpointFilters`
438+
/// capability. This attribute is only honored by a debug adapter if the
439+
/// corresponding capability `supportsExceptionFilterOptions` is true. The
440+
/// `filter` and `filterOptions` sets are additive.
441+
std::optional<std::vector<ExceptionFilterOptions>> filterOptions;
442+
443+
/// Configuration options for selected exceptions.
444+
/// The attribute is only honored by a debug adapter if the corresponding
445+
/// capability `supportsExceptionOptions` is true.
446+
std::optional<std::vector<ExceptionOptions>> exceptionOptions;
447+
};
448+
449+
/// Arguments for `setInstructionBreakpoints` request.
450+
struct SetInstructionBreakpointsArguments {
451+
/// The instruction references of the breakpoints.
452+
std::vector<InstructionBreakpoint> breakpoints;
453+
};
454+
bool fromJSON(const llvm::json::Value &, SetInstructionBreakpointsArguments &,
455+
llvm::json::Path);
456+
457+
/// Response to `setInstructionBreakpoints` request.
458+
struct SetInstructionBreakpointsResponseBody {
459+
/// Information about the breakpoints. The array elements correspond to the
460+
/// elements of the `breakpoints` array.
461+
std::vector<Breakpoint> breakpoints;
462+
};
463+
llvm::json::Value toJSON(const SetInstructionBreakpointsResponseBody &);
464+
380465
} // namespace lldb_dap::protocol
381466

382467
#endif

lldb/tools/lldb-dap/Protocol/ProtocolTypes.h

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,66 @@ struct InstructionBreakpoint {
499499
bool fromJSON(const llvm::json::Value &, InstructionBreakpoint &,
500500
llvm::json::Path);
501501

502+
/// An ExceptionFilterOptions is used to specify an exception filter together with a condition for the `setExceptionBreakpoints` request.
503+
struct ExceptionFilterOptions {
504+
/// ID of an exception filter returned by the `exceptionBreakpointFilters`
505+
/// capability.
506+
std::string filterId;
507+
508+
/// An expression for conditional exceptions.
509+
/// The exception breaks into the debugger if the result of the condition is
510+
/// true.
511+
std::optional<std::string> condition;
512+
513+
/// The mode of this exception breakpoint. If defined, this must be one of the
514+
/// `breakpointModes` the debug adapter advertised in its `Capabilities`.
515+
std::optional<std::string> mode;
516+
};
517+
bool fromJSON(const llvm::json::Value &, ExceptionFilterOptions &,
518+
llvm::json::Path);
519+
520+
/// This enumeration defines all possible conditions when a thrown exception
521+
/// should result in a break.
522+
enum ExceptionBreakMode : unsigned {
523+
/// Never breaks.
524+
eExceptionBreakModeNever,
525+
/// Always breaks.
526+
eExceptionBreakModeAlways,
527+
/// Breaks when the exception is unhandled.
528+
eExceptionBreakModeUnhandled,
529+
/// Breaks if the exception is not handled by user code.
530+
eExceptionBreakModeUserUnhandled
531+
};
532+
bool fromJSON(const llvm::json::Value &, ExceptionBreakMode &,
533+
llvm::json::Path);
534+
535+
/// An ExceptionPathSegment represents a segment in a path that is used to
536+
/// match leafs or nodes in a tree of exceptions.
537+
struct ExceptionPathSegment {
538+
/// If false or missing, this segment matches the names provided. Otherwise,
539+
/// it matches anything except the names provided.
540+
std::optional<bool> negate;
541+
542+
/// Depending on the value of `negate`, the names that should match or not
543+
/// match.
544+
std::vector<std::string> names;
545+
};
546+
bool fromJSON(const llvm::json::Value &, ExceptionPathSegment &,
547+
llvm::json::Path);
548+
549+
/// ExceptionOptions assigns configuration options to a set of exceptions.
550+
struct ExceptionOptions {
551+
/// A path that selects a single or multiple exceptions in a tree. If `path`
552+
/// is missing, the whole tree is selected.
553+
/// By convention, the first segment of the path is a category that is used
554+
/// to group exceptions in the UI.
555+
std::optional<std::vector<ExceptionPathSegment>> path;
556+
557+
/// Condition when a thrown exception should result in a break.
558+
ExceptionBreakMode breakMode;
559+
};
560+
bool fromJSON(const llvm::json::Value &, ExceptionOptions &,
561+
llvm::json::Path);
502562

503563
} // namespace lldb_dap::protocol
504564

0 commit comments

Comments
 (0)