mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 16:56:03 +02:00
Debugger: resource strings / clean up
git-svn-id: trunk@42445 -
This commit is contained in:
parent
32871c5786
commit
ae48b1dba1
@ -191,12 +191,12 @@ type
|
|||||||
FResultData: TGDBMIExecResult;
|
FResultData: TGDBMIExecResult;
|
||||||
protected
|
protected
|
||||||
function ProcessInputFromGdb(const AData: String): Boolean; override;
|
function ProcessInputFromGdb(const AData: String): Boolean; override;
|
||||||
procedure HandleNoGdbRunning; override;
|
|
||||||
procedure HandleReadError; override;
|
|
||||||
procedure HandleTimeOut; override;
|
|
||||||
function GetTimeOutVerifier: TGDBInstruction; override;
|
function GetTimeOutVerifier: TGDBInstruction; override;
|
||||||
procedure Init; override;
|
procedure Init; override;
|
||||||
public
|
public
|
||||||
|
procedure HandleNoGdbRunning; override;
|
||||||
|
procedure HandleReadError; override;
|
||||||
|
procedure HandleTimeOut; override;
|
||||||
property ResultData: TGDBMIExecResult read FResultData;
|
property ResultData: TGDBMIExecResult read FResultData;
|
||||||
property HasResult: Boolean read FHasResult; // seen a "^foo" msg from gdb
|
property HasResult: Boolean read FHasResult; // seen a "^foo" msg from gdb
|
||||||
property FullCmdReply: String read FFullCmdReply;
|
property FullCmdReply: String read FFullCmdReply;
|
||||||
@ -809,6 +809,16 @@ resourcestring
|
|||||||
+ 'This may be caused by missing debug info.';
|
+ 'This may be caused by missing debug info.';
|
||||||
gdbmiCommandStartMainRunNoPIDError = 'The debugger failed to get the application''s PID.%0:s'
|
gdbmiCommandStartMainRunNoPIDError = 'The debugger failed to get the application''s PID.%0:s'
|
||||||
+ 'This may be caused by missing debug info.';
|
+ 'This may be caused by missing debug info.';
|
||||||
|
gdbmiGDBInternalError = 'GDB has encountered an internal error: %0:sPress "Ok" to continue '
|
||||||
|
+'debugging. This may NOT be safe.%0:sPress "Stop" to end the debug session.';
|
||||||
|
gdbmiGDBInternalErrorInfo = 'While executing the command: %0:s"%2:s"%0:sgdb reported:%0:s"%'
|
||||||
|
+'1:s"%0:s';
|
||||||
|
gdbmiEventLogGDBInternalError = 'GDB has encountered an internal error: %s';
|
||||||
|
gdbmiEventLogNoSymbols = 'File ''%s'' has no debug symbols';
|
||||||
|
gdbmiEventLogProcessStart = 'Process Start: %s';
|
||||||
|
gdbmiEventLogDebugOutput = 'Debug Output: %s';
|
||||||
|
gdbmiEventLogProcessExitNormally = 'Process Exit: normally';
|
||||||
|
gdbmiEventLogProcessExitCode = 'Process Exit: %s';
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -1612,13 +1622,24 @@ end;
|
|||||||
procedure TGDBMIDbgInstructionQueue.HandleGdbDataBeforeInstruction(var AData: String;
|
procedure TGDBMIDbgInstructionQueue.HandleGdbDataBeforeInstruction(var AData: String;
|
||||||
var SkipData: Boolean; const TheInstruction: TGDBInstruction);
|
var SkipData: Boolean; const TheInstruction: TGDBInstruction);
|
||||||
|
|
||||||
|
procedure DoConsoleStream(Line: String);
|
||||||
|
begin
|
||||||
|
// check for symbol info
|
||||||
|
if Pos('no debugging symbols', Line) > 0
|
||||||
|
then begin
|
||||||
|
Debugger.TargetFlags := Debugger.TargetFlags - [tfHasSymbols];
|
||||||
|
Debugger.DoDbgEvent(ecDebugger, etDefault, Format(gdbmiEventLogNoSymbols, [Debugger.FileName]));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure DoLogStream(const Line: String);
|
procedure DoLogStream(const Line: String);
|
||||||
begin
|
begin
|
||||||
// check for symbol info
|
// check for symbol info
|
||||||
if Pos('No symbol table is loaded. Use the \"file\" command.', Line) > 0
|
if Pos('No symbol table is loaded. Use the \"file\" command.', Line) > 0
|
||||||
then begin
|
then begin
|
||||||
Debugger.TargetFlags := Debugger.TargetFlags - [tfHasSymbols];
|
Debugger.TargetFlags := Debugger.TargetFlags - [tfHasSymbols];
|
||||||
Debugger.DoDbgEvent(ecDebugger, etDefault, Format('File ''%s'' has no debug symbols', [Debugger.FileName]));
|
Debugger.DoDbgEvent(ecDebugger, etDefault,
|
||||||
|
Format(gdbmiEventLogNoSymbols, [Debugger.FileName]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// check internal error
|
// check internal error
|
||||||
@ -1626,15 +1647,13 @@ procedure TGDBMIDbgInstructionQueue.HandleGdbDataBeforeInstruction(var AData: St
|
|||||||
(Pos('internal to gdb has been detected', LowerCase(Line)) > 0) or
|
(Pos('internal to gdb has been detected', LowerCase(Line)) > 0) or
|
||||||
(Pos('further debugging may prove unreliable', LowerCase(Line)) > 0)
|
(Pos('further debugging may prove unreliable', LowerCase(Line)) > 0)
|
||||||
then begin
|
then begin
|
||||||
Debugger.DoDbgEvent(ecDebugger, etDefault, Format('GDB has encountered an internal error: %s', [AData]));
|
Debugger.DoDbgEvent(ecDebugger, etDefault,
|
||||||
|
Format(gdbmiEventLogGDBInternalError, [AData]));
|
||||||
if TGDBMIDebuggerProperties(Debugger.GetProperties).WarnOnInternalError
|
if TGDBMIDebuggerProperties(Debugger.GetProperties).WarnOnInternalError
|
||||||
then begin
|
then begin
|
||||||
if Debugger.OnFeedback(Debugger,
|
if Debugger.OnFeedback(Debugger,
|
||||||
Format('GDB has encountered an internal error: %0:s' +
|
Format(gdbmiGDBInternalError, [LineEnding]),
|
||||||
'Press "Ok" to continue debugging. This may NOT be safe.%0:s' +
|
Format(gdbmiGDBInternalErrorInfo, [LineEnding, Line, TheInstruction.DebugText]),
|
||||||
'Press "Stop" to end the debug session.', [LineEnding]),
|
|
||||||
Format('While executing the command: %0:s"%2:s"%0:sgdb reported:%0:s"%1:s"%0:s',
|
|
||||||
[LineEnding, Line, TheInstruction.DebugText]),
|
|
||||||
ftWarning, [frOk, frStop]
|
ftWarning, [frOk, frStop]
|
||||||
) = frStop
|
) = frStop
|
||||||
then begin
|
then begin
|
||||||
@ -1653,7 +1672,7 @@ procedure TGDBMIDbgInstructionQueue.HandleGdbDataBeforeInstruction(var AData: St
|
|||||||
begin
|
begin
|
||||||
if AData <> ''
|
if AData <> ''
|
||||||
then case AData[1] of
|
then case AData[1] of
|
||||||
//'~': DoConsoleStream(AData);
|
'~': DoConsoleStream(AData);
|
||||||
//'@': DoTargetStream(AData);
|
//'@': DoTargetStream(AData);
|
||||||
'&': DoLogStream(AData);
|
'&': DoLogStream(AData);
|
||||||
//'*': DoExecAsync(AData);
|
//'*': DoExecAsync(AData);
|
||||||
@ -1732,13 +1751,6 @@ function TGDBMIDebuggerInstruction.ProcessInputFromGdb(const AData: String): Boo
|
|||||||
var
|
var
|
||||||
len: Integer;
|
len: Integer;
|
||||||
begin
|
begin
|
||||||
// check for symbol info
|
|
||||||
if Pos('no debugging symbols', Line) > 0
|
|
||||||
then begin
|
|
||||||
FCmd.TargetInfo^.TargetFlags := FCmd.TargetInfo^.TargetFlags - [tfHasSymbols];
|
|
||||||
FCmd.DoDbgEvent(ecDebugger, etDefault, Format('File ''%s'' has no debug symbols', [FCmd.FTheDebugger.FileName]));
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
// Strip surrounding ~" "
|
// Strip surrounding ~" "
|
||||||
len := Length(Line) - 3;
|
len := Length(Line) - 3;
|
||||||
if len < 0 then Exit;
|
if len < 0 then Exit;
|
||||||
@ -1757,7 +1769,6 @@ function TGDBMIDebuggerInstruction.ProcessInputFromGdb(const AData: String): Boo
|
|||||||
|
|
||||||
FResultData.Values := FResultData.Values + Line;
|
FResultData.Values := FResultData.Values + Line;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
procedure DoTargetStream(const Line: String);
|
procedure DoTargetStream(const Line: String);
|
||||||
begin
|
begin
|
||||||
@ -1818,7 +1829,8 @@ function TGDBMIDebuggerInstruction.ProcessInputFromGdb(const AData: String): Boo
|
|||||||
FCmd.FTheDebugger.Threads.Changed;
|
FCmd.FTheDebugger.Threads.Changed;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FCmd.DoDbgEvent(ecProcess, etProcessStart, 'Process Start: ' + FCmd.FTheDebugger.FileName);
|
FCmd.DoDbgEvent(ecProcess, etProcessStart,
|
||||||
|
Format(gdbmiEventLogProcessStart, [FCmd.FTheDebugger.FileName]));
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if S = 'stopped' then begin
|
if S = 'stopped' then begin
|
||||||
@ -2382,7 +2394,7 @@ var
|
|||||||
InLogWarning := True;
|
InLogWarning := True;
|
||||||
Delete(Warning, 1, Length(LogWarning));
|
Delete(Warning, 1, Length(LogWarning));
|
||||||
Warning := MakePrintable(UnEscapeBackslashed(Trim(Warning), [uefOctal, uefTab, uefNewLine]));
|
Warning := MakePrintable(UnEscapeBackslashed(Trim(Warning), [uefOctal, uefTab, uefNewLine]));
|
||||||
DoDbgEvent(ecOutput, etOutputDebugString, 'Debug Output: ' + Warning);
|
DoDbgEvent(ecOutput, etOutputDebugString, Format(gdbmiEventLogDebugOutput, [Warning]));
|
||||||
end;
|
end;
|
||||||
if InLogWarning then
|
if InLogWarning then
|
||||||
FLogWarnings := FLogWarnings + Warning + LineEnding;
|
FLogWarnings := FLogWarnings + Warning + LineEnding;
|
||||||
@ -5721,7 +5733,7 @@ begin
|
|||||||
Reason := List.Values['reason'];
|
Reason := List.Values['reason'];
|
||||||
if (Reason = 'exited-normally')
|
if (Reason = 'exited-normally')
|
||||||
then begin
|
then begin
|
||||||
DoDbgEvent(ecProcess, etProcessExit, 'Process Exit: normally');
|
DoDbgEvent(ecProcess, etProcessExit, gdbmiEventLogProcessExitNormally);
|
||||||
SetDebuggerState(dsStop);
|
SetDebuggerState(dsStop);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
@ -5729,7 +5741,8 @@ begin
|
|||||||
if Reason = 'exited'
|
if Reason = 'exited'
|
||||||
then begin
|
then begin
|
||||||
FTheDebugger.SetExitCode(StrToIntDef(List.Values['exit-code'], 0));
|
FTheDebugger.SetExitCode(StrToIntDef(List.Values['exit-code'], 0));
|
||||||
DoDbgEvent(ecProcess, etProcessExit, 'Process Exit: ' + List.Values['exit-code']);
|
DoDbgEvent(ecProcess, etProcessExit, Format(gdbmiEventLogProcessExitCode, [List.Values['exi'
|
||||||
|
+'t-code']]));
|
||||||
SetDebuggerState(dsStop);
|
SetDebuggerState(dsStop);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user