summaryrefslogtreecommitdiffstats
path: root/lldb
Commit message (Collapse)AuthorAgeFilesLines
* [Reproducers] Change how reproducers are initialized.Jonas Devlieghere2018-12-0340-311/+402
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the way the reproducer is initialized. Rather than making changes at run time we now do everything at initialization time. To make this happen we had to introduce initializer options and their SB variant. This allows us to tell the initializer that we're running in reproducer capture/replay mode. Because of this change we also had to alter our testing strategy. We cannot reinitialize LLDB when using the dotest infrastructure. Instead we use lit and invoke two instances of the driver. Another consequence is that we can no longer enable capture or replay through commands. This was bound to go away form the beginning, but I had something in mind where you could enable/disable specific providers. However this seems like it adds very little value right now so the corresponding commands were removed. Finally this change also means you now have to control this through the driver, for which I replaced --reproducer with --capture and --replay to differentiate between the two modes. Differential revision: https://reviews.llvm.org/D55038 llvm-svn: 348152
* [PDB] Support PDB-backed expressions evaluation (+ fix stuck test)Aleksandr Urakov2018-12-0312-33/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch contains several small fixes, which makes it possible to evaluate expressions on Windows using information from PDB. The changes are: - several sanitize checks; - make IRExecutionUnit::MemoryManager::getSymbolAddress to not return a magic value on a failure, because callers wait 0 in this case; - entry point required to be a file address, not RVA, in the ObjectFilePECOFF; - do not crash on a debuggee second chance exception - it may be an expression evaluation crash. Also fix detection of "crushed" threads in tests; - create parameter declarations for functions in AST to make it possible to call debugee functions from expressions; - relax name searching rules for variables, functions, namespaces and types. Now it works just like in the DWARF plugin; - fix endless recursion in SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc. Reviewers: zturner, asmith, stella.stamenova Reviewed By: stella.stamenova, asmith Tags: #lldb Differential Revision: https://reviews.llvm.org/D53759 llvm-svn: 348136
* [lit] Add a generic build script with a lit substitution.Zachary Turner2018-12-0116-56/+700
| | | | | | | | | | | | | | | | | | | This adds a script called build.py as well as a lit substitution called %build that we can use to invoke it. The idea is that this allows a lit test to build test inferiors without having to worry about architecture / platform specific differences, command line syntax, finding / configurationg a proper toolchain, and other issues. They can simply write something like: %build --arch=32 -o %t.exe %p/Inputs/foo.cpp and it will just work. This paves the way for being able to run lit tests with multiple configurations, platforms, and compilers with a single test. Differential Revision: https://reviews.llvm.org/D54914 llvm-svn: 348058
* [windows] Fix two minor bugs on WindowsStella Stamenova2018-12-012-5/+6
| | | | | | | 1. In ProcessWindows if we fail to allocate memory, we need to return LLDB_INVALID_ADDRESS rather than 0 or nullptr as that is the invalid address that LLDB looks for 2. In RegisterContextWindows in ReadAllRegisterValues, always create a new buffer. This is what the other platforms do and data_sp is always null in all tested scenarios on Windows as well llvm-svn: 348055
* Add a test to verify that lldb can load a kext binary.Jason Molenda2018-11-302-0/+260
| | | | | | <rdar://problem/46356062> llvm-svn: 348040
* Skip TestRequireHWBreakpoints on WindowsJonas Devlieghere2018-11-301-0/+4
| | | | | | | | | The test assumes that HW breakpoints are not implemented by the debug server. Windows doesn't use these and might actually support HW breakpoints so these tests are expected fail because they don't raise the expected error. llvm-svn: 348010
* Revert "[PDB] Support PDB-backed expressions evaluation"Stella Stamenova2018-11-3012-135/+34
| | | | | | | | | This reverts commit dec87759523b2f22fcff3325bc2cd543e4cda0e7. This commit caused the tests on Windows to run forever rather than complete. Reverting until the commit can be fixed to not stall. llvm-svn: 348009
* [NativePDB] Fix ast-reconstruction test on x86Aleksandr Urakov2018-11-301-3/+3
| | | | | | | | | | | | | | | | | | | Summary: This patch fixes ast-reconstruction.cpp test on x86 platform. Patch by: leonid.mashinskiy Reviewers: zturner, stella.stamenova Reviewed By: zturner Subscribers: aleksandr.urakov, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D55002 llvm-svn: 347975
* [Target] Do not skip a stop on a breakpoint if a plan was completedAleksandr Urakov2018-11-307-0/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes the next situation. On Windows clang-cl makes no stub before the main function, so the main function is located exactly on module entry point. May be it is the same on other platforms. So consider the following sequence: - set a breakpoint on main and stop there; - try to evaluate expression, which requires a code execution on the debuggee side. Such an execution always returns to the module entry, and the plan waits for it there; - the plan understands that it is complete now and removes its breakpoint. But the breakpoint site is still there, because we also have a breakpoint on entry; - StopInfo analyzes a situation. It sees that we have stopped on the breakpoint site, and it sees that the breakpoint site has owners, and no one logical breakpoint is internal (because the plan is already completed and it have removed its breakpoint); - StopInfo thinks that it's a user breakpoint and skips it to avoid recursive computations; - the program continues. So in this situation the program continues without a stop right after the expression evaluation. To avoid this an additional check that the plan was completed was added. Reviewers: jingham, zturner, boris.ulasevich Reviewed by: jingham Tags: #lldb Differential Revision: https://reviews.llvm.org/D53761 llvm-svn: 347974
* [PDB] Support PDB-backed expressions evaluationAleksandr Urakov2018-11-3012-34/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch contains several small fixes, which makes it possible to evaluate expressions on Windows using information from PDB. The changes are: - several sanitize checks; - make IRExecutionUnit::MemoryManager::getSymbolAddress to not return a magic value on a failure, because callers wait 0 in this case; - entry point required to be a file address, not RVA, in the ObjectFilePECOFF; - do not crash on a debuggee second chance exception - it may be an expression evaluation crash; - create parameter declarations for functions in AST to make it possible to call debugee functions from expressions; - relax name searching rules for variables, functions, namespaces and types. Now it works just like in the DWARF plugin; - fix endless recursion in SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc. Reviewers: zturner, asmith, stella.stamenova Reviewed By: stella.stamenova, asmith Tags: #lldb Differential Revision: https://reviews.llvm.org/D53759 llvm-svn: 347962
* [Symbol] Search symbols with name and type in a symbol fileAleksandr Urakov2018-11-307-11/+97
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds possibility of searching a public symbol with name and type in a symbol file, not only in a symtab. It is helpful when working with PE, because PE's symtabs contain only imported / exported symbols only. Such a search is required for e.g. evaluation of an expression that calls some function of the debuggee. Reviewers: zturner, asmith, labath, clayborg, espindola Reviewed By: clayborg Subscribers: davide, emaste, arichardson, aleksandr.urakov, jingham, lldb-commits, stella.stamenova Tags: #lldb Differential Revision: https://reviews.llvm.org/D53368 llvm-svn: 347960
* Fix the Xcode project (pt. 2)Jonas Devlieghere2018-11-301-0/+4
| | | | | | | | Apparently LLVM's libSupport depends on libDemangle to print the stack trace. I'm not sure if this is desired but for now we don't have much choice if we want to turn to bot green again. llvm-svn: 347952
* Fix the Xcode projectJonas Devlieghere2018-11-301-10/+54
| | | | | | | | | | This fixes the driver with the Xcode project. We need to link the driver against the correct LLVM libraries and make sure we're disabling exceptions/rtti. Thanks to Jim for helping me figure this out. llvm-svn: 347936
* [lldbsuite] Build with -gdwarf on WindowsStella Stamenova2018-11-291-0/+6
| | | | | | Earlier this month there was a change in clang that defaulted to using codeview rather than dwarf on Windows. Since all the tests rely on dwarf, we need to explicitly request dwarf when building on Windows. llvm-svn: 347924
* [CMake] Fix standalone build for debugserver on macOSStefan Granitz2018-11-291-1/+6
| | | | | | | | | | | | | | | | | Summary: Quick-fix to avoid CMake config issue: ``` CMake Error at /path/to/lldb/cmake/modules/AddLLDB.cmake:116 (add_dependencies): Cannot add target-level dependencies to non-existent target "lldb-suite". ``` Reviewers: xiaobai, beanz Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D55032 llvm-svn: 347869
* [LLDB] - Improve the support of .debug_str_offsets/.debug_str_offsets.dwoGeorge Rimar2018-11-297-20/+280
| | | | | | | | | | | | | | | | | A skeleton compilation unit may contain the DW_AT_str_offsets_base attribute that points to the first string offset of the CU contribution to the .debug_str_offsets. At the same time, when we use split dwarf, the corresponding split debug unit also may use DW_FORM_strx* forms pointing to its own .debug_str_offsets.dwo. In that case, DWO does not contain DW_AT_str_offsets_base, but LLDB still need to know and skip the .debug_str_offsets.dwo section header to access the offsets. The patch implements the support of DW_AT_str_offsets_base. Differential revision: https://reviews.llvm.org/D54844 llvm-svn: 347859
* Fix windows build broken by r347846Pavel Labath2018-11-291-1/+0
| | | | | | | | | The changed order of includes caused compile errors on MSVC due to snprintf macro definition. snprintf should available since VS2015, and the rest of the code seems to be able to use snprintf just fine without this macro, so this removes it from the lldb driver as well. llvm-svn: 347855
* Remove getopt includes from the driverPavel Labath2018-11-292-13/+0
| | | | | | | | | | | | | They are not needed now that we use LLVMOption for command-line parsing thank you, Jonas). This also allows us to avoid linking of lldbHost into the driver which was breaking liblldb encapsulation. (Technically, there is still a lldb/Host/windows/windows.h include which is needed on windows, but this is a header-only wrapper for <windows.h>, so it is not necessary to link lldbHost for that. But ideally, that should go away too.) llvm-svn: 347846
* [LLDB] - Fix setting the breakpoints when -gsplit-dwarf and DWARF 5 were ↵George Rimar2018-11-294-4/+140
| | | | | | | | | | | | | | | | used for building the executable. The issue happens because starting from DWARF v5 DW_AT_addr_base attribute should be used instead of DW_AT_GNU_addr_base. LLDB does not do that and we end up reading the .debug_addr header as section content (as addresses) instead of skipping it and reading the real addresses. Then LLDB is unable to match 2 similar locations and thinks they are different. Differential revision: https://reviews.llvm.org/D54751 llvm-svn: 347842
* [driver] Fix --core/-c and add testJonas Devlieghere2018-11-294-50/+52
| | | | | | | | | | | Because the optarg variable was shadowed we didn't notice we weren't extracting the value from the option. This patch fixes that and renames the variable to prevent this from happening in the future. I also added two tests to check the error output for --core and --file when the given value doesn't exist. llvm-svn: 347821
* [driver] Some NFC cleanupJonas Devlieghere2018-11-282-30/+33
| | | | | | | This patch includes some small things I noticed while refactoring the driver but didn't want to include in that patch. llvm-svn: 347817
* Make standalone build find tabelgenJonas Devlieghere2018-11-281-0/+1
| | | | | | | The standalone build couldn't find tablegen because we didn't include it. This patch rectifies that. llvm-svn: 347814
* [lldb] Add GetCurrentException APIs to SBThread, add frame recognizer for ↵Kuba Mracek2018-11-2812-10/+187
| | | | | | | | | | | | | | objc_exception_throw for Obj-C runtimes This adds new APIs and a command to deal with exceptions (mostly Obj-C exceptions): SBThread and Thread get GetCurrentException API, which returns an SBValue/ValueObjectSP with the current exception for a thread. "Current" means an exception that is currently being thrown, caught or otherwise processed. In this patch, we only know about the exception when in objc_exception_throw, but subsequent patches will expand this (and add GetCurrentExceptionBacktrace, which will return an SBThread/ThreadSP containing a historical thread backtrace retrieved from the exception object. Currently unimplemented, subsequent patches will implement this). Extracting the exception from objc_exception_throw is implemented by adding a frame recognizer. This also add a new sub-command "thread exception", which prints the current exception. Differential Revision: https://reviews.llvm.org/D43886 llvm-svn: 347813
* [unittests] Fix the File System Test on WindowsStella Stamenova2018-11-281-8/+0
| | | | | | Two of the file system tests are failing on Windows - this updates them to expect the correct values after the refactor of the file system code. llvm-svn: 347796
* Revert r347673 "Catch up with EvaluateAsInt() clang API change."Hans Wennborg2018-11-281-5/+6
| | | | | | r347417 was re-committed in Clang. llvm-svn: 347758
* [unittest] Fix the FileSystem test on Windows. (Attempt #2)Jonas Devlieghere2018-11-281-5/+5
| | | | | | | This fixes the double escaping and compares FileSpecs instead of strings. llvm-svn: 347725
* Remove dead code from IOHandlerAlex Langford2018-11-271-4/+0
| | | | | | This has been dead since 2014 according to the blame llvm-svn: 347721
* [lldbsuite] Each lldb suite test must have a unique class nameStella Stamenova2018-11-272-2/+2
| | | | | | A couple of new tests have been added that use existing class names. This causes failures on Windows if the tests run at the same time and on any platform it results in the logs being overwritten. llvm-svn: 347717
* [Reproducers] Improve reproducer API and add unit tests.Jonas Devlieghere2018-11-2712-137/+283
| | | | | | | | | | | | | | | | | | | When I landed the initial reproducer framework I knew there were some things that needed improvement. Rather than bundling it with a patch that adds more functionality I split it off into this patch. I also think the API is stable enough to add unit testing, which is included in this patch as well. Other improvements include: - Refactor how we initialize the loader and generator. - Improve naming consistency: capture and replay seems the least ambiguous. - Index providers by name and make sure there's only one of each. - Add convenience methods for creating and accessing providers. Differential revision: https://reviews.llvm.org/D54616 llvm-svn: 347716
* [unittest] Fix the FileSystem test on Windows.Jonas Devlieghere2018-11-271-0/+8
| | | | | | | | On Windows, when using the VFS without going through FileSpec, the absolute path to `/foo` is `\\foo`. This updates the unittest to expect that. llvm-svn: 347712
* [Driver] Use libOption with tablegen.Jonas Devlieghere2018-11-2711-648/+661
| | | | | | | | | | | | | This patch modifies the lldb driver to use libOption for option parsing. It allows us to decouple option parsing from option processing which is important when arguments affect initialization. This was previously not possible because the debugger need to be initialized as some option interpretation (like the scripting language etc) was handled by the debugger, rather than in the driver. Differential revision: https://reviews.llvm.org/D54692 llvm-svn: 347709
* [CMake] Pass full libedit path to linkerTatyana Krasnukha2018-11-272-2/+2
| | | | | | Otherwise, linker fails with "cannot find -ledit" in case of custom libedit installation. llvm-svn: 347693
* Catch up with EvaluateAsInt() clang API change.Davide Italiano2018-11-271-6/+5
| | | | llvm-svn: 347673
* Move time cast to SymbolFileDWARFDebugMapJonas Devlieghere2018-11-273-23/+12
| | | | | | | | | When trying to fix the bots we expected that the cast would be needed in different places. Ultimately it turned out only the SymbolFileDWARFDebugMap was affected so, as Pavel correctly notes, it makes more sense to do the cast just there instead of in teh FS. llvm-svn: 347660
* Add support for the Dylan language to ClangASTContextBruce Mitchener2018-11-271-1/+3
| | | | | | | | | | | | | | | | | | | Summary: This change adds eLanguageTypeDylan to the set of languages supported by ClangASTContext. Debug info generated by the Open Dylan compiler's LLVM back-end was designed to be compatible with C debug info. Patch by Peter Housel. Reviewers: clayborg Reviewed By: clayborg Subscribers: brucem, lldb-commits, aprantl Differential Revision: https://reviews.llvm.org/D54886 llvm-svn: 347637
* Revert "[CMake] Streamline code signing for debugserver and pass ↵Davide Italiano2018-11-276-122/+74
| | | | | | | | entitlements to extended llvm_codesign" It breaks the lldb cmake bots. llvm-svn: 347619
* [FileSystem] Ignore nanoseconds when comparing oso_mod_timeJonas Devlieghere2018-11-263-7/+19
| | | | | | | | | | | After a recent change in LLVM the TimePoint encoding become more precise, exceeding the precision of the TimePoint obtained from the DebugMap. This patch adds a flag to the GetModificationTime helper in the FileSystem to return the modification time with less precision. Thanks to Davide for bisecting this failure on the LLDB bots. llvm-svn: 347615
* [lit] Fully qualify lit_config to avoid runtime crashes.Davide Italiano2018-11-261-1/+1
| | | | llvm-svn: 347579
* [Cmake] Add missing dependency to `count`.Davide Italiano2018-11-261-0/+1
| | | | llvm-svn: 347578
* [ASTImporter] Set MustBuildLookupTable on PrimaryContextGabor Marton2018-11-261-1/+1
| | | | | | | | | | | | Summary: SetMustBuildLookupTable() must always be called on a primary context. Reviewers: labath, shafik, a.sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411 Differential Revision: https://reviews.llvm.org/D54863 llvm-svn: 347575
* Revert r347491 as it's llvm counterpart breaks buildbotsLuke Cheeseman2018-11-232-3/+3
| | | | llvm-svn: 347500
* Revert r343342 together with LLVM commit 347490.Luke Cheeseman2018-11-232-3/+3
| | | | llvm-svn: 347491
* Update call to EvaluateAsInt() to the new syntax.Bill Wendling2018-11-211-5/+6
| | | | llvm-svn: 347418
* [lit] Add pthread to the compilation of the tests on LinuxStella Stamenova2018-11-211-1/+1
| | | | | | | | | | | | Summary: Right now only some platforms add pthread to the compilation, however, at least one of the tests requires the pthread library on Linux as well. Since the library is available, this change adds it by default on Linux. Reviewers: labath, zturner, asmith Subscribers: stella.stamenova, jfb, lldb-commits Differential Revision: https://reviews.llvm.org/D54808 llvm-svn: 347412
* Revert 347365, its prerequisite 347364 got reverted.Nico Weber2018-11-211-6/+5
| | | | llvm-svn: 347391
* Update call to EvaluateAsInt() to the new syntax.Bill Wendling2018-11-201-5/+6
| | | | llvm-svn: 347365
* [lit] Build and link TestIRMemoryMapWindows explicitlyStella Stamenova2018-11-201-1/+2
| | | | | | If we just invoke clang-cl without specifying the linker, the tests fail on Windows because they cannot find the correct linker to use, so it needs to be specified explicitly llvm-svn: 347323
* [lit] Disable the stop hook tests on WindowsStella Stamenova2018-11-202-0/+2
| | | | | | These tests are not able to pass on Windows as written as they don't even build llvm-svn: 347321
* [CMake] Streamline code signing for debugserver and pass entitlements to ↵Stefan Granitz2018-11-206-74/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | extended llvm_codesign Summary: Use llvm_codesign to sign debugserver with entitlements. Set global LLVM_CODESIGNING_IDENTITY from LLDB_CODESIGN_IDENTITY (if given). Pass through ENTITLEMENTS from add_lldb_executable to add_llvm_executable. Handle reconfigurations correctly. We have a lot of cases, make them explicit: (1) build and sign debugserver, if all conditions apply: * LLDB_NO_DEBUGSERVER=OFF (default) * On Darwin: LLDB_USE_SYSTEM_DEBUGSERVER=OFF (default) * On Darwin: LLVM_CODESIGNING_IDENTITY == lldb_codesign (2) use system debugserver, if on Darwin and any of: * LLDB_USE_SYSTEM_DEBUGSERVER=ON and found on system (explicit case) * LLVM_CODESIGNING_IDENTITY != lldb_codesign and found on system (fallback case) (3) debugserver will not be available, in case of: * LLDB_NO_DEBUGSERVER=ON * On Darwin: LLVM_CODESIGNING_IDENTITY != lldb_codesign and not found on system (4) error state, in case of: * LLDB_USE_SYSTEM_DEBUGSERVER=ON and not found on system * LLDB_USE_SYSTEM_DEBUGSERVER=ON and LLDB_NO_DEBUGSERVER=ON Reviewers: xiaobai, beanz, vsk, JDevlieghere Subscribers: mgorny, lldb-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D54476 llvm-svn: 347305
* Skip TestTargetCreateDepsJonas Devlieghere2018-11-201-1/+1
| | | | | | Skip this test because Windows deals differently with shared libraries. llvm-svn: 347283
OpenPOWER on IntegriCloud