From c6e18403ead63d28a894d89889c8637d9d1ca7ca Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sun, 18 Sep 2016 14:10:33 +0200 Subject: [PATCH] #97, update interface + call stack handling + start Registers --- icons/other/list.png | Bin 0 -> 317 bytes icons/other/pause.png | Bin 0 -> 317 bytes icons/other/play.png | Bin 0 -> 512 bytes icons/other/power.png | Bin 0 -> 635 bytes icons/other/processor.png | Bin 0 -> 680 bytes lazproj/coedit.lpi | 7 +- src/ce_gdb.lfm | 215 ++++++++++++++++----------------- src/ce_gdb.pas | 243 +++++++++++++++++++++++++++++++++++--- 8 files changed, 335 insertions(+), 130 deletions(-) create mode 100644 icons/other/list.png create mode 100644 icons/other/pause.png create mode 100644 icons/other/play.png create mode 100644 icons/other/power.png create mode 100644 icons/other/processor.png diff --git a/icons/other/list.png b/icons/other/list.png new file mode 100644 index 0000000000000000000000000000000000000000..663cbadddefa3c7f74f35faa702b752eb251f599 GIT binary patch literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#VfERCM0c#WBR9cj@HUTulxFt>;%oC#+8w zH~lQC^g^)d-50K`+HPs!MF>J^gu_&o~H*|uMF(z0Us2qZ0zYjpkm6i9%Mq0@;sLi!KF#R?B^F=+#Dm*VO+W)=YiSrW`ybK9Uh-w7lrl8VefEf;nx>8rM;(4N(Ox2W&Gnq>NYp9Zqq87yJ}?O^@J1+ z7>4G1KF8S9eb%lCvtxS$CvNOy3ILe(^4PQA7@fLD<&rXDyY_P-y_e)rLW%+k zu0z55Ij+si4-fe2O|z%z5I4uW>AQAL{=ESXp338^!mr7Eddj=(3!;r}jOG$_U+VY+ z(JUzIy~olPhBi^Y!dD)m^S@6e0)+jEP)PD0-b=#f(0}(%QBeaW3yU|V2 zowz6x0xE`RBa*af8VB=LhR#Rc%=k|5LDDY0aJZav&pnU#p5(eNr5+YZl4Vj9g*^Wt zNzw}N0pO1n$$AwGW69LMvH zX%e$6G7J};z@cLf-<|-Qr#p<@orwD~d|_HFS(Za040uZC8h%HXY|O;t&2LoHYvb|pN%;G&U>e3jt*ud`xvd+zUgn%E z)6Bhky_!P@hmN_{(z^b>087{F%x0vx%xmiUaYNGxfA84#G&(r+?%XoE{{8^dEUedB ztw7Kl=2y7M&7Q{A7PVBB(7~bmhrHnpb-M+BZveh%@$;8bHIf{S41@wVY}>xi<&zu( z=-|+UiFl;2R;j|@AHZ0)R#6w$zWpjkXU>gzPbcq4q2L=^qE&S8@cGo(&qAqOuhkde zCzNT=y9=m;MP(ebNIv_AOaMQBOGVw z#D(iL^WY_2di0JiKly|X4xNb3a>O|Hi2y9391ab^RQm9T<0I`Y;oCtMf`pX+slWQu Vlt1}gq3-|y002ovPDHLkV1h%1H?IHy literal 0 HcmV?d00001 diff --git a/icons/other/processor.png b/icons/other/processor.png new file mode 100644 index 0000000000000000000000000000000000000000..a1c423e3df7a6e65a702de68432ba1334e730601 GIT binary patch literal 680 zcmV;Z0$2TsP)6BVdguP2lFyqXtbp*aeCae?*O__2M5uB+~Vw3H5*%!IP$C z{js~LyZd}I?Y6Zv@iootyf@!B-^`l_Aq2ve&zxWkBiKC?ufublFNM3xXE8baE zpEO_%7d-<*7fjp!jcoQ6B9X`jFsY%sVoVvZEDN7kR`!< zm^T+lfelU5Fgh}dAP5*p0NNu0QsDbOTp7m-B(AI=HQzHhJZ9Qb8i8h}4HVZc1}`n; z@H(4?CJFc^q{1+ca8(79Zvj_IqrkD$Wtqw2+9R^&O|h7~8I65vn#%;JDY*UoV*+hQ z=czd)cV_AiR==*{a9SMb9sHl2YmI}vPa-GP!P@Zes$rr_4% zZup*qKc!M-a4X;@(@1^M^cGy{{Z>;DKRtZCbxX@}dJFObdEV(;Q^bZhAuELS%X#zi z>HTY{dyO5RX5-{^f0*tU$zuoNWXTWr8*E2eQr&Z=!#W#l@S9ou6<`22ASV16FUN}j O0000 - + @@ -103,6 +103,11 @@ + + + + + diff --git a/src/ce_gdb.lfm b/src/ce_gdb.lfm index 47503f08..0098f297 100644 --- a/src/ce_gdb.lfm +++ b/src/ce_gdb.lfm @@ -1,128 +1,37 @@ inherited CEGdbWidget: TCEGdbWidget Left = 640 - Height = 521 + Height = 625 Top = 213 Width = 517 ActiveControl = Back Caption = 'GDB commander' - ClientHeight = 521 + ClientHeight = 625 ClientWidth = 517 inherited Back: TPanel - Height = 521 + Height = 625 Width = 517 - ClientHeight = 521 + ClientHeight = 625 ClientWidth = 517 inherited Content: TPanel - Height = 485 + Height = 589 Width = 517 - ClientHeight = 485 + ClientHeight = 589 ClientWidth = 517 - object Panel1: TPanel[0] - Left = 2 - Height = 30 - Top = 2 - Width = 513 - Align = alTop - BorderSpacing.Around = 2 - BevelOuter = bvNone - ClientHeight = 30 - ClientWidth = 513 - PopupMenu = contextMenu - TabOrder = 0 - object btnStart: TBitBtn - Left = 2 - Height = 26 - Hint = 'start debugging' - Top = 2 - Width = 28 - Align = alLeft - BorderSpacing.Around = 2 - Layout = blGlyphBottom - OnClick = btnStartClick - Spacing = 0 - TabOrder = 0 - end - object lstfilter: TListFilterEdit - Left = 152 - Height = 26 - Top = 2 - Width = 359 - ButtonWidth = 28 - NumGlyphs = 1 - Align = alClient - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Around = 2 - MaxLength = 0 - TabOrder = 1 - end - object btnStop: TBitBtn - Left = 32 - Height = 26 - Hint = 'stop debuging' - Top = 2 - Width = 28 - Align = alLeft - BorderSpacing.Around = 2 - Layout = blGlyphBottom - OnClick = btnStopClick - Spacing = 0 - TabOrder = 2 - end - object btnCont: TBitBtn - Left = 62 - Height = 26 - Hint = 'continue debugging' - Top = 2 - Width = 28 - Align = alLeft - BorderSpacing.Around = 2 - Layout = blGlyphBottom - OnClick = btnContClick - Spacing = 0 - TabOrder = 3 - end - object btnReg: TBitBtn - Left = 92 - Height = 26 - Hint = 'view registers' - Top = 2 - Width = 28 - Align = alLeft - BorderSpacing.Around = 2 - Layout = blGlyphBottom - OnClick = btnRegClick - Spacing = 0 - TabOrder = 4 - end - object btnStack: TBitBtn - Left = 122 - Height = 26 - Hint = 'view call stack' - Top = 2 - Width = 28 - Align = alLeft - BorderSpacing.Around = 2 - Layout = blGlyphBottom - OnClick = btnStackClick - Spacing = 0 - TabOrder = 5 - end - end - object Panel2: TPanel[1] + object Panel2: TPanel[0] Left = 0 - Height = 451 - Top = 34 + Height = 589 + Top = 0 Width = 517 Align = alClient BevelOuter = bvNone Caption = 'Panel2' - ClientHeight = 451 + ClientHeight = 589 ClientWidth = 517 - TabOrder = 1 + TabOrder = 0 object Panel3: TPanel Left = 4 Height = 28 - Top = 419 + Top = 557 Width = 509 Align = alBottom BorderSpacing.Around = 4 @@ -135,28 +44,27 @@ inherited CEGdbWidget: TCEGdbWidget Height = 24 Hint = 'custom GDB command' Top = 2 - Width = 481 + Width = 477 Align = alClient BorderSpacing.Top = 2 BorderSpacing.Bottom = 2 OnKeyUp = Edit1KeyUp TabOrder = 0 end - object btnSendCom: TBitBtn - Left = 481 - Height = 28 - Top = 0 + object btnSendCom: TSpeedButton + Left = 479 + Height = 24 + Top = 2 Width = 28 Align = alRight - Layout = blGlyphBottom + BorderSpacing.Around = 2 OnClick = btnSendComClick - TabOrder = 1 end end object stateViewer: TTIPropertyGrid Left = 0 - Height = 415 - Top = 0 + Height = 313 + Top = 240 Width = 517 Align = alClient CheckboxForBoolean = True @@ -168,10 +76,93 @@ inherited CEGdbWidget: TCEGdbWidget SplitterX = 200 ValueFont.Color = clMaroon end + object lstCallStack: TListView + Left = 0 + Height = 240 + Top = 0 + Width = 517 + Align = alTop + Columns = <> + TabOrder = 2 + end end end inherited toolbar: TCEToolBar Width = 509 + object button0: TCEToolButton[0] + Left = 213 + Top = 0 + Caption = 'button0' + scaledSeparator = False + end + object button1: TCEToolButton[1] + Left = 185 + Top = 0 + Caption = 'button1' + scaledSeparator = False + end + object btnStack: TCEToolButton[2] + Left = 157 + Hint = 'view call stack' + Top = 0 + Caption = 'btnStack' + OnClick = btnStackClick + resourceName = 'LIST' + scaledSeparator = False + end + object btnReg: TCEToolButton[3] + Left = 129 + Hint = 'view CPU registers' + Top = 0 + Caption = 'btnReg' + OnClick = btnRegClick + resourceName = 'PROCESSOR' + scaledSeparator = False + end + object button4: TCEToolButton[4] + Left = 113 + Height = 28 + Top = 0 + Width = 16 + Caption = 'button4' + Style = tbsDivider + scaledSeparator = False + end + object btnPause: TCEToolButton[5] + Left = 85 + Hint = 'pause debugging' + Top = 0 + Caption = 'btnPause' + resourceName = 'PAUSE' + scaledSeparator = False + end + object btnStop: TCEToolButton[6] + Left = 29 + Hint = 'stop debugging' + Top = 0 + Caption = 'btnStop' + OnClick = btnStopClick + resourceName = 'CANCEL' + scaledSeparator = False + end + object btnContinue: TCEToolButton[7] + Left = 57 + Hint = 'continue debugging' + Top = 0 + Caption = 'btnContinue' + OnClick = btnContClick + resourceName = 'PLAY' + scaledSeparator = False + end + object btnStart: TCEToolButton[8] + Left = 1 + Hint = 'start debugging' + Top = 0 + Caption = 'btnStart' + OnClick = btnStartClick + resourceName = 'POWER' + scaledSeparator = False + end end end inherited contextMenu: TPopupMenu diff --git a/src/ce_gdb.pas b/src/ce_gdb.pas index dcb7537b..5c3d43cb 100644 --- a/src/ce_gdb.pas +++ b/src/ce_gdb.pas @@ -5,15 +5,14 @@ unit ce_gdb; interface uses - Classes, SysUtils, FileUtil, ListFilterEdit, Forms, Controls, Graphics, RegExpr, - ComCtrls, PropEdits, GraphPropEdits, RTTIGrids, Dialogs, ExtCtrls, Menus, strutils, - Buttons, StdCtrls, process ,ce_common, ce_interfaces, ce_widget, ce_processes, - ce_observer, ce_synmemo, ce_sharedres, ce_stringrange, fpjson; + Classes, SysUtils, FileUtil, ListFilterEdit, Forms, Controls, Graphics, + RegExpr, ComCtrls, PropEdits, GraphPropEdits, RTTIGrids, Dialogs, ExtCtrls, + Menus, strutils, Buttons, StdCtrls, process, ce_common, ce_interfaces, + ce_widget, ce_processes, ce_observer, ce_synmemo, ce_sharedres, + ce_stringrange, ce_dsgncontrols, fpjson; type - //TODO-cDebugging: write a parser for the DBG/MI output messages - {$IFDEF CPU64} TCpuRegister = (rax, rbx, rcx, rdx, rsi, rdi, rbp, rsp, r8, r9, r10, r11, r12, r13, r14, r15, rip); @@ -48,6 +47,38 @@ type TInspectableStack = class(Tpersistent) end; + TCEDebugWidgetOptions = class + fDemangle: boolean; + fShowCLI: boolean; + end; + + // Represents an item in the call stack + TStackItem = class(TCollectionItem) + strict private + fFilename: string; + fFname: string; + fAddress: PtrUInt; + fLine: integer; + public + procedure setProperties(addr: PtrUint; fname, nme: string; lne: integer); + property address: ptruint read fAddress; + property filename: string read fFilename; + property line: integer read fLine; + property name: string read fFname; + end; + + TStackItems = class + strict private + fItems: TCollection; + procedure listDblClick(sender: TObject); + public + constructor create; + destructor destroy; override; + procedure assignToList(list: TListView); + procedure addItem(addr: PtrUint; fname, nme: string; lne: integer); + procedure clear; + end; + // Stores the stack and the registers content, to be displayable in // an object inspector. @@ -181,17 +212,20 @@ type { TCEGdbWidget } TCEGdbWidget = class(TCEWidget, ICEProjectObserver, ICEDocumentObserver) - btnReg: TBitBtn; - btnStack: TBitBtn; - btnSendCom: TBitBtn; - btnStop: TBitBtn; - btnStart: TBitBtn; - btnCont: TBitBtn; + btnContinue: TCEToolButton; + btnPause: TCEToolButton; + btnReg: TCEToolButton; + btnStack: TCEToolButton; + btnStart: TCEToolButton; + btnStop: TCEToolButton; + button0: TCEToolButton; + button1: TCEToolButton; + button4: TCEToolButton; Edit1: TEdit; - lstfilter: TListFilterEdit; - Panel1: TPanel; + lstCallStack: TListView; Panel2: TPanel; Panel3: TPanel; + btnSendCom: TSpeedButton; stateViewer: TTIPropertyGrid; procedure btnContClick(Sender: TObject); procedure btnRegClick(Sender: TObject); @@ -200,6 +234,8 @@ type procedure btnStartClick(Sender: TObject); procedure btnStopClick(Sender: TObject); procedure Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); + protected + procedure setToolBarFlat(value: boolean); override; private fDoc: TCESynMemo; fProj: ICECommonProject; @@ -211,6 +247,7 @@ type fGdb: TCEProcess; fInspState: TInspectableState; fShowCLI: boolean; + fStackItems: TStackItems; // procedure startDebugging; procedure killGdb; @@ -245,6 +282,99 @@ type implementation {$R *.lfm} +{$REGION TStackItem/TStackItems ------------------------------------------------} +procedure TStackItem.setProperties(addr: PtrUint; fname, nme: string; lne: integer); +begin + fAddress:=addr; + fLine:=lne; + fFilename:=fname; + fFname:= nme; +end; + +constructor TStackItems.create; +begin + fItems := TCollection.Create(TStackItem); +end; + +destructor TStackItems.destroy; +begin + fItems.Free; + inherited; +end; + +procedure TStackItems.assignToList(list: TListView); +var + i: integer; + litm: TListItem; + sitm: TStackItem; +begin + list.Clear; + list.ReadOnly:=true; + list.GridLines:=true; + list.ViewStyle:= TViewStyle.vsReport; + if list.ColumnCount <> 3 then + begin + list.Columns.Clear; + list.Columns.Add; + list.Columns.Add; + list.Columns.Add; + end; + list.Column[0].MaxWidth:= 250; + list.Column[0].Caption:= 'function'; + list.Column[1].Caption:= 'address'; + list.Column[2].Caption:= 'filename'; + list.Column[0].AutoSize:= true; + list.Column[1].AutoSize:= true; + list.Column[2].AutoSize:= true; + list.OnDblClick:= @listDblClick; + for i:= 0 to fItems.Count-1 do + begin + litm := list.Items.Add; + sitm := TStackItem(fItems.Items[i]); + litm.Caption := sitm.name; + {$IFDEF CPU64} + litm.SubItems.Add(format('0x%.16X', [sitm.address])); + {$ELSE} + litm.SubItems.Add(format('0x%.8X', [sitm.address])); + {$ENDIF} + litm.SubItems.Add(shortenPath(sitm.filename)); + litm.Data:=sitm; + end; +end; + +procedure TStackItems.listDblClick(sender: TObject); +var + lst: TListView; + itm: TStackItem; + nme: string; + doc: TCESynMemo; +begin + if (sender.isNil) or not (sender is TListView) then + exit; + lst := TListView(sender); + if lst.Selected.isNil or lst.Selected.Data.isNil then + exit; + itm := TStackItem(lst.Selected.Data); + nme := itm.filename; + if not nme.fileExists then + exit; + getMultiDocHandler.openDocument(nme); + doc := getMultiDocHandler.findDocument(nme); + if doc.isNotNil then + doc.CaretY:= itm.line; +end; + +procedure TStackItems.addItem(addr: PtrUint; fname, nme: string; lne: integer); +begin + TStackItem(fItems.Add).setProperties(addr, fname, nme, lne); +end; + +procedure TStackItems.clear; +begin + fItems.Clear; +end; +{$ENDREGION} + {$REGION TInspectableState -----------------------------------------------------} function TCpuRegValueEditor.GetValue: ansistring; begin @@ -282,6 +412,7 @@ begin fInspState := TInspectableState.Create; stateViewer.TIObject := fInspState; fJson := TJsonObject.Create; + fStackItems := TStackItems.create; fShowCLI := true; // AssignPng(btnSendCom, 'ACCEPT'); @@ -294,9 +425,16 @@ begin killGdb; fInspState.Free; fJson.Free; + fStackItems.Free; EntitiesConnector.removeObserver(self); inherited; end; + +procedure TCEGdbWidget.setToolBarFlat(value: boolean); +begin + inherited setToolBarFLat(value); + btnSendCom.Flat:=value; +end; {$ENDREGION} {$REGION ICEProjectObserver ----------------------------------------------------} @@ -506,6 +644,11 @@ procedure parseGdbout(const str: string; var json: TJSONObject); exit; c := r^.front; case c of + 'a'..'z': + begin + r^.takeUntil('=').yield; + r^.popFront; + end; '{': begin r^.popFront; @@ -613,6 +756,12 @@ begin end; end; +// ^done,register-values=[{number="0",value="0"},{number="1",value="140737488347232"},{number="2",value="140737349740925"},{number="3",value="140737488346960"},{number="4",value="140737488346960"},{number="5",value="1"},{number="6",value="140737488346752"},{number="7",value="140737488343952"},{number="8",value="0"},{number="9",value="140737488346176"},{number="10",value="8"},{number="11",value="518"},{number="12",value="140737488347040"},{number="13",value="140737488347024"},{number="14",value="1"},{number="15",value="140737488346960"},{number="16",value="4848450"},{number="17",value="582"},{number="18",value="51"},{number="19",value="43"},{number="20",value="0"},{number="21",value="0"},{number="22",value="0"},{number="23",value="0"},{number="24",value="0"},{number="25",value="0"},{number="26",value="0"},{number="27",value="0"},{number="28",value="0"},{number="29",value="0"},{number="30",value="0"},{number="31",value="0"},{number="32",value="895"},{number="33",value="0"},{number="34",value="65535"},{number="35",value="0"},{number="36",value="0"},{number="37",value="0"},{number="38",value="0"},{number="39",value="0"},{number="40",value="{v4_float = {0, 0, -9223372036854775808, 0}, v2_double = {0, 0}, v16_int8 = {0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0}, v8_int16 = {-256, 0, 0, 0, 0, -256, 0, 0}, v4_int32 = {65280, 0, -16777216, 0}, v2_int64 = {65280, 4278190080}, uint128 = 00078918677504442992524819234560}"},{number="41",value="{v4_float = {0, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = {0 }, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v2_int64 = {0, 0}, uint128 = 00000000000000000000000000000000}"},{number="42",value="{v4_float = {-9223372036854775808, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = {0, 0, 0, -1, 0 }, v8_int16 = {0, -256, 0, 0, 0, 0, 0, 0}, v4_int32 = {-16777216, 0, 0, 0}, v2_int64 = {4278190080, 0}, uint128 = 00000000000000000000004278190080}"},{number="43",value="{v4_float = {0, 0, -9223372036854775808, -9223372036854775808}, v2_double = {0, -9223372036854775808}, v16_int8 = {0, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1}, v8_int16 = {-256, 0, 0, 0, 0, -1, -1, -1}, v4_int32 = {65280, 0, -65536, -1}, v2_int64 = {65280, -65536}, uint128 = 340282366920937254537554992802593570560}"},{number="44",value="{v4_float = {-9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808}, v2_double = {-9223372036854775808, -9223372036854775808}, v16_int8 = {-1 }, v8_int16 = {-1, -1, -1, -1, -1, -1, -1, -1}, v4_int32 = {-1, -1, -1, -1}, v2_int64 = {-1, -1}, uint128 = 340282366920938463463374607431768211455}"},{number="45",value="{v4_float = {0, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = {0 }, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v2_int64 = {0, 0}, uint128 = 00000000000000000000000000000000}"},{number="46",value="{v4_float = {0, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = {0 }, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v2_int64 = {0, 0}, uint128 = 00000000000000000000000000000000}"},{number="47",value="{v4_float = {0, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = {0 }, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v2_int64 = {0, 0}, uint128 = 00000000000000000000000000000000}"},{number="48",value="{v4_float = {0, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = {0, 0, 0, 0, 0, 0, 0, 0, -56, 117, 117, 0, 0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 30152, 117, 0, 0}, v4_int32 = {0, 0, 7697864, 0}, v2_int64 = {0, 7697864}, uint128 = 00000142000527122222103840948224}"},{number="49",value="{v4_float = {0, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = {0 }, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v2_int64 = {0, 0}, uint128 = 00000000000000000000000000000000}"},{number="50",value="{v4_float = {0, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = {0 }, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v2_int64 = {0, 0}, uint128 = 00000000000000000000000000000000}"},{number="51",value="{v4_float = {-9223372036854775808, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = {0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0}, v8_int16 = {0, -256, 0, 0, 0, 0, 0, 255}, v4_int32 = {-16777216, 0, 0, 16711680}, v2_int64 = {4278190080, 71776119061217280}, uint128 = 1324035698926381045275276568229314560}"},{number="52",value="{v4_float = {0, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = {0 }, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v2_int64 = {0, 0}, uint128 = 00000000000000000000000000000000}"},{number="53",value="{v4_float = {0, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = {0 }, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v2_int64 = {0, 0}, uint128 = 00000000000000000000000000000000}"},{number="54",value="{v4_float = {0, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = {0 }, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v2_int64 = {0, 0}, uint128 = 00000000000000000000000000000000}"},{number="55",value="{v4_float = {0, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = {0 }, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v2_int64 = {0, 0}, uint128 = 00000000000000000000000000000000}"},{number="56",value="8064"},{number="57",value="00000000000000000000000000000000"},{number="58",value="00000000000000000000000000000000"},{number="59",value="00000000000000000000000000000000"},{number="60",value="00000000000000000000000000000000"},{number="61",value="00000000000000000000000000000000"},{number="62",value="00000000000000000000000000000000"},{number="63",value="00000000000000000000000000000000"},{number="64",value="00000000000000000000000000000000"},{number="65",value="00000000000000000000000000000000"},{number="66",value="00000000000000000000000000000000"},{number="67",value="00000000000000000000000000000000"},{number="68",value="00000000000000000000000000000000"},{number="69",value="00000000000000000000000000000000"},{number="70",value="00000000000000000000000000000000"},{number="71",value="00000000000000000000000000000000"},{number="72",value="00000000000000000000000000000000"},{number="151",value="-1"},{number="152",value="0"},{number="153",value="96"},{number="154",value="125"},{number="155",value="80"},{number="156",value="80"},{number="157",value="1"},{number="158",value="-128"},{number="159",value="-112"},{number="160",value="0"},{number="161",value="64"},{number="162",value="8"},{number="163",value="6"},{number="164",value="-96"},{number="165",value="-112"},{number="166",value="1"},{number="167",value="80"},{number="168",value="0"},{number="169",value="-32"},{number="170",value="-23"},{number="171",value="-33"},{number="172",value="0"},{number="173",value="-8096"},{number="174",value="-5763"},{number="175",value="-8368"},{number="176",value="-8368"},{number="177",value="1"},{number="178",value="-8576"},{number="180",value="0"},{number="181",value="-9152"},{number="182",value="8"},{number="183",value="518"},{number="184",value="-8288"},{number="185",value="-8304"},{number="186",value="1"},{number="187",value="-8368"},{number="188",value="0"},{number="189",value="-8096"},{number="190",value="-138614403"},{number="191",value="-8368"},{number="192",value="-8368"},{number="193",value="1"},{number="194",value="-8576"},{number="195",value="-11376"},{number="196",value="0"},{number="197",value="-9152"},{number="198",value="8"},{number="199",value="518"},{number="200",value="-8288"},{number="201",value="-8304"},{number="202",value="1"},{number="203",value="-8368"},{number="204",value="{v8_float = {0, 0, -9223372036854775808, 0, 0, 0, 0, 0}, v4_double = {0, 0, 0, 0}, v32_int8 = {0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0 }, v16_int16 = {-256, 0, 0, 0, 0, -256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, v8_int32 = {65280, 0, -16777216, 0, 0, 0, 0, 0}, v4_int64 = {65280, 4278190080, 0, 0}, v2_int128 = {00078918677504442992524819234560, 00000000000000000000000000000000}}"},{number="205",value="{v8_float = {0, 0, 0, 0, 0, 0, 0, 0}, v4_double = {0, 0, 0, 0}, v32_int8 = {0 }, v16_int16 = {0 }, v8_int32 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int64 = {0, 0, 0, 0}, v2_int128 = {00000000000000000000000000000000, 00000000000000000000000000000000}}"},{number="206",value="{v8_float = {-9223372036854775808, 0, 0, 0, 0, 0, 0, 0}, v4_double = {0, 0, 0, 0}, v32_int8 = {0, 0, 0, -1, 0 }, v16_int16 = {0, -256, 0 }, v8_int32 = {-16777216, 0, 0, 0, 0, 0, 0, 0}, v4_int64 = {4278190080, 0, 0, 0}, v2_int128 = {00000000000000000000004278190080, 00000000000000000000000000000000}}"},{number="207",value="{v8_float = {0, 0, -9223372036854775808, -9223372036854775808, 0, 0, 0, 0}, v4_double = {0, -9223372036854775808, 0, 0}, v32_int8 = {0, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, 0 }, v16_int16 = {-256, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0}, v8_int32 = {65280, 0, -65536, -1, 0, 0, 0, 0}, v4_int64 = {65280, -65536, 0, 0}, v2_int128 = {340282366920937254537554992802593570560, 00000000000000000000000000000000}}"},{number="208",value="{v8_float = {-9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, 0, 0, 0, 0}, v4_double = {-9223372036854775808, -9223372036854775808, 0, 0}, v32_int8 = {-1 , 0 }, v16_int16 = {-1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0}, v8_int32 = {-1, -1, -1, -1, 0, 0, 0, 0}, v4_int64 = {-1, -1, 0, 0}, v2_int128 = {340282366920938463463374607431768211455, 00000000000000000000000000000000}}"},{number="209",value="{v8_float = {0, 0, 0, 0, 0, 0, 0, 0}, v4_double = {0, 0, 0, 0}, v32_int8 = {0 }, v16_int16 = {0 }, v8_int32 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int64 = {0, 0, 0, 0}, v2_int128 = {00000000000000000000000000000000, 00000000000000000000000000000000}}"},{number="210",value="{v8_float = {0, 0, 0, 0, 0, 0, 0, 0}, v4_double = {0, 0, 0, 0}, v32_int8 = {0 }, v16_int16 = {0 }, v8_int32 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int64 = {0, 0, 0, 0}, v2_int128 = {00000000000000000000000000000000, 00000000000000000000000000000000}}"},{number="211",value="{v8_float = {0, 0, 0, 0, 0, 0, 0, 0}, v4_double = {0, 0, 0, 0}, v32_int8 = {0 }, v16_int16 = {0 }, v8_int32 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int64 = {0, 0, 0, 0}, v2_int128 = {00000000000000000000000000000000, 00000000000000000000000000000000}}"},{number="212",value="{v8_float = {0, 0, 0, 0, 0, 0, 0, 0}, v4_double = {0, 0, 0, 0}, v32_int8 = {0, 0, 0, 0, 0, 0, 0, 0, -56, 117, 117, 0 }, v16_int16 = {0, 0, 0, 0, 30152, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, v8_int32 = {0, 0, 7697864, 0, 0, 0, 0, 0}, v4_int64 = {0, 7697864, 0, 0}, v2_int128 = {00000142000527122222103840948224, 00000000000000000000000000000000}}"},{number="213",value="{v8_float = {0, 0, 0, 0, 0, 0, 0, 0}, v4_double = {0, 0, 0, 0}, v32_int8 = {0 }, v16_int16 = {0 }, v8_int32 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int64 = {0, 0, 0, 0}, v2_int128 = {00000000000000000000000000000000, 00000000000000000000000000000000}}"},{number="214",value="{v8_float = {0, 0, 0, 0, 0, 0, 0, 0}, v4_double = {0, 0, 0, 0}, v32_int8 = {0 }, v16_int16 = {0 }, v8_int32 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int64 = {0, 0, 0, 0}, v2_int128 = {00000000000000000000000000000000, 00000000000000000000000000000000}}"},{number="215",value="{v8_float = {-9223372036854775808, 0, 0, 0, 0, 0, 0, 0}, v4_double = {0, 0, 0, 0}, v32_int8 = {0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0 }, v16_int16 = {0, -256, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0}, v8_int32 = {-16777216, 0, 0, 16711680, 0, 0, 0, 0}, v4_int64 = {4278190080, 71776119061217280, 0, 0}, v2_int128 = {1324035698926381045275276568229314560, 00000000000000000000000000000000}}"},{number="216",value="{v8_float = {0, 0, 0, 0, 0, 0, 0, 0}, v4_double = {0, 0, 0, 0}, v32_int8 = {0 }, v16_int16 = {0 }, v8_int32 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int64 = {0, 0, 0, 0}, v2_int128 = {00000000000000000000000000000000, 00000000000000000000000000000000}}"},{number="217",value="{v8_float = {0, 0, 0, 0, 0, 0, 0, 0}, v4_double = {0, 0, 0, 0}, v32_int8 = {0 }, v16_int16 = {0 }, v8_int32 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int64 = {0, 0, 0, 0}, v2_int128 = {00000000000000000000000000000000, 00000000000000000000000000000000}}"},{number="218",value="{v8_float = {0, 0, 0, 0, 0, 0, 0, 0}, v4_double = {0, 0, 0, 0}, v32_int8 = {0 }, v16_int16 = {0 }, v8_int32 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int64 = {0, 0, 0, 0}, v2_int128 = {00000000000000000000000000000000, 00000000000000000000000000000000}}"},{number="219",value="{v8_float = {0, 0, 0, 0, 0, 0, 0, 0}, v4_double = {0, 0, 0, 0}, v32_int8 = {0 }, v16_int16 = {0 }, v8_int32 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int64 = {0, 0, 0, 0}, v2_int128 = {00000000000000000000000000000000, 00000000000000000000000000000000}}"}] + +// ^done,stack=[frame={level="0",addr="0x00000000004a4e04",func="_D3std6getopt38__T6getoptTE3std6getopt6configTAyaTPbZ6getoptFKAAyaE3std6getopt6configAyaPbZS3std6getopt12GetoptResult",file="/usr/include/dmd/phobos/std/getopt.d",fullname="/usr/include/dmd/phobos/std/getopt.d",line="438"},frame={level="1",addr="0x000000000049fb82",func="D main",file="/home/basile/Dev/dproj/Resource.d/src/resource.d",fullname="/home/basile/Dev/dproj/Resource.d/src/resource.d",line="39"}] + + + procedure TCEGdbWidget.interpretJson; var val: TJSONData; @@ -622,6 +771,12 @@ var // brkp data fne: string = ''; lne: integer = -1; + // registers data + rnm: integer = 0; + rvl: PtrUInt = 0; + // call stack data + nme: string; + adr: PtrUInt; begin val := fJson.Find('reason'); @@ -645,6 +800,60 @@ begin end; end; + val := fJson.Find('register-values'); + if val.isNotNil and (val.JSONType = jtArray) then + begin + arr := TJSONArray(val); + for idx := 0 to arr.Count-1 do + begin + obj := TJSONObject(arr.Objects[idx]); + if obj.isNil then + break + else + begin + val := obj.Find('number'); + if val.isNotNil then + rnm := strToInt(val.AsString); + val := obj.Find('value'); + //if val.isNotNil and (val.JSONType = jtString) then + // rvl := StrToInt64(val.AsString) + //else + // TODO-cGDB: FPU and SSE regs are in a sub object + // break; + // TODO-cGDB: set inspectable state + end; + end; + end; + + val := fJson.Find('stack'); + if val.isNotNil and (val.JSONType = jtArray) then + begin + fStackItems.clear; + lstCallStack.Clear; + arr := TJSONArray(val); + for idx := 0 to arr.Count-1 do + begin + obj := arr.Objects[idx]; + if obj.isNil then + break; + val := obj.Find('fullname'); + if val.isNotNil then + fne:= val.AsString; + // TODO-cGDB: demangle function name. + val := obj.Find('func'); + if val.isNotNil then + nme:= val.AsString; + val := obj.Find('addr'); + if val.isNotNil then + adr := val.AsInt64; + val := obj.Find('line'); + if val.isNotNil then + lne := val.AsInteger; + fStackItems.addItem(adr, fne, nme, lne); + end; + fStackItems.assignToList(lstCallStack); + end; + if fShowCLI then begin arr := TJSONArray(fJson.Find('CLI')); @@ -665,8 +874,8 @@ begin fLog.Clear; fGdb.getFullLines(fLog); - //for str in fLog do - // fMsg.message(str, nil, amcMisc, amkAuto); + for str in fLog do + fMsg.message(str, nil, amcMisc, amkAuto); if flog.Text.isEmpty then exit; @@ -713,7 +922,7 @@ end; procedure TCEGdbWidget.infoStack; begin // GDBMI output format, "info frame" is for CLI output - gdbCommand('-stack-info-frame', @gdboutJsonize); + gdbCommand('-stack-list-frames', @gdboutJsonize); end; procedure TCEGdbWidget.btnStartClick(Sender: TObject);