From 3d50d891f2f1d434bde515be27f4fec43e470fc9 Mon Sep 17 00:00:00 2001 From: micio Date: Fri, 7 Feb 2014 15:54:58 +0000 Subject: [PATCH] Ide/Debuggers/Gdb_MI2 : small speed improvement on tooltip handling git-svn-id: svn://ultimatepp.org/upp/trunk@6882 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/Debuggers/Gdb_MI2.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/uppsrc/ide/Debuggers/Gdb_MI2.cpp b/uppsrc/ide/Debuggers/Gdb_MI2.cpp index 35c0c50eb..897687fd6 100644 --- a/uppsrc/ide/Debuggers/Gdb_MI2.cpp +++ b/uppsrc/ide/Debuggers/Gdb_MI2.cpp @@ -196,22 +196,31 @@ bool Gdb_MI2::IsFinished() bool Gdb_MI2::Tip(const String& exp, CodeEditor::MouseTip& mt) { + static String prevExp = ""; + static String prevVal = ""; + String val; + // quick exit - if(exp.IsEmpty() || !dbg) + if(exp.IsEmpty() || !dbg || IsWaitingEvent()) return false; - // try to not delay other events -/* - if(IsWaitingEvent()) - return false; -*/ + if(exp != prevExp) + { + MIValue res = MICmd("data-evaluate-expression \"" + exp + "\""); + if(res.IsError() || res.IsEmpty()) + val = ""; + else + val = res["value"].ToString(); + + prevExp = exp; + prevVal = val; + } + else + val = prevVal; - MIValue res = MICmd("data-evaluate-expression \"" + exp + "\""); - if(res.IsError() || res.IsEmpty()) - return false; mt.display = &StdDisplay(); - mt.value = exp + "=" + res["value"].ToString(); + mt.value = exp + "=" + val; mt.sz = mt.display->GetStdSize(String(mt.value) + "X"); return true; } @@ -580,7 +589,6 @@ MIValue Gdb_MI2::ReadGdb(bool wait) // debugger run/stop status -- all remaining asynchrnonous output is discarded MIValue Gdb_MI2::MICmd(const char *cmdLine) { -RLOG("COMMAND : " << cmdLine); LDUMP(cmdLine); // sends command to debugger and get result data