summaryrefslogtreecommitdiffstats
path: root/lldb/tools/lldb-mi/MICmdCmdVar.cpp
diff options
context:
space:
mode:
authorDawn Perchik <dawn@burble.org>2015-10-24 02:01:28 +0000
committerDawn Perchik <dawn@burble.org>2015-10-24 02:01:28 +0000
commitb5d425ecfb621e76c4e74f84d4272a38709f6457 (patch)
tree49320a8b3e505e76bdd86f0dc87bbbca31ace4ff /lldb/tools/lldb-mi/MICmdCmdVar.cpp
parentc27d2f266ee57a477f9500357da1fd0596f54861 (diff)
downloadbcm5719-llvm-b5d425ecfb621e76c4e74f84d4272a38709f6457.tar.gz
bcm5719-llvm-b5d425ecfb621e76c4e74f84d4272a38709f6457.zip
[lldb-mi] Fix expansion of anonymous structures and unions
A variable of type: struct S { union { int i1; unsigned u1; }; union { int i2; unsigned u2; }; }; had been impossible to evaluate in lldb-mi, because MI assigns '??' as the variable name to each of the unnamed unions after "-var-list-children" command. Also '??' incorrectly goes to 'exp' field which is treated by IDE as a structure field name and is displayed in watch window. The patch fixes this returning empty string as type name for unnamed union and assigning $N to variable name, where N is the field number in the parent entity. Patch from evgeny.leviant@gmail.com Reviewed by: clayborg, abidh Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13947 llvm-svn: 251176
Diffstat (limited to 'lldb/tools/lldb-mi/MICmdCmdVar.cpp')
-rw-r--r--lldb/tools/lldb-mi/MICmdCmdVar.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lldb/tools/lldb-mi/MICmdCmdVar.cpp b/lldb/tools/lldb-mi/MICmdCmdVar.cpp
index c9153360cc3..c0a1e51098c 100644
--- a/lldb/tools/lldb-mi/MICmdCmdVar.cpp
+++ b/lldb/tools/lldb-mi/MICmdCmdVar.cpp
@@ -1015,7 +1015,9 @@ CMICmdCmdVarListChildren::Execute()
lldb::SBValue member = rValue.GetChildAtIndex(i);
const CMICmnLLDBUtilSBValue utilValue(member);
const CMIUtilString strExp = utilValue.GetName();
- const CMIUtilString name(CMIUtilString::Format("%s.%s", rVarObjName.c_str(), strExp.c_str()));
+ const CMIUtilString name(strExp.empty() ?
+ CMIUtilString::Format("%s.$%u", rVarObjName.c_str(), i) :
+ CMIUtilString::Format("%s.%s", rVarObjName.c_str(), strExp.c_str()));
const MIuint nChildren = member.GetNumChildren();
const CMIUtilString strThreadId(CMIUtilString::Format("%u", member.GetThread().GetIndexID()));
OpenPOWER on IntegriCloud