Index: packages/Python/lldbsuite/test/functionalities/expression_path/Makefile =================================================================== --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/expression_path/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules Index: packages/Python/lldbsuite/test/functionalities/expression_path/TestExpressionPath.py =================================================================== --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/expression_path/TestExpressionPath.py @@ -0,0 +1,46 @@ +""" +Test the Expression Path. +""" + +from __future__ import print_function + + + +import os, time +import re +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil + +class ExpressionPathTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + def setUp(self): + # Call super's setUp(). + TestBase.setUp(self) + # Find the line number to break inside main(). + self.line = line_number('main.cpp', '// Set break point at this line.') + + def test_expression_path(self): + """Test the GetExpressionPath() function of ValueObject using 'frame variable --flat' command.""" + self.build() + exe = os.path.join(os.getcwd(), "a.out") + self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + + # Break in main() after the variables are assigned values. + lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) + + self.runCmd("run", RUN_SUCCEEDED) + + # The stop reason of the thread should be breakpoint. + self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, + substrs = ['stopped', 'stop reason = breakpoint']) + + # The breakpoint should have a hit count of 1. + self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, + substrs = [' resolved, hit count = 1']) + + self.expect('frame variable s --flat', + substrs = ['s.x = 1', + 's.y = 2']) \ No newline at end of file Index: packages/Python/lldbsuite/test/functionalities/expression_path/main.cpp =================================================================== --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/expression_path/main.cpp @@ -0,0 +1,26 @@ +//===-- main.cpp ------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +struct S +{ + union + { + unsigned r[2]; + struct { + int x; + int y; + }; + }; +}; + +int main() +{ + struct S s = { 1, 2 }; + return 0; // Set break point at this line. +} \ No newline at end of file Index: source/Core/ValueObject.cpp =================================================================== --- source/Core/ValueObject.cpp +++ source/Core/ValueObject.cpp @@ -2536,7 +2536,7 @@ if (!is_deref_of_parent) { ValueObject *non_base_class_parent = GetNonBaseClassParent(); - if (non_base_class_parent) + if (non_base_class_parent && !non_base_class_parent->GetName().IsEmpty()) { CompilerType non_base_class_parent_compiler_type = non_base_class_parent->GetCompilerType(); if (non_base_class_parent_compiler_type)