mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-02-25 04:48:16 +01:00
FpDebug - propagate error if no TDbgProcess could be started. Potential fix for #41076
(cherry picked from commit f0f125ea19)
This commit is contained in:
parent
405258f321
commit
ab751a50a8
@ -3994,24 +3994,28 @@ begin
|
||||
{$ifdef windows}
|
||||
FDbgController.ForceNewConsoleWin:=TFpDebugDebuggerProperties(GetProperties).ForceNewConsole;
|
||||
{$endif windows}
|
||||
FDbgController.AttachToPid := 0;
|
||||
if ACommand = dcAttach then begin
|
||||
FDbgController.AttachToPid := StrToIntDef(String(AParams[0].VAnsiString), 0);
|
||||
Result := FDbgController.AttachToPid <> 0;
|
||||
if not Result then begin
|
||||
FileName := '';
|
||||
Exit;
|
||||
// Check if CreateDbgProcess returns a valid TDbgProcess
|
||||
if Assigned(FDbgController.CurrentProcess) then begin
|
||||
FDbgController.AttachToPid := 0;
|
||||
if ACommand = dcAttach then begin
|
||||
FDbgController.AttachToPid := StrToIntDef(String(AParams[0].VAnsiString), 0);
|
||||
Result := FDbgController.AttachToPid <> 0;
|
||||
if not Result then begin
|
||||
FileName := '';
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
FWorkQueue.Clear;
|
||||
FWorkQueue.ThreadCount := 1;
|
||||
{$IFDEF FPDEBUG_THREAD_CHECK} CurrentFpDebugThreadIdForAssert := FWorkQueue.Threads[0].ThreadID;{$ENDIF}
|
||||
WorkItem := TFpThreadWorkerControllerRun.Create(Self);
|
||||
FWorkQueue.PushItem(WorkItem);
|
||||
FWorkQueue.WaitForItem(WorkItem, True);
|
||||
Result := WorkItem.StartSuccesfull;
|
||||
FWorkerThreadId := WorkItem.WorkerThreadId;
|
||||
WorkItem.DecRef;
|
||||
end;
|
||||
FWorkQueue.Clear;
|
||||
FWorkQueue.ThreadCount := 1;
|
||||
{$IFDEF FPDEBUG_THREAD_CHECK} CurrentFpDebugThreadIdForAssert := FWorkQueue.Threads[0].ThreadID;{$ENDIF}
|
||||
WorkItem := TFpThreadWorkerControllerRun.Create(Self);
|
||||
FWorkQueue.PushItem(WorkItem);
|
||||
FWorkQueue.WaitForItem(WorkItem, True);
|
||||
Result := WorkItem.StartSuccesfull;
|
||||
FWorkerThreadId := WorkItem.WorkerThreadId;
|
||||
WorkItem.DecRef;
|
||||
|
||||
if not result then begin
|
||||
// TDebuggerIntf.SetFileName has set the state to dsStop, to make sure
|
||||
// that dcRun could be requested. Reset the filename so that the state
|
||||
|
||||
Loading…
Reference in New Issue
Block a user