Debugger: Add text messages for RunErrors

git-svn-id: trunk@63382 -
This commit is contained in:
martin 2020-06-17 16:52:46 +00:00
parent 8f89ad7b07
commit 63b7ef5df1
8 changed files with 146 additions and 10 deletions

1
.gitattributes vendored
View File

@ -1290,6 +1290,7 @@ components/debuggerintf/Makefile svneol=native#text/plain
components/debuggerintf/Makefile.compiled svneol=native#text/plain
components/debuggerintf/Makefile.fpc svneol=native#text/plain
components/debuggerintf/dbgintfbasetypes.pas svneol=native#text/pascal
components/debuggerintf/dbgintfcommonstrings.pas svneol=native#text/pascal
components/debuggerintf/dbgintfdebuggerbase.pp svneol=native#text/pascal
components/debuggerintf/dbgintfmiscclasses.pas svneol=native#text/pascal
components/debuggerintf/dbgintfpseudoterminal.pas svneol=native#text/pascal

View File

@ -0,0 +1,67 @@
unit DbgIntfCommonStrings;
{$mode objfpc}{$H+}
interface
resourcestring
rsRunErrorInvalidFunctionNumber = 'Invalid function number';
rsRunErrorFileNotFound = 'File not found';
rsRunErrorPathNotFound = 'Path not found';
rsRunErrorTooManyOpenFiles = 'Too many open files';
rsRunErrorFileAccessDenied = 'File access denied';
rsRunErrorInvalidFileHandle = 'Invalid file handle';
rsRunErrorInvalidFileAccessCode = 'Invalid file access code';
rsRunErrorInvalidDriveNumber = 'Invalid drive number';
rsRunErrorCannotRemoveCurrentDirect = 'Cannot remove current directory';
rsRunErrorCannotRenameAcrossDrives = 'Cannot rename across drives';
rsRunErrorDiskReadError = 'Disk read error';
rsRunErrorDiskWriteError = 'Disk write error';
rsRunErrorFileNotAssigned = 'File not assigned';
rsRunErrorFileNotOpen = 'File not open';
rsRunErrorFileNotOpenForInput = 'File not open for input';
rsRunErrorFileNotOpenForOutput = 'File not open for output';
rsRunErrorInvalidNumericFormat = 'Invalid numeric format';
rsRunErrorInvalidEnumeration = 'Invalid enumeration';
rsRunErrorDiskIsWriteProtected = 'Disk is write-protected';
rsRunErrorBadDriveRequestStructLeng = 'Bad drive request struct length';
rsRunErrorDriveNotReady = 'Drive not ready';
rsRunErrorCRCErrorInData = 'CRC error in data';
rsRunErrorDiskSeekError = 'Disk seek error';
rsRunErrorUnknownMediaType = 'Unknown media type';
rsRunErrorSectorNotFound = 'Sector Not Found';
rsRunErrorPrinterOutOfPaper = 'Printer out of paper';
rsRunErrorDeviceWriteFault = 'Device write fault';
rsRunErrorDeviceReadFault = 'Device read fault';
rsRunErrorHardwareFailure = 'Hardware failure';
rsRunErrorDivisionByZero = 'Division by zero';
rsRunErrorRangeCheckError = 'Range check error';
rsRunErrorStackOverflowError = 'Stack overflow error';
rsRunErrorHeapOverflowError = 'Heap overflow error';
rsRunErrorInvalidPointerOperation = 'Invalid pointer operation';
rsRunErrorFloatingPointOverflow = 'Floating point overflow';
rsRunErrorFloatingPointUnderflow = 'Floating point underflow';
rsRunErrorInvalidFloatingPointOpera = 'Invalid floating point operation';
rsRunErrorObjectNotInitialized = 'Object not initialized';
rsRunErrorCallToAbstractMethod = 'Call to abstract method';
rsRunErrorStreamRegistrationError = 'Stream registration error';
rsRunErrorCollectionIndexOutOfRange = 'Collection index out of range';
rsRunErrorCollectionOverflowError = 'Collection overflow error';
rsRunErrorArithmeticOverflowError = 'Arithmetic overflow error';
rsRunErrorGeneralProtectionFault = 'General Protection fault';
rsRunErrorUnhandledExceptionOccurre = 'Unhandled exception occurred';
rsRunErrorInvalidValueSpecified = 'Invalid value specified';
rsRunErrorInvalidTypecast = 'Invalid typecast';
rsRunErrorVariantDispatchError = 'Variant dispatch error';
rsRunErrorVariantArrayCreate = 'Variant array create';
rsRunErrorVariantIsNotAnArray = 'Variant is not an array';
rsRunErrorVarArrayBoundsCheckError = 'Var Array Bounds check error';
rsRunErrorAssertionFailedError = 'Assertion failed error';
rsRunErrorSafecallErrorCheck = 'Safecall error check';
rsRunErrorExceptionStackCorrupted = 'Exception stack corrupted';
rsRunErrorThreadsNotSupported = 'Threads not supported';
implementation
end.

View File

@ -50,7 +50,7 @@ uses
// LazUtils
LazClasses, LazLoggerBase, LazFileUtils, LazStringUtils, Maps, LazMethodList,
// DebuggerIntf
DbgIntfBaseTypes, DbgIntfMiscClasses, DbgIntfPseudoTerminal;
DbgIntfBaseTypes, DbgIntfMiscClasses, DbgIntfPseudoTerminal, DbgIntfCommonStrings;
const
DebuggerIntfVersion = 0;
@ -1855,6 +1855,7 @@ type
FReleaseLock: Integer;
procedure DebuggerEnvironmentChanged(Sender: TObject);
procedure EnvironmentChanged(Sender: TObject);
function GetRunErrorText(ARunError: Integer): string;
//function GetUnitInfoProvider: TDebuggerUnitInfoProvider;
function GetState: TDBGState;
function ReqCmd(const ACommand: TDBGCommand;
@ -1975,6 +1976,7 @@ type
write SetDebuggerEnvironment; // The environment passed to the debugger process
property Environment: TStrings read FEnvironment write SetEnvironment; // The environment passed to the debuggee
property Exceptions: TBaseExceptions read FExceptions write FExceptions; // A list of exceptions we should ignore
property RunErrorText [ARunError: Integer]: string read GetRunErrorText;
property ExitCode: Integer read FExitCode;
property ExternalDebugger: String read FExternalDebugger; // The name of the debugger executable
property FileName: String read FFileName write SetFileName; // The name of the exe to be debugged
@ -6076,6 +6078,68 @@ begin
FCurEnvironment.Assign(FEnvironment);
end;
function TDebuggerIntf.GetRunErrorText(ARunError: Integer): string;
begin
Result := '';
case ARunError of
1: Result := rsRunErrorInvalidFunctionNumber;
2: Result := rsRunErrorFileNotFound;
3: Result := rsRunErrorPathNotFound;
4: Result := rsRunErrorTooManyOpenFiles;
5: Result := rsRunErrorFileAccessDenied;
6: Result := rsRunErrorInvalidFileHandle;
12: Result := rsRunErrorInvalidFileAccessCode;
15: Result := rsRunErrorInvalidDriveNumber;
16: Result := rsRunErrorCannotRemoveCurrentDirect;
17: Result := rsRunErrorCannotRenameAcrossDrives;
100: Result := rsRunErrorDiskReadError;
101: Result := rsRunErrorDiskWriteError;
102: Result := rsRunErrorFileNotAssigned;
103: Result := rsRunErrorFileNotOpen;
104: Result := rsRunErrorFileNotOpenForInput;
105: Result := rsRunErrorFileNotOpenForOutput;
106: Result := rsRunErrorInvalidNumericFormat;
107: Result := rsRunErrorInvalidEnumeration;
150: Result := rsRunErrorDiskIsWriteProtected;
151: Result := rsRunErrorBadDriveRequestStructLeng;
152: Result := rsRunErrorDriveNotReady;
154: Result := rsRunErrorCRCErrorInData;
156: Result := rsRunErrorDiskSeekError;
157: Result := rsRunErrorUnknownMediaType;
158: Result := rsRunErrorSectorNotFound;
159: Result := rsRunErrorPrinterOutOfPaper;
160: Result := rsRunErrorDeviceWriteFault;
161: Result := rsRunErrorDeviceReadFault;
162: Result := rsRunErrorHardwareFailure;
200: Result := rsRunErrorDivisionByZero;
201: Result := rsRunErrorRangeCheckError;
202: Result := rsRunErrorStackOverflowError;
203: Result := rsRunErrorHeapOverflowError;
204: Result := rsRunErrorInvalidPointerOperation;
205: Result := rsRunErrorFloatingPointOverflow;
206: Result := rsRunErrorFloatingPointUnderflow;
207: Result := rsRunErrorInvalidFloatingPointOpera;
210: Result := rsRunErrorObjectNotInitialized;
211: Result := rsRunErrorCallToAbstractMethod;
212: Result := rsRunErrorStreamRegistrationError;
213: Result := rsRunErrorCollectionIndexOutOfRange;
214: Result := rsRunErrorCollectionOverflowError;
215: Result := rsRunErrorArithmeticOverflowError;
216: Result := rsRunErrorGeneralProtectionFault;
217: Result := rsRunErrorUnhandledExceptionOccurre;
218: Result := rsRunErrorInvalidValueSpecified;
219: Result := rsRunErrorInvalidTypecast;
222: Result := rsRunErrorVariantDispatchError;
223: Result := rsRunErrorVariantArrayCreate;
224: Result := rsRunErrorVariantIsNotAnArray;
225: Result := rsRunErrorVarArrayBoundsCheckError;
227: Result := rsRunErrorAssertionFailedError;
229: Result := rsRunErrorSafecallErrorCheck;
231: Result := rsRunErrorExceptionStackCorrupted;
232: Result := rsRunErrorThreadsNotSupported;
end;
end;
function TDebuggerIntf.GetPseudoTerminal: TPseudoTerminal;
begin
Result := nil;

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<Package Version="4">
<Package Version="5">
<PathDelim Value="\"/>
<Name Value="DebuggerIntf"/>
<Type Value="RunAndDesignTime"/>
@ -27,7 +27,7 @@
Provides an interface to add debuggers to the IDE"/>
<License Value="GPL-2"/>
<Version Minor="1"/>
<Files Count="5">
<Files Count="6">
<Item1>
<Filename Value="dbgintfbasetypes.pas"/>
<UnitName Value="DbgIntfBaseTypes"/>
@ -46,8 +46,12 @@ Provides an interface to add debuggers to the IDE"/>
</Item4>
<Item5>
<Filename Value="dbgintfpseudoterminal.pas"/>
<UnitName Value="dbgintfpseudoterminal"/>
<UnitName Value="DbgIntfPseudoTerminal"/>
</Item5>
<Item6>
<Filename Value="dbgintfcommonstrings.pas"/>
<UnitName Value="DbgIntfCommonStrings"/>
</Item6>
</Files>
<RequiredPkgs Count="1">
<Item1>

View File

@ -9,7 +9,7 @@ interface
uses
DbgIntfBaseTypes, DbgIntfDebuggerBase, DbgIntfMiscClasses, IDEMiniLibC,
DbgIntfPseudoTerminal, LazarusPackageIntf;
DbgIntfPseudoTerminal, DbgIntfCommonStrings, LazarusPackageIntf;
implementation

View File

@ -6186,7 +6186,7 @@ function TGDBMIDebuggerCommandExecute.ProcessStopped(const AParams: String;
exit;
end;
FTheDebugger.DoException(deRunError, ExceptName, Location, '', CanContinue);
FTheDebugger.DoException(deRunError, ExceptName, Location, FTheDebugger.RunErrorText[ErrorNo], CanContinue);
if CanContinue
then begin
//ExecuteCommand('-exec-continue')
@ -6226,7 +6226,7 @@ function TGDBMIDebuggerCommandExecute.ProcessStopped(const AParams: String;
exit;
end;
FTheDebugger.DoException(deRunError, ExceptName, Location, '', CanContinue);
FTheDebugger.DoException(deRunError, ExceptName, Location, FTheDebugger.RunErrorText[ErrorNo], CanContinue);
if CanContinue
then begin
//ExecuteCommand('-exec-continue')

View File

@ -2700,7 +2700,7 @@ begin
exit;
end;
DoException(deRunError, ExceptName, ExceptionLocation, '', continue);
DoException(deRunError, ExceptName, ExceptionLocation, RunErrorText[ErrNo], continue);
if not &continue then begin
EnterPause(ExceptionLocation);
@ -2731,7 +2731,7 @@ begin
exit;
end;
DoException(deRunError, ExceptName, ExceptionLocation, '', continue);
DoException(deRunError, ExceptName, ExceptionLocation, RunErrorText[ErrNo], continue);
if not &continue then begin
EnterPause(ExceptionLocation);

View File

@ -927,7 +927,7 @@ const
exit;
end;
Debugger.DoException(deRunError, ExceptName, Debugger.FCurrentLocation, '', CanContinue);
Debugger.DoException(deRunError, ExceptName, Debugger.FCurrentLocation, Debugger.RunErrorText[ErrNo], CanContinue);
if CanContinue
then begin
FState := crStoppedRaise;