From 70e85ed84e7b83e69e77a470ad55d5f5d5b26819 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Wed, 29 Jan 2020 23:55:14 +0100 Subject: [PATCH] gdb commander, place results of custm eval in the variable list it's not anymore required to inspect the raw gdbmi output to see them --- src/u_gdb.pas | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/u_gdb.pas b/src/u_gdb.pas index 3eff18a3..eaa56a91 100644 --- a/src/u_gdb.pas +++ b/src/u_gdb.pas @@ -501,6 +501,7 @@ type fSubj: TDebugObserverSubject; fDoc: TDexedMemo; fDbgRunnable: boolean; + fCatchCustomEval: boolean; fProj: ICommonProject; fJson: TJsonObject; fLog: TStringList; @@ -2231,6 +2232,30 @@ var fFpuRaw: array[0..9] of Byte absolute fFpuExtended; begin + if fCatchCustomEval then + begin + fCatchCustomEval := false; + if fJson.findAny('value', val) then + begin + case fEvalKind of + TGdbEvalKind.gekSelectedVar: + lstVariables.AddItem(format('reevaluation of `%s`', [fLastEvalStuff]), nil); + TGdbEvalKind.gekDerefSelectedVar: + lstVariables.AddItem(format('dereference of `*(%s)`', [fLastEvalStuff]), nil); + TGdbEvalKind.gekCustom: + lstVariables.AddItem(format('evaluation of `%s`', [fLastEvalStuff]), nil); + end; + with lstVariables.Items[lstVariables.Items.Count-1] do + begin + SubItems.Add(val.AsString); + MakeVisible(false); + Selected:=true; + end; + end + else dlgOkInfo(format('it was not possible to evaluate '#10#9'`%s`', [fLastEvalStuff])); + exit; + end; + if fJson.findAny('reason', val) then begin reason := val.AsString; @@ -2666,7 +2691,8 @@ end; procedure TGdbWidget.evalStuff(const stuff: string); begin fLastEvalStuff := stuff; - gdbCommand('-data-evaluate-expression "' + stuff + '"'); + fCatchCustomEval := true; + gdbCommand('-data-evaluate-expression "' + stuff + '"', @gdboutJsonize); end; procedure TGdbWidget.continueDebugging;