[Lldb-commits] [PATCH] D63165: Initial support for native debugging of x86/x64 Windows processes
asmith added a comment. This is done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63165/new/ https://reviews.llvm.org/D63165 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r368679 - [lldb][NFC] Add basic IOHandler completion test
Author: teemperor Date: Tue Aug 13 05:12:19 2019 New Revision: 368679 URL: http://llvm.org/viewvc/llvm-project?rev=368679&view=rev Log: [lldb][NFC] Add basic IOHandler completion test We have no test coverage for the IOHandler code that is doing the completion in the command line. This is adding a pexpect-based test as a preparation for the switch to using CompletionRequest in the whole completion machinery. Added: lldb/trunk/packages/Python/lldbsuite/test/iohandler/ lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/ lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/main.c Added: lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py?rev=368679&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py Tue Aug 13 05:12:19 2019 @@ -0,0 +1,58 @@ +""" +Test completion in our IOHandlers. +""" + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * + +class IOHandlerCompletionTest(TestBase): + +mydir = TestBase.compute_mydir(__file__) +NO_DEBUG_INFO_TESTCASE = True + +def setUp(self): +TestBase.setUp(self) + +def expect_string(self, string): +import pexpect +"""This expects for "string", with timeout & EOF being test fails.""" +try: +self.child.expect_exact(string) +except pexpect.EOF: +self.fail("Got EOF waiting for '%s'" % (string)) +except pexpect.TIMEOUT: +self.fail("Timed out waiting for '%s'" % (string)) + +@expectedFailureAll( +oslist=["windows"], +bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") +def test_completion(self): +self.setTearDownCleanup() + +import pexpect +exe = self.getBuildArtifact("a.out") +prompt = "(lldb) " + +self.child = pexpect.spawn( +'%s %s %s %s' % +(lldbtest_config.lldbExec, self.lldbOption, "", exe)) + +self.expect_string(prompt) +self.child.send("\t\t\t") +self.expect_string("register") + +self.child.send("regi\t") +self.expect_string(prompt + "register") +self.child.send("\n") + +self.child.send("\t") +self.expect_string("More (Y/n/a)") +self.child.send("n") +self.expect_string(prompt) + +# Shouldn't crash or anything like that. +self.child.send("regoinvalid\t") +self.expect_string(prompt) + +self.deletePexpectChild() Added: lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/main.c?rev=368679&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/main.c (added) +++ lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/main.c Tue Aug 13 05:12:19 2019 @@ -0,0 +1,5 @@ +int main(int argc, char **argv) { + lldb_enable_attach(); + int to_complete = 0; + return to_complete; +} ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D65682: Give a little more info when "run_to_x_breakpoint" fails
kwk requested changes to this revision. kwk added inline comments. This revision now requires changes to proceed. Comment at: lldb/packages/Python/lldbsuite/test/lldbutil.py:789 + signal_threads = signaled) +test.fail("Stopped for another reason: Breakpoint: %d Signaled: %d Crashed: %d"%(len(bkpts), len(crashed), len(signaled))) + I think the order of the placeholders is wrong either in the format string or in the arguments. This should work: ``` test.fail("Stopped for another reason: Breakpoint: %d Signaled: %d Crashed: %d"%(len(bkpts), len(signaled), len(crashed))) ``` Repository: rLLDB LLDB CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65682/new/ https://reviews.llvm.org/D65682 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D60963: Fix dereferencing null pointer
kwk added inline comments. Comment at: llvm/lib/Demangle/MicrosoftDemangle.cpp:737 TagTypeNode *Demangler::parseTagUniqueName(StringView &MangledName) { + if (!MangledName.consumeFront(".?A")) { Why not change the return type to `llvm::Expected`? Then you have one return value that is either an error (when return value evaluates to `false`) or the value. On top of just a boolean `Error` variable you then can also use the return value to store error texts if you need them. Now, I don't know if the `Error` member is used anywhere else. Repository: rLLDB LLDB CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60963/new/ https://reviews.llvm.org/D60963 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r368688 - [lldb] Reland "Refactor guard variable checks in IRForTarget"
Author: teemperor Date: Tue Aug 13 06:09:18 2019 New Revision: 368688 URL: http://llvm.org/viewvc/llvm-project?rev=368688&view=rev Log: [lldb] Reland "Refactor guard variable checks in IRForTarget" It seems the broken guard variable check for Windows was a feature(TM) and not a bug, so let's keep add a flag to the guard check that keeps the old behavior in the places where we ignored guard variables before. Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp?rev=368688&r1=368687&r2=368688&view=diff == --- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Tue Aug 13 06:09:18 2019 @@ -155,6 +155,15 @@ clang::NamedDecl *IRForTarget::DeclForGl return DeclForGlobal(global_val, m_module); } +/// Returns true iff the mangled symbol is for a static guard variable. +static bool isGuardVariableSymbol(llvm::StringRef mangled_symbol, + bool check_ms_abi = true) { + bool result = mangled_symbol.startswith("_ZGV"); // Itanium ABI guard variable + if (check_ms_abi) +result |= mangled_symbol.startswith("@4IA"); // Microsoft ABI + return result; +} + bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) { lldb_private::Log *log( lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); @@ -172,15 +181,17 @@ bool IRForTarget::CreateResultVariable(l for (StringMapEntry &value_symbol : value_symbol_table) { result_name = value_symbol.first(); -if (result_name.contains("$__lldb_expr_result_ptr") && -!result_name.startswith("_ZGV")) { +// Check if this is a guard variable. It seems this causes some hiccups +// on Windows, so let's only check for Itanium guard variables. +bool is_guard_var = isGuardVariableSymbol(result_name, /*MS ABI*/ false); + +if (result_name.contains("$__lldb_expr_result_ptr") && !is_guard_var) { found_result = true; m_result_is_pointer = true; break; } -if (result_name.contains("$__lldb_expr_result") && -!result_name.startswith("_ZGV")) { +if (result_name.contains("$__lldb_expr_result") && !is_guard_var) { found_result = true; m_result_is_pointer = false; break; @@ -1528,14 +1539,12 @@ bool IRForTarget::ResolveExternals(Funct } static bool isGuardVariableRef(Value *V) { - Constant *Old = nullptr; + Constant *Old = dyn_cast(V); - if (!(Old = dyn_cast(V))) + if (!Old) return false; - ConstantExpr *CE = nullptr; - - if ((CE = dyn_cast(V))) { + if (auto CE = dyn_cast(V)) { if (CE->getOpcode() != Instruction::BitCast) return false; @@ -1544,12 +1553,8 @@ static bool isGuardVariableRef(Value *V) GlobalVariable *GV = dyn_cast(Old); - if (!GV || !GV->hasName() || - (!GV->getName().startswith("_ZGV") && // Itanium ABI guard variable - !GV->getName().endswith("@4IA")))// Microsoft ABI guard variable - { + if (!GV || !GV->hasName() || !isGuardVariableSymbol(GV->getName())) return false; - } return true; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r368695 - [lldb] Fix Microsoft guard variable detection
Author: teemperor Date: Tue Aug 13 07:13:39 2019 New Revision: 368695 URL: http://llvm.org/viewvc/llvm-project?rev=368695&view=rev Log: [lldb] Fix Microsoft guard variable detection Apparently we need to check for a suffix, not a prefix. This broke probably broke expression evaluation on Windows. Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp?rev=368695&r1=368694&r2=368695&view=diff == --- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Tue Aug 13 07:13:39 2019 @@ -160,7 +160,7 @@ static bool isGuardVariableSymbol(llvm:: bool check_ms_abi = true) { bool result = mangled_symbol.startswith("_ZGV"); // Itanium ABI guard variable if (check_ms_abi) -result |= mangled_symbol.startswith("@4IA"); // Microsoft ABI +result |= mangled_symbol.endswith("@4IA"); // Microsoft ABI return result; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D63165: Initial support for native debugging of x86/x64 Windows processes
labath accepted this revision. labath added a comment. This looks great to me. Thank you for your patience. Comment at: lldb/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp:10 +#include "RegisterContextWindows_x86_64.h" +#include "RegisterContextWindows_i386.h" +#include "RegisterContext_x86.h" I think this include should no longer be needed. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63165/new/ https://reviews.llvm.org/D63165 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D65739: [API] Have SBCommandReturnObject::GetOutput/Error return "" instead of nullptr
labath added a comment. Any thoughts on this one? The fix seems quite straight-forward, but I know there was a lot of discussion about None vs "" in the past (and I unfortunately don't remember the outcome of that, nor I was able to find those discussions), so I want to make sure I'm doing the right thing here... CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65739/new/ https://reviews.llvm.org/D65739 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r367441 - Don't crash when pass by value struct has no definition.
On 05/08/2019 22:21, Greg Clayton wrote: so I can crash LLDB now with: $ clang -c main.s $ lldb main.o (lldb) target create "main.o" Current executable set to 'main.o' (x86_64). (lldb) image lookup --verbose --address 0x0008 I can make a python test that can easily do this. Is there a better way that people would prefer? We need something that will get the function for the address and get the function's type. Doing this will cause the function type to be realized. This is the only way to get the "ByValue" type to be created since looking up the type will fail because it is a declaration, but if it is used as a parameter, it will be made. I attached my mach-o .s files below in case anyone wants it. The .s file looks great. I'd probably just reduce it slightly by removing the .apple_*** lookup tables, as they're probably not needed for this test. Instead of a python test, it would probably be more appropriate to make this a lit test. It should be sufficient to attach something like # RUN: llvm-mc -target x86_64-apple-macosx %s >%t # RUN: %lldb %t -o "image lookup --verbose 0" -o exit | FileCheck %s # CHECK: to the beginning of the file. pl ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D60963: Fix dereferencing null pointer
thakis added inline comments. Comment at: llvm/lib/Demangle/MicrosoftDemangle.cpp:737 TagTypeNode *Demangler::parseTagUniqueName(StringView &MangledName) { + if (!MangledName.consumeFront(".?A")) { kwk wrote: > Why not change the return type to `llvm::Expected`? Then you > have one return value that is either an error (when return value evaluates to > `false`) or the value. On top of just a boolean `Error` variable you then can > also use the return value to store error texts if you need them. Now, I don't > know if the `Error` member is used anywhere else. Error is not a parameter, it's class-level state that's used pervasively in this file. Repository: rLLDB LLDB CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60963/new/ https://reviews.llvm.org/D60963 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D62570: Use LLVM's debug line parser in LLDB
clayborg added a comment. Thanks for running the perf tests, that will be great to keep handy somewhere. Might be good to check this test in somewhere. I still think that making changes to the llvm line parser might be a good idea where we can get a callback when a row is to be pushed with the current line table state. This would allow symbolication clients that need just one address, like in atos kind of cases, to not have to store an array of these things and then search them. It would also allow us to just populate our line table as we see fit without the need to have complete LLVM tables and then convert them. Shouldn't be very hard to modify the code in llvm. Let me know what you think. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D62570/new/ https://reviews.llvm.org/D62570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D62570: Use LLVM's debug line parser in LLDB
aprantl accepted this revision. aprantl added a comment. This revision is now accepted and ready to land. Two percent is a noticeable price tag, but since we are doing extra work with error handling and building a copy of the line table in memory first; understandable, I'm moderately optimistic that we could increase the performance a bit in the future by eliminating the extra copy step, though perhaps not with some larger changes to the LLVM interface. Since we need this for DWARF 5 support and the performance penalty isn't that bad, this patch gets a thumbs up from me. I ssume you profiled the code and there isn't any obvious silliness in the implementation? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D62570/new/ https://reviews.llvm.org/D62570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D65682: Give a little more info when "run_to_x_breakpoint" fails
jingham updated this revision to Diff 214865. jingham added a comment. Fixed the inverted call order. Repository: rLLDB LLDB CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65682/new/ https://reviews.llvm.org/D65682 Files: packages/Python/lldbsuite/test/lldbutil.py Index: packages/Python/lldbsuite/test/lldbutil.py === --- packages/Python/lldbsuite/test/lldbutil.py +++ packages/Python/lldbsuite/test/lldbutil.py @@ -778,7 +778,18 @@ threads = get_threads_stopped_at_breakpoint( process, bkpt) +# Check that we stopped at our breakpoint. Try to separate failure reasons: +test.assertNotEqual(process.GetState(), lldb.eStateExited, "Process exited before stopping at breakpoint.") +if len(threads) == 0: +(bkpts, crashed, signaled) = ([], [], []) +sort_stopped_threads(process, + breakpoint_threads = bkpts, + crashed_threads = crashed, + signal_threads = signaled) +test.fail("Stopped for another reason: Breakpoint: %d Signaled: %d Crashed: %d"%(len(bkpts), len(signaled), len(crashed))) + test.assertTrue(len(threads) == 1, "Expected 1 thread to stop at breakpoint, %d did."%(len(threads))) + thread = threads[0] return (target, process, thread, bkpt) Index: packages/Python/lldbsuite/test/lldbutil.py === --- packages/Python/lldbsuite/test/lldbutil.py +++ packages/Python/lldbsuite/test/lldbutil.py @@ -778,7 +778,18 @@ threads = get_threads_stopped_at_breakpoint( process, bkpt) +# Check that we stopped at our breakpoint. Try to separate failure reasons: +test.assertNotEqual(process.GetState(), lldb.eStateExited, "Process exited before stopping at breakpoint.") +if len(threads) == 0: +(bkpts, crashed, signaled) = ([], [], []) +sort_stopped_threads(process, + breakpoint_threads = bkpts, + crashed_threads = crashed, + signal_threads = signaled) +test.fail("Stopped for another reason: Breakpoint: %d Signaled: %d Crashed: %d"%(len(bkpts), len(signaled), len(crashed))) + test.assertTrue(len(threads) == 1, "Expected 1 thread to stop at breakpoint, %d did."%(len(threads))) + thread = threads[0] return (target, process, thread, bkpt) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D65682: Give a little more info when "run_to_x_breakpoint" fails
jingham added a comment. Thanks for pointing that out. Repository: rLLDB LLDB CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65682/new/ https://reviews.llvm.org/D65682 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D62570: Use LLVM's debug line parser in LLDB
clayborg added a comment. I agree with Adrian, this isn't something that needs to hold up this patch, but I do think it is worth doing soon in LLVM. The line table parsing code just needs to take a std::function (or llvm equivalent) that gets called like a lambda when a row is to be pushed. The current LLVM parsing code just has this callback create its own line tables as is currently done. We would just create our own line tables using our callback. So it won't take much work at all in llvm to make this happen and then be able to adopt it in LLDB. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D62570/new/ https://reviews.llvm.org/D62570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D65677: [VirtualFileSystem] Support encoding a current working directory in a VFS mapping.
JDevlieghere added a comment. After some brainstorming I've identified a few other approaches that should better reflect the transience of the current working directory: - We can modify the VFS to have a notion of //search paths//. The `adjustPath` function could iterate over the search paths until it finds an absolute path that exists. If none exist we'd return the same path we return today. This would be the most general approach. - We could create a new virtual file system that we put on top of the RedirectingFileSystem which does something similar to what I've described above. This would require us to override every function that calls `adjustPath`, so it would be pretty heavyweight and rather inflexible. I'd like to get your feedback before I start implementing these. What do you think? Is there another approach that's worth considering? Repository: rLLDB LLDB CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65677/new/ https://reviews.llvm.org/D65677 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D62570: Use LLVM's debug line parser in LLDB
JDevlieghere added a comment. Thank you! I agree that extending the LLVM parser is a good idea, especially if it's already using a callback internally. I'll add a comment in the code and spend some time looking at that in the coming days. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D62570/new/ https://reviews.llvm.org/D62570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D66102: [Symbol] Decouple clang from CompilerType
This revision was automatically updated to reflect the committed changes. Closed by commit rL368741: [Symbol] Decouple clang from CompilerType (authored by xiaobai, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D66102?vs=214678&id=214901#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66102/new/ https://reviews.llvm.org/D66102 Files: lldb/trunk/include/lldb/Symbol/ClangASTContext.h lldb/trunk/include/lldb/Symbol/CompilerType.h lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.h lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp lldb/trunk/source/Symbol/CompilerType.cpp lldb/trunk/unittests/Symbol/TestClangASTContext.cpp Index: lldb/trunk/include/lldb/Symbol/CompilerType.h === --- lldb/trunk/include/lldb/Symbol/CompilerType.h +++ lldb/trunk/include/lldb/Symbol/CompilerType.h @@ -13,7 +13,6 @@ #include #include -#include "lldb/Core/ClangForward.h" #include "lldb/lldb-private.h" #include "llvm/ADT/APSInt.h" @@ -32,7 +31,6 @@ public: // Constructors and Destructors CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type); - CompilerType(clang::ASTContext *ast_context, clang::QualType qual_type); CompilerType(const CompilerType &rhs) : m_type(rhs.m_type), m_type_system(rhs.m_type_system) {} @@ -169,8 +167,6 @@ void SetCompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type); - void SetCompilerType(clang::ASTContext *ast, clang::QualType qual_type); - unsigned GetTypeQualifiers() const; // Creating related types Index: lldb/trunk/include/lldb/Symbol/ClangASTContext.h === --- lldb/trunk/include/lldb/Symbol/ClangASTContext.h +++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h @@ -229,7 +229,8 @@ if (const RecordDeclType *record_decl = llvm::dyn_cast(named_decl)) compiler_type.SetCompilerType( -ast, clang::QualType(record_decl->getTypeForDecl(), 0)); +this, clang::QualType(record_decl->getTypeForDecl(), 0) + .getAsOpaquePtr()); } } } Index: lldb/trunk/unittests/Symbol/TestClangASTContext.cpp === --- lldb/trunk/unittests/Symbol/TestClangASTContext.cpp +++ lldb/trunk/unittests/Symbol/TestClangASTContext.cpp @@ -422,12 +422,14 @@ type, "foo_def", CompilerDeclContext(m_ast.get(), m_ast->GetTranslationUnitDecl())); - CompilerType auto_type(m_ast->getASTContext(), - m_ast->getASTContext()->getAutoType( - ClangUtil::GetCanonicalQualType(typedef_type), - clang::AutoTypeKeyword::Auto, false)); + CompilerType auto_type( + m_ast.get(), + m_ast->getASTContext() + ->getAutoType(ClangUtil::GetCanonicalQualType(typedef_type), +clang::AutoTypeKeyword::Auto, false) + .getAsOpaquePtr()); - CompilerType int_type(m_ast->getASTContext(), m_ast->getASTContext()->IntTy); + CompilerType int_type(m_ast.get(), m_ast->getASTContext()->IntTy.getAsOpaquePtr()); for (CompilerType t : {type, typedef_type, auto_type}) { SCOPED_TRACE(t.GetTypeName().AsCString()); Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp === --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp @@ -149,8 +149,9 @@ } ClangASTContext::AddFieldToRecordType( union_type, element.name.c_str(), - CompilerType(&ast_ctx, element.type), lldb::eAccessPublic, - element.bitfield); + CompilerType(ClangASTContext::GetASTContext(&ast_ctx), + element.type.getAsOpaquePtr()), + lldb::eAccessPublic, element.bitfield); ++count; } ClangASTContext::CompleteTagDeclarationDefinition(union_type); @@ -172,7 +173,9 @@ if (!lldb_ctx) return clang::QualType(); CompilerType array_type(lldb_ctx->CreateArrayType( - CompilerType(&ast_ctx, element_type), size, false)); + CompilerType(ClangASTContext::GetASTContext(&ast_ctx), + element_type.getAsOpaquePtr())
[Lldb-commits] [lldb] r368742 - [DWARF} Use LLVM's debug line parser in LLDB.
Author: jdevlieghere Date: Tue Aug 13 12:51:51 2019 New Revision: 368742 URL: http://llvm.org/viewvc/llvm-project?rev=368742&view=rev Log: [DWARF} Use LLVM's debug line parser in LLDB. The line number table header was substantially revised in DWARF 5 and is not fully supported by LLDB's current debug line implementation. This patch replaces the LLDB debug line parser with its counterpart in LLVM. This was possible because of the limited contact surface between the code to parse the DWARF debug line section and the rest of LLDB. We pay a small cost in terms of performance and memory usage. This is something we plan to address in the near future. Differential revision: https://reviews.llvm.org/D62570 Removed: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h Modified: lldb/trunk/include/lldb/Core/FileSpecList.h lldb/trunk/include/lldb/Symbol/CompileUnit.h lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Symbol/CompileUnit.cpp Modified: lldb/trunk/include/lldb/Core/FileSpecList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FileSpecList.h?rev=368742&r1=368741&r2=368742&view=diff == --- lldb/trunk/include/lldb/Core/FileSpecList.h (original) +++ lldb/trunk/include/lldb/Core/FileSpecList.h Tue Aug 13 12:51:51 2019 @@ -25,6 +25,9 @@ class Stream; /// A class that contains a mutable list of FileSpec objects. class FileSpecList { public: + typedef std::vector collection; + typedef collection::const_iterator const_iterator; + /// Default constructor. /// /// Initialize this object with an empty file list. @@ -191,9 +194,10 @@ public: static size_t GetFilesMatchingPartialPath(const char *path, bool dir_okay, FileSpecList &matches); + const_iterator begin() const { return m_files.begin(); } + const_iterator end() const { return m_files.end(); } + protected: - typedef std::vector - collection; ///< The collection type for the file list. collection m_files; ///< A collection of FileSpec objects. }; Modified: lldb/trunk/include/lldb/Symbol/CompileUnit.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompileUnit.h?rev=368742&r1=368741&r2=368742&view=diff == --- lldb/trunk/include/lldb/Symbol/CompileUnit.h (original) +++ lldb/trunk/include/lldb/Symbol/CompileUnit.h Tue Aug 13 12:51:51 2019 @@ -298,6 +298,8 @@ public: /// A line table object pointer that this object now owns. void SetLineTable(LineTable *line_table); + void SetSupportFiles(const FileSpecList &support_files); + void SetDebugMacros(const DebugMacrosSP &debug_macros); /// Set accessor for the variable list. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt?rev=368742&r1=368741&r2=368742&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt Tue Aug 13 12:51:51 2019 @@ -22,7 +22,6 @@ add_lldb_library(lldbPluginSymbolFileDWA DWARFDebugArangeSet.cpp DWARFDebugInfo.cpp DWARFDebugInfoEntry.cpp - DWARFDebugLine.cpp DWARFDebugMacro.cpp DWARFDebugRanges.cpp DWARFDeclContext.cpp Removed: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp?rev=368741&view=auto == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp (removed) @@ -1,837 +0,0 @@ -//===-- DWARFDebugLine.cpp --*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===--===// - -#include "DWARFDebugLine.h" - -//#define ENABLE_DEBUG_PRINTF // DO NOT LEAVE THIS DEFINED: DEBUG ONLY!!! -#include - -#include - -#include "lldb/Core/FileSpecList.h" -#include "lldb/Core/Module.h" -#include "lldb/Host/Host.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Timer.h" - -#include "DWARFUnit.h" -#include "LogChannelDWARF.h" -#include "SymbolFileDWARF.h" - -using namespace lldb; -using namespace lldb_private; -using namespace std; - -// Parse -// -// Parse all i
[Lldb-commits] [PATCH] D62570: Use LLVM's debug line parser in LLDB
This revision was automatically updated to reflect the committed changes. Closed by commit rL368742: [DWARF} Use LLVM's debug line parser in LLDB. (authored by JDevlieghere, committed by ). Changed prior to commit: https://reviews.llvm.org/D62570?vs=214464&id=214903#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D62570/new/ https://reviews.llvm.org/D62570 Files: lldb/trunk/include/lldb/Core/FileSpecList.h lldb/trunk/include/lldb/Symbol/CompileUnit.h lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Symbol/CompileUnit.cpp Index: lldb/trunk/include/lldb/Symbol/CompileUnit.h === --- lldb/trunk/include/lldb/Symbol/CompileUnit.h +++ lldb/trunk/include/lldb/Symbol/CompileUnit.h @@ -298,6 +298,8 @@ /// A line table object pointer that this object now owns. void SetLineTable(LineTable *line_table); + void SetSupportFiles(const FileSpecList &support_files); + void SetDebugMacros(const DebugMacrosSP &debug_macros); /// Set accessor for the variable list. Index: lldb/trunk/include/lldb/Core/FileSpecList.h === --- lldb/trunk/include/lldb/Core/FileSpecList.h +++ lldb/trunk/include/lldb/Core/FileSpecList.h @@ -25,6 +25,9 @@ /// A class that contains a mutable list of FileSpec objects. class FileSpecList { public: + typedef std::vector collection; + typedef collection::const_iterator const_iterator; + /// Default constructor. /// /// Initialize this object with an empty file list. @@ -191,9 +194,10 @@ static size_t GetFilesMatchingPartialPath(const char *path, bool dir_okay, FileSpecList &matches); + const_iterator begin() const { return m_files.begin(); } + const_iterator end() const { return m_files.end(); } + protected: - typedef std::vector - collection; ///< The collection type for the file list. collection m_files; ///< A collection of FileSpec objects. }; Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt @@ -22,7 +22,6 @@ DWARFDebugArangeSet.cpp DWARFDebugInfo.cpp DWARFDebugInfoEntry.cpp - DWARFDebugLine.cpp DWARFDebugMacro.cpp DWARFDebugRanges.cpp DWARFDeclContext.cpp Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -58,7 +58,6 @@ #include "DWARFDebugAbbrev.h" #include "DWARFDebugAranges.h" #include "DWARFDebugInfo.h" -#include "DWARFDebugLine.h" #include "DWARFDebugMacro.h" #include "DWARFDebugRanges.h" #include "DWARFDeclContext.h" @@ -72,6 +71,7 @@ #include "SymbolFileDWARFDwo.h" #include "SymbolFileDWARFDwp.h" +#include "llvm/DebugInfo/DWARF/DWARFContext.h" #include "llvm/Support/FileSystem.h" #include @@ -153,7 +153,67 @@ return g_settings_sp; } -} // anonymous namespace end +} // namespace + +static const llvm::DWARFDebugLine::LineTable * +ParseLLVMLineTable(lldb_private::DWARFContext &context, + llvm::DWARFDebugLine &line, dw_offset_t line_offset, + dw_offset_t unit_offset) { + Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO); + + llvm::DWARFDataExtractor data = context.getOrLoadLineData().GetAsLLVM(); + llvm::DWARFContext &ctx = context.GetAsLLVM(); + llvm::Expected line_table = + line.getOrParseLineTable( + data, line_offset, ctx, nullptr, [&](llvm::Error e) { +LLDB_LOG_ERROR(log, std::move(e), + "SymbolFileDWARF::ParseLineTable failed to parse"); + }); + + if (!line_table) { +LLDB_LOG_ERROR(log, line_table.takeError(), + "SymbolFileDWARF::ParseLineTable failed to parse"); +return nullptr; + } + return *line_table; +} + +static FileSpecList +ParseSupportFilesFromPrologue(const lldb::ModuleSP &module, + const llvm::DWARFDebugLine::Prologue &prologue, + llvm::StringRef compile_dir = {}, + FileSpec first_file = {}) { + FileSpecList support_files; + support_files.Append(first_file); + + const size_t number_of_files = prologue.FileNames.size(); + for (size_t idx = 1; idx <= number_of_files; ++idx) { +std::string original_file; +if (!prologue.getFileNameByIndex( +idx, compile_dir, +llvm::DILineInf
[Lldb-commits] [lldb] r368746 - [DWARF] Guess the path style
Author: jdevlieghere Date: Tue Aug 13 14:00:27 2019 New Revision: 368746 URL: http://llvm.org/viewvc/llvm-project?rev=368746&view=rev Log: [DWARF] Guess the path style Try to guess the FileSpec path style before defaulting to native. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=368746&r1=368745&r2=368746&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Aug 13 14:00:27 2019 @@ -198,18 +198,22 @@ ParseSupportFilesFromPrologue(const lldb continue; } +auto maybe_path_style = FileSpec::GuessPathStyle(original_file); +FileSpec::Style style = +maybe_path_style ? *maybe_path_style : FileSpec::Style::native; + std::string remapped_file; if (!prologue.getFileNameByIndex( idx, compile_dir, llvm::DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, remapped_file)) { // Always add an entry so the indexes remain correct. - support_files.EmplaceBack(original_file, FileSpec::Style::native); + support_files.EmplaceBack(original_file, style); continue; } module->RemapSourceFile(llvm::StringRef(original_file), remapped_file); -support_files.EmplaceBack(remapped_file, FileSpec::Style::native); +support_files.EmplaceBack(remapped_file, style); } return support_files; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D66174: [Utility] Phase out RegularExpression and use llvm::Regex instead.
JDevlieghere created this revision. JDevlieghere added a reviewer: LLDB. JDevlieghere added a project: LLDB. Herald added a subscriber: abidh. I want to remove the RegularExpression class in Utility and replace it with llvm::Regex. This is something I'd do incrementally on the side when I have some spare minutes. This patch is to make sure everybody is on board and show what the interface looks like. Repository: rLLDB LLDB https://reviews.llvm.org/D66174 Files: lldb/source/Host/common/Socket.cpp lldb/source/Utility/FileSpec.cpp Index: lldb/source/Utility/FileSpec.cpp === --- lldb/source/Utility/FileSpec.cpp +++ lldb/source/Utility/FileSpec.cpp @@ -7,7 +7,6 @@ //===--===// #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Stream.h" #include "llvm/ADT/SmallString.h" @@ -18,6 +17,7 @@ #include "llvm/Support/ErrorOr.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Program.h" +#include "llvm/Support/Regex.h" #include "llvm/Support/raw_ostream.h" #include @@ -487,12 +487,12 @@ if (!extension) return false; - static RegularExpression g_source_file_regex(llvm::StringRef( + static llvm::Regex g_source_file_regex( "^.([cC]|[mM]|[mM][mM]|[cC][pP][pP]|[cC]\\+\\+|[cC][xX][xX]|[cC][cC]|[" "cC][pP]|[sS]|[aA][sS][mM]|[fF]|[fF]77|[fF]90|[fF]95|[fF]03|[fF][oO][" "rR]|[fF][tT][nN]|[fF][pP][pP]|[aA][dD][aA]|[aA][dD][bB]|[aA][dD][sS])" - "$")); - return g_source_file_regex.Execute(extension.GetStringRef()); + "$"); + return g_source_file_regex.match(extension.GetStringRef()); } bool FileSpec::IsRelative() const { Index: lldb/source/Host/common/Socket.cpp === --- lldb/source/Host/common/Socket.cpp +++ lldb/source/Host/common/Socket.cpp @@ -15,11 +15,11 @@ #include "lldb/Host/common/TCPSocket.h" #include "lldb/Host/common/UDPSocket.h" #include "lldb/Utility/Log.h" -#include "lldb/Utility/RegularExpression.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Errno.h" #include "llvm/Support/Error.h" +#include "llvm/Support/Regex.h" #include "llvm/Support/WindowsError.h" #ifndef LLDB_DISABLE_POSIX @@ -280,12 +280,12 @@ bool Socket::DecodeHostAndPort(llvm::StringRef host_and_port, std::string &host_str, std::string &port_str, int32_t &port, Status *error_ptr) { - static RegularExpression g_regex( - llvm::StringRef("([^:]+|\\[[0-9a-fA-F:]+.*\\]):([0-9]+)")); - RegularExpression::Match regex_match(2); - if (g_regex.Execute(host_and_port, ®ex_match)) { -if (regex_match.GetMatchAtIndex(host_and_port, 1, host_str) && -regex_match.GetMatchAtIndex(host_and_port, 2, port_str)) { + static llvm::Regex g_regex("([^:]+|\\[[0-9a-fA-F:]+.*\\]):([0-9]+)"); + llvm::SmallVector matches; + if (g_regex.match(host_and_port, &matches)) { +if (matches.size() == 3) { + host_str = matches[1].str(); + port_str = matches[2].str(); // IPv6 addresses are wrapped in [] when specified with ports if (host_str.front() == '[' && host_str.back() == ']') host_str = host_str.substr(1, host_str.size() - 2); Index: lldb/source/Utility/FileSpec.cpp === --- lldb/source/Utility/FileSpec.cpp +++ lldb/source/Utility/FileSpec.cpp @@ -7,7 +7,6 @@ //===--===// #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Stream.h" #include "llvm/ADT/SmallString.h" @@ -18,6 +17,7 @@ #include "llvm/Support/ErrorOr.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Program.h" +#include "llvm/Support/Regex.h" #include "llvm/Support/raw_ostream.h" #include @@ -487,12 +487,12 @@ if (!extension) return false; - static RegularExpression g_source_file_regex(llvm::StringRef( + static llvm::Regex g_source_file_regex( "^.([cC]|[mM]|[mM][mM]|[cC][pP][pP]|[cC]\\+\\+|[cC][xX][xX]|[cC][cC]|[" "cC][pP]|[sS]|[aA][sS][mM]|[fF]|[fF]77|[fF]90|[fF]95|[fF]03|[fF][oO][" "rR]|[fF][tT][nN]|[fF][pP][pP]|[aA][dD][aA]|[aA][dD][bB]|[aA][dD][sS])" - "$")); - return g_source_file_regex.Execute(extension.GetStringRef()); + "$"); + return g_source_file_regex.match(extension.GetStringRef()); } bool FileSpec::IsRelative() const { Index: lldb/source/Host/common/Socket.cpp === --- lldb/source/Host/common/Socket.cpp +++ lldb/source/Host/common/Socket.cpp @@ -15,11 +15,11 @@ #include "lldb/Host/common/TCPSocket.h" #include "lldb/Host/common/UDPSocket.h" #include "lldb/Utility/Log.h" -#include "lldb/Utility/RegularExpression.h
[Lldb-commits] [PATCH] D66175: Improve anonymous class heuristic in ClangASTContext::CreateRecordType
shafik created this revision. shafik added reviewers: aprantl, teemperor. Currently the heuristic used in `ClangASTContext::CreateRecordType` to identify an anonymous class is that there is that `name` is a `nullptr` or simply a null terminator. This heuristic is not accurate since it will also sweep up unnamed classes and lambdas. The improved heuristic relies on the requirement that an anonymous class must be contained within a class. The motivator for this fix is that we currently see crashes during code completion inside lambdas and member functions of unnamed classes not within a class. This heuristic fix removes these cases but leaves unnamed classes within a class incorrectly labeled anonymous. We will fix this problem long-term by implementing `DW_AT_export_symbols` which will allow us to accurately identify anonymous classes without a heuristic. https://reviews.llvm.org/D66175 Files: packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/TestCompletionCrashInLambda.py source/Symbol/ClangASTContext.cpp Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -1508,8 +1508,25 @@ *ast, (TagDecl::TagKind)kind, decl_ctx, SourceLocation(), SourceLocation(), is_anonymous ? nullptr : &ast->Idents.get(name)); - if (is_anonymous) -decl->setAnonymousStructOrUnion(true); + if (is_anonymous) { +// The current heuristic for checking if a CXXRecordDecl is anonymous is if +// there is no name or if it is just a null terminator. +// This is not accurate since currently this can sweep up both unnamed +// classes and lambdas as anonymous classes, which they are not. +// +// Anonymous classes is a GNU/MSVC extension that clang supports. It +// requires the anonymous class be embedded within a class. So the new +// heuristic verifies this condition. +// +// This fix will unfortunately still mislabel unnamed classes within a class +// but this improves the situation greatly since getting this wrong in the +// other cases can lead to an assert in clang CodeCompletion since +// SemaAccess assumes the DeclContext of an anonymous class is a +// CXXRecordDecl. +if (CXXRecordDecl *record = dyn_cast(decl_ctx)) { + decl->setAnonymousStructOrUnion(true); +} + } if (decl) { if (metadata) Index: packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/TestCompletionCrashInLambda.py === --- packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/TestCompletionCrashInLambda.py +++ packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/TestCompletionCrashInLambda.py @@ -1,4 +1,4 @@ from lldbsuite.test import lldbinline from lldbsuite.test import decorators -lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIf(bugnumber="rdar://53755023")]) +lldbinline.MakeInlineTest(__file__, globals(), []) Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -1508,8 +1508,25 @@ *ast, (TagDecl::TagKind)kind, decl_ctx, SourceLocation(), SourceLocation(), is_anonymous ? nullptr : &ast->Idents.get(name)); - if (is_anonymous) -decl->setAnonymousStructOrUnion(true); + if (is_anonymous) { +// The current heuristic for checking if a CXXRecordDecl is anonymous is if +// there is no name or if it is just a null terminator. +// This is not accurate since currently this can sweep up both unnamed +// classes and lambdas as anonymous classes, which they are not. +// +// Anonymous classes is a GNU/MSVC extension that clang supports. It +// requires the anonymous class be embedded within a class. So the new +// heuristic verifies this condition. +// +// This fix will unfortunately still mislabel unnamed classes within a class +// but this improves the situation greatly since getting this wrong in the +// other cases can lead to an assert in clang CodeCompletion since +// SemaAccess assumes the DeclContext of an anonymous class is a +// CXXRecordDecl. +if (CXXRecordDecl *record = dyn_cast(decl_ctx)) { + decl->setAnonymousStructOrUnion(true); +} + } if (decl) { if (metadata) Index: packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/TestCompletionCrashInLambda.py === --- packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/TestCompletionCrashInLambda.py +++ packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/TestCompletionCrashInLambda.py @@ -1,4 +1,4 @@ from lldbsuite.test import lldbinline from l
[Lldb-commits] [lldb] r368772 - [DebugLine] Be more robust in geussing the path style
Author: jdevlieghere Date: Tue Aug 13 16:30:11 2019 New Revision: 368772 URL: http://llvm.org/viewvc/llvm-project?rev=368772&view=rev Log: [DebugLine] Be more robust in geussing the path style My previous change didn't fix the Windows bot. This patch is an attempt to make guessing the path style more robust by first looking at the compile dir and falling back to the actual file if that's unsuccessful. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=368772&r1=368771&r2=368772&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Aug 13 16:30:11 2019 @@ -186,6 +186,8 @@ ParseSupportFilesFromPrologue(const lldb FileSpecList support_files; support_files.Append(first_file); + llvm::Optional compile_dir_style = + FileSpec::GuessPathStyle(compile_dir); const size_t number_of_files = prologue.FileNames.size(); for (size_t idx = 1; idx <= number_of_files; ++idx) { std::string original_file; @@ -198,9 +200,13 @@ ParseSupportFilesFromPrologue(const lldb continue; } -auto maybe_path_style = FileSpec::GuessPathStyle(original_file); -FileSpec::Style style = -maybe_path_style ? *maybe_path_style : FileSpec::Style::native; +FileSpec::Style style = FileSpec::Style::native; +if (compile_dir_style) { + style = *compile_dir_style; +} else if (llvm::Optional file_style = + FileSpec::GuessPathStyle(original_file)) { + style = *file_style; +} std::string remapped_file; if (!prologue.getFileNameByIndex( ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D66175: Improve anonymous class heuristic in ClangASTContext::CreateRecordType
aprantl added inline comments. Comment at: packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/TestCompletionCrashInLambda.py:4 -lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIf(bugnumber="rdar://53755023")]) +lldbinline.MakeInlineTest(__file__, globals(), []) Can you rename that test to not contain the word "crash" and instead describe the action being performed? (CompletionOfLambda or something like that should be fine) Comment at: source/Symbol/ClangASTContext.cpp:1505 bool is_anonymous = (!name) || (!name[0]); rename this to `has_name` Comment at: source/Symbol/ClangASTContext.cpp:1509 *ast, (TagDecl::TagKind)kind, decl_ctx, SourceLocation(), SourceLocation(), is_anonymous ? nullptr : &ast->Idents.get(name)); `has_name ? &ast->Idents.get(name) : nullptr` Comment at: source/Symbol/ClangASTContext.cpp:1513 +// The current heuristic for checking if a CXXRecordDecl is anonymous is if +// there is no name or if it is just a null terminator. +// This is not accurate since currently this can sweep up both unnamed if (!has_name) { // In C++ a lambda is also represented as an unnamed class. This is different from // an *anonymous class* that the user wrote. Anonymous ... ... CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66175/new/ https://reviews.llvm.org/D66175 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D66175: Improve anonymous class heuristic in ClangASTContext::CreateRecordType
aprantl added inline comments. Comment at: source/Symbol/ClangASTContext.cpp:1521 +// +// This fix will unfortunately still mislabel unnamed classes within a class +// but this improves the situation greatly since getting this wrong in the // FIXME: An unnamed class within a class is also wrongly recognized as an anonymous struct. Comment at: source/Symbol/ClangASTContext.cpp:1524 +// other cases can lead to an assert in clang CodeCompletion since +// SemaAccess assumes the DeclContext of an anonymous class is a +// CXXRecordDecl. and move the excuse in the commit message. It would be really helpful though to include tiny source code examples here to iiustrate the difference between unnames struct and anonymous structs vs. unnamed structs in structs. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66175/new/ https://reviews.llvm.org/D66175 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r368774 - Enable lldb-server on Windows
Author: asmith Date: Tue Aug 13 16:50:54 2019 New Revision: 368774 URL: http://llvm.org/viewvc/llvm-project?rev=368774&view=rev Log: Enable lldb-server on Windows Summary: This commit contains three small changes to enable lldb-server on Windows. - Add lldb-server for Windows to the build - Disable pty redirection on Windows for the initial lldb-server bring up - Add a support to get the parent pid for a process on Windows - Ifdef some signals which aren't supported on Windows Thanks to Hui Huang for the help with this patch! Reviewers: labath Reviewed By: labath Subscribers: JDevlieghere, compnerd, Hui, amccarth, xiaobai, srhines, mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D61686 Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake lldb/trunk/source/Host/windows/Host.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp lldb/trunk/tools/lldb-server/lldb-platform.cpp Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=368774&r1=368773&r2=368774&view=diff == --- lldb/trunk/cmake/modules/LLDBConfig.cmake (original) +++ lldb/trunk/cmake/modules/LLDBConfig.cmake Tue Aug 13 16:50:54 2019 @@ -408,7 +408,7 @@ list(APPEND system_libs ${CMAKE_DL_LIBS} # Figure out if lldb could use lldb-server. If so, then we'll # ensure we build lldb-server when an lldb target is being built. -if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD") +if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD|Windows") set(LLDB_CAN_USE_LLDB_SERVER ON) else() set(LLDB_CAN_USE_LLDB_SERVER OFF) Modified: lldb/trunk/source/Host/windows/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Host.cpp?rev=368774&r1=368773&r2=368774&view=diff == --- lldb/trunk/source/Host/windows/Host.cpp (original) +++ lldb/trunk/source/Host/windows/Host.cpp Tue Aug 13 16:50:54 2019 @@ -169,7 +169,23 @@ bool Host::GetProcessInfo(lldb::pid_t pi GetProcessExecutableAndTriple(handle, process_info); // Need to read the PEB to get parent process and command line arguments. - return true; + + AutoHandle snapshot(CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)); + if (!snapshot.IsValid()) +return false; + + PROCESSENTRY32W pe; + pe.dwSize = sizeof(PROCESSENTRY32W); + if (Process32FirstW(snapshot.get(), &pe)) { +do { + if (pe.th32ProcessID == pid) { +process_info.SetParentProcessID(pe.th32ParentProcessID); +return true; + } +} while (Process32NextW(snapshot.get(), &pe)); + } + + return false; } llvm::Expected Host::StartMonitoringChildProcess( Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=368774&r1=368773&r2=368774&view=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Tue Aug 13 16:50:54 2019 @@ -39,6 +39,8 @@ #if defined(__APPLE__) #define DEBUGSERVER_BASENAME "debugserver" +#elif defined(_WIN32) +#define DEBUGSERVER_BASENAME "lldb-server.exe" #else #define DEBUGSERVER_BASENAME "lldb-server" #endif Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=368774&r1=368773&r2=368774&view=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Tue Aug 13 16:50:54 2019 @@ -217,8 +217,13 @@ Status GDBRemoteCommunicationServerLLGS: m_process_launch_info.GetFlags().Set(eLaunchFlagDebug); if (should_forward_stdio) { +// Temporarily relax the following for Windows until we can take advantage +// of the recently added pty support. This doesn't really affect the use of +// lldb-server on Windows. +#if !defined(_WIN32) if (llvm::Error Err = m_process_launch_info.SetUpPtyRedirection()) return Status(std::move(Err)); +#endif } { Modified: lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp?rev=368774&r1=368773&r2=368774&view=diff ==
[Lldb-commits] [PATCH] D61686: Enable lldb-server on Windows
asmith updated this revision to Diff 214979. asmith edited the summary of this revision. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61686/new/ https://reviews.llvm.org/D61686 Files: cmake/modules/LLDBConfig.cmake source/Host/windows/Host.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp tools/lldb-server/lldb-gdbserver.cpp tools/lldb-server/lldb-platform.cpp Index: tools/lldb-server/lldb-platform.cpp === --- tools/lldb-server/lldb-platform.cpp +++ tools/lldb-server/lldb-platform.cpp @@ -15,8 +15,9 @@ #include #include #include +#if !defined(_WIN32) #include - +#endif #include #include "llvm/Support/FileSystem.h" @@ -67,6 +68,7 @@ #define HIGH_PORT (49151u) #endif +#if !defined(_WIN32) // Watch for signals static void signal_handler(int signo) { switch (signo) { @@ -81,6 +83,7 @@ break; } } +#endif static void display_usage(const char *progname, const char *subcommand) { fprintf(stderr, "Usage:\n %s %s [--log-file log-file-name] [--log-channels " @@ -131,8 +134,10 @@ const char *subcommand = argv[1]; argc--; argv++; +#if !defined(_WIN32) signal(SIGPIPE, SIG_IGN); signal(SIGHUP, signal_handler); +#endif int long_option_index = 0; Status error; std::string listen_host_port; @@ -309,8 +314,10 @@ printf("Connection established.\n"); if (g_server) { // Collect child zombie processes. +#if !defined(_WIN32) while (waitpid(-1, nullptr, WNOHANG) > 0) ; +#endif if (fork()) { // Parent doesn't need a connection to the lldb client delete conn; Index: tools/lldb-server/lldb-gdbserver.cpp === --- tools/lldb-server/lldb-gdbserver.cpp +++ tools/lldb-server/lldb-gdbserver.cpp @@ -514,7 +514,7 @@ handle_launch(gdb_server, argc, argv); // Print version info. - printf("%s-%s", LLGS_PROGRAM_NAME, LLGS_VERSION_STR); + printf("%s-%s\n", LLGS_PROGRAM_NAME, LLGS_VERSION_STR); ConnectToRemote(mainloop, gdb_server, reverse_connect, host_and_port, progname, subcommand, named_pipe_path.c_str(), Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -217,8 +217,13 @@ m_process_launch_info.GetFlags().Set(eLaunchFlagDebug); if (should_forward_stdio) { +// Temporarily relax the following for Windows until we can take advantage +// of the recently added pty support. This doesn't really affect the use of +// lldb-server on Windows. +#if !defined(_WIN32) if (llvm::Error Err = m_process_launch_info.SetUpPtyRedirection()) return Status(std::move(Err)); +#endif } { Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -38,6 +38,8 @@ #if defined(__APPLE__) #define DEBUGSERVER_BASENAME "debugserver" +#elif defined(_WIN32) +#define DEBUGSERVER_BASENAME "lldb-server.exe" #else #define DEBUGSERVER_BASENAME "lldb-server" #endif Index: source/Host/windows/Host.cpp === --- source/Host/windows/Host.cpp +++ source/Host/windows/Host.cpp @@ -169,7 +169,23 @@ GetProcessExecutableAndTriple(handle, process_info); // Need to read the PEB to get parent process and command line arguments. - return true; + + AutoHandle snapshot(CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)); + if (!snapshot.IsValid()) +return false; + + PROCESSENTRY32W pe; + pe.dwSize = sizeof(PROCESSENTRY32W); + if (Process32FirstW(snapshot.get(), &pe)) { +do { + if (pe.th32ProcessID == pid) { +process_info.SetParentProcessID(pe.th32ParentProcessID); +return true; + } +} while (Process32NextW(snapshot.get(), &pe)); + } + + return false; } llvm::Expected Host::StartMonitoringChildProcess( Index: cmake/modules/LLDBConfig.cmake === --- cmake/modules/LLDBConfig.cmake +++ cmake/modules/LLDBConfig.cmake @@ -399,7 +399,7 @@ # Figure out if lldb could use lldb-server. If so, then we'll # ensure we build lldb-server when an lldb target is being built. -if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD") +if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD|Windows") set(LLDB_CAN_USE_LLDB_SERVER ON) else() set(LLDB_CAN_USE_LLDB_SERVER OFF) ___ lldb-
[Lldb-commits] [PATCH] D61687: Update Python tests for lldb-server on Windows
asmith updated this revision to Diff 214985. asmith edited the summary of this revision. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61687/new/ https://reviews.llvm.org/D61687 Files: packages/Python/lldbsuite/test/dotest.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubSetSID.py packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py Index: packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py === --- packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py +++ packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py @@ -29,6 +29,7 @@ kv_dict = self.parse_key_val_dict(context.get("key_vals_text")) self.assertEqual(expected_name, kv_dict.get("name")) +@skipIfWindows # the test is not updated for Windows. @llgs_test def test(self): """ Make sure lldb-server can retrieve inferior thread name""" Index: packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py === --- packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py +++ packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py @@ -81,6 +81,7 @@ self.ignore_signals(signals_to_ignore) self.expect_exit_code(len(signals_to_ignore)) +@skipIfWindows # no signal support @llgs_test def test_default_signals_behavior(self): self.init_llgs_test() Index: packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py === --- packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py +++ packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py @@ -925,6 +925,12 @@ # Convert text pids to ints process_ids = [int(text_pid) for text_pid in text_process_ids if text_pid != ''] +elif platform.system() == 'Windows': +output = subprocess.check_output( +"for /f \"tokens=2 delims=,\" %F in ('tasklist /nh /fi \"PID ne 0\" /fo csv') do @echo %~F", shell=True).decode("utf-8") +text_process_ids = output.split('\n')[1:] +process_ids = [int(text_pid) + for text_pid in text_process_ids if text_pid != ''] # elif {your_platform_here}: # fill in process_ids as a list of int type process IDs running on # the local system. Index: packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py === --- packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py +++ packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py @@ -38,6 +38,7 @@ self.build() self.inferior_seg_fault_received(self.GDB_REMOTE_STOP_CODE_BAD_ACCESS) +@skipIfWindows # No signal is sent on Windows. @llgs_test def test_inferior_seg_fault_received_llgs(self): self.init_llgs_test() Index: packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py === --- packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py +++ packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py @@ -36,6 +36,7 @@ self.build() self.inferior_abort_received() +@skipIfWindows # No signal is sent on Windows. @llgs_test # std::abort() on <= API 16 raises SIGSEGV -
[Lldb-commits] [PATCH] D61687: Update Python tests for lldb-server on Windows
asmith added a comment. Any more comments on the tests for Windows? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61687/new/ https://reviews.llvm.org/D61687 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r368776 - Update Python tests for lldb-server on Windows
Author: asmith Date: Tue Aug 13 17:14:15 2019 New Revision: 368776 URL: http://llvm.org/viewvc/llvm-project?rev=368776&view=rev Log: Update Python tests for lldb-server on Windows Summary: Thanks to Hui Huang and reviewers for all the help with this patch! Reviewers: labath, jfb, clayborg Reviewed By: labath Subscribers: Hui, clayborg, dexonsmith, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D61687 Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubSetSID.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=368776&r1=368775&r2=368776&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Tue Aug 13 17:14:15 2019 @@ -1216,8 +1216,8 @@ def run_suite(): # Don't do debugserver tests on anything except OS X. configuration.dont_do_debugserver_test = "linux" in target_platform or "freebsd" in target_platform or "windows" in target_platform -# Don't do lldb-server (llgs) tests on anything except Linux. -configuration.dont_do_llgs_test = not ("linux" in target_platform) +# Don't do lldb-server (llgs) tests on anything except Linux and Windows. +configuration.dont_do_llgs_test = not ("linux" in target_platform) and not ("windows" in target_platform) # Collect tests from the specified testing directories. If a test # subdirectory filter is explicitly specified, limit the search to that Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py?rev=368776&r1=368775&r2=368776&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py Tue Aug 13 17:14:15 2019 @@ -104,6 +104,7 @@ class TestGdbRemoteAuxvSupport(gdbremote # tests don't get skipped. # +@skipIfWindows # no auxv support. @llgs_test def test_supports_auxv_llgs(self): self.init_llgs_test() @@ -127,6 +128,7 @@ class TestGdbRemoteAuxvSupport(gdbremote self.set_inferior_startup_launch() self.auxv_data_is_correct_size() +@skipIfWindows @llgs_test def test_auxv_data_is_correct_size_llgs(self): self.init_llgs_test() @@ -165,6 +167,7 @@ class TestGdbRemoteAuxvSupport(gdbremote self.set_inferior_startup_launch() self.auxv_keys_look_valid() +@skipIfWindows @llgs_test def test_auxv_keys_look_valid_llgs(self): self.init_llgs_test() @@ -212,6 +215,7 @@ class TestGdbRemoteAuxvSupport(gdbremote self.set_inferior_startup_launch() self.auxv_chunked_reads_work() +@skipIfWindows @llgs_test def test_auxv_chunked_reads_work_llgs(self): self.init_llgs_test() Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py?rev=368776&r1=368775&r2=
[Lldb-commits] [PATCH] D61687: Update Python tests for lldb-server on Windows
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL368776: Update Python tests for lldb-server on Windows (authored by asmith, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D61687?vs=214985&id=214991#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61687/new/ https://reviews.llvm.org/D61687 Files: lldb/trunk/packages/Python/lldbsuite/test/dotest.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubSetSID.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py Index: lldb/trunk/packages/Python/lldbsuite/test/dotest.py === --- lldb/trunk/packages/Python/lldbsuite/test/dotest.py +++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py @@ -1216,8 +1216,8 @@ # Don't do debugserver tests on anything except OS X. configuration.dont_do_debugserver_test = "linux" in target_platform or "freebsd" in target_platform or "windows" in target_platform -# Don't do lldb-server (llgs) tests on anything except Linux. -configuration.dont_do_llgs_test = not ("linux" in target_platform) +# Don't do lldb-server (llgs) tests on anything except Linux and Windows. +configuration.dont_do_llgs_test = not ("linux" in target_platform) and not ("windows" in target_platform) # Collect tests from the specified testing directories. If a test # subdirectory filter is explicitly specified, limit the search to that Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py === --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py @@ -174,12 +174,11 @@ self.build() self.qProcessInfo_contains_keys(set(['cputype', 'cpusubtype'])) -@skipUnlessPlatform(["linux"]) @llgs_test -def test_qProcessInfo_contains_triple_llgs_linux(self): +def test_qProcessInfo_contains_triple_ppid_llgs(self): self.init_llgs_test() self.build() -self.qProcessInfo_contains_keys(set(['triple'])) +self.qProcessInfo_contains_keys(set(['triple', 'parent-pid'])) @skipUnlessDarwin @debugserver_test @@ -202,9 +201,9 @@ # for the remote Host and Process. self.qProcessInfo_does_not_contain_keys(set(['triple'])) -@skipUnlessPlatform(["linux"]) +@skipIfDarwin @llgs_test -def test_qProcessInfo_does_not_contain_cputype_cpusubtype_llgs_linux(self): +def test_qProcessInfo_does_not_contain_cputype_cpusubtype_llgs(self): self.init_llgs_test() self.build() self.qProcessInfo_does_not_contain_keys(set(['cputype', 'cpusubtype'])) Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py === --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py @@ -105,6 +105,7 @@ self.single_step_only_steps_one_instruction( use_Hc_packet=True, step_instruction="vCont;s") +@skipIfWindows # No pty support to test O* & I* notification packets. @llgs_test @expectedFailureAndroid( bu
[Lldb-commits] [lldb] r368782 - Fix warning: suggest braces around initialization of subobject
Author: jdevlieghere Date: Tue Aug 13 18:25:10 2019 New Revision: 368782 URL: http://llvm.org/viewvc/llvm-project?rev=368782&view=rev Log: Fix warning: suggest braces around initialization of subobject This patch adds braces to the DEFINE_XMM macro. Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp?rev=368782&r1=368781&r2=368782&view=diff == --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp Tue Aug 13 18:25:10 2019 @@ -75,11 +75,13 @@ typedef struct _FPReg { (sizeof(GPR) + LLVM_EXTENSION offsetof(FPReg, regname)) #define DEFINE_XMM(reg) \ -#reg, NULL, sizeof(((FPReg *)nullptr)->reg), FPR_OFFSET(reg), eEncodingUint, \ - eFormatVectorOfUInt64, \ - {dwarf_##reg##_x86_64, dwarf_##reg##_x86_64, LLDB_INVALID_REGNUM, \ - LLDB_INVALID_REGNUM, lldb_##reg##_x86_64 }, \ - nullptr, nullptr, nullptr, 0 + { \ +#reg, NULL, sizeof(((FPReg *)nullptr)->reg), FPR_OFFSET(reg), \ +eEncodingUint, eFormatVectorOfUInt64, \ +{dwarf_##reg##_x86_64, dwarf_##reg##_x86_64, LLDB_INVALID_REGNUM, \ + LLDB_INVALID_REGNUM, lldb_##reg##_x86_64 }, \ + nullptr, nullptr, nullptr, 0 \ + } // clang-format off static RegisterInfo g_register_infos_x86_64[] = { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D66174: [Utility] Reimplement RegularExpression on top of llvm::Regex
JDevlieghere updated this revision to Diff 215022. JDevlieghere retitled this revision from "[Utility] Phase out RegularExpression and use llvm::Regex instead." to "[Utility] Reimplement RegularExpression on top of llvm::Regex". JDevlieghere edited the summary of this revision. JDevlieghere added reviewers: labath, clayborg, jingham, xiaobai. Herald added subscribers: krytarowski, srhines. Herald added a reviewer: jdoerfert. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66174/new/ https://reviews.llvm.org/D66174 Files: lldb/include/lldb/Interpreter/OptionValueRegex.h lldb/include/lldb/Utility/RegularExpression.h lldb/source/Commands/CommandObjectBreakpoint.cpp lldb/source/Commands/CommandObjectFrame.cpp lldb/source/Core/Disassembler.cpp lldb/source/Host/common/Socket.cpp lldb/source/Interpreter/CommandObjectRegexCommand.cpp lldb/source/Interpreter/OptionArgParser.cpp lldb/source/Interpreter/OptionValueRegex.cpp lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/source/Symbol/ObjectFile.cpp lldb/source/Symbol/Variable.cpp lldb/source/Target/ThreadPlanStepInRange.cpp lldb/source/Utility/RegularExpression.cpp lldb/unittests/Utility/NameMatchesTest.cpp Index: lldb/unittests/Utility/NameMatchesTest.cpp === --- lldb/unittests/Utility/NameMatchesTest.cpp +++ lldb/unittests/Utility/NameMatchesTest.cpp @@ -49,8 +49,8 @@ TEST(NameMatchesTest, RegularExpression) { EXPECT_TRUE(NameMatches("foobar", NameMatch::RegularExpression, "foo")); EXPECT_TRUE(NameMatches("foobar", NameMatch::RegularExpression, "f[oa]o")); - EXPECT_TRUE(NameMatches("foo", NameMatch::RegularExpression, "")); - EXPECT_TRUE(NameMatches("", NameMatch::RegularExpression, "")); + EXPECT_FALSE(NameMatches("", NameMatch::RegularExpression, "")); + EXPECT_FALSE(NameMatches("foo", NameMatch::RegularExpression, "")); EXPECT_FALSE(NameMatches("foo", NameMatch::RegularExpression, "b")); EXPECT_FALSE(NameMatches("", NameMatch::RegularExpression, "b")); EXPECT_FALSE(NameMatches("^a", NameMatch::RegularExpression, "^a")); Index: lldb/source/Utility/RegularExpression.cpp === --- lldb/source/Utility/RegularExpression.cpp +++ lldb/source/Utility/RegularExpression.cpp @@ -22,16 +22,9 @@ using namespace lldb_private; -RegularExpression::RegularExpression() : m_re(), m_comp_err(1), m_preg() { - memset(&m_preg, 0, sizeof(m_preg)); -} - // Constructor that compiles "re" using "flags" and stores the resulting // compiled regular expression into this object. -RegularExpression::RegularExpression(llvm::StringRef str) -: RegularExpression() { - Compile(str); -} +RegularExpression::RegularExpression(llvm::StringRef str) { Compile(str); } RegularExpression::RegularExpression(const RegularExpression &rhs) : RegularExpression() { @@ -45,12 +38,6 @@ return *this; } -// Destructor -// -// Any previously compiled regular expression contained in this object will be -// freed. -RegularExpression::~RegularExpression() { Free(); } - // Compile a regular expression using the supplied regular expression text and // flags. The compiled regular expression lives in this object so that it can // be readily used for regular expression matches. Execute() can be called @@ -61,13 +48,9 @@ // True if the regular expression compiles successfully, false // otherwise. bool RegularExpression::Compile(llvm::StringRef str) { - Free(); - - // regcomp() on darwin does not recognize "" as a valid regular expression, - // so we substitute it with an equivalent non-empty one. - m_re = str.empty() ? "()" : str; - m_comp_err = ::regcomp(&m_preg, m_re.c_str(), DEFAULT_COMPILE_FLAGS); - return m_comp_err == 0; + m_regex_text = str.empty() ? "()" : str; + m_regex = llvm::Regex(str); + return IsValid(); } // Execute a regular expression match using the compiled regular expression @@ -75,84 +58,25 @@ // are used for regular expression matches "match_count" should indicate the // number of regmatch_t values that are present in "match_ptr". The regular // expression will be executed using the "execute_flags". -bool RegularExpression::Execute(llvm::StringRef str, Match *match) const { - int err = 1; - if (m_comp_err == 0) { -// Argument to regexec must be null-terminated. -std::string reg_str = str; -if (match) { - err = ::regexec(&m_preg, reg_str.c_str(), match->GetSize(), - match->GetData(), 0); -} else { - err = ::regexec(&m_preg, reg_str.c_str(), 0, nullptr, 0); -} - } - - if (err != 0) { -// The regular expression didn't
[Lldb-commits] [lldb] r368802 - [lldb] Reinstate original guard variable check
Author: teemperor Date: Tue Aug 13 22:52:33 2019 New Revision: 368802 URL: http://llvm.org/viewvc/llvm-project?rev=368802&view=rev Log: [lldb] Reinstate original guard variable check The isGuardVariableSymbol option for ignoring Microsoft's ABI was originally added to get the bots green, but now that we found the actual issue (that we checked for prefix instead of suffix in the MS ABI check), we should be able to properly implement the guard variable check without any strange Microsoft exceptions. Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp?rev=368802&r1=368801&r2=368802&view=diff == --- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Tue Aug 13 22:52:33 2019 @@ -156,12 +156,9 @@ clang::NamedDecl *IRForTarget::DeclForGl } /// Returns true iff the mangled symbol is for a static guard variable. -static bool isGuardVariableSymbol(llvm::StringRef mangled_symbol, - bool check_ms_abi = true) { - bool result = mangled_symbol.startswith("_ZGV"); // Itanium ABI guard variable - if (check_ms_abi) -result |= mangled_symbol.endswith("@4IA"); // Microsoft ABI - return result; +static bool isGuardVariableSymbol(llvm::StringRef mangled_symbol) { + return mangled_symbol.startswith("_ZGV") || // Itanium ABI + mangled_symbol.endswith("@4IA"); // Microsoft ABI } bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) { @@ -181,9 +178,8 @@ bool IRForTarget::CreateResultVariable(l for (StringMapEntry &value_symbol : value_symbol_table) { result_name = value_symbol.first(); -// Check if this is a guard variable. It seems this causes some hiccups -// on Windows, so let's only check for Itanium guard variables. -bool is_guard_var = isGuardVariableSymbol(result_name, /*MS ABI*/ false); +// Check if this is a guard variable. +const bool is_guard_var = isGuardVariableSymbol(result_name); if (result_name.contains("$__lldb_expr_result_ptr") && !is_guard_var) { found_result = true; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D63165: Initial support for native debugging of x86/x64 Windows processes
teemperor added a comment. This commit seems to have broken the windows bot: http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/7780 Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63165/new/ https://reviews.llvm.org/D63165 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D66175: Improve anonymous class heuristic in ClangASTContext::CreateRecordType
teemperor added a comment. Could you expand the test (or add another test) for completing in an anonymous classes? Otherwise this LGTM beside Adrian comments assuming this fixes the crash. Comment at: packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/TestCompletionCrashInLambda.py:4 -lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIf(bugnumber="rdar://53755023")]) +lldbinline.MakeInlineTest(__file__, globals(), []) aprantl wrote: > Can you rename that test to not contain the word "crash" and instead describe > the action being performed? > (CompletionOfLambda or something like that should be fine) You an actually completely remove the decorators import and the empty `[]`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66175/new/ https://reviews.llvm.org/D66175 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits