[Lldb-commits] [PATCH] D49106: Refactor parsing of argument lists with a raw string suffix.
jingham added a comment. This is great. The only quibble I have is that I would really like to restrict ArgsWithSuffix to be "OptionsWithSuffix". I don't think we want to add: (lldb) some_cmd -f 0 -g 0 SomeArg OtherArg -- raw string That seems unnecessarily general, and not terribly helpful. So at minimum I'd suggest calling the new class "OptionsWithSuffix" or even "OptionsWithRaw" since CommandObjectRaw will be the main user of this. Note, you half enforce that at present because you require the first word of the argument list to be "-" for there to be any argument parsing at all. If you can think of a good way of checking that there weren't errant trailing args before the "--" that's a bonus, though it might be good enough to just document this as the required behavior... https://reviews.llvm.org/D49106 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44603: [lldb] Introduce StackFrameRecognizer
jingham requested changes to this revision. jingham added a comment. This revision now requires changes to proceed. This is good. I had a few inline comments, mostly about the command syntax. I think you should switch "-m" to "-s" since that's what we use in the other similar places. For the "type summary" etc. commands which have a similar registry & match function, Enrico added: (lldb) type summary info expression that tell you what summary formatter will match the given expression. It might be nice to have: (lldb) recognizer info that would tell you what recognizer is going to be in force for this frame. The isn't terribly important if there's only a few recognizers, but if there are more, or when you're trying to get one to work, having this info is really handy. That's not required - and I'm fine with doing that as a follow-on, however. Comment at: source/API/SBFrame.cpp:1062 +if (recognized_arg_list) { + for (size_t i = 0; i < recognized_arg_list->GetSize(); i++) { +SBValue value_sb; You can say: ``` for (auto _value_sp : recognized_arg_list->GetObjects()) { SBValue value_sb; value_sb.SetSP(rec_value_sp, use_dynamic); value_list.Append(value_sb); } ``` That's a little easier to read. Comment at: source/Commands/CommandObjectFrame.cpp:721 +if (recognized_arg_list) { + for (size_t i = 0; i < recognized_arg_list->GetSize(); i++) { +valobj_sp = recognized_arg_list->GetValueObjectAtIndex(i); Should be able to use GetObjects here too. Comment at: source/Commands/CommandObjectFrame.cpp:761 +// clang-format off + { LLDB_OPT_SET_ALL, false, "module",'m', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Name of the module that this recognizer applies to." }, + { LLDB_OPT_SET_ALL, false, "function", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Name of the function that this recognizer applies to." }, In most of the other places where we limit a search to a shared library (e.g. breakpoint set, source list & target var) we use "s" and "shlib" in the command line. It would be better to stay consistent with that. Also the type of the argument should be eArgTypeShlibName (though these types don't do anything yet, they should eventually get hooked up to completers. But since they don't you can also add the module completer by setting: CommandCompletions::eModuleCompletion in the completers slot. See for instance the setting of "shlib" in g_breakpoint_set_options in CommandObjectBreakpoint.cpp. The few places that don't follow this rule (like image list) take a list of shared libraries as arguments, so don't fall within this rule. Also, for module and name entries I've been allowing multiple instances of the option, and then accumulating them in a list. So for instance, you can set: ``` (lldb) br s -n foo -n main -s Sketch -s libsystem_c.dylib ``` There's no automatic way to indicate that you are doing this, I always note it explicitly in the help: ``` (lldb) help break set ... -n ( --name ) Set the breakpoint by function name. Can be repeated multiple times to make one breakpoint for multiple names ``` That might also be useful here. Comment at: source/Commands/CommandObjectFrame.cpp:858-859 +import' and then we can register this recognizer with 'frame recognizer add'. +It's important to restrict the recognizer to the libc library (which is +libsystem_kernel.dylib on macOS): + Why? Comment at: www/python-reference.html:749 + +Frame recognizers allow retrieving information about special frames based on +ABI, arguments or other special properties of that frame, even without source Grammatically it would be better to say "Frame recognizers allow FOR retrieving..." Comment at: www/python-reference.html:752-753 +code or debug info. Currently, they can extract function arguments that would +otherwise be unaccesible. + +Adding a custom frame recognizer is possible by implementing a Python class They can also be used to augment extant function arguments, so this isn't exactly right. It's just the most obvious use. Might be good to be clear about that? Comment at: www/python-reference.html:754 + +Adding a custom frame recognizer is possible by implementing a Python class +and using the 'frame recognizer add' command. The Python class should have a I'd say "Adding a custom frame recognizer is DONE by implementing..." You are at this point telling somebody how to do it, not what can be done...
[Lldb-commits] [PATCH] D49110: [testsuite] Implement a category to skip libstdcxx tests
davide created this revision. davide added a reviewer: labath. Herald added a subscriber: krytarowski. On systems where it's not supported. As far as I understand Linux is the only systems which now ships with libstdcxx (maybe NetBSD?, but I'm not entirely sure of the state of lldb on the platform). We could make this more fine grained looking for the header as we do for libcxx. This is a little tricky as there's no such thing as `/usr/include/c++/v1`, but libstdcxx encodes the version number in the path (i.e. `/usr/include/c++/5.4`). I guess we might match a regex, but it seems fragile to me. @labath I hope this is more in line with what you had in mind, thanks for your feedback! https://reviews.llvm.org/D49110 Files: lldb/packages/Python/lldbsuite/test/dotest.py lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py lldb/packages/Python/lldbsuite/test/test_categories.py Index: lldb/packages/Python/lldbsuite/test/test_categories.py === --- lldb/packages/Python/lldbsuite/test/test_categories.py +++ lldb/packages/Python/lldbsuite/test/test_categories.py @@ -26,6 +26,7 @@ 'gmodules': 'Tests that can be run with -gmodules debug information', 'expression': 'Tests related to the expression parser', 'libc++': 'Test for libc++ data formatters', +'libstdcxx': 'Test for libstdcxx data formatters', 'objc': 'Tests related to the Objective-C programming language support', 'pyapi': 'Tests related to the Python API', 'basic_process': 'Basic process execution sniff tests.', Index: lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py === --- lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py +++ lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py @@ -23,9 +23,7 @@ # Find the line number to break at. self.line = line_number('main.cpp', '// Set break point at this line.') -@skipIfFreeBSD -@skipIfWindows # libstdcpp not ported to Windows -@skipIfwatchOS # libstdcpp not ported to watchos +@add_test_categories(["libstdcxx"]) def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() Index: lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py === --- lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py +++ lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py @@ -23,12 +23,7 @@ # Find the line number to break at. self.line = line_number('main.cpp', '// Set break point at this line.') -@expectedFailureAll( -oslist=['freebsd'], -bugnumber='llvm.org/pr20548 fails to build on lab.llvm.org buildbot') -@skipIfWindows # libstdcpp not ported to Windows. -@skipIfDarwin -@skipIfwatchOS # libstdcpp not ported to watchos +@add_test_categories(["libstdcxx"]) def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() Index: lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py === ---
[Lldb-commits] [PATCH] D49106: Refactor parsing of argument lists with a raw string suffix.
teemperor created this revision. teemperor added a reviewer: jingham. Herald added a subscriber: mgorny. A subset of the LLDB commands follows this command line interface style: [arguments] -- The parsing code for this interface has been so far been duplicated into the different command objects which makes it hard to maintain and reuse elsewhere. This patches improves the situation by adding a ArgsWithSuffix class that centralizes the parsing logic and allows easier testing. The different commands now just call this class to extract the arguments and the raw suffix from the provided user input. https://reviews.llvm.org/D49106 Files: include/lldb/Interpreter/CommandObject.h include/lldb/Utility/Args.h source/Commands/CommandObjectCommands.cpp source/Commands/CommandObjectExpression.cpp source/Commands/CommandObjectPlatform.cpp source/Commands/CommandObjectType.cpp source/Commands/CommandObjectWatchpoint.cpp source/Interpreter/CommandObject.cpp source/Interpreter/Options.cpp source/Utility/Args.cpp unittests/Utility/ArgsWithSuffixTest.cpp unittests/Utility/CMakeLists.txt Index: unittests/Utility/CMakeLists.txt === --- unittests/Utility/CMakeLists.txt +++ unittests/Utility/CMakeLists.txt @@ -1,5 +1,6 @@ add_lldb_unittest(UtilityTests ArgsTest.cpp + ArgsWithSuffixTest.cpp ArchSpecTest.cpp CleanUpTest.cpp ConstStringTest.cpp Index: unittests/Utility/ArgsWithSuffixTest.cpp === --- /dev/null +++ unittests/Utility/ArgsWithSuffixTest.cpp @@ -0,0 +1,183 @@ +//===-- ArgsWithSuffixTest.cpp --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "gtest/gtest.h" + +#include "lldb/Utility/Args.h" +#include "lldb/Utility/StringList.h" + +using namespace lldb_private; + +TEST(ArgsWithSuffixTest, EmptyInput) { + // An empty string is just an empty suffix without any arguments. + ArgsWithSuffix args(""); + ASSERT_FALSE(args.HasArgs()); + ASSERT_STREQ(args.GetSuffix().c_str(), ""); +} + +TEST(ArgsWithSuffixTest, SingleWhitespaceInput) { + // Only whitespace is just a suffix. + ArgsWithSuffix args(" "); + ASSERT_FALSE(args.HasArgs()); + ASSERT_STREQ(args.GetSuffix().c_str(), " "); +} + +TEST(ArgsWithSuffixTest, WhitespaceInput) { + // Only whitespace is just a suffix. + ArgsWithSuffix args(" "); + ASSERT_FALSE(args.HasArgs()); + ASSERT_STREQ(args.GetSuffix().c_str(), " "); +} + +TEST(ArgsWithSuffixTest, ArgsButNoDelimiter) { + // This counts as a suffix because there is no -- at the end. + ArgsWithSuffix args("-foo bar"); + ASSERT_FALSE(args.HasArgs()); + ASSERT_STREQ(args.GetSuffix().c_str(), "-foo bar"); +} + +TEST(ArgsWithSuffixTest, ArgsButNoLeadingDash) { + // No leading dash means we have no arguments. + ArgsWithSuffix args("foo bar --"); + ASSERT_FALSE(args.HasArgs()); + ASSERT_STREQ(args.GetSuffix().c_str(), "foo bar --"); +} + +TEST(ArgsWithSuffixTest, QuotedSuffix) { + // We need to have a way to escape the -- to make it usable as an argument. + ArgsWithSuffix args("-foo \"--\" bar"); + ASSERT_FALSE(args.HasArgs()); + ASSERT_STREQ(args.GetSuffix().c_str(), "-foo \"--\" bar"); +} + +TEST(ArgsWithSuffixTest, EmptySuffix) { + // An empty suffix with arguments. + ArgsWithSuffix args("-foo --"); + ASSERT_TRUE(args.HasArgs()); + ASSERT_EQ(args.GetArgString(), "-foo "); + ASSERT_EQ(args.GetArgStringWithDelimiter(), "-foo --"); + + auto ref = args.GetArgs().GetArgumentArrayRef(); + ASSERT_EQ(1u, ref.size()); + EXPECT_STREQ("-foo", ref[0]); + + ASSERT_STREQ(args.GetSuffix().c_str(), ""); +} + +TEST(ArgsWithSuffixTest, EmptySuffixSingleWhitespace) { + // A single whitespace also countas as an empty suffix (because that usually + // separates the suffix from the double dash. + ArgsWithSuffix args("-foo -- "); + ASSERT_TRUE(args.HasArgs()); + ASSERT_EQ(args.GetArgString(), "-foo "); + ASSERT_EQ(args.GetArgStringWithDelimiter(), "-foo -- "); + + auto ref = args.GetArgs().GetArgumentArrayRef(); + ASSERT_EQ(1u, ref.size()); + EXPECT_STREQ("-foo", ref[0]); + + ASSERT_STREQ(args.GetSuffix().c_str(), ""); +} + +TEST(ArgsWithSuffixTest, WhitespaceSuffix) { + // A single whtiespace character as a suffix. + ArgsWithSuffix args("-foo -- "); + ASSERT_TRUE(args.HasArgs()); + ASSERT_EQ(args.GetArgString(), "-foo "); + ASSERT_EQ(args.GetArgStringWithDelimiter(), "-foo -- "); + + auto ref = args.GetArgs().GetArgumentArrayRef(); + ASSERT_EQ(1u, ref.size()); + EXPECT_STREQ("-foo", ref[0]); + + ASSERT_STREQ(args.GetSuffix().c_str(), " "); +} + +TEST(ArgsWithSuffixTest, LeadingSpaceArgs) { + // Whitespace before the first dash needs to be
[Lldb-commits] [PATCH] D48960: Use an unwinder to get register contexts of frames other than zeroth under Windows
amccarth added inline comments. Comment at: source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp:52 if (!m_reg_context_sp) -m_reg_context_sp = CreateRegisterContextForFrameIndex(0); +m_reg_context_sp = CreateRegisterContextForZerothFrame(); This bit seems redundant given that CreateRegisterContextForFrameIndex now checks the special case of 0. It's not a big deal, but I could see someone getting confused while debugging things wondering by CreateRegisterContextForFrameIndex is sometimes called for frame 0 and sometimes not. https://reviews.llvm.org/D48960 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48960: Use an unwinder to get register contexts of frames other than zeroth under Windows
stella.stamenova added a comment. I'm actually in the middle of cleaning up the change attached to this bug: https://bugs.llvm.org/show_bug.cgi?id=37495 which is equivalent functionally but follows the pattern for the other targets. Let me run some tests and I'll submit it for review. It should fix your issue. https://reviews.llvm.org/D48960 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r336608 - Rollback [test-suite] Add a decorator for the lack of libstdcxx on the system.
Author: davide Date: Mon Jul 9 14:56:28 2018 New Revision: 336608 URL: http://llvm.org/viewvc/llvm-project?rev=336608=rev Log: Rollback [test-suite] Add a decorator for the lack of libstdcxx on the system. Pavel suggested an alternative approach that I'll try to implement. Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=336608=336607=336608=diff == --- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Mon Jul 9 14:56:28 2018 @@ -687,18 +687,6 @@ def skipUnlessSupportedTypeAttribute(att return None return skipTestIfFn(compiler_doesnt_support_struct_attribute) -def skipUnlessLibstdcxxAvailable(func): -"""Decorate the item to skip test unless libstdc++ is available on the system.""" -def compiler_doesnt_support_libstdcxx(self): -compiler_path = self.getCompiler() -f = tempfile.NamedTemporaryFile() -f = tempfile.NamedTemporaryFile() -cmd = "echo '#include | %s -x c++ -stdlib=libstdc++ -o %s -" % (compiler_path, f.name) -if os.popen(cmd).close() is not None: -return "libstdcxx not available on the sytem" -return None -return skipTestIfFn(compiler_doesnt_support_libstdcxx)(func) - def skipUnlessThreadSanitizer(func): """Decorate the item to skip test unless Clang -fsanitize=thread is supported.""" Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py?rev=336608=336607=336608=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py Mon Jul 9 14:56:28 2018 @@ -23,7 +23,8 @@ class StdIteratorDataFormatterTestCase(T # Find the line number to break at. self.line = line_number('main.cpp', '// Set break point at this line.') -@skipUnlessLibstdcxxAvailable +@skipIfWindows # libstdcpp not ported to Windows +@skipIfwatchOS # libstdcpp not ported to watchos def test_with_run_command(self): """Test that libstdcpp iterators format properly.""" self.build() Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py?rev=336608=336607=336608=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py Mon Jul 9 14:56:28 2018 @@ -27,7 +27,8 @@ class
[Lldb-commits] [lldb] r336607 - [ObjCRuntime] Add support for obfuscation in tagged pointers.
Author: davide Date: Mon Jul 9 14:53:43 2018 New Revision: 336607 URL: http://llvm.org/viewvc/llvm-project?rev=336607=rev Log: [ObjCRuntime] Add support for obfuscation in tagged pointers. This is the default in MacOS Mojave. No testcases, as basically we have a lot of coverage (and the testsuite fails quite a bit without this change in Beta 3). Thanks to Fred Riss for helping me with this patch (fixing bugs/nondeterminism). Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=336607=336606=336607=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Mon Jul 9 14:53:43 2018 @@ -283,6 +283,10 @@ bool AppleObjCRuntimeV1::ClassDescriptor return false; } +lldb::addr_t AppleObjCRuntimeV1::GetTaggedPointerObfuscator() { + return 0; +} + lldb::addr_t AppleObjCRuntimeV1::GetISAHashTablePointer() { if (m_isa_hash_table_ptr == LLDB_INVALID_ADDRESS) { ModuleSP objc_module_sp(GetObjCModule()); Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h?rev=336607=336606=336607=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h Mon Jul 9 14:53:43 2018 @@ -45,6 +45,8 @@ public: } } + lldb::addr_t GetTaggedPointerObfuscator(); + class ClassDescriptorV1 : public ObjCLanguageRuntime::ClassDescriptor { public: ClassDescriptorV1(ValueObject _pointer); Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=336607=336606=336607=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Mon Jul 9 14:53:43 2018 @@ -384,7 +384,9 @@ AppleObjCRuntimeV2::AppleObjCRuntimeV2(P m_get_class_info_args_mutex(), m_get_shared_cache_class_info_code(), m_get_shared_cache_class_info_args(LLDB_INVALID_ADDRESS), m_get_shared_cache_class_info_args_mutex(), m_decl_vendor_ap(), - m_isa_hash_table_ptr(LLDB_INVALID_ADDRESS), m_hash_signature(), + m_tagged_pointer_obfuscator(LLDB_INVALID_ADDRESS), + m_isa_hash_table_ptr(LLDB_INVALID_ADDRESS), + m_hash_signature(), m_has_object_getClass(false), m_loaded_objc_opt(false), m_non_pointer_isa_cache_ap( NonPointerISACache::CreateInstance(*this, objc_module_sp)), @@ -1196,6 +1198,38 @@ AppleObjCRuntimeV2::GetClassDescriptor(V return objc_class_sp; } +lldb::addr_t AppleObjCRuntimeV2::GetTaggedPointerObfuscator() { + if (m_tagged_pointer_obfuscator != LLDB_INVALID_ADDRESS) +return m_tagged_pointer_obfuscator; + + + Process *process = GetProcess(); + ModuleSP objc_module_sp(GetObjCModule()); + + if (!objc_module_sp) +return LLDB_INVALID_ADDRESS; + + static ConstString g_gdb_objc_obfuscator("objc_debug_taggedpointer_obfuscator"); + + const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType( + g_gdb_objc_obfuscator, lldb::eSymbolTypeAny); + if (symbol) { +lldb::addr_t g_gdb_obj_obfuscator_ptr = + symbol->GetLoadAddress(>GetTarget()); + +if (g_gdb_obj_obfuscator_ptr != LLDB_INVALID_ADDRESS) { + Status error; + m_tagged_pointer_obfuscator = process->ReadPointerFromMemory( +g_gdb_obj_obfuscator_ptr, error); +} + } + // If we don't have a correct value at this point, there must be no obfuscation. + if (m_tagged_pointer_obfuscator == LLDB_INVALID_ADDRESS) +m_tagged_pointer_obfuscator = 0; + + return m_tagged_pointer_obfuscator; +} + lldb::addr_t AppleObjCRuntimeV2::GetISAHashTablePointer() { if (m_isa_hash_table_ptr == LLDB_INVALID_ADDRESS) { Process *process = GetProcess(); @@
[Lldb-commits] [PATCH] D48868: [LLDB] In ProcessGDBRemote::UpdateThreadIDList(), the thread PCs should not be cleared after they are updated from the stop reply packet
jasonmolenda added a comment. (just to be clear, the m_thread_pcs.clear() in ProcessGDBRemote::UpdateThreadIDList that I called a bug -- today we only have two ways of populating that, jThreadsInfo or the thread-pcs: value in the stop packet. So clearing it unconditionally here, and then populating it from thread_pcs: seems reasonable.) https://reviews.llvm.org/D48868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48868: [LLDB] In ProcessGDBRemote::UpdateThreadIDList(), the thread PCs should not be cleared after they are updated from the stop reply packet
jasonmolenda added a comment. I could imagine there being a bug in this ProcessGDBRemote::UpdateThreadIDList -> ProcessGDBRemote::UpdateThreadIDsFromStopReplyThreadsValue sequence when talking to a gdb-remote stub that does not implement the lldb-enhancement jThreadsInfo. If jThreadsInfo isn't implemented, we fall back to looking for the thread-pcs: and threads: key-value pairs in the stop packet that we received. We clear m_thread_pcs, then look if thread-pcs: is present (that's one bug) to add all the thread pc values. After that, we look for the threads: list and if it is present, we call UpdateThreadIDsFromStopReplyThreadsValue which clears m_thread_pcs again (bug #2) and then adds any threads listed to the m_thread_ids. I could believe there are problems here if we're talking to a gdb-remote that doesn't support jThreadsInfo but does provide threads: or thread-pcs: maybe? It'd be interesting to see what the packet log for a stop packet is showing, and what exactly the gdb-remote stub is. https://reviews.llvm.org/D48868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48303: Don't take the address of an xvalue when printing an expr result
This revision was automatically updated to reflect the committed changes. Closed by commit rL336582: Dont take the address of an xvalue when printing an expr result (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D48303?vs=154656=154670#toc Repository: rL LLVM https://reviews.llvm.org/D48303 Files: lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/Makefile lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp === --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -292,9 +292,8 @@ // // - During dematerialization, $0 is ignored. - bool is_lvalue = (last_expr->getValueKind() == VK_LValue || -last_expr->getValueKind() == VK_XValue) && - (last_expr->getObjectKind() == OK_Ordinary); + bool is_lvalue = last_expr->getValueKind() == VK_LValue && + last_expr->getObjectKind() == OK_Ordinary; QualType expr_qual_type = last_expr->getType(); const clang::Type *expr_type = expr_qual_type.getTypePtr(); Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/Makefile === --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py === --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py @@ -0,0 +1,37 @@ +from __future__ import print_function + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class ExprXValuePrintingTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) + +self.main_source = "main.cpp" +self.main_source_spec = lldb.SBFileSpec(self.main_source) + +def do_test(self, dictionary=None): +"""Printing an xvalue should work.""" +self.build(dictionary=dictionary) + +(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + '// Break here', self.main_source_spec) +frame = thread.GetFrameAtIndex(0) + +value = frame.EvaluateExpression("foo().data") +self.assertTrue(value.IsValid()) +self.assertTrue(value.GetError().Success()) +self.assertEqual(value.GetValueAsSigned(), 1234) + +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") +def test(self): +self.do_test() + Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp === --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp @@ -0,0 +1,12 @@ +struct Tmp +{ + int data = 1234; +}; + +Tmp foo() { return Tmp(); } + +int main(int argc, char const *argv[]) +{ + int something = foo().data; + return 0; // Break here +} Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp === --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -292,9 +292,8 @@ // // - During dematerialization, $0 is ignored. - bool is_lvalue = (last_expr->getValueKind() == VK_LValue || -last_expr->getValueKind() == VK_XValue) && - (last_expr->getObjectKind() == OK_Ordinary); + bool is_lvalue = last_expr->getValueKind() == VK_LValue && + last_expr->getObjectKind() == OK_Ordinary; QualType expr_qual_type = last_expr->getType(); const clang::Type *expr_type = expr_qual_type.getTypePtr(); Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/Makefile === ---
[Lldb-commits] [lldb] r336582 - Don't take the address of an xvalue when printing an expr result
Author: teemperor Date: Mon Jul 9 11:57:11 2018 New Revision: 336582 URL: http://llvm.org/viewvc/llvm-project?rev=336582=rev Log: Don't take the address of an xvalue when printing an expr result Summary: If we have an xvalue here, we will always hit the `err_typecheck_invalid_lvalue_addrof` error in 'Sema::CheckAddressOfOperand' when trying to take the address of the result. This patch uses the fallback code path where we store the result in a local variable instead when we hit this case. Fixes rdar://problem/40613277 Reviewers: jingham, vsk Reviewed By: vsk Subscribers: vsk, friss, lldb-commits Differential Revision: https://reviews.llvm.org/D48303 Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/ lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/Makefile lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/Makefile?rev=336582=auto == --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/Makefile Mon Jul 9 11:57:11 2018 @@ -0,0 +1,5 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py?rev=336582=auto == --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py Mon Jul 9 11:57:11 2018 @@ -0,0 +1,37 @@ +from __future__ import print_function + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class ExprXValuePrintingTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) + +self.main_source = "main.cpp" +self.main_source_spec = lldb.SBFileSpec(self.main_source) + +def do_test(self, dictionary=None): +"""Printing an xvalue should work.""" +self.build(dictionary=dictionary) + +(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + '// Break here', self.main_source_spec) +frame = thread.GetFrameAtIndex(0) + +value = frame.EvaluateExpression("foo().data") +self.assertTrue(value.IsValid()) +self.assertTrue(value.GetError().Success()) +self.assertEqual(value.GetValueAsSigned(), 1234) + +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") +def test(self): +self.do_test() + Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp?rev=336582=auto == --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp (added) +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp Mon Jul 9 11:57:11 2018 @@ -0,0 +1,12 @@ +struct Tmp +{ + int data = 1234; +}; + +Tmp foo() { return Tmp(); } + +int main(int argc, char const *argv[]) +{ + int something = foo().data; + return 0; // Break here +} Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp?rev=336582=336581=336582=diff == --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp Mon Jul 9 11:57:11 2018 @@ -292,9 +292,8 @@ bool ASTResultSynthesizer::SynthesizeBod // // - During dematerialization, $0 is ignored. - bool is_lvalue = (last_expr->getValueKind() == VK_LValue || -last_expr->getValueKind() == VK_XValue) && - (last_expr->getObjectKind() == OK_Ordinary); + bool is_lvalue = last_expr->getValueKind() == VK_LValue && +
[Lldb-commits] [PATCH] D48303: Don't take the address of an xvalue when printing an expr result
vsk accepted this revision. vsk added a comment. This revision is now accepted and ready to land. Thanks, LGTM. This looks pretty cut and dry. The evaluator shouldn't try to take the address of an rvalue. https://reviews.llvm.org/D48303 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48303: Don't take the address of an xvalue when printing an expr result
teemperor updated this revision to Diff 154656. teemperor edited the summary of this revision. teemperor added a subscriber: vsk. teemperor added a comment. - Removed unnecessary include from the test. https://reviews.llvm.org/D48303 Files: packages/Python/lldbsuite/test/expression_command/xvalue/Makefile packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp Index: source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp === --- source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -292,9 +292,8 @@ // // - During dematerialization, $0 is ignored. - bool is_lvalue = (last_expr->getValueKind() == VK_LValue || -last_expr->getValueKind() == VK_XValue) && - (last_expr->getObjectKind() == OK_Ordinary); + bool is_lvalue = last_expr->getValueKind() == VK_LValue && + last_expr->getObjectKind() == OK_Ordinary; QualType expr_qual_type = last_expr->getType(); const clang::Type *expr_type = expr_qual_type.getTypePtr(); Index: packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp @@ -0,0 +1,12 @@ +struct Tmp +{ + int data = 1234; +}; + +Tmp foo() { return Tmp(); } + +int main(int argc, char const *argv[]) +{ + int something = foo().data; + return 0; // Break here +} Index: packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py @@ -0,0 +1,37 @@ +from __future__ import print_function + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class ExprXValuePrintingTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) + +self.main_source = "main.cpp" +self.main_source_spec = lldb.SBFileSpec(self.main_source) + +def do_test(self, dictionary=None): +"""Printing an xvalue should work.""" +self.build(dictionary=dictionary) + +(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + '// Break here', self.main_source_spec) +frame = thread.GetFrameAtIndex(0) + +value = frame.EvaluateExpression("foo().data") +self.assertTrue(value.IsValid()) +self.assertTrue(value.GetError().Success()) +self.assertEqual(value.GetValueAsSigned(), 1234) + +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") +def test(self): +self.do_test() + Index: packages/Python/lldbsuite/test/expression_command/xvalue/Makefile === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules Index: source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp === --- source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -292,9 +292,8 @@ // // - During dematerialization, $0 is ignored. - bool is_lvalue = (last_expr->getValueKind() == VK_LValue || -last_expr->getValueKind() == VK_XValue) && - (last_expr->getObjectKind() == OK_Ordinary); + bool is_lvalue = last_expr->getValueKind() == VK_LValue && + last_expr->getObjectKind() == OK_Ordinary; QualType expr_qual_type = last_expr->getType(); const clang::Type *expr_type = expr_qual_type.getTypePtr(); Index: packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp @@ -0,0 +1,12 @@ +struct Tmp +{ + int data = 1234; +}; + +Tmp foo() { return Tmp(); } + +int main(int argc, char const *argv[]) +{ + int something = foo().data; + return 0; // Break here +} Index: packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py @@ -0,0 +1,37 @@ +from __future__ import print_function + + +import lldb
[Lldb-commits] [PATCH] D49062: [lldb-mi] Re-implement data-info-line command.
apolyakov added inline comments. Comment at: packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py:22 @skipIfDarwin # pexpect is known to be unreliable on Darwin @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_data_disassemble(self): aprantl wrote: > It would be *awesome* if we could also convert this entire to a > lit/FileCheck. Looks like all the tests in this file are basically skipped > everywhere because it's so unreliable... It's problematic to convert `data-info-line` test to a lit one since we don't know addresses of a source lines. It means that we can't do this: `-data-info-line *0xsome_address` https://reviews.llvm.org/D49062 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D49062: [lldb-mi] Re-implement data-info-line command.
aprantl added inline comments. Comment at: packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py:22 @skipIfDarwin # pexpect is known to be unreliable on Darwin @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_data_disassemble(self): It would be *awesome* if we could also convert this entire to a lit/FileCheck. Looks like all the tests in this file are basically skipped everywhere because it's so unreliable... https://reviews.llvm.org/D49062 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48802: [lldb-mi] Re-implement symbol-list-lines command.
stella.stamenova added a comment. (gdb) -file-exec-and-symbols "E:\\_work\\4\\b\\LLVMBuild\\tools\\lldb\\lit\\tools\\lldb-mi\\symbol\\Output\\symbol-list-lines.test.tmp" ^done (gdb) ^done (gdb) =library-loaded,id="E:\\_work\\4\\b\\LLVMBuild\\tools\\lldb\\lit\\tools\\lldb-mi\\symbol\\Output\\symbol-list-lines.test.tmp",target-name="E:\\_work\\4\\b\\LLVMBuild\\tools\\lldb\\lit\\tools\\lldb-mi\\symbol\\Output\\symbol-list-lines.test.tmp",host-name="E:\\_work\\4\\b\\LLVMBuild\\tools\\lldb\\lit\\tools\\lldb-mi\\symbol\\Output\\symbol-list-lines.test.tmp",symbols-loaded="0",loaded_addr="-",size="0" ^done (gdb) ^done (gdb) ^done (gdb) ^done (gdb) ^error,msg="File Handler. Invalid file name path" (gdb) ^done (gdb) ^done (gdb) ^error,msg="File Handler. Invalid file name path" (gdb) ^done (gdb) ^error,msg="File Handler. Invalid file name path" (gdb) ^done (gdb) Repository: rL LLVM https://reviews.llvm.org/D48802 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48802: [lldb-mi] Re-implement symbol-list-lines command.
apolyakov added a comment. Could you please provide an output of this command on Windows: `E:\_work\4\b\LLVMBuild\Release\bin\lldb-mi.EXE --synchronous E:\_work\4\b\LLVMBuild\tools\lldb\lit\tools\lldb-mi\symbol\Output\symbol-list-lines.test.tmp < E:\_work\4\s\llvm\tools\lldb\lit\tools\lldb-mi\symbol\symbol-list-lines.test`? I'll try to find out what causes a failure. Repository: rL LLVM https://reviews.llvm.org/D48802 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48802: [lldb-mi] Re-implement symbol-list-lines command.
stella.stamenova added a comment. symbol-list-lines.test fails on windows. I'm trying to get through the rest of the failing tests on Windows, so I can add a bot to run the tests and alert on new failures. FAIL: lldb :: tools/lldb-mi/symbol/symbol-list-lines.test (45 of 1063) TEST 'lldb :: tools/lldb-mi/symbol/symbol-list-lines.test' FAILED Script: -- : 'RUN: at line 1'; E:/_work/4/b/LLVMBuild/Release/bin/clang.exe -o E:\_work\4\b\LLVMBuild\tools\lldb\lit\tools\lldb-mi\symbol\Output\symbol-list-lines.test.tmp E:\_work\4\s\llvm\tools\lldb\lit\tools\lldb-mi\symbol/inputs/main.c E:\_work\4\s\llvm\tools\lldb\lit\tools\lldb-mi\symbol/inputs/symbol-list-lines.c E:\_work\4\s\llvm\tools\lldb\lit\tools\lldb-mi\symbol/inputs/list-lines-helper.c -g : 'RUN: at line 2'; E:\_work\4\b\LLVMBuild\Release\bin\lldb-mi.EXE --synchronous E:\_work\4\b\LLVMBuild\tools\lldb\lit\tools\lldb-mi\symbol\Output\symbol-list-lines.test.tmp < E:\_work\4\s\llvm\tools\lldb\lit\tools\lldb-mi\symbol\symbol-list-lines.test | E:\_work\4\b\LLVMBuild\Release\bin\FileCheck.EXE E:\_work\4\s\llvm\tools\lldb\lit\tools\lldb-mi\symbol\symbol-list-lines.test -- Exit Code: 1 Command Output (stdout): -- $ ":" "RUN: at line 1" $ "E:/_work/4/b/LLVMBuild/Release/bin/clang.exe" "-o" "E:\_work\4\b\LLVMBuild\tools\lldb\lit\tools\lldb-mi\symbol\Output\symbol-list-lines.test.tmp" "E:\_work\4\s\llvm\tools\lldb\lit\tools\lldb-mi\symbol/inputs/main.c" "E:\_work\4\s\llvm\tools\lldb\lit\tools\lldb-mi\symbol/inputs/symbol-list-lines.c" "E:\_work\4\s\llvm\tools\lldb\lit\tools\lldb-mi\symbol/inputs/list-lines-helper.c" "-g" $ ":" "RUN: at line 2" $ "E:\_work\4\b\LLVMBuild\Release\bin\lldb-mi.EXE" "--synchronous" "E:\_work\4\b\LLVMBuild\tools\lldb\lit\tools\lldb-mi\symbol\Output\symbol-list-lines.test.tmp" $ "E:\_work\4\b\LLVMBuild\Release\bin\FileCheck.EXE" "E:\_work\4\s\llvm\tools\lldb\lit\tools\lldb-mi\symbol\symbol-list-lines.test" # command stderr: ##[error]llvm\tools\lldb\lit\tools\lldb-mi\symbol\symbol-list-lines.test(14,10): Error G8E235623: expected string not found in input 3>E:\_work\4\s\llvm\tools\lldb\lit\tools\lldb-mi\symbol\symbol-list-lines.test(14,10): error G8E235623: expected string not found in input [E:\_work\4\b\LLVMBuild\tools\lldb\lit\check-lldb-lit.vcxproj] # CHECK: ^done,lines=[{pc="0x{{[0-9A-Fa-f]+}}",line="3"},{pc="0x{{[0-9A-Fa-f]+}}",line="4"},{pc="0x{{[0-9A-Fa-f]+}}",line="5"}] ^ :17:1: note: scanning from here (gdb) ^ Repository: rL LLVM https://reviews.llvm.org/D48802 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r336564 - Retrieve a function PDB symbol correctly from nested blocks
Author: stella.stamenova Date: Mon Jul 9 10:36:33 2018 New Revision: 336564 URL: http://llvm.org/viewvc/llvm-project?rev=336564=rev Log: Retrieve a function PDB symbol correctly from nested blocks Summary: This patch fixes a problem with retrieving a function symbol by an address in a nested block. In the current implementation of ResolveSymbolContext function it retrieves a symbol with PDB_SymType::None and then checks if found symbol's tag equals to PDB_SymType::Function. So, if nested block's symbol was found, ResolveSymbolContext does not resolve a function. It is very simple to reproduce this. For example, in the next program ``` int main() { auto r = 0; for (auto i = 1; i <= 10; i++) { r += i & 1 + (i - 1) & 1 - 1; } return r; } ``` if we will stop inside the cycle and will do a backtrace, the top element will be broken. But how we can test this? I thought to add an option to lldb-test to allow search a function by address, but the address may change when the compiler will be changed. Patch by: Aleksandr Urakov Reviewers: asmith, labath, zturner Reviewed By: asmith, labath Subscribers: stella.stamenova, llvm-commits Differential Revision: https://reviews.llvm.org/D47939 Modified: lldb/trunk/lit/SymbolFile/PDB/function-nested-block.test Modified: lldb/trunk/lit/SymbolFile/PDB/function-nested-block.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/function-nested-block.test?rev=336564=336563=336564=diff == --- lldb/trunk/lit/SymbolFile/PDB/function-nested-block.test (original) +++ lldb/trunk/lit/SymbolFile/PDB/function-nested-block.test Mon Jul 9 10:36:33 2018 @@ -4,4 +4,4 @@ RUN: lld-link /debug:full /nodefaultlib RUN: lldb-test symbols -find=function -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck %s CHECK: Found 1 functions: -CHECK: name = "{{.*}}", mangled = "_main" +CHECK: name = "{{.*}}", mangled = "{{_?}}main" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D49062: [lldb-mi] Re-implement data-info-line command.
apolyakov added inline comments. Comment at: tools/lldb-mi/MICmdCmdData.cpp:1691 +break; + for (uint32_t j = 0, e = cu.GetNumLineEntries(); j < e; ++j) { +const lldb::SBLineEntry = cu.GetLineEntryAtIndex(j); aprantl wrote: > @clayborg: Is there something better we could do instead of doing a linear > search through all debug line entries? I think we can get rid of this by adding a new method to SBModule - `ResolveSymbolContextsForFileSpec`, which will use a method with the same from Module. https://reviews.llvm.org/D49062 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D49062: [lldb-mi] Re-implement data-info-line command.
apolyakov updated this revision to Diff 154623. apolyakov added a comment. Returned accidentally removed backslashes in `self.expect` pattern, removed comment from: `#include // For std::to_string.` https://reviews.llvm.org/D49062 Files: packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py tools/lldb-mi/MICmdCmdData.cpp tools/lldb-mi/MICmdCmdData.h Index: tools/lldb-mi/MICmdCmdData.h === --- tools/lldb-mi/MICmdCmdData.h +++ tools/lldb-mi/MICmdCmdData.h @@ -34,14 +34,14 @@ #pragma once // Third party headers: -#include "lldb/API/SBCommandReturnObject.h" #include "lldb/API/SBError.h" // In-house headers: #include "MICmdBase.h" #include "MICmnLLDBDebugSessionInfoVarObj.h" #include "MICmnMIValueList.h" #include "MICmnMIValueTuple.h" +#include "MICmnMIResultRecord.h" //++ // @@ -377,6 +377,6 @@ // Attributes: private: - lldb::SBCommandReturnObject m_lldbResult; const CMIUtilString m_constStrArgLocation; + CMICmnMIResultRecord m_resultRecord; }; Index: tools/lldb-mi/MICmdCmdData.cpp === --- tools/lldb-mi/MICmdCmdData.cpp +++ tools/lldb-mi/MICmdCmdData.cpp @@ -19,15 +19,13 @@ // CMICmdCmdDataInfoLine implementation. // Third Party Headers: -#include "lldb/API/SBCommandInterpreter.h" #include "lldb/API/SBInstruction.h" #include "lldb/API/SBInstructionList.h" #include "lldb/API/SBStream.h" #include "lldb/API/SBThread.h" -#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/Twine.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Support/Regex.h" -#include // For PRIx64 +#include // In-house headers: #include "MICmdArgValConsume.h" @@ -46,6 +44,12 @@ #include "MICmnMIResultRecord.h" #include "MICmnMIValueConst.h" +namespace { +CMIUtilString IntToHexAddrStr(uint32_t number) { + return CMIUtilString("0x" + llvm::Twine::utohexstr(number).str()); +} +} // namespace + //++ // // Details: CMICmdCmdDataEvaluateExpression constructor. @@ -1588,7 +1592,9 @@ // Throws: None. //-- CMICmdCmdDataInfoLine::CMICmdCmdDataInfoLine() -: m_constStrArgLocation("location") { +: m_constStrArgLocation("location"), + m_resultRecord(m_cmdData.strMiCmdToken, + CMICmnMIResultRecord::eResultClass_Done) { // Command factory matches this name with that received from the stdin stream m_strMiCmd = "data-info-line"; @@ -1604,7 +1610,7 @@ // Return: None. // Throws: None. //-- -CMICmdCmdDataInfoLine::~CMICmdCmdDataInfoLine() {} +CMICmdCmdDataInfoLine::~CMICmdCmdDataInfoLine() = default; //++ // @@ -1637,98 +1643,84 @@ bool CMICmdCmdDataInfoLine::Execute() { CMICMDBASE_GETOPTION(pArgLocation, String, m_constStrArgLocation); + lldb::SBLineEntry line; + bool found_line = false; const CMIUtilString (pArgLocation->GetValue()); - CMIUtilString strCmdOptionsLocation; + lldb::SBTarget target = CMICmnLLDBDebugSessionInfo::Instance().GetTarget(); + if (strLocation.at(0) == '*') { // Parse argument: // *0x12345 -// ^^^ -- address -const CMIUtilString strAddress(strLocation.substr(1)); -strCmdOptionsLocation = -CMIUtilString::Format("--address %s", strAddress.c_str()); +// ^ -- address +lldb::addr_t address = 0x0; +if (llvm::StringRef(strLocation.substr(1)).getAsInteger(0, address)) { + SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_SOME_ERROR), + m_cmdData.strMiCmd.c_str(), + "Failed to parse address.")); + return MIstatus::failure; +} +line = target.ResolveFileAddress(address).GetLineEntry(); +// Check that found line is valid. +if (line.GetLine()) + found_line = true; } else { const size_t nLineStartPos = strLocation.rfind(':'); if ((nLineStartPos == std::string::npos) || (nLineStartPos == 0) || (nLineStartPos == strLocation.length() - 1)) { - SetError( - CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_LOCATION_FORMAT), -m_cmdData.strMiCmd.c_str(), strLocation.c_str()) - .c_str()); + SetError(CMIUtilString::Format( + MIRSRC(IDS_CMD_ERR_INVALID_LOCATION_FORMAT), + m_cmdData.strMiCmd.c_str(), strLocation.c_str())); return MIstatus::failure; } // Parse argument: // hello.cpp:5 // ^ -- file // ^ -- line -const CMIUtilString strFile(strLocation.substr(0, nLineStartPos)); -const CMIUtilString strLine(strLocation.substr(nLineStartPos + 1)); -strCmdOptionsLocation = -CMIUtilString::Format("--file
[Lldb-commits] [PATCH] D49062: [lldb-mi] Re-implement data-info-line command.
aprantl added inline comments. Comment at: packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py:376 self.expect( -"\^error,msg=\"Command 'data-info-line'\. Error: The LineEntry is absent or has an unknown format\.\"") +"\^error,msg=\"Command 'data-info-line'. Error: The LineEntry is absent or has an unknown format.\"") Why are you changing the regexp here? '.' matches any character, so to match the literal `.` you need to escape it with a backslash. Comment at: tools/lldb-mi/MICmdCmdData.cpp:28 #include "llvm/ADT/StringRef.h" -#include "llvm/Support/Regex.h" -#include // For PRIx64 +#include // For std::to_string. I don't think that comment is necessary. Comment at: tools/lldb-mi/MICmdCmdData.cpp:1691 +break; + for (uint32_t j = 0, e = cu.GetNumLineEntries(); j < e; ++j) { +const lldb::SBLineEntry = cu.GetLineEntryAtIndex(j); @clayborg: Is there something better we could do instead of doing a linear search through all debug line entries? https://reviews.llvm.org/D49062 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48868: [LLDB] In ProcessGDBRemote::UpdateThreadIDList(), the thread PCs should not be cleared after they are updated from the stop reply packet
labath added a comment. Could you elaborate on how/why is this wrong? E.g. in which situations does it matter whether we clear the PC list? https://reviews.llvm.org/D48868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits