* Patch from Colin Western

+ added a check for long repeats

git-svn-id: trunk@7366 -
This commit is contained in:
marc 2005-07-17 22:22:00 +00:00
parent de83f4a4a6
commit 4b1881f23a

View File

@ -1113,7 +1113,7 @@ end;
function TGDBMIDebugger.GetText(const AExpression: String;
const AValues: array of const): String;
var
S: String;
S, Trailor: String;
R: TGDBMIExecResult;
n, len, idx: Integer;
v: Integer;
@ -1121,8 +1121,9 @@ begin
if not ExecuteCommand('x/s ' + AExpression, AValues, [cfNoMICommand, cfIgnoreError], R)
then begin
Result := '';
end
else begin
Exit;
end;
S := StripLN(R.Values);
// don't use ' as end terminator, there might be one as part of the text
// since ' will be the last char, simply strip it.
@ -1176,6 +1177,13 @@ begin
len := Length(S);
if v <= 1 then Continue;
// limit the amount of repeats
if v > 1000
then begin
Trailor := Trailor + Format('###(repeat truncated: %u -> 1000)###', [v]);
v := 1000;
end;
// make sure result has some room
SetLength(Result, Length(Result) + v - 1);
while v > 1 do begin
@ -1187,14 +1195,13 @@ begin
else
// Debugger has returned something we don't know of
// Append the remainder to our parsed result
SetLength(Result, n);
Delete(S, 1, idx - 1);
Result := Result + '###(gdb unparsed remainder:' + S + ')###';
Exit;
Trailor := Trailor + '###(gdb unparsed remainder:' + S + ')###';
Break;
end;
end;
SetLength(Result, n);
end;
Result := Result + Trailor;
end;
function TGDBMIDebugger.GetSupportedCommands: TDBGCommands;
@ -2461,7 +2468,9 @@ begin
Arguments := TStringList.Create;
TGDBMIDebugger(Debugger).ExecuteCommand('-stack-list-arguments 1 %d %d',
[AIndex, AIndex], [], R);
[AIndex, AIndex], [cfIgnoreError], R);
// TODO: check what to display on error
List := CreateMIValueList(R);
S := List.Values['stack-args'];
FreeAndNil(List);
@ -2786,6 +2795,10 @@ initialization
end.
{ =============================================================================
$Log$
Revision 1.66 2005/07/17 22:22:00 marc
* Patch from Colin Western
+ added a check for long repeats
Revision 1.65 2005/07/17 20:08:35 marc
* GDB repeated values are expanded