[Lldb-commits] [PATCH] MI support for '-var-create $regname' command.

Ewan Crawford ewan at codeplay.com
Fri Apr 10 03:45:16 PDT 2015


Hi ki.stfu,

This command is currently processed using expression evaluation, meaning the variable binds to the result of the expression not the register.
Therefore any subsequent calls to '-var-assign' will not update the register. Fixed by detecting '$' prefix for registers according to specification.

Thanks, Ewan

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8965

Files:
  tools/lldb-mi/MICmdCmdVar.cpp

Index: tools/lldb-mi/MICmdCmdVar.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdVar.cpp
+++ tools/lldb-mi/MICmdCmdVar.cpp
@@ -177,13 +177,23 @@
     lldb::SBThread thread = (nThreadId != UINT64_MAX) ? sbProcess.GetThreadByIndexID(nThreadId) : sbProcess.GetSelectedThread();
     m_nThreadId = thread.GetIndexID();
     lldb::SBFrame frame = bCurrentFrame ? thread.GetSelectedFrame() : thread.GetFrameAtIndex(nFrame);
+    lldb::SBValue value;
 
-    const bool bArgs = true;
-    const bool bLocals = true;
-    const bool bStatics = true;
-    const bool bInScopeOnly = false;
-    const lldb::SBValueList valueList = frame.GetVariables(bArgs, bLocals, bStatics, bInScopeOnly);
-    lldb::SBValue value = valueList.GetFirstValueByName(rStrExpression.c_str());
+    if(rStrExpression[0] == '$')
+    {
+        const CMIUtilString rStrRegister(rStrExpression.substr(1).c_str());
+        value = frame.FindRegister(rStrRegister.c_str());
+    }
+    else
+    {
+        const bool bArgs = true;
+        const bool bLocals = true;
+        const bool bStatics = true;
+        const bool bInScopeOnly = false;
+        const lldb::SBValueList valueList = frame.GetVariables(bArgs, bLocals, bStatics, bInScopeOnly);
+        value = valueList.GetFirstValueByName(rStrExpression.c_str());
+    }
+
     if (!value.IsValid())
         value = frame.EvaluateExpression(rStrExpression.c_str());

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8965.23583.patch
Type: text/x-patch
Size: 1444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150410/97ce9bfa/attachment.bin>


More information about the lldb-commits mailing list