Debugger: put some common types into DbgIntf

git-svn-id: trunk@44080 -
This commit is contained in:
martin 2014-02-15 01:42:00 +00:00
parent 3f415797e4
commit 5612452b40
4 changed files with 26 additions and 12 deletions

View File

@ -7,7 +7,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, fpcunit, testutils, testregistry, Classes, SysUtils, FileUtil, fpcunit, testutils, testregistry,
EnvironmentOpts, TransferMacros, LCLProc, LazLogger, CompileHelpers, Dialogs, ExtToolDialog, EnvironmentOpts, TransferMacros, LCLProc, LazLogger, CompileHelpers, Dialogs, ExtToolDialog,
Debugger, GDBMIDebugger; Debugger, GDBMIDebugger, FpGdbmiDebugger;
(* (*
fpclist.txt contains lines of format: fpclist.txt contains lines of format:
@ -387,6 +387,7 @@ end;
function TGDBTestCase.GdbClass: TGDBMIDebuggerClass; function TGDBTestCase.GdbClass: TGDBMIDebuggerClass;
begin begin
Result := TGDBMIDebugger; Result := TGDBMIDebugger;
//Result := TFPGDBMIDebugger;
end; end;
procedure TGDBTestCase.DoDbgOut(Sender: TObject; S: string; var Handled: Boolean); procedure TGDBTestCase.DoDbgOut(Sender: TObject; S: string; var Handled: Boolean);
@ -1266,6 +1267,10 @@ initialization
DebugLogger.FindOrRegisterLogGroup('DBGMI_TYPE_INFO', True )^.Enabled := True; DebugLogger.FindOrRegisterLogGroup('DBGMI_TYPE_INFO', True )^.Enabled := True;
DebugLogger.FindOrRegisterLogGroup('DBGMI_TIMEOUT_DEBUG', True )^.Enabled := True; DebugLogger.FindOrRegisterLogGroup('DBGMI_TIMEOUT_DEBUG', True )^.Enabled := True;
DebugLogger.FindOrRegisterLogGroup('FPDBG_DWARF_SEARCH', True)^.Enabled := True;
DebugLogger.FindOrRegisterLogGroup('FPDBG_DWARF_WARNINGS', True)^.Enabled := True;
//FPDBG_DWARF_VERBOSE
AppDir := AppendPathDelim(ExtractFilePath(Paramstr(0))); AppDir := AppendPathDelim(ExtractFilePath(Paramstr(0)));
if not(CheckAppDir(AppDir)) if not(CheckAppDir(AppDir))

View File

@ -5,7 +5,7 @@ unit TestBreakPoint;
interface interface
uses uses
SysUtils, fpcunit, testutils, testregistry, TestGDBMIControl, SysUtils, fpcunit, testutils, testregistry, TestGDBMIControl, DbgIntfBaseTypes,
TestBase, Debugger, GDBMIDebugger, LCLProc, TestWatches; TestBase, Debugger, GDBMIDebugger, LCLProc, TestWatches;
type type

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, fpcunit, testutils, testregistry, LCLProc, Classes, SysUtils, fpcunit, testutils, testregistry, LCLProc,
GDBMIDebugger, Debugger, DebugManager, maps; DbgIntfBaseTypes, GDBMIDebugger, Debugger, DebugManager, maps;
type type
TTestDisAssRegion = record TTestDisAssRegion = record

View File

@ -5,7 +5,7 @@ unit TestWatches;
interface interface
uses uses
Classes, SysUtils, fpcunit, testutils, testregistry, TestGDBMIControl, Classes, SysUtils, fpcunit, testutils, testregistry, TestGDBMIControl, DbgIntfBaseTypes,
TestBase, Debugger, GDBMIDebugger, LCLProc, SynRegExpr, Forms, StdCtrls, Controls; TestBase, Debugger, GDBMIDebugger, LCLProc, SynRegExpr, Forms, StdCtrls, Controls;
const const
@ -1311,6 +1311,13 @@ begin
// maybe typename = "set of TEnum" // maybe typename = "set of TEnum"
AddFmtDef('VarEnumSetA', '^\[Three\]$', skSet, '', [IgnDwrf2IfNoSet]); AddFmtDef('VarEnumSetA', '^\[Three\]$', skSet, '', [IgnDwrf2IfNoSet]);
AddFmtDef('VarSetA', '^\[s2\]$', skSet, '', [IgnDwrf2IfNoSet]); AddFmtDef('VarSetA', '^\[s2\]$', skSet, '', [IgnDwrf2IfNoSet]);
AddFmtDef('GlobSubEnum', '^Two$', skEnum, '', []);
AddFmtDef('GlobSubRange1', '^55$', skSimple, '9..77', []);
//some gdb report 248 (stabs <= 7.2.1 // )
AddFmtDef('GlobSubRange2', '.', skSimple, '-9..-7', []);
{%endregion * Enum/Set * } {%endregion * Enum/Set * }
{%region * Variant * } {%region * Variant * }
@ -2015,11 +2022,9 @@ var
end; end;
procedure TestWatch(Name: String; AWatch: TCurrentWatch; Data: TWatchExpectation; WatchValue: String = ''); procedure TestWatch(Name: String; AWatch: TCurrentWatch; Data: TWatchExpectation; WatchValue: String = '');
const KindName: array [TDBGSymbolKind] of string =
('skClass', 'skRecord', 'skEnum', 'skSet', 'skProcedure', 'skFunction', 'skSimple', 'skPointer', 'skVariant');
var var
rx: TRegExpr; rx: TRegExpr;
s: String; s, s2: String;
flag, IsValid, HasTpInfo, f2: Boolean; flag, IsValid, HasTpInfo, f2: Boolean;
WV: TWatchValue; WV: TWatchValue;
Stack: Integer; Stack: Integer;
@ -2096,13 +2101,14 @@ var
// Check TypeInfo // Check TypeInfo
s:=''; s:='';
if HasTpInfo then s := KindName[WV.TypeInfo.Kind]; if HasTpInfo then WriteStr(s, WV.TypeInfo.Kind);
WriteStr(s2, DataRes.ExpKind);
IgnoreText := ''; if IgnoreKind then IgnoreText := 'Ignored by flag'; IgnoreText := ''; if IgnoreKind then IgnoreText := 'Ignored by flag';
if IsValid and HasTpInfo then begin if IsValid and HasTpInfo then begin
if (not IgnoreKind) and IgnoreKindPtr and (WV.TypeInfo.Kind = skPointer) then IgnoreText := 'Ignored by flag (Kind may be Ptr)'; if (not IgnoreKind) and IgnoreKindPtr and (WV.TypeInfo.Kind = skPointer) then IgnoreText := 'Ignored by flag (Kind may be Ptr)';
f2 := TestEquals(Name + ' Kind', KindName[DataRes.ExpKind], KindName[WV.TypeInfo.Kind], DataRes.MinGdb, DataRes.MinFpc, IgnoreText); f2 := TestEquals(Name + ' Kind', s2, s, DataRes.MinGdb, DataRes.MinFpc, IgnoreText);
end else begin end else begin
f2 := TestTrue(Name + ' Kind is "'+KindName[DataRes.ExpKind]+'", failed: STATE was <'+dbgs(WV.Validity)+'>, HasTypeInfo='+dbgs(HasTpInfo)+' Val="'+s+'"', False, DataRes.MinGdb, DataRes.MinFpc, IgnoreText); f2 := TestTrue(Name + ' Kind is "'+s2+'", failed: STATE was <'+dbgs(WV.Validity)+'>, HasTypeInfo='+dbgs(HasTpInfo)+' Val="'+s+'"', False, DataRes.MinGdb, DataRes.MinFpc, IgnoreText);
end; end;
if (not f2) and IgnoreAll then exit; // failed Data, do not list others as potential unexpected success if (not f2) and IgnoreAll then exit; // failed Data, do not list others as potential unexpected success
@ -2112,7 +2118,7 @@ var
if IsValid and HasTpInfo then begin if IsValid and HasTpInfo then begin
s:=''; s:='';
if HasTpInfo then s := WV.TypeInfo.TypeName; if HasTpInfo then s := WV.TypeInfo.TypeName;
CmpNames('TypeName', DataRes.ExpTypeName, s, fTpMtch in DataRes.Flgs); CmpNames(Name+' TypeName', DataRes.ExpTypeName, s, fTpMtch in DataRes.Flgs);
//if fTpMtch in DataRes.Flgs //if fTpMtch in DataRes.Flgs
//then begin //then begin
// rx := TRegExpr.Create; // rx := TRegExpr.Create;
@ -2138,8 +2144,11 @@ var
DataRes.MinGdb, DataRes.MinFpc, IgnoreText);; DataRes.MinGdb, DataRes.MinFpc, IgnoreText);;
if j >= 0 then begin if j >= 0 then begin
fld := WV.TypeInfo.Fields[j]; fld := WV.TypeInfo.Fields[j];
WriteStr(s, MemberTests[i].ExpKind);
WriteStr(s2, fld.DBGType.Kind);
if fld.DBGType <> nil then begin if fld.DBGType <> nil then begin
TestTrue(Name + ' members with name ' + MemberTests[i].Name + ' type=' + KindName[MemberTests[i].ExpKind] + ' but was ' + KindName[fld.DBGType.Kind], TestTrue(Name + ' members with name ' + MemberTests[i].Name + ' type='
+ s + ' but was ' + s2,
MemberTests[i].ExpKind = fld.DBGType.Kind, DataRes.MinGdb, DataRes.MinFpc, IgnoreText);; MemberTests[i].ExpKind = fld.DBGType.Kind, DataRes.MinGdb, DataRes.MinFpc, IgnoreText);;
CmpNames(Name + ' members with name ' + MemberTests[i].Name + 'TypeName', CmpNames(Name + ' members with name ' + MemberTests[i].Name + 'TypeName',
MemberTests[i].ExpTypeName, fld.DBGType.TypeName, fTpMtch in MemberTests[i].Flgs); MemberTests[i].ExpTypeName, fld.DBGType.TypeName, fTpMtch in MemberTests[i].Flgs);