FpDebug: Cleanup of several issues introduced in r63899 #539c1f9a2b, in which a lot more was committed then planned. Among others utility functions to allow calling functions with parameters. The ability to set the value of (regvar) variables and some minor bug-fixes. As part of the parameter-support, addresses located in a register are not immediately read and converted to constants anymore. But the location of the actual register is stored. This might have unforeseen side-effects

git-svn-id: trunk@63900 -
This commit is contained in:
joost 2020-09-20 21:52:48 +00:00
parent 539c1f9a2b
commit 566610a9ba
8 changed files with 108 additions and 19 deletions

1
.gitattributes vendored
View File

@ -1460,6 +1460,7 @@ components/fpdebug/app/fpdserver/fpdserver.lpi svneol=native#text/plain
components/fpdebug/app/fpdserver/fpdserver.lpr svneol=native#text/plain
components/fpdebug/app/fpdserver/readme.txt svneol=native#text/plain
components/fpdebug/fpdbgavrclasses.pas svneol=native#text/pascal
components/fpdebug/fpdbgcallcontextinfo.pas svneol=native#text/pascal
components/fpdebug/fpdbgclasses.pp svneol=native#text/pascal
components/fpdebug/fpdbgcommon.pas svneol=native#text/pascal
components/fpdebug/fpdbgcontroller.pas svneol=native#text/plain

View File

@ -0,0 +1,44 @@
unit FpDbgCallContextInfo;
{$mode objfpc}{$H+}
interface
uses
DbgIntfBaseTypes,
FpDbgInfo,
FpdMemoryTools,
FpDbgDwarfDataClasses,
FpDbgDwarf;
type
{ TFpDbgInfoCallContext }
TFpDbgInfoCallContext = class(TFpDbgAbstractCallContext)
public
function CreateParamSymbol(AParamIndex: Integer; ASymbol: TFpSymbol): TFpValue; override;
end;
implementation
{ TFpDbgInfoCallContext }
function TFpDbgInfoCallContext.CreateParamSymbol(AParamIndex: Integer; ASymbol: TFpSymbol): TFpValue;
var
ParameterMemLocation: TFpDbgMemLocation;
TypeSymbol: TFpSymbol;
ParamSymbol: TFpSymbolDwarfFunctionResult;
begin
ParameterMemLocation := RegisterLoc(5);
TypeSymbol := ASymbol.TypeInfo;
ParamSymbol := TFpSymbolDwarfFunctionResult.Create(ASymbol.Name, TDbgDwarfSymbolBase(ASymbol).InformationEntry, TypeSymbol.Kind, ParameterMemLocation);
try
Result := ParamSymbol.Value;
finally
ParamSymbol.ReleaseReference;
end;
TFpValueDwarf(Result).Context := Self;
end;
end.

View File

@ -2099,11 +2099,6 @@ begin
FStack.PushConst(NewValue);
end;
DW_OP_regx: begin
//if not FMemManager.ReadRegister(ULEB128toOrdinal(CurData), NewValue, FContext) then begin
// SetError;
// exit;
//end;
//FStack.PushConst(NewValue);
FStack.PushTargetRegister(ULEB128toOrdinal(CurData));
end;

View File

@ -493,7 +493,6 @@ type
function GetProcedureAtAddress: TFpValue; virtual;
function GetMemManager: TFpDbgMemManager; virtual;
function GetSizeOfAddress: Integer; virtual;
procedure DoReferenceReleased; override;
public
constructor Create(ALocationContext: TFpDbgLocationContext);
destructor Destroy; override;
@ -1201,11 +1200,6 @@ begin
Result := nil;
end;
procedure TFpDbgSymbolScope.DoReferenceReleased;
begin
inherited DoReferenceReleased;
end;
function TFpDbgSimpleLocationContext.GetMemManager: TFpDbgMemManager;
begin
Result := FMemManager;

View File

@ -26,13 +26,17 @@ resourcestring
MsgfpErrInvalidNumber = 'Cannot parse number: %1:s';
MsgfpErrCannotDereferenceType = 'Cannot dereference Expression "%1:s"';
MsgfpErrTypeHasNoIndex = 'Cannot access indexed element in expression %1:s';
MsgfpErrChangeVariableNotSupported = 'Changing the value of this variable is not supported';
// 100 memreader error
MsgfpInternalErrfpErrFailedReadMem = 'Internal error: Failed to read data from memory';
MsgfpInternalErrCanNotReadInvalidMem = 'Internal error: Missing data location';
MsgfpErrReadMemSizeLimit = 'Memory read size exceeds limit';
MsgfpErrCanNotReadMemAtAddr = 'Failed to read Mem at Address $%1:x';
MsgfpErrFailedReadRegiseter = 'Failed to read data from register';
MsgfpInternalErrFailedWriteMem = 'Failed to write data';
MsgfpErrFailedWriteMem = 'Failed to write data';
MsgfpInternalErrCanNotWriteInvalidMem = 'Internal error writing data: Missing data location';
MsgfpErrCanNotWriteMemAtAddr = 'Failed to read Mem at Address $%1:x';
// 200 LocationParser
MsgfpErrLocationParser = 'Internal Error: Cannot calculate location.';
MsgfpErrLocationParserMemRead = '%1:s (while calculating location)'; // Pass on nested error
@ -199,13 +203,16 @@ begin
fpErrInvalidNumber: Result := MsgfpErrInvalidNumber;
fpErrCannotDereferenceType: Result := MsgfpErrCannotDereferenceType;
fpErrTypeHasNoIndex: Result := MsgfpErrTypeHasNoIndex;
fpErrChangeVariableNotSupported: Result := MsgfpErrChangeVariableNotSupported;
fpInternalErrCanNotReadInvalidMem: Result := MsgfpInternalErrCanNotReadInvalidMem;
fpErrReadMemSizeLimit: Result := MsgfpErrReadMemSizeLimit;
fpInternalErrFailedReadMem: Result := MsgfpInternalErrfpErrFailedReadMem;
fpErrCanNotReadMemAtAddr: Result := MsgfpErrCanNotReadMemAtAddr;
fpErrFailedReadRegister: Result := MsgfpErrFailedReadRegiseter;
fpErrFailedWriteMem: Result := MsgfpInternalErrFailedWriteMem;
fpInternalErrCanNotWriteInvalidMem:Result := MsgfpInternalErrCanNotWriteInvalidMem;
fpErrFailedWriteMem: Result := MsgfpErrFailedWriteMem;
fpErrCanNotWriteMemAtAddr: Result := MsgfpErrCanNotWriteMemAtAddr;
fpErrLocationParser: Result := MsgfpErrLocationParser;
fpErrLocationParserMemRead: Result := MsgfpErrLocationParserMemRead;

View File

@ -17,13 +17,29 @@ msgstr ""
#: fperrormessages.msgfperrcannotreadmemataddr
#, object-pascal-format
msgctxt "fperrormessages.msgfperrcannotreadmemataddr"
msgid "Failed to read Mem at Address $%1:x"
msgstr ""
#: fperrormessages.msgfperrcannotwritememataddr
#, object-pascal-format
msgctxt "fperrormessages.msgfperrcannotwritememataddr"
msgid "Failed to read Mem at Address $%1:x"
msgstr ""
#: fperrormessages.msgfperrchangevariablenotsupported
msgid "Changing the value of this variable is not supported"
msgstr ""
#: fperrormessages.msgfperrfailedreadregiseter
msgid "Failed to read data from register"
msgstr ""
#: fperrormessages.msgfperrfailedwritemem
msgctxt "fperrormessages.msgfperrfailedwritemem"
msgid "Failed to write data"
msgstr ""
#: fperrormessages.msgfperrinvalidnumber
#, object-pascal-format
msgid "Cannot parse number: %1:s"
@ -101,8 +117,8 @@ msgstr ""
msgid "Internal error: Missing data location"
msgstr ""
#: fperrormessages.msgfpinternalerrfailedwritemem
msgid "Failed to write data"
#: fperrormessages.msgfpinternalerrcannotwriteinvalidmem
msgid "Internal error writing data: Missing data location"
msgstr ""
#: fperrormessages.msgfpinternalerrfperrfailedreadmem

View File

@ -28,13 +28,29 @@ msgstr "Impossível desreferenciar Expressão \"%1:s\""
#: fperrormessages.msgfperrcannotreadmemataddr
#, object-pascal-format
msgctxt "fperrormessages.msgfperrcannotreadmemataddr"
msgid "Failed to read Mem at Address $%1:x"
msgstr "Falha ao ler memória no endereço $%1:x"
#: fperrormessages.msgfperrcannotwritememataddr
#, object-pascal-format, fuzzy
msgctxt "fperrormessages.msgfperrcannotwritememataddr"
msgid "Failed to read Mem at Address $%1:x"
msgstr "Falha ao ler memória no endereço $%1:x"
#: fperrormessages.msgfperrchangevariablenotsupported
msgid "Changing the value of this variable is not supported"
msgstr ""
#: fperrormessages.msgfperrfailedreadregiseter
msgid "Failed to read data from register"
msgstr "Falha ao ler dados do registrador"
#: fperrormessages.msgfperrfailedwritemem
msgctxt "fperrormessages.msgfperrfailedwritemem"
msgid "Failed to write data"
msgstr ""
#: fperrormessages.msgfperrinvalidnumber
#, object-pascal-format
msgid "Cannot parse number: %1:s"
@ -112,8 +128,8 @@ msgstr "Impossível acessar elemento indexado na expressão %1:s"
msgid "Internal error: Missing data location"
msgstr "Erro interno: Localização dos dados faltando"
#: fperrormessages.msgfpinternalerrfailedwritemem
msgid "Failed to write data"
#: fperrormessages.msgfpinternalerrcannotwriteinvalidmem
msgid "Internal error writing data: Missing data location"
msgstr ""
#: fperrormessages.msgfpinternalerrfperrfailedreadmem

View File

@ -27,13 +27,29 @@ msgstr "Невозможно разыменовать выражение \"%1:s\
#: fperrormessages.msgfperrcannotreadmemataddr
#, object-pascal-format
msgctxt "fperrormessages.msgfperrcannotreadmemataddr"
msgid "Failed to read Mem at Address $%1:x"
msgstr "Не удалось прочитать память по адресу $%1:x"
#: fperrormessages.msgfperrcannotwritememataddr
#, object-pascal-format, fuzzy
msgctxt "fperrormessages.msgfperrcannotwritememataddr"
msgid "Failed to read Mem at Address $%1:x"
msgstr "Не удалось прочитать память по адресу $%1:x"
#: fperrormessages.msgfperrchangevariablenotsupported
msgid "Changing the value of this variable is not supported"
msgstr ""
#: fperrormessages.msgfperrfailedreadregiseter
msgid "Failed to read data from register"
msgstr "Не удалось прочитать данные из регистра"
#: fperrormessages.msgfperrfailedwritemem
msgctxt "fperrormessages.msgfperrfailedwritemem"
msgid "Failed to write data"
msgstr ""
#: fperrormessages.msgfperrinvalidnumber
#, object-pascal-format
msgid "Cannot parse number: %1:s"
@ -111,8 +127,8 @@ msgstr "Невозможно получить доступ к элементу
msgid "Internal error: Missing data location"
msgstr "Внутренняя ошибка: неизвестно расположение данных"
#: fperrormessages.msgfpinternalerrfailedwritemem
msgid "Failed to write data"
#: fperrormessages.msgfpinternalerrcannotwriteinvalidmem
msgid "Internal error writing data: Missing data location"
msgstr ""
#: fperrormessages.msgfpinternalerrfperrfailedreadmem