diff --git a/debugger/debugger.pp b/debugger/debugger.pp index 4db68671df..d4c674e210 100644 --- a/debugger/debugger.pp +++ b/debugger/debugger.pp @@ -452,7 +452,7 @@ type (******************************************************************************) type - TDBGSymbolKind = (skClass, skRecord, skEnum, skSet, skProcedure, skFunction, skSimple, skPointer); + TDBGSymbolKind = (skClass, skRecord, skEnum, skSet, skProcedure, skFunction, skSimple, skPointer, skVariant); TDBGFieldLocation = (flPrivate, flProtected, flPublic, flPublished); TDBGFieldFlag = (ffVirtual,ffConstructor,ffDestructor); TDBGFieldFlags = set of TDBGFieldFlag; diff --git a/debugger/gdbmidebugger.pp b/debugger/gdbmidebugger.pp index 630339cca4..a343a75863 100644 --- a/debugger/gdbmidebugger.pp +++ b/debugger/gdbmidebugger.pp @@ -2365,11 +2365,10 @@ begin end; end; + skVariant: begin + AResult := GetVariantValue(AResult); + end; skRecord: begin - if (ResultInfo.TypeName = 'Variant') or - (ResultInfo.TypeName = 'VARIANT') then - AResult := GetVariantValue(AResult) - else if (ResultInfo.TypeName = 'ShortString') or (ResultInfo.TypeName = 'SHORTSTRING') then AResult := AResult // don't show 'record ShortString' as this is debug info implementation details diff --git a/debugger/gdbtypeinfo.pp b/debugger/gdbtypeinfo.pp index da7714053d..5fefa5c7e2 100644 --- a/debugger/gdbtypeinfo.pp +++ b/debugger/gdbtypeinfo.pp @@ -261,7 +261,12 @@ var S: String; Field: TDBGField; begin - FKind := skRecord; + if (FTypeName = 'Variant') or + (FTypeName = 'VARIANT') then + FKind := skVariant + else + FKind := skRecord; + FFields := TDBGFields.Create; //concatenate all lines and skip last end diff --git a/debugger/inspectdlg.lfm b/debugger/inspectdlg.lfm index 28e5f68dfb..fd104ed74d 100644 --- a/debugger/inspectdlg.lfm +++ b/debugger/inspectdlg.lfm @@ -9,7 +9,9 @@ inherited IDEInspectDlg: TIDEInspectDlg ClientWidth = 295 Constraints.MinHeight = 200 Constraints.MinWidth = 200 + KeyPreview = True OnClose = FormClose + OnKeyDown = FormKeyDown object StatusBar1: TStatusBar[0] Left = 0 Height = 23 diff --git a/debugger/inspectdlg.lrs b/debugger/inspectdlg.lrs index 700c634a3f..796e334d02 100644 --- a/debugger/inspectdlg.lrs +++ b/debugger/inspectdlg.lrs @@ -4,15 +4,15 @@ LazarusResources.Add('TIDEInspectDlg','FORMDATA',[ 'TPF0'#241#14'TIDEInspectDlg'#13'IDEInspectDlg'#4'Left'#3'n'#1#6'Height'#3#151 +#1#3'Top'#3#185#0#5'Width'#3''''#1#11'BorderStyle'#7#13'bsSizeToolWin'#7'Cap' +'tion'#6#13'IDEInspectDlg'#12'ClientHeight'#3#151#1#11'ClientWidth'#3''''#1 - +#21'Constraints.MinHeight'#3#200#0#20'Constraints.MinWidth'#3#200#0#7'OnClos' - +'e'#7#9'FormClose'#0#242#2#0#10'TStatusBar'#10'StatusBar1'#4'Left'#2#0#6'Hei' - +'ght'#2#23#3'Top'#3#128#1#5'Width'#3''''#1#6'Panels'#14#0#0#0#242#2#1#12'TPa' - +'geControl'#11'PageControl'#4'Left'#2#0#6'Height'#3'k'#1#3'Top'#2#21#5'Width' - +#3''''#1#10'ActivePage'#7#8'DataPage'#5'Align'#7#8'alClient'#8'TabIndex'#2#0 - +#8'TabOrder'#2#1#0#9'TTabSheet'#8'DataPage'#7'Caption'#6#8'DataPage'#0#0#9'T' - +'TabSheet'#14'PropertiesPage'#7'Caption'#6#14'PropertiesPage'#0#0#9'TTabShee' - +'t'#11'MethodsPage'#7'Caption'#6#11'MethodsPage'#0#0#0#242#2#2#5'TEdit'#13'E' - +'ditInspected'#4'Left'#2#0#6'Height'#2#21#3'Top'#2#0#5'Width'#3''''#1#5'Alig' - +'n'#7#5'alTop'#7'Enabled'#8#8'ReadOnly'#9#8'TabOrder'#2#2#4'Text'#6#5'(...)' - +#0#0#0 + +#21'Constraints.MinHeight'#3#200#0#20'Constraints.MinWidth'#3#200#0#10'KeyPr' + +'eview'#9#7'OnClose'#7#9'FormClose'#9'OnKeyDown'#7#11'FormKeyDown'#0#242#2#0 + +#10'TStatusBar'#10'StatusBar1'#4'Left'#2#0#6'Height'#2#23#3'Top'#3#128#1#5'W' + +'idth'#3''''#1#6'Panels'#14#0#0#0#242#2#1#12'TPageControl'#11'PageControl'#4 + +'Left'#2#0#6'Height'#3'k'#1#3'Top'#2#21#5'Width'#3''''#1#10'ActivePage'#7#8 + +'DataPage'#5'Align'#7#8'alClient'#8'TabIndex'#2#0#8'TabOrder'#2#1#0#9'TTabSh' + +'eet'#8'DataPage'#7'Caption'#6#8'DataPage'#0#0#9'TTabSheet'#14'PropertiesPag' + +'e'#7'Caption'#6#14'PropertiesPage'#0#0#9'TTabSheet'#11'MethodsPage'#7'Capti' + +'on'#6#11'MethodsPage'#0#0#0#242#2#2#5'TEdit'#13'EditInspected'#4'Left'#2#0#6 + +'Height'#2#21#3'Top'#2#0#5'Width'#3''''#1#5'Align'#7#5'alTop'#7'Enabled'#8#8 + +'ReadOnly'#9#8'TabOrder'#2#2#4'Text'#6#5'(...)'#0#0#0 ]); diff --git a/debugger/inspectdlg.pas b/debugger/inspectdlg.pas index 0ffc58aa30..5a86650e80 100644 --- a/debugger/inspectdlg.pas +++ b/debugger/inspectdlg.pas @@ -30,7 +30,7 @@ interface uses Classes, SysUtils, TypInfo, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, ComCtrls, ObjectInspector, PropEdits, Debugger, DebuggerDlg, BaseDebugManager, - LazarusIDEStrConsts, IDEWindowIntf,LCLProc,Grids, StdCtrls; + LazarusIDEStrConsts, IDEWindowIntf, LCLProc, LCLType, Grids, StdCtrls; type @@ -53,6 +53,7 @@ type PropertiesPage: TTabSheet; MethodsPage: TTabSheet; procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); + procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); private FDataGridHook, FPropertiesGridHook, @@ -68,6 +69,7 @@ type procedure Localize; procedure InspectClass; procedure InspectRecord; + procedure InspectVariant; procedure InspectSimple; procedure InspectPointer; procedure GridDataSetup; @@ -90,6 +92,13 @@ begin IDEDialogLayoutList.SaveLayout(Self); end; +procedure TIDEInspectDlg.FormKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin + if Key = VK_ESCAPE then + Close; +end; + procedure TIDEInspectDlg.Localize; begin Caption := lisInspectDialog; @@ -100,9 +109,9 @@ end; procedure TIDEInspectDlg.InspectClass; begin - DataPage.Visible:=true; - PropertiesPage.Visible:=false; - MethodsPage.Visible:=true; + DataPage.TabVisible:=true; + PropertiesPage.TabVisible:=false; + MethodsPage.TabVisible:=true; if not Assigned(FDBGInfo) then exit; if not Assigned(FDBGInfo.Fields) then exit; @@ -117,20 +126,32 @@ begin FGridMethods.AutoSizeColumn(3); end; +procedure TIDEInspectDlg.InspectVariant; +begin + DataPage.TabVisible:=true; + PropertiesPage.TabVisible:=false; + MethodsPage.TabVisible:=false; + if not Assigned(FDBGInfo) then exit; + EditInspected.Text:=FExpression+' : Variant'; + GridDataSetup; + FGridData.Cells[0,1]:=FExpression; + FGridData.Cells[1,1]:='Variant'; + FGridData.Cells[2,1]:=FHumanReadable; + FGridData.AutoSizeColumn(1); +end; + procedure TIDEInspectDlg.InspectRecord; begin - DataPage.Visible:=true; - PropertiesPage.Visible:=false; - MethodsPage.Visible:=false; + DataPage.TabVisible:=true; + PropertiesPage.TabVisible:=false; + MethodsPage.TabVisible:=false; if not Assigned(FDBGInfo) then exit; if not Assigned(FDBGInfo.Fields) then exit; EditInspected.Text:=FExpression+' : '+FDBGInfo.TypeName; GridDataSetup; // handle special records - if (FDBGInfo.TypeName = 'VARIANT') or - (FDBGInfo.TypeName = 'Variant') or - (FDBGInfo.TypeName = 'ShortString') or + if (FDBGInfo.TypeName = 'ShortString') or (FDBGInfo.TypeName = 'SHORTSTRING') then begin FGridData.Cells[0,1]:=FExpression; @@ -144,6 +165,9 @@ end; procedure TIDEInspectDlg.InspectSimple; begin + DataPage.TabVisible:=true; + PropertiesPage.TabVisible:=false; + MethodsPage.TabVisible:=false; if not Assigned(FDBGInfo) then exit; EditInspected.Text:=FExpression+' : '+FDBGInfo.TypeName + ' = ' + FDBGInfo.Value.AsString; GridDataSetup; @@ -155,6 +179,9 @@ end; procedure TIDEInspectDlg.InspectPointer; begin + DataPage.TabVisible:=true; + PropertiesPage.TabVisible:=false; + MethodsPage.TabVisible:=false; if not Assigned(FDBGInfo) then exit; EditInspected.Text:=FExpression+' : ^'+FDBGInfo.TypeName + ' = ' + FDBGInfo.Value.AsString; GridDataSetup; @@ -251,6 +278,13 @@ begin FGridData.Cells[1,k]:='Record '+FDBGInfo.Fields[j].DBGType.TypeName; FGridData.Cells[2,k]:=FDBGInfo.Fields[j].DBGType.Value.AsString; end; + skVariant: + begin + inc(k); + FGridData.Cells[0,k]:=FDBGInfo.Fields[j].Name; + FGridData.Cells[1,k]:='Variant'; + FGridData.Cells[2,k]:=FDBGInfo.Fields[j].DBGType.Value.AsString; + end; skProcedure: begin end; @@ -376,6 +410,7 @@ begin case FDBGInfo.Kind of skClass: InspectClass(); skRecord: InspectRecord(); + skVariant: InspectVariant(); // skEnum: ; // skSet: ; // skProcedure: ;