[Lldb-commits] [PATCH] D51934: [target] Change target create's behavior wrt loading dependent files.

2018-09-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

ping


https://reviews.llvm.org/D51934



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51934: [target] Change target create's behavior wrt loading dependent files.

2018-09-19 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I am fine with this, Jim or Jason should ok this too just to be sure


https://reviews.llvm.org/D51934



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51520: Add libc++ data formatter for std::variant

2018-09-19 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik updated this revision to Diff 166144.
shafik added a comment.

Updating LibcxxVariantGetIndexValidity() to no longer do type check of __index. 
It was left over from the old method of checking for an empty variant and was 
also breaking clang 5.


https://reviews.llvm.org/D51520

Files:
  lldb.xcodeproj/project.pbxproj
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/Makefile
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/main.cpp
  source/Plugins/Language/CPlusPlus/CMakeLists.txt
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/LibCxx.h
  source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
  source/Plugins/Language/CPlusPlus/LibCxxVariant.h

Index: source/Plugins/Language/CPlusPlus/LibCxxVariant.h
===
--- /dev/null
+++ source/Plugins/Language/CPlusPlus/LibCxxVariant.h
@@ -0,0 +1,31 @@
+//===-- LibCxxVariant.h ---*- C++
+//-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef liblldb_LibCxxVariant_h_
+#define liblldb_LibCxxVariant_h_
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+#include "lldb/Utility/Stream.h"
+
+namespace lldb_private {
+namespace formatters {
+bool LibcxxVariantSummaryProvider(
+ValueObject &valobj, Stream &stream,
+const TypeSummaryOptions &options); // libc++ std::variant<>
+
+SyntheticChildrenFrontEnd *LibcxxVariantFrontEndCreator(CXXSyntheticChildren *,
+lldb::ValueObjectSP);
+
+} // namespace formatters
+} // namespace lldb_private
+
+#endif // liblldb_LibCxxVariant_h_
Index: source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
===
--- /dev/null
+++ source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
@@ -0,0 +1,256 @@
+//===-- LibCxxVariant.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "LibCxxVariant.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/ScopeExit.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+// libc++ variant implementation contains two members that we care about both
+// are contained in the __impl member.
+// - __index which tells us which of the variadic template types is the active
+//   type for the variant
+// - __data is a variadic union which recursively contains itself as member
+//   which refers to the tailing variadic types.
+//   - __head which refers to the leading non pack type
+// - __value refers to the actual value contained
+//   - __tail which refers to the remaining pack types
+//
+// e.g. given std::variant v1
+//
+// (lldb) frame var -R v1.__impl.__data
+//(... __union<... 0, int, double, char>) v1.__impl.__data = {
+// ...
+//  __head = {
+//__value = ...
+//  }
+//  __tail = {
+//  ...
+//__head = {
+//  __value = ...
+//}
+//__tail = {
+//...
+//  __head = {
+//__value = ...
+//  ...
+//
+// So given
+// - __index equal to 0 the active value is contained in
+//
+// __data.__head.__value
+//
+// - __index equal to 1 the active value is contained in
+//
+// __data.__tail.__head.__value
+//
+// - __index equal to 2 the active value is contained in
+//
+//  __data.__tail.__tail.__head.__value
+//
+
+namespace {
+// libc++ std::variant index could have one of three states
+// 1) VALID, we can obtain it and its not variant_npos
+// 2) INVALID, we can't obtain it or it is not a type we expect
+// 3) NPOS, its value is variant_npos which means the variant has no value
+enum class LibcxxVariantIndexValidity { VALID, INVALID, NPOS };
+
+LibcxxVariantIndexValidity
+LibcxxVariantGetIndexValidity(ValueObjectSP &impl_sp) {
+  ValueObjectSP index_sp(
+  impl_sp->GetChildMemberWithName(ConstString("__index"), true));
+
+  if (!index_sp)
+return LibcxxVariantIndexValidity::INVALID;
+
+  int64_t index_value = index_sp->GetValueAsSigned(0);
+
+  if (index_value == -1)
+return LibcxxVariantIndexValidity::NPOS;
+
+  return LibcxxVariantIndexValidity::VALID;
+}
+
+llvm::Optional LibcxxVariantIndexValue(ValueObjectSP &impl

[Lldb-commits] [PATCH] D52270: TestMultilineExpr: validate evaluation for expressions spread over multiple lines

2018-09-19 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz created this revision.
sgraenitz added reviewers: vsk, davide, aprantl.

When LLDB successfully parses a command (like "expression" in this case) and 
determines incomplete input, the user can continue typing on multiple lines (in 
this case "2+3"). This should provide the correct result. 
Note that LLDB reverts input from the additional lines, so they are not present 
in the output.


https://reviews.llvm.org/D52270

Files:
  lit/Expr/TestMultilineExpr.test


Index: lit/Expr/TestMultilineExpr.test
===
--- /dev/null
+++ lit/Expr/TestMultilineExpr.test
@@ -0,0 +1,10 @@
+# RUN: %lldb -b -s %s | FileCheck %s
+
+# In terminal sessions LLDB reverts input from subsequent lines so it doesn't 
show up in the output we check below.
+expression
+2+
+3
+
+# CHECK: (lldb) expression
+# CHECK-NEXT: Enter expressions, then terminate with an empty line to evaluate:
+# CHECK-NEXT: (int) {{.*}} = 5
\ No newline at end of file


Index: lit/Expr/TestMultilineExpr.test
===
--- /dev/null
+++ lit/Expr/TestMultilineExpr.test
@@ -0,0 +1,10 @@
+# RUN: %lldb -b -s %s | FileCheck %s
+
+# In terminal sessions LLDB reverts input from subsequent lines so it doesn't show up in the output we check below.
+expression
+2+
+3
+
+# CHECK: (lldb) expression
+# CHECK-NEXT: Enter expressions, then terminate with an empty line to evaluate:
+# CHECK-NEXT: (int) {{.*}} = 5
\ No newline at end of file
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52270: TestMultilineExpr: validate evaluation for expressions spread over multiple lines

2018-09-19 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lit/Expr/TestMultilineExpr.test:3
+
+# In terminal sessions LLDB reverts input from subsequent lines so it doesn't 
show up in the output we check below.
+expression

aprantl wrote:
> "reverts" -> "joins"?
or did you mean "hides"


https://reviews.llvm.org/D52270



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52270: TestMultilineExpr: validate evaluation for expressions spread over multiple lines

2018-09-19 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lit/Expr/TestMultilineExpr.test:3
+
+# In terminal sessions LLDB reverts input from subsequent lines so it doesn't 
show up in the output we check below.
+expression

"reverts" -> "joins"?



Comment at: lit/Expr/TestMultilineExpr.test:11
+# CHECK-NEXT: (int) {{.*}} = 5
\ No newline at end of file


There's no newline at end of file :-)


https://reviews.llvm.org/D52270



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r342563 - [DataFormatters] Add formatter for C++17 std::variant

2018-09-19 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Wed Sep 19 11:07:05 2018
New Revision: 342563

URL: http://llvm.org/viewvc/llvm-project?rev=342563&view=rev
Log:
[DataFormatters] Add formatter for C++17 std::variant

rdar://problem/43691454

Patch by Shafik Yaghmour.

Differential Revision: https://reviews.llvm.org/D51520

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/main.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVariant.h
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.h

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=342563&r1=342562&r2=342563&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Sep 19 11:07:05 2018
@@ -401,6 +401,8 @@
AF9FF1F71FAA79FE00474976 /* LibCxxQueue.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */; 
};
AF9FF1F51FAA79A400474976 /* LibCxxTuple.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */; 
};
945261C41B9A11FC00BF138D /* LibCxxUnorderedMap.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 945261BA1B9A11E800BF138D /* 
LibCxxUnorderedMap.cpp */; };
+   E414F6F121388F6C00C50BC6 /* LibCxxVariant.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = E414F6F021388F6B00C50BC6 /* LibCxxVariant.cpp 
*/; };
+   E414F6EE21388F0300C50BC6 /* LibCxxVariant.h in Headers */ = 
{isa = PBXBuildFile; fileRef = E414F6ED21388F0200C50BC6 /* LibCxxVariant.h */; 
};
945261C51B9A11FC00BF138D /* LibCxxVector.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 945261BB1B9A11E800BF138D /* LibCxxVector.cpp */; 
};
945261C61B9A11FC00BF138D /* LibStdcpp.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 945261BC1B9A11E800BF138D /* LibStdcpp.cpp */; };
4CDB8D6E1DBA91B6006C5B13 /* LibStdcppTuple.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CDB8D681DBA91A6006C5B13 /* LibStdcppTuple.cpp 
*/; };
@@ -2056,6 +2058,8 @@
AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxQueue.cpp; path = Language/CPlusPlus/LibCxxQueue.cpp; sourceTree = 
""; };
AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxTuple.cpp; path = Language/CPlusPlus/LibCxxTuple.cpp; sourceTree = 
""; };
945261BA1B9A11E800BF138D /* LibCxxUnorderedMap.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
LibCxxUnorderedMap.cpp; path = Language/CPlusPlus/LibCxxUnorderedMap.cpp; 
sourceTree = ""; };
+   E414F6F021388F6B00C50BC6 /* LibCxxVariant.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxVariant.cpp; path = Language/CPlusPlus/LibCxxVariant.cpp; 
sourceTree = ""; };
+   E414F6ED21388F0200C50BC6 /* LibCxxVariant.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
LibCxxVariant.h; path = Language/CPlusPlus/LibCxxVariant.h; sourceTree = 
""; };
945261BB1B9A11E800BF138D /* LibCxxVector.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
LibCxxVector.cpp; path = Language/CPlusPlus/LibCxxVector.cpp; sourceTree = 
""; };
945261BC1B9A11E800BF138D /* LibStdcpp.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LibStdcpp.cpp; 
path = Language/CPlusPlus/LibStdcpp.cpp; sourceTree = ""; };
945261BD1B9A11E800BF138D /* LibStdcpp.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LibStdcpp.h; path 
= Language/CPlusPlus/LibStdcpp.h; sourceTree = ""; };
@@ -6475,6 +6479,8 @@
AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */,
AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */,
945261BA1B9A11E800BF138D /* 
LibCxxUnorderedMap.cpp */,
+   E414F6ED21388F0200C50BC6 /* LibCxxVariant.h */,
+ 

[Lldb-commits] [PATCH] D52270: TestMultilineExpr: validate evaluation for expressions spread over multiple lines

2018-09-19 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 166151.
sgraenitz added a comment.

Addressing Adrian's comments


https://reviews.llvm.org/D52270

Files:
  lit/Expr/TestMultilineExpr.test


Index: lit/Expr/TestMultilineExpr.test
===
--- /dev/null
+++ lit/Expr/TestMultilineExpr.test
@@ -0,0 +1,10 @@
+# RUN: %lldb -b -s %s | FileCheck %s
+
+# In terminal sessions LLDB hides input from subsequent lines so it's not 
visible in the output we check below.
+expression
+2+
+3
+
+# CHECK: (lldb) expression
+# CHECK-NEXT: Enter expressions, then terminate with an empty line to evaluate:
+# CHECK-NEXT: (int) {{.*}} = 5


Index: lit/Expr/TestMultilineExpr.test
===
--- /dev/null
+++ lit/Expr/TestMultilineExpr.test
@@ -0,0 +1,10 @@
+# RUN: %lldb -b -s %s | FileCheck %s
+
+# In terminal sessions LLDB hides input from subsequent lines so it's not visible in the output we check below.
+expression
+2+
+3
+
+# CHECK: (lldb) expression
+# CHECK-NEXT: Enter expressions, then terminate with an empty line to evaluate:
+# CHECK-NEXT: (int) {{.*}} = 5
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52270: TestMultilineExpr: validate evaluation for expressions spread over multiple lines

2018-09-19 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Does that mean we can remove 
./packages/Python/lldbsuite/test/expression_command/multiline/TestMultilineExpressions.py
 ?


https://reviews.llvm.org/D52270



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52270: TestMultilineExpr: validate evaluation for expressions spread over multiple lines

2018-09-19 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz marked 3 inline comments as done.
sgraenitz added inline comments.



Comment at: lit/Expr/TestMultilineExpr.test:9
+# CHECK: (lldb) expression
+# CHECK-NEXT: Enter expressions, then terminate with an empty line to evaluate:
+# CHECK-NEXT: (int) {{.*}} = 5

Maybe it's nitpicking, but I'd actually prefer not to match this specific 
string. It could be any human-readable instruction. However, if I replace it 
with `{{.*}}` lit will complain that the match doesn't start on the next line:
```
TestMultilineExpr.test:9:15: error: CHECK-NEXT: is on the same line as previous 
match
# CHECK-NEXT: {{.*}}
  ^
:9:18: note: 'next' match was here
(lldb) expression
 ^
:9:18: note: previous match ended here
(lldb) expression
 ^
```

Any ideas how to get it right?


https://reviews.llvm.org/D52270



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52270: TestMultilineExpr: validate evaluation for expressions spread over multiple lines

2018-09-19 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

Can't you just check for '5', as this is the only information we actually 
actually care about here?


https://reviews.llvm.org/D52270



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52270: TestMultilineExpr: validate evaluation for expressions spread over multiple lines

2018-09-19 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 166155.
sgraenitz added a comment.

Remove old Python test in 
./packages/Python/lldbsuite/test/expression_command/multiline/


https://reviews.llvm.org/D52270

Files:
  lit/Expr/TestMultilineExpr.test
  packages/Python/lldbsuite/test/expression_command/multiline/Makefile
  
packages/Python/lldbsuite/test/expression_command/multiline/TestMultilineExpressions.py
  packages/Python/lldbsuite/test/expression_command/multiline/main.c

Index: packages/Python/lldbsuite/test/expression_command/multiline/main.c
===
--- packages/Python/lldbsuite/test/expression_command/multiline/main.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include 
-
-int main(int argc, char const *argv[]) {
-printf("Hello world.\n"); // break here
-return 0;
-}
Index: packages/Python/lldbsuite/test/expression_command/multiline/TestMultilineExpressions.py
===
--- packages/Python/lldbsuite/test/expression_command/multiline/TestMultilineExpressions.py
+++ /dev/null
@@ -1,90 +0,0 @@
-"""Test multiline expressions."""
-
-from __future__ import print_function
-
-import os
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class MultilineExpressionsTestCase(TestBase):
-
-mydir = TestBase.compute_mydir(__file__)
-NO_DEBUG_INFO_TESTCASE = True
-
-def setUp(self):
-# Call super's setUp().
-TestBase.setUp(self)
-# Find the line number to break on inside main.cpp.
-self.line = line_number('main.c', 'break')
-
-@skipIfRemote
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
-def test_with_run_commands(self):
-"""Test that multiline expressions work correctly"""
-self.build()
-import pexpect
-exe = self.getBuildArtifact("a.out")
-prompt = "(lldb) "
-
-# So that the child gets torn down after the test.
-self.child = pexpect.spawn(
-'%s %s %s' %
-(lldbtest_config.lldbExec, self.lldbOption, exe))
-child = self.child
-# Turn on logging for what the child sends back.
-if self.TraceOn():
-child.logfile_read = sys.stdout
-
-# Set the breakpoint, run the inferior, when it breaks, issue print on
-# the various convenience variables.
-child.expect_exact(prompt)
-child.sendline('breakpoint set -f main.c -l %d' % self.line)
-child.expect_exact(prompt)
-child.sendline('run')
-child.expect_exact("stop reason = breakpoint 1.1")
-child.expect_exact(prompt)
-child.sendline('expr')
-child.expect_exact('1:')
-
-child.sendline('2+')
-child.expect_exact('2:')
-
-child.sendline('3')
-child.expect_exact('3:')
-
-child.sendline('')
-child.expect_exact(prompt)
-self.expect(child.before, exe=False,
-patterns=['= 5'])
-
-@skipIfRemote
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
-def test_empty_list(self):
-"""Test printing an empty list of expressions"""
-import pexpect
-prompt = "(lldb) "
-
-# So that the child gets torn down after the test
-self.child = pexpect.spawn(
-"%s %s" %
-(lldbtest_config.lldbExec, self.lldbOption))
-child = self.child
-
-# Turn on logging for what the child sends back.
-if self.TraceOn():
-child.logfile_read = sys.stdout
-
-# We expect a prompt, then send "print" to start a list of expressions,
-# then an empty line. We expect a prompt back.
-child.expect_exact(prompt)
-child.sendline("print")
-child.expect_exact('1:')
-child.sendline("")
-child.expect_exact(prompt)
Index: packages/Python/lldbsuite/test/expression_command/multiline/Makefile
===
--- packages/Python/lldbsuite/test/expression_command/multiline/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
Index: lit/Expr/TestMultilineExpr.test
===
--- /dev/null
+++ lit/Expr/TestMultilineExpr.test
@@ -0,0 +1,10 @@
+# RUN: %lldb -b -s %s | FileCheck %s
+
+# In terminal sessions LLDB hides input from subsequent lines so it's not visible in the output we check below.
+expression
+2+
+3
+
+# CHECK: (lldb) expression
+# CHECK-NEXT: Enter expressions, then terminate with an empty line to evaluate:
+# CHECK-NEXT: (int) {{.*}} = 5
___
lldb-commits mailing list
lldb-commits@lists

[Lldb-commits] [PATCH] D52270: TestMultilineExpr: validate evaluation for expressions spread over multiple lines

2018-09-19 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

For those following at home: the point of this exercise is to get rid of the 
-expect-based TestMultilineExpressions.py testcase that kept failing on build 
bots.


https://reviews.llvm.org/D52270



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51934: [target] Change target create's behavior wrt loading dependent files.

2018-09-19 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

A typo and probably something copied from another test case, other than that 
this looks good.




Comment at: 
packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py:2
+"""
+Test that breakpoint by symbol name works correctly with dynamic libs.
+"""

I don't  think this is what the test actually does...



Comment at: source/Commands/CommandObjectTarget.cpp:145
+{eLoadDependentsDefault, "default",
+ "Only load dependents when the target is an executables."},
+{eLoadDependentsNo, "true",

"executable" not "executables"


https://reviews.llvm.org/D51934



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52270: TestMultilineExpr: validate evaluation for expressions spread over multiple lines

2018-09-19 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lit/Expr/TestMultilineExpr.test:9
+# CHECK: (lldb) expression
+# CHECK-NEXT: Enter expressions, then terminate with an empty line to evaluate:
+# CHECK-NEXT: (int) {{.*}} = 5

sgraenitz wrote:
> Maybe it's nitpicking, but I'd actually prefer not to match this specific 
> string. It could be any human-readable instruction. However, if I replace it 
> with `{{.*}}` lit will complain that the match doesn't start on the next line:
> ```
> TestMultilineExpr.test:9:15: error: CHECK-NEXT: is on the same line as 
> previous match
> # CHECK-NEXT: {{.*}}
>   ^
> :9:18: note: 'next' match was here
> (lldb) expression
>  ^
> :9:18: note: previous match ended here
> (lldb) expression
>  ^
> ```
> 
> Any ideas how to get it right?
why not:
```
# CHECK: (lldb) expression
# CHECK: (int) {{.*}} = 5
```
?


https://reviews.llvm.org/D52270



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52270: TestMultilineExpr: validate evaluation for expressions spread over multiple lines

2018-09-19 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

In https://reviews.llvm.org/D52270#1239641, @teemperor wrote:

> Can't you just check for '5', as this is the only information we actually 
> actually care about here?


Yes that would be the simplest way, but as LLDB still echoes all commands 
including comments, all CHECK lines are self-fulfilling prophecies.
This is what FileCheck will see in this case:

  (lldb) command source -s 0 
'/Users/sgranitz/Develop/lldb-llvm/git-svn/llvm/tools/lldb/lit/lit-lldb-init'
  Executing commands in 
'/Users/sgranitz/Develop/lldb-llvm/git-svn/llvm/tools/lldb/lit/lit-lldb-init'.
  (lldb) # LLDB init file for the LIT tests.
  (lldb) settings set symbols.enable-external-lookup false
  (lldb) command source -s 0 
'/Users/sgranitz/Develop/lldb-llvm/git-svn/llvm/tools/lldb/lit/Expr/TestMultilineExpr.test'
  Executing commands in 
'/Users/sgranitz/Develop/lldb-llvm/git-svn/llvm/tools/lldb/lit/Expr/TestMultilineExpr.test'.
  (lldb) # RUN: %lldb -b -s %s | FileCheck %s
  (lldb) # In terminal sessions LLDB hides input from subsequent lines so it's 
not visible in the output we check below.
  (lldb) expression
  Enter expressions, then terminate with an empty line to evaluate:
  (int) $0 = 5
  (lldb) # CHECK: (lldb) expression
  (lldb) # CHECK-NEXT: Enter expressions, then terminate with an empty line to 
evaluate:
  (lldb) # CHECK-NEXT: (int) {{.*}} = 5


https://reviews.llvm.org/D52270



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52270: TestMultilineExpr: validate evaluation for expressions spread over multiple lines

2018-09-19 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

> LLDB still echoes all commands including comments

What do you think about fixing that before landing this patch? Then we don't 
need to work around it.


https://reviews.llvm.org/D52270



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52270: TestMultilineExpr: validate evaluation for expressions spread over multiple lines

2018-09-19 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

In https://reviews.llvm.org/D52270#1239685, @aprantl wrote:

> What do you think about fixing that before landing this patch? Then we don't 
> need to work around it.


Hm, we didn't finally decide for the fix and I don't want to raise the pressure 
on it artificially.
I think it will anyway reveal more places, where we forgot about this little 
detail and thus provide opportunity to improve also this test.

Of course, this also means that I can keep matching the specific string for 
this (hopefully short) foreseeable future.




Comment at: lit/Expr/TestMultilineExpr.test:9
+# CHECK: (lldb) expression
+# CHECK-NEXT: Enter expressions, then terminate with an empty line to evaluate:
+# CHECK-NEXT: (int) {{.*}} = 5

aprantl wrote:
> sgraenitz wrote:
> > Maybe it's nitpicking, but I'd actually prefer not to match this specific 
> > string. It could be any human-readable instruction. However, if I replace 
> > it with `{{.*}}` lit will complain that the match doesn't start on the next 
> > line:
> > ```
> > TestMultilineExpr.test:9:15: error: CHECK-NEXT: is on the same line as 
> > previous match
> > # CHECK-NEXT: {{.*}}
> >   ^
> > :9:18: note: 'next' match was here
> > (lldb) expression
> >  ^
> > :9:18: note: previous match ended here
> > (lldb) expression
> >  ^
> > ```
> > 
> > Any ideas how to get it right?
> why not:
> ```
> # CHECK: (lldb) expression
> # CHECK: (int) {{.*}} = 5
> ```
> ?
I think we can keep it like this for now.


https://reviews.llvm.org/D52270



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r337459 - ELF: Replace the header-extension unit test with a lit one

2018-09-19 Thread Davide Italiano via lldb-commits
Pavel, I guess this one is yours.
http://green.lab.llvm.org/green/job/lldb-cmake-clang-6.0.1//484/console

Mind to fix?

FAILED: tools/lldb/unittests/ObjectFile/ELF/ObjectFileELFTests : &&
/Users/buildslave/jenkins/workspace/lldb-cmake-clang-6.0.1/host-compiler/bin/clang++
-fPIC -fvisibility-inlines-hidden -Werror=date-time
-Werror=unguarded-availability-new -std=c++11 -fmodules
-fmodules-cache-path=/Users/buildslave/jenkins/workspace/lldb-cmake-clang-6.0.1/lldb-build/module.cache
-fcxx-modules -Wall -Wextra -Wno-unused-parameter -Wwrite-strings
-Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor
-Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color
-Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing
-Wno-deprecated-register -Wno-vla-extension -O3
-Wl,-search_paths_first -Wl,-headerpad_max_install_names
-Wl,-dead_strip
tools/lldb/unittests/ObjectFile/ELF/CMakeFiles/ObjectFileELFTests.dir/TestObjectFileELF.cpp.o
-o tools/lldb/unittests/ObjectFile/ELF/ObjectFileELFTests
-F/System/Library/PrivateFrameworks lib/libLLVMSupport.a
lib/libgtest_main.a lib/libgtest.a lib/liblldbPluginObjectFileELF.a
lib/liblldbPluginSymbolVendorELF.a lib/liblldbCore.a
lib/liblldbUtilityHelpers.a -lpthread lib/liblldbHost.a
lib/liblldbSymbol.a lib/liblldbTarget.a lib/liblldbBreakpoint.a
lib/liblldbDataFormatters.a lib/liblldbExpression.a
lib/liblldbInterpreter.a lib/liblldbPluginProcessUtility.a
lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a
lib/liblldbHostMacOSXObjCXX.a lib/liblldbPluginExpressionParserClang.a
lib/liblldbPluginExpressionParserGo.a
lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a
lib/liblldbPluginObjectFileJIT.a lib/liblldbCommands.a
lib/liblldbPluginClangCommon.a lib/liblldbPluginAppleObjCRuntime.a
lib/liblldbCore.a lib/liblldbHost.a lib/liblldbSymbol.a
lib/liblldbTarget.a lib/liblldbBreakpoint.a
lib/liblldbDataFormatters.a lib/liblldbExpression.a
lib/liblldbInterpreter.a lib/liblldbPluginProcessUtility.a
lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a
lib/liblldbHostMacOSXObjCXX.a lib/liblldbPluginExpressionParserClang.a
lib/liblldbPluginExpressionParserGo.a
lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a
lib/liblldbPluginObjectFileJIT.a lib/liblldbCommands.a
lib/liblldbPluginClangCommon.a lib/liblldbPluginAppleObjCRuntime.a
lib/liblldbCore.a lib/liblldbHost.a lib/liblldbSymbol.a
lib/liblldbTarget.a lib/liblldbBreakpoint.a
lib/liblldbDataFormatters.a lib/liblldbExpression.a
lib/liblldbInterpreter.a lib/liblldbPluginProcessUtility.a
lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a
lib/liblldbHostMacOSXObjCXX.a lib/liblldbPluginExpressionParserClang.a
lib/liblldbPluginExpressionParserGo.a
lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a
lib/liblldbPluginObjectFileJIT.a lib/liblldbCommands.a
lib/liblldbPluginClangCommon.a lib/liblldbPluginAppleObjCRuntime.a
lib/liblldbCore.a lib/liblldbHost.a lib/liblldbSymbol.a
lib/liblldbTarget.a lib/liblldbBreakpoint.a
lib/liblldbDataFormatters.a lib/liblldbExpression.a
lib/liblldbInterpreter.a lib/liblldbPluginProcessUtility.a
lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a
lib/liblldbHostMacOSXObjCXX.a lib/liblldbPluginExpressionParserClang.a
lib/liblldbPluginExpressionParserGo.a
lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a
lib/liblldbPluginObjectFileJIT.a lib/liblldbCommands.a
lib/liblldbPluginClangCommon.a lib/liblldbPluginAppleObjCRuntime.a
lib/libclangCodeGen.a lib/libLLVMCoroutines.a lib/libLLVMCoverage.a
lib/libLLVMLTO.a lib/libLLVMObjCARCOpts.a lib/libLLVMPasses.a
lib/libLLVMCodeGen.a lib/libclangRewriteFrontend.a
lib/libclangFrontend.a lib/libclangDriver.a lib/libclangParse.a
lib/libLLVMOption.a lib/libclangSerialization.a lib/libclangSema.a
lib/libclangEdit.a lib/libclangAnalysis.a lib/libclangASTMatchers.a
lib/libclangRewrite.a lib/libLLVMipo.a lib/libLLVMBitWriter.a
lib/libLLVMIRReader.a lib/libLLVMAsmParser.a
lib/libLLVMInstrumentation.a lib/libLLVMLinker.a
lib/libLLVMScalarOpts.a lib/libLLVMAggressiveInstCombine.a
lib/libLLVMInstCombine.a lib/libLLVMVectorize.a
lib/libLLVMTransformUtils.a lib/libLLVMMCJIT.a
lib/libLLVMExecutionEngine.a lib/libLLVMRuntimeDyld.a
lib/libLLVMTarget.a lib/libLLVMAnalysis.a lib/libLLVMProfileData.a
lib/libLLVMDebugInfoDWARF.a lib/libLLVMDebugInfoPDB.a
lib/libLLVMObject.a lib/libLLVMBitReader.a lib/libLLVMMCParser.a
lib/liblldbBase.a lib/libclangAST.a lib/libclangLex.a
lib/libclangBasic.a lib/libLLVMCore.a lib/libLLVMMC.a
lib/libLLVMDebugInfoCodeView.a lib/libLLVMDebugInfoMSF.a
lib/liblldbUtility.a lib/libLLVMBinaryFormat.a lib/libLLVMSupport.a
-lz -lm lib/libLLVMDemangle.a -ledit /usr/lib/libpython2.7.dylib
-lxml2 -framework Foundation -framework CoreFoundation -framework
CoreServices -framework Security -framework DebugSymbols
/usr/lib/libcurses.dylib /usr/lib/libform.d

Re: [Lldb-commits] [lldb] r337459 - ELF: Replace the header-extension unit test with a lit one

2018-09-19 Thread Davide Italiano via lldb-commits
Nevermind, wrong commit.
On Wed, Sep 19, 2018 at 2:26 PM Davide Italiano  wrote:
>
> Pavel, I guess this one is yours.
> http://green.lab.llvm.org/green/job/lldb-cmake-clang-6.0.1//484/console
>
> Mind to fix?
>
> FAILED: tools/lldb/unittests/ObjectFile/ELF/ObjectFileELFTests : &&
> /Users/buildslave/jenkins/workspace/lldb-cmake-clang-6.0.1/host-compiler/bin/clang++
> -fPIC -fvisibility-inlines-hidden -Werror=date-time
> -Werror=unguarded-availability-new -std=c++11 -fmodules
> -fmodules-cache-path=/Users/buildslave/jenkins/workspace/lldb-cmake-clang-6.0.1/lldb-build/module.cache
> -fcxx-modules -Wall -Wextra -Wno-unused-parameter -Wwrite-strings
> -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long
> -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor
> -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color
> -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing
> -Wno-deprecated-register -Wno-vla-extension -O3
> -Wl,-search_paths_first -Wl,-headerpad_max_install_names
> -Wl,-dead_strip
> tools/lldb/unittests/ObjectFile/ELF/CMakeFiles/ObjectFileELFTests.dir/TestObjectFileELF.cpp.o
> -o tools/lldb/unittests/ObjectFile/ELF/ObjectFileELFTests
> -F/System/Library/PrivateFrameworks lib/libLLVMSupport.a
> lib/libgtest_main.a lib/libgtest.a lib/liblldbPluginObjectFileELF.a
> lib/liblldbPluginSymbolVendorELF.a lib/liblldbCore.a
> lib/liblldbUtilityHelpers.a -lpthread lib/liblldbHost.a
> lib/liblldbSymbol.a lib/liblldbTarget.a lib/liblldbBreakpoint.a
> lib/liblldbDataFormatters.a lib/liblldbExpression.a
> lib/liblldbInterpreter.a lib/liblldbPluginProcessUtility.a
> lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a
> lib/liblldbHostMacOSXObjCXX.a lib/liblldbPluginExpressionParserClang.a
> lib/liblldbPluginExpressionParserGo.a
> lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a
> lib/liblldbPluginObjectFileJIT.a lib/liblldbCommands.a
> lib/liblldbPluginClangCommon.a lib/liblldbPluginAppleObjCRuntime.a
> lib/liblldbCore.a lib/liblldbHost.a lib/liblldbSymbol.a
> lib/liblldbTarget.a lib/liblldbBreakpoint.a
> lib/liblldbDataFormatters.a lib/liblldbExpression.a
> lib/liblldbInterpreter.a lib/liblldbPluginProcessUtility.a
> lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a
> lib/liblldbHostMacOSXObjCXX.a lib/liblldbPluginExpressionParserClang.a
> lib/liblldbPluginExpressionParserGo.a
> lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a
> lib/liblldbPluginObjectFileJIT.a lib/liblldbCommands.a
> lib/liblldbPluginClangCommon.a lib/liblldbPluginAppleObjCRuntime.a
> lib/liblldbCore.a lib/liblldbHost.a lib/liblldbSymbol.a
> lib/liblldbTarget.a lib/liblldbBreakpoint.a
> lib/liblldbDataFormatters.a lib/liblldbExpression.a
> lib/liblldbInterpreter.a lib/liblldbPluginProcessUtility.a
> lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a
> lib/liblldbHostMacOSXObjCXX.a lib/liblldbPluginExpressionParserClang.a
> lib/liblldbPluginExpressionParserGo.a
> lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a
> lib/liblldbPluginObjectFileJIT.a lib/liblldbCommands.a
> lib/liblldbPluginClangCommon.a lib/liblldbPluginAppleObjCRuntime.a
> lib/liblldbCore.a lib/liblldbHost.a lib/liblldbSymbol.a
> lib/liblldbTarget.a lib/liblldbBreakpoint.a
> lib/liblldbDataFormatters.a lib/liblldbExpression.a
> lib/liblldbInterpreter.a lib/liblldbPluginProcessUtility.a
> lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a
> lib/liblldbHostMacOSXObjCXX.a lib/liblldbPluginExpressionParserClang.a
> lib/liblldbPluginExpressionParserGo.a
> lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a
> lib/liblldbPluginObjectFileJIT.a lib/liblldbCommands.a
> lib/liblldbPluginClangCommon.a lib/liblldbPluginAppleObjCRuntime.a
> lib/libclangCodeGen.a lib/libLLVMCoroutines.a lib/libLLVMCoverage.a
> lib/libLLVMLTO.a lib/libLLVMObjCARCOpts.a lib/libLLVMPasses.a
> lib/libLLVMCodeGen.a lib/libclangRewriteFrontend.a
> lib/libclangFrontend.a lib/libclangDriver.a lib/libclangParse.a
> lib/libLLVMOption.a lib/libclangSerialization.a lib/libclangSema.a
> lib/libclangEdit.a lib/libclangAnalysis.a lib/libclangASTMatchers.a
> lib/libclangRewrite.a lib/libLLVMipo.a lib/libLLVMBitWriter.a
> lib/libLLVMIRReader.a lib/libLLVMAsmParser.a
> lib/libLLVMInstrumentation.a lib/libLLVMLinker.a
> lib/libLLVMScalarOpts.a lib/libLLVMAggressiveInstCombine.a
> lib/libLLVMInstCombine.a lib/libLLVMVectorize.a
> lib/libLLVMTransformUtils.a lib/libLLVMMCJIT.a
> lib/libLLVMExecutionEngine.a lib/libLLVMRuntimeDyld.a
> lib/libLLVMTarget.a lib/libLLVMAnalysis.a lib/libLLVMProfileData.a
> lib/libLLVMDebugInfoDWARF.a lib/libLLVMDebugInfoPDB.a
> lib/libLLVMObject.a lib/libLLVMBitReader.a lib/libLLVMMCParser.a
> lib/liblldbBase.a lib/libclangAST.a lib/libclangLex.a
> lib/libclangBasic.a lib/libLLVMCore.a lib/libLLVMMC.a
> lib/libLLVMDebugInfoCodeView.a lib/libLLVMDebugInfoMSF.a
> lib/liblldbUtility.a lib/libLLVMBinaryFormat.a lib/l

[Lldb-commits] [PATCH] D52247: Refactor FindVariable() core functionality into StackFrame out of SBFrame

2018-09-19 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik updated this revision to Diff 166194.
shafik marked 6 inline comments as done.
shafik added a comment.

Addressing comments:

  
  - Adding documentation to FindVariable()
  - Using ConstString instead of const char *


https://reviews.llvm.org/D52247

Files:
  include/lldb/Target/StackFrame.h
  source/API/SBFrame.cpp
  source/Target/StackFrame.cpp

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -1709,6 +1709,41 @@
 GetFrameCodeAddress());
 }
 
+lldb::ValueObjectSP StackFrame::FindVariable(ConstString name) {
+  ValueObjectSP value_sp;
+
+  if (!name)
+return value_sp;
+
+  TargetSP target_sp = CalculateTarget();
+  ProcessSP process_sp = CalculateProcess();
+
+  if (!target_sp && !process_sp)
+return value_sp;
+
+  VariableList variable_list;
+  VariableSP var_sp;
+  SymbolContext sc(GetSymbolContext(eSymbolContextBlock));
+
+  if (sc.block) {
+const bool can_create = true;
+const bool get_parent_variables = true;
+const bool stop_if_block_is_inlined_function = true;
+
+if (sc.block->AppendVariables(
+can_create, get_parent_variables, stop_if_block_is_inlined_function,
+[this](Variable *v) { return v->IsInScope(this); },
+&variable_list)) {
+  var_sp = variable_list.FindVariable(name);
+}
+
+if (var_sp)
+  value_sp = GetValueObjectForFrameVariable(var_sp, eNoDynamicValues);
+  }
+
+  return value_sp;
+}
+
 TargetSP StackFrame::CalculateTarget() {
   TargetSP target_sp;
   ThreadSP thread_sp(GetThread());
Index: source/API/SBFrame.cpp
===
--- source/API/SBFrame.cpp
+++ source/API/SBFrame.cpp
@@ -666,28 +666,10 @@
 if (stop_locker.TryLock(&process->GetRunLock())) {
   frame = exe_ctx.GetFramePtr();
   if (frame) {
-VariableList variable_list;
-SymbolContext sc(frame->GetSymbolContext(eSymbolContextBlock));
-
-if (sc.block) {
-  const bool can_create = true;
-  const bool get_parent_variables = true;
-  const bool stop_if_block_is_inlined_function = true;
+value_sp = frame->FindVariable(ConstString(name));
 
-  if (sc.block->AppendVariables(
-  can_create, get_parent_variables,
-  stop_if_block_is_inlined_function,
-  [frame](Variable *v) { return v->IsInScope(frame); },
-  &variable_list)) {
-var_sp = variable_list.FindVariable(ConstString(name));
-  }
-}
-
-if (var_sp) {
-  value_sp =
-  frame->GetValueObjectForFrameVariable(var_sp, eNoDynamicValues);
+if (value_sp)
   sb_value.SetSP(value_sp, use_dynamic);
-}
   } else {
 if (log)
   log->Printf("SBFrame::FindVariable () => error: could not "
Index: include/lldb/Target/StackFrame.h
===
--- include/lldb/Target/StackFrame.h
+++ include/lldb/Target/StackFrame.h
@@ -503,6 +503,18 @@
   lldb::ValueObjectSP GuessValueForRegisterAndOffset(ConstString reg,
  int64_t offset);
 
+  //--
+  /// Attempt to reconstruct the ValueObject for a variable with a given \a name
+  /// from within the current StackFrame, within the current block.
+  ///
+  /// @params [in] name
+  ///   The name of the variable.
+  ///
+  /// @return
+  ///   The ValueObject if found.
+  //--
+  lldb::ValueObjectSP FindVariable(ConstString name);
+
   //--
   // lldb::ExecutionContextScope pure virtual functions
   //--
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52247: Refactor FindVariable() core functionality into StackFrame out of SBFrame

2018-09-19 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

@jingham @clayborg @davide addressed comments w/ the exception of the lambda 
one which I politely disagree with.




Comment at: source/Target/StackFrame.cpp:1733-1738
+if (sc.block->AppendVariables(
+can_create, get_parent_variables, 
stop_if_block_is_inlined_function,
+[this](Variable *v) { return v->IsInScope(this); },
+&variable_list)) {
+  var_sp = variable_list.FindVariable(ConstString(name));
+}

davide wrote:
> This is fairly unreadable IMHO. If I were you, I would hoist the lambda out.
This is exactly the case lambda were meant to address, moving it out would just 
add boilerplate code :-(


https://reviews.llvm.org/D52247



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52247: Refactor FindVariable() core functionality into StackFrame out of SBFrame

2018-09-19 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.

This is fine by me.


https://reviews.llvm.org/D52247



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52247: Refactor FindVariable() core functionality into StackFrame out of SBFrame

2018-09-19 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.

Sure.


https://reviews.llvm.org/D52247



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52247: Refactor FindVariable() core functionality into StackFrame out of SBFrame

2018-09-19 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Just a documentation suggestion, but looks good.




Comment at: include/lldb/Target/StackFrame.h:508
+  /// Attempt to reconstruct the ValueObject for a variable with a given \a 
name
+  /// from within the current StackFrame, within the current block.
+  ///

We might want to say how the search is done. Something like "The search for the 
variable starts in the deepest block corresponding to the current PC in the 
stack frame and traverse through all parent blocks stopping at inlined function 
boundaries"


https://reviews.llvm.org/D52247



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits