Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/dap4delphi.dpk
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ package dap4delphi;
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LOCALSYMBOLS OFF}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION OFF}
{$OVERFLOWCHECKS ON}
{$RANGECHECKS ON}
{$REFERENCEINFO ON}
{$OPTIMIZATION ON}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO OFF}
{$SAFEDIVIDE OFF}
{$STACKFRAMES ON}
{$STACKFRAMES OFF}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DEFINE DEBUG}
{$DEFINE RELEASE}
{$ENDIF IMPLICITBUILDING}
{$DESCRIPTION 'Debug Adapter Protocol'}
{$LIBSUFFIX AUTO}
Expand Down
451 changes: 306 additions & 145 deletions packages/dap4delphi.dproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion source/BaseProtocol.Events.pas
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ TProgressEndEventBody = class(TBaseType)
FMessage: string;
public
property ProgressId: string read FProgressId write FProgressId;
property Message: string read FMessage write FMessage;
property &Message: string read FMessage write FMessage;
end;

[EventType(TEventType.ProgressEnd)]
Expand Down
20 changes: 10 additions & 10 deletions source/BaseProtocol.Json.pas
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ class procedure TBaseProtocolJsonAdapter.RegisterConverters(
DoRegisterObjectListConverter<TBreakpointLocation>(AMarshal);
DoRegisterObjectListConverter<TSourceBreakpoint>(AMarshal);
DoRegisterObjectListConverter<TFunctionBreakpoint>(AMarshal);
DoRegisterObjectListConverter<TExceptionFilterOption>(AMarshal);
DoRegisterObjectListConverter<TExceptionOption>(AMarshal);
DoRegisterObjectListConverter<TExceptionFilterOptions>(AMarshal);
DoRegisterObjectListConverter<TExceptionOptions>(AMarshal);
DoRegisterObjectListConverter<TDataBreakpoint>(AMarshal);
DoRegisterObjectListConverter<TInstructionBreakpoint>(AMarshal);
DoRegisterObjectListConverter<TStackFrame>(AMarshal);
Expand All @@ -107,9 +107,9 @@ class procedure TBaseProtocolJsonAdapter.RegisterConverters(
DoRegisterObjectListConverter<TThread>(AMarshal);
DoRegisterObjectListConverter<TStepInTarget>(AMarshal);
DoRegisterObjectListConverter<TTarget>(AMarshal);
DoRegisterObjectListConverter<TCompletitionItem>(AMarshal);
DoRegisterObjectListConverter<TExceptionDetail>(AMarshal);
DoRegisterObjectListConverter<TDisassembleInstruction>(AMarshal);
DoRegisterObjectListConverter<TCompletionItem>(AMarshal);
DoRegisterObjectListConverter<TExceptionDetails>(AMarshal);
DoRegisterObjectListConverter<TDisassembledInstruction>(AMarshal);
DoRegisterObjectListConverter<TExceptionBreakpointsFilter>(AMarshal);
DoRegisterObjectListConverter<TDynamicScope>(AMarshal);
DoRegisterObjectListConverter<TChecksum>(AMarshal);
Expand Down Expand Up @@ -163,8 +163,8 @@ class procedure TBaseProtocolJsonAdapter.RegisterReverters(
DoRegisterObjectListReverter<TBreakpointLocation>(AUnmarshal);
DoRegisterObjectListReverter<TSourceBreakpoint>(AUnmarshal);
DoRegisterObjectListReverter<TFunctionBreakpoint>(AUnmarshal);
DoRegisterObjectListReverter<TExceptionFilterOption>(AUnmarshal);
DoRegisterObjectListReverter<TExceptionOption>(AUnmarshal);
DoRegisterObjectListReverter<TExceptionFilterOptions>(AUnmarshal);
DoRegisterObjectListReverter<TExceptionOptions>(AUnmarshal);
DoRegisterObjectListReverter<TDataBreakpoint>(AUnmarshal);
DoRegisterObjectListReverter<TInstructionBreakpoint>(AUnmarshal);
DoRegisterObjectListReverter<TStackFrame>(AUnmarshal);
Expand All @@ -174,9 +174,9 @@ class procedure TBaseProtocolJsonAdapter.RegisterReverters(
DoRegisterObjectListReverter<TThread>(AUnmarshal);
DoRegisterObjectListReverter<TStepInTarget>(AUnmarshal);
DoRegisterObjectListReverter<TTarget>(AUnmarshal);
DoRegisterObjectListReverter<TCompletitionItem>(AUnmarshal);
DoRegisterObjectListReverter<TExceptionDetail>(AUnmarshal);
DoRegisterObjectListReverter<TDisassembleInstruction>(AUnmarshal);
DoRegisterObjectListReverter<TCompletionItem>(AUnmarshal);
DoRegisterObjectListReverter<TExceptionDetails>(AUnmarshal);
DoRegisterObjectListReverter<TDisassembledInstruction>(AUnmarshal);
DoRegisterObjectListReverter<TExceptionBreakpointsFilter>(AUnmarshal);
DoRegisterObjectListReverter<TDynamicScope>(AUnmarshal);
DoRegisterObjectListReverter<TChecksum>(AUnmarshal);
Expand Down
12 changes: 8 additions & 4 deletions source/BaseProtocol.Parser.pas
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,15 @@ class function TBaseProtocolParser.GetProtocolMessageType(
const AJSONObject: TJSONObject): TClass;
begin
case JsonToMessageType(AJSONObject) of
TMessageType.Request : Exit(TProtocolMessage.Requests[JsonToRequestType(AJSONObject)]);
TMessageType.Response: Exit(TProtocolMessage.Responses[JsonToRequestType(AJSONObject)]);
TMessageType.Event : Exit(TProtocolMessage.Events[JsonToEventType(AJSONObject)]);
TMessageType.Request:
Result := TProtocolMessage.Requests[JsonToRequestType(AJSONObject)];
TMessageType.Response:
Result := TProtocolMessage.Responses[JsonToRequestType(AJSONObject)];
TMessageType.Event:
Result := TProtocolMessage.Events[JsonToEventType(AJSONObject)];
else
Result := nil;
end;
Result := nil;
end;

class function TBaseProtocolParser.JsonToMessageType(
Expand Down
62 changes: 37 additions & 25 deletions source/BaseProtocol.Requests.pas
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,13 @@ TSetExceptionBreakpointsArguments = class(TBaseType)
[JSONName('filters')]
FFilters: TArray<string>;
[JSONName('filterOptions'), Managed()]
FFilterOptions: TExceptionFilterOptions;
FFilterOptions: TExceptionFilterOptionsList;
[JSONName('exceptionOptions'), Managed()]
FExceptionOptions: TExceptionOptions;
FExceptionOptions: TExceptionOptionsList;
public
property Filters: TArray<string> read FFilters write FFilters;
property FilterOptions: TExceptionFilterOptions read FFilterOptions write FFilterOptions;
property ExceptionOptions: TExceptionOptions read FExceptionOptions write FExceptionOptions;
property FilterOptions: TExceptionFilterOptionsList read FFilterOptions write FFilterOptions;
property ExceptionOptions: TExceptionOptionsList read FExceptionOptions write FExceptionOptions;
end;

[RequestCommand(TRequestCommand.SetExceptionBreakpoints)]
Expand All @@ -297,9 +297,15 @@ TDatabreakpointInfoArguments = class(TBaseType)
FVariablesReference: integer;
[JSONName('name')]
FName: string;
[JSONName('frameId')]
FFrameId: integer;
[JSONName('mode')]
FMode: TBreakpointMode_;
public
property VariablesReference: integer read FVariablesReference write FVariablesReference;
property Name: string read FName write FName;
property FrameId: integer read FFrameId write FFrameId;
property Mode: TBreakpointMode_ read FMode write FMode;
end;

[RequestCommand(TRequestCommand.DataBreakpointInfo)]
Expand Down Expand Up @@ -646,12 +652,15 @@ TSetVariableResponseBody = class(TBaseType)
FNamedVariables: integer;
[JSONName('indexedVariables')]
FIndexedVariables: integer;
[JSONName('memoryReference')]
FMemoryReference: string;
public
property Value: string read FValue write FValue;
property &Type: string read FType write FType;
property VariablesReference: integer read FVariablesReference write FVariablesReference;
property NamedVariables: integer read FNamedVariables write FNamedVariables;
property IndexedVariables: integer read FIndexedVariables write FIndexedVariables;
property MemoryReference: string read FMemoryReference write FMemoryReference;
end;

TSetVariableResponse = class(TResponse<TSetVariableResponseBody>);
Expand Down Expand Up @@ -755,27 +764,27 @@ TLoadedSourcesResponseBody = class(TBaseType)

TLoadedSourcesResponse = class(TResponse<TLoadedSourcesResponseBody>);

TEvaluteArguments = class(TBaseType)
TEvaluateArguments = class(TBaseType)
private
[JSONName('expression')]
FExpression: string;
[JSONName('frameId')]
FFrameId: integer;
FFrameId: integer;
[JSONName('context'), JSONReflect(ctString, rtString, TEnumInterceptor)]
FContext: TEvaluteContext;
[JSONName('format'), Managed()]
FFormat: TValueFormat;
public
property Expression: string read FExpression write FExpression;
property FrameId: Integer read FFrameId write FFrameId;
property FrameId: Integer read FFrameId write FFrameId;
property Context: TEvaluteContext read FContext write FContext;
property Format: TValueFormat read FFormat write FFormat;
end;

[RequestCommand(TRequestCommand.Evaluate)]
TEvaluteRequest = class(TRequest<TEvaluteArguments>);
TEvaluateRequest = class(TRequest<TEvaluateArguments>);

TEvaluteResponseBody = class(TBaseType)
TEvaluateResponseBody = class(TBaseType)
private
[JSONName('result')]
FResult: string;
Expand All @@ -790,18 +799,18 @@ TEvaluteResponseBody = class(TBaseType)
[JSONName('indexedVariables')]
FIndexedVariables: integer;
[JSONName('memoryReference')]
FMemoryReference: integer;
FMemoryReference: string;
public
property Result: string read FResult write FResult;
property &Type: string read FType write FType;
property PresentationHint: TVariablePresentationHint read FPresentationHint write FPresentationHint;
property VariablesReference: integer read FVariablesReference write FVariablesReference;
property NamedVariables: integer read FNamedVariables write FNamedVariables;
property IndexedVariables: integer read FIndexedVariables write FIndexedVariables;
property MemoryReference: integer read FMemoryReference write FMemoryReference;
property MemoryReference: string read FMemoryReference write FMemoryReference;
end;

TEvaluteResponse = class(TResponse<TEvaluteResponseBody>);
TEvaluateResponse = class(TResponse<TEvaluateResponseBody>);

TSetExpressionArguments = class(TBaseType)
private
Expand Down Expand Up @@ -835,12 +844,15 @@ TSetExpressionResponseBody = class(TBaseType)
FNamedVariables: integer;
[JSONName('indexedVariables')]
FIndexedVariables: integer;
[JSONName('memoryReference')]
FMemoryReference: string;
public
property Value: string read FValue write FValue;
property PresentationHint: TVariablePresentationHint read FPresentationHint write FPresentationHint;
property VariablesReference: integer read FVariablesReference write FVariablesReference;
property NamedVariables: integer read FNamedVariables write FNamedVariables;
property IndexedVariables: integer read FIndexedVariables write FIndexedVariables;
property MemoryReference: string read FMemoryReference write FMemoryReference;
end;

TSetExpressionResponse = class(TResponse<TSetExpressionResponseBody>);
Expand Down Expand Up @@ -899,7 +911,7 @@ TGotoTargetsResponseBody = class(TBaseType)

TGotoTargetsResponse = class(TResponse<TGotoTargetsResponseBody>);

TCompletitionsArguments = class(TBaseType)
TCompletionsArguments = class(TBaseType)
private
[JSONName('frameId')]
FFrameId: integer;
Expand All @@ -917,17 +929,17 @@ TCompletitionsArguments = class(TBaseType)
end;

[RequestCommand(TRequestCommand.Completions)]
TCompletitionsRequest = class(TRequest<TCompletitionsArguments>);
TCompletionsRequest = class(TRequest<TCompletionsArguments>);

TCompletitionsResponseBody = class(TBaseType)
TCompletionsResponseBody = class(TBaseType)
private
[JSONName('frameId'), Managed()]
FTargets: TCompletitionItems;
[JSONName('targets'), Managed()]
FTargets: TCompletionItems;
public
property Targets: TCompletitionItems read FTargets write FTargets;
property Targets: TCompletionItems read FTargets write FTargets;
end;

TCompletitionsResponse = class(TResponse<TCompletitionsResponseBody>);
TCompletionsResponse = class(TResponse<TCompletionsResponseBody>);

TExceptionInfoArguments = class(TBaseType)
private
Expand All @@ -949,12 +961,12 @@ TExceptionInfoResponseBody = class(TBaseType)
[JSONName('breakMode'), JSONReflect(ctString, rtString, TEnumInterceptor)]
FBreakMode: TExceptionBreakMode;
[JSONName('details'), Managed()]
FDetails: TExceptionDetail;
FDetails: TExceptionDetails;
public
property ExceptionId: string read FExceptionId write FExceptionId;
property Description: string read FDescription write FDescription;
property BreakMode: TExceptionBreakMode read FBreakMode write FBreakMode;
property Details: TExceptionDetail read FDetails write FDetails;
property Details: TExceptionDetails read FDetails write FDetails;
end;

TExceptionInfoResponse = class(TResponse<TExceptionInfoResponseBody>);
Expand Down Expand Up @@ -1051,9 +1063,9 @@ TDisassembleRequest = class(TRequest<TDisassembleArguments>);
TDisassembleResponseBody = class(TBaseType)
private
[JSONName('instructions'), Managed()]
FInstructions: TDynamicDisassembleInstructions;
FInstructions: TDynamicDisassembledInstructions;
public
property Instructions: TDynamicDisassembleInstructions read FInstructions write FInstructions;
property Instructions: TDynamicDisassembledInstructions read FInstructions write FInstructions;
end;

TDisassembleResponse = class(TResponse<TDisassembleResponseBody>);
Expand Down Expand Up @@ -1098,13 +1110,13 @@ class procedure TRequestsRegistration.RegisterAll;
TProtocolMessage.RegisterRequest(TRequestCommand.Attach, TAttachRequest, TAttachResponse);
TProtocolMessage.RegisterRequest(TRequestCommand.BreakpointLocations, TDynamicBreakpointLocationsRequest, TBreakpointLocationsResponse);
TProtocolMessage.RegisterRequest(TRequestCommand.Cancel, TCancelRequest, TCancelResponse);
TProtocolMessage.RegisterRequest(TRequestCommand.Completions, TCompletitionsRequest, TCompletitionsResponse);
TProtocolMessage.RegisterRequest(TRequestCommand.Completions, TCompletionsRequest, TCompletionsResponse);
TProtocolMessage.RegisterRequest(TRequestCommand.ConfigurationDone, TConfigurationDoneRequest, TConfigurationDoneResponse);
TProtocolMessage.RegisterRequest(TRequestCommand.Continue, TContinueRequest, TContinueResponse);
TProtocolMessage.RegisterRequest(TRequestCommand.DataBreakpointInfo, TDatabreakpointInfoRequest, TDatabreakpointInfoResponse);
TProtocolMessage.RegisterRequest(TRequestCommand.Disassemble, TDisassembleRequest, TDisassembleResponse);
TProtocolMessage.RegisterRequest(TRequestCommand.Disconnect, TDisconnectRequest, TDisconnectResponse);
TProtocolMessage.RegisterRequest(TRequestCommand.Evaluate, TEvaluteRequest, TEvaluteResponse);
TProtocolMessage.RegisterRequest(TRequestCommand.Evaluate, TEvaluateRequest, TEvaluateResponse);
TProtocolMessage.RegisterRequest(TRequestCommand.ExceptionInfo, TExceptionInfoRequest, TExceptionInfoResponse);
TProtocolMessage.RegisterRequest(TRequestCommand.Goto, TGotoRequest, TGotoResponse);
TProtocolMessage.RegisterRequest(TRequestCommand.GotoTargets, TDynamicGotoTargetsRequest, TGotoTargetsResponse);
Expand Down
3 changes: 3 additions & 0 deletions source/BaseProtocol.ReverseRequests.pas
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ TRunInTerminalRequestArguments = class(TBaseType)
FArgs: TArray<string>;
[JSONName('env'), Managed()]
FEnv: TEnvs;
[JSONName('argsCanBeInterpretedByShell')]
FArgsCanBeInterpretedByShell: boolean;
public
property Kind: TRunInTerminalRequestArgumentsKind read FKind write FKind;
property Title: string read FTitle write FTitle;
property Cwd: string read FCwd write FCwd;
property Args: TArray<string> read FArgs write FArgs;
property Env: TEnvs read FEnv write FEnv;
property ArgsCanBeInterpretedByShell: boolean read FArgsCanBeInterpretedByShell write FArgsCanBeInterpretedByShell;
end;

[RequestCommand(TRequestCommand.RunInTerminal)]
Expand Down
Loading