mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-30 01:27:17 +01:00
MWE: * Fixed string resolving
* Updated exception handling git-svn-id: trunk@3097 -
This commit is contained in:
parent
a0b72293e3
commit
f53e64a526
@ -137,12 +137,12 @@ type
|
|||||||
FLocals: TStringList;
|
FLocals: TStringList;
|
||||||
FLocalsValid: Boolean;
|
FLocalsValid: Boolean;
|
||||||
procedure LocalsNeeded;
|
procedure LocalsNeeded;
|
||||||
|
procedure AddLocals(const AParams:String);
|
||||||
protected
|
protected
|
||||||
procedure DoStateChange; override;
|
procedure DoStateChange; override;
|
||||||
function GetName(const AnIndex: Integer): String; override;
|
function GetName(const AnIndex: Integer): String; override;
|
||||||
function GetValue(const AnIndex: Integer): String; override;
|
function GetValue(const AnIndex: Integer): String; override;
|
||||||
public
|
public
|
||||||
procedure AddLocals(const AParams:String);
|
|
||||||
function Count: Integer; override;
|
function Count: Integer; override;
|
||||||
constructor Create(const ADebugger: TDebugger);
|
constructor Create(const ADebugger: TDebugger);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -509,8 +509,9 @@ begin
|
|||||||
Result := '';
|
Result := '';
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
WriteLN('GetText: "', S, '"');
|
S := StripLN(S);
|
||||||
Result := GetPart('\t ''', '', S);
|
S := GetPart('\t ''', '', S);
|
||||||
|
Result := LeftStr(S, Length(S) - 1);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -599,7 +600,7 @@ begin
|
|||||||
TargetPIDPart:=GetPart('child Thread ', ' ', S);
|
TargetPIDPart:=GetPart('child Thread ', ' ', S);
|
||||||
FTargetPID := StrToIntDef(TargetPIDPart, 0);
|
FTargetPID := StrToIntDef(TargetPIDPart, 0);
|
||||||
|
|
||||||
WriteLN('Target PID: ', FTargetPID);
|
WriteLN('[Debugger] Target PID: ', FTargetPID);
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
FTargetPID := 0;
|
FTargetPID := 0;
|
||||||
@ -724,8 +725,14 @@ begin
|
|||||||
if ExecuteCommand('-gdb-version', [], S, True)
|
if ExecuteCommand('-gdb-version', [], S, True)
|
||||||
then FVersion := GetPart('(', ')', S)
|
then FVersion := GetPart('(', ')', S)
|
||||||
else FVersion := '';
|
else FVersion := '';
|
||||||
WriteLN('Running GDB version: ', FVersion);
|
if FVersion < '5.3'
|
||||||
|
then begin
|
||||||
|
WriteLN('[WARNING] Debugger: Running an old (< 5.3) GDB version: ', FVersion);
|
||||||
|
WriteLN(' Not all functionality will be supported.');
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
WriteLN('[Debugger] Running GDB version: ', FVersion);
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Init;
|
inherited Init;
|
||||||
end
|
end
|
||||||
@ -784,11 +791,18 @@ begin
|
|||||||
if Pos('no debugging symbols', S) > 0
|
if Pos('no debugging symbols', S) > 0
|
||||||
then begin
|
then begin
|
||||||
FHasSymbols := False;
|
FHasSymbols := False;
|
||||||
WriteLN('WARNING: File ''',FileName, ''' has no debug symbols');
|
WriteLN('[WARNING] Debugger: File ''',FileName, ''' has no debug symbols');
|
||||||
end
|
end
|
||||||
else if ANoMICommand
|
else if ANoMICommand
|
||||||
then begin
|
then begin
|
||||||
AResultValues := AResultValues + Copy(S, 3, Length(S) - 5) + LINE_END;
|
// Strip surrounding ~" "
|
||||||
|
S := Copy(S, 3, Length(S) - 3);
|
||||||
|
if (RightStr(S, 2) = '\n') and (RightStr(S, 3) <> '\\n')
|
||||||
|
then begin
|
||||||
|
// Delete lineend symbol & add lineend
|
||||||
|
S := Copy(S, 1, Length(S) - 2) + LINE_END;
|
||||||
|
end;
|
||||||
|
AResultValues := AResultValues + S;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
WriteLN('[Debugger] Console output: ', S);
|
WriteLN('[Debugger] Console output: ', S);
|
||||||
@ -937,7 +951,7 @@ function TGDBMIDebugger.ProcessStopped(const AParams: String): Boolean;
|
|||||||
Location.SrcFile := GetPart('\"', '\"', S);
|
Location.SrcFile := GetPart('\"', '\"', S);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
DoException(-1, Format('%s: %s', [ExceptionName, ExceptionMessage]));
|
DoException(ExceptionName, ExceptionMessage);
|
||||||
DoCurrent(Location);
|
DoCurrent(Location);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -959,7 +973,7 @@ function TGDBMIDebugger.ProcessStopped(const AParams: String): Boolean;
|
|||||||
Location.SrcFile := GetPart('\"', '\"', S);
|
Location.SrcFile := GetPart('\"', '\"', S);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
DoException(ErrorNo, Format('RunError(%d)', [ErrorNo]));
|
DoException(Format('RunError(%d)', [ErrorNo]), '');
|
||||||
DoCurrent(Location);
|
DoCurrent(Location);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -989,20 +1003,18 @@ begin
|
|||||||
if Reason = 'exited-signalled'
|
if Reason = 'exited-signalled'
|
||||||
then begin
|
then begin
|
||||||
SetState(dsStop);
|
SetState(dsStop);
|
||||||
// TODO: define signal no
|
DoException('External: ' + List.Values['signal-name'], '');
|
||||||
DoException(0, List.Values['signal-name']);
|
// ProcessFrame(List.Values['frame']);
|
||||||
ProcessFrame(List.Values['frame']);
|
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if Reason = 'signal-received'
|
if Reason = 'signal-received'
|
||||||
then begin
|
then begin
|
||||||
// TODO: check to run (un)handled
|
// TODO: check to run (un)handled
|
||||||
// TODO: define signal no
|
|
||||||
SetState(dsPause);
|
SetState(dsPause);
|
||||||
S := List.Values['signal-name'];
|
S := List.Values['signal-name'];
|
||||||
if S <> 'SIGINT'
|
if S <> 'SIGINT'
|
||||||
then DoException(0, S);
|
then DoException('External: ' + S, '');
|
||||||
ProcessFrame(List.Values['frame']);
|
ProcessFrame(List.Values['frame']);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
@ -1226,9 +1238,9 @@ end;
|
|||||||
|
|
||||||
procedure TGDBMILocals.AddLocals(const AParams: String);
|
procedure TGDBMILocals.AddLocals(const AParams: String);
|
||||||
var
|
var
|
||||||
n: Integer;
|
n, addr: Integer;
|
||||||
LocList, List: TStrings;
|
LocList, List: TStrings;
|
||||||
Name: String;
|
S, Name, Value: String;
|
||||||
begin
|
begin
|
||||||
LocList := CreateMIValueList(AParams);
|
LocList := CreateMIValueList(AParams);
|
||||||
for n := 0 to LocList.Count - 1 do
|
for n := 0 to LocList.Count - 1 do
|
||||||
@ -1237,7 +1249,19 @@ begin
|
|||||||
Name := List.Values['name'];
|
Name := List.Values['name'];
|
||||||
if Name = 'this'
|
if Name = 'this'
|
||||||
then Name := 'Self';
|
then Name := 'Self';
|
||||||
FLocals.Add(Name + '=' + List.Values['value']);
|
|
||||||
|
Value := List.Values['value'];
|
||||||
|
// try to deref. strings
|
||||||
|
S := GetPart(['(pchar) ', '(ansistring) '], [], Value, True, False);
|
||||||
|
if S <> ''
|
||||||
|
then begin
|
||||||
|
addr := StrToIntDef(S, 0);
|
||||||
|
if addr = 0
|
||||||
|
then Value := ''''''
|
||||||
|
else Value := '''' + TGDBMIDebugger(Debugger).GDBGetText(Pointer(addr)) + '''';
|
||||||
|
end;
|
||||||
|
|
||||||
|
FLocals.Add(Name + '=' + Value);
|
||||||
FreeAndNil(List);
|
FreeAndNil(List);
|
||||||
end;
|
end;
|
||||||
FreeAndNil(LocList);
|
FreeAndNil(LocList);
|
||||||
@ -1745,6 +1769,10 @@ end;
|
|||||||
end.
|
end.
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.19 2003/05/29 17:40:10 marc
|
||||||
|
MWE: * Fixed string resolving
|
||||||
|
* Updated exception handling
|
||||||
|
|
||||||
Revision 1.18 2003/05/29 07:25:02 mattias
|
Revision 1.18 2003/05/29 07:25:02 mattias
|
||||||
added Destroying flag, debugger now always shuts down
|
added Destroying flag, debugger now always shuts down
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user