summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
Commit message (Collapse)AuthorAgeFilesLines
* [ExpressionParser] Handle llvm::Expected resultJonas Devlieghere2019-07-231-2/+10
| | | | | | | | | | This fixes the unchecked-error assertion at runtime. Expected<T> must be checked before access or destruction. Expected<T> value was in success state. (Note: Expected<T> values in success mode must still be checked prior to being destroyed). llvm-svn: 366853
* [ExpressionParser] Fix formatting and whitespace (NFC)Jonas Devlieghere2019-07-231-32/+32
| | | | | | Fix formatting and whitespace before making changes to this file. llvm-svn: 366852
* Revert "Revert "Add ReadCStringFromMemory for faster string reads""Antonio Afonso2019-07-232-7/+6
| | | | | | This reverts commit 9c10b620c0619611dfe062216459431955ac4801. llvm-svn: 366848
* Revert "Revert "Implement xfer:libraries-svr4:read packet""Antonio Afonso2019-07-237-4/+126
| | | | | | This reverts commit 08c38f77c5fb4d3735ec215032fed8ee6730b3db. llvm-svn: 366847
* ProcessMachCore: Fix a -Wmisleading-indentation warningPavel Labath2019-07-231-36/+35
| | | | llvm-svn: 366803
* SymbolVendor: Move compile unit handling into the SymbolFile classPavel Labath2019-07-2312-77/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: SymbolFile classes are responsible for creating CompileUnit instances and they already need to have a notion of the id<->CompileUnit mapping (because of APIs like ParseCompileUnitAtIndex). However, the SymbolVendor has remained as the thing responsible for caching created units (which the SymbolFiles were calling via convoluted constructs like "m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(...)"). This patch moves the responsibility of caching the units into the SymbolFile class. It does this by moving the implementation of SymbolVendor::{GetNumCompileUnits,GetCompileUnitAtIndex} into the equivalent SymbolFile functions. The SymbolVendor functions become just a passthrough much like the rest of SymbolVendor. The original implementations of SymbolFile::GetNumCompileUnits is moved to "CalculateNumCompileUnits", and are made protected, as the "Get" function is the external api of the class. SymbolFile::ParseCompileUnitAtIndex is made protected for the same reason. This is the first step in removing the SymbolVendor indirection, as proposed in <http://lists.llvm.org/pipermail/lldb-dev/2019-June/015071.html>. After removing all interesting logic from the SymbolVendor class, I'll proceed with removing the indirection itself. Reviewers: clayborg, jingham, JDevlieghere Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D65089 llvm-svn: 366791
* [Logging] Replace LogIfAnyCategoriesSet with LLDB_LOG.Jonas Devlieghere2019-07-221-16/+0
| | | | | | | | This patch removes any remaining instances of LogIfAnyCategoriesSet and replaces them with the LLDB_LOG macro. This in turn made it possible to make Log::VAPrintf and Log::VAError private. llvm-svn: 366768
* [Windows] Fix race condition between state changesAdrian McCarthy2019-07-221-11/+10
| | | | | | | | | | | | | | | Patch by Martin Andersson (martin.andersson@evoma.se) If the process is resumed before the state is changed to "running" there is a possibility (when single stepping) that the debugger stops and changes the state to "stopped" before it is first changed to "running". This causes the process to ignore the stop event (since the state did not change) which in turn leads the DebuggerThread to wait indefinitely for the exception predicate in HandleExceptionEvent. Differential Revision: https://reviews.llvm.org/D62183 llvm-svn: 366703
* ELF: Fix a "memset clearing object of non-trivial type" warningPavel Labath2019-07-222-16/+3
| | | | | | | | Just delete the memset as the ELFHeader constructor already zero-initializes the object. Also clean up the ObjectFileELF constructors/desctructors while I'm in there. llvm-svn: 366692
* [lldb] Fix crash when looking up type coming from the ClangModuleDeclVendorRaphael Isemann2019-07-211-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We assume in LLDB that every type comes from an ASTContext with an associated ClangASTContext. However the types inside the ClangModuleDeclVendor don't have a ClangASTContext so we end up crashing whenever we create a CompilerType for one of these types. Simplest way to trigger this bug is to just look up NSObject from a module: (lldb) expr @import Foundation (lldb) type lookup NSObject Assertion failed: (m_type_system != nullptr), function CompilerType, file /Users/teemperor/llvm1/llvm-project/lldb/source/Symbol/CompilerType.cpp, line 39. This patch just creates a ClangASTContext for the ASTContext used by ClangModuleDeclVendor. Reviewers: davide, shafik Reviewed By: davide Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D64989 llvm-svn: 366653
* [NativePDB] Make GetOrCreateDeclForUid return an lldb CompilerDeclNathan Lanza2019-07-213-12/+16
| | | | | | | | | We intend to make PdbAstBuilder abstract and implement PdbAstBuilderClang along with any other languages that wish to use PDBs. Thus, change GetOrCreateDeclForUid from returning a clang decl to a lldb_private::CompilerDecl. llvm-svn: 366650
* [lldb] Fix buildbot build fail caused by r366645Yuanfang Chen2019-07-211-2/+2
| | | | llvm-svn: 366647
* Support Linux signal return trampolines in frame initializationJoseph Tremoulet2019-07-1921-12/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add __kernel_rt_sigreturn to the list of trap handlers for Linux (it's used as such on aarch64 at least), and __restore_rt as well (used on x86_64). Skip decrement-and-recompute for trap handlers in InitializeNonZerothFrame, as signal dispatch may point the child frame's return address to the start of the return trampoline. Parse the 'S' flag for signal handlers from eh_frame augmentation, and propagate it to the unwind plan. Reviewers: labath, jankratochvil, compnerd, jfb, jasonmolenda Reviewed By: jasonmolenda Subscribers: clayborg, MaskRay, wuzish, nemanjai, kbarton, jrtc27, atanasyan, jsji, javed.absar, kristof.beyls, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D63667 llvm-svn: 366580
* Fall back to dyld's _dyld_start when no LC_MAIN / main() func can be foundJason Molenda2019-07-182-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | The new DriverKit user-land kernel drivers in macOS 10.15 / Catalina do not have a main() function or an LC_MAIN load command. lldb uses the address of main() as the return address for inferior function calls; it puts a breakpoint on main, runs the inferior function call, and when the main() breakpoint is hit, lldb knows unambiguously that the inferior function call ran to completion - no other function calls main. This change hoists the logic for finding the "entry address" from ThreadPlanCallFunction to Target. It changes the logic to first try to get the entry address from the main executable module, but if that module does not have one, it will iterate through all modules looking for an entry address. The patch also adds code to ObjectFileMachO to use dyld's _dyld_start function as an entry address. <rdar://problem/52343958> Differential Revision: https://reviews.llvm.org/D64897 llvm-svn: 366493
* [FileSpecList] Add EmplaceBack method (NFC)Jonas Devlieghere2019-07-184-6/+6
| | | | | | | | Instead of having to write FileSpecList::Append(FileSpec(args)) you can now call FileSpecList::EmplaceBack(args), similar to std::vector<>::emplace_back. llvm-svn: 366489
* Add offsetof support to expression evaluator.Raphael Isemann2019-07-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We currently don't support offsetof in the expression evaluator as it is implemented as a macro (which then calls __builtin_offsetof) in stddef.h. The best solution would be to include that header (or even better, import Clang's builtin module), but header-parsing and (cross-platform) importing modules is not ready yet. Until we get this working with modules I would say we add the macro to our existing macro list as we already do with other macros from stddef.h/stdint.h. We should be able to drop all of them once we can import the relevant modules by default. rdar://26040641 Reviewers: shafik, davide Reviewed By: davide Subscribers: clayborg, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D64917 llvm-svn: 366476
* Add support to ProcessMachCore::DoLoadCore to handle an EFI UUID str.Jason Molenda2019-07-171-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a core file has an EFI version string which includes a UUID (similar to what it returns for the kdp KDP_KERNELVERSION packet) in the LC_IDENT or LC_NOTE 'kern ver str' load command. In that case, we should try to find the binary and dSYM for the UUID listed. The dSYM may have python code which knows how to relocate the binary to the correct address in lldb's target section load list and loads other ancillary binaries. The test case is a little involved, 1. it compiles an inferior hello world apple (a.out), 2. it compiles a program which can create a corefile manually with a specific binary's UUID encoded in it, 3. it gets the UUID of the a.out binary, 4. it creates a shell script, dsym-for-uuid.sh, which will return the full path to the a.out + a.out.dSYM when called with teh correct UUID, 5. it sets the LLDB_APPLE_DSYMFORUUID_EXECUTABLE env var before creating the lldb target, to point to this dsym-for-uuid.sh, 6. runs the create-corefile binary we compiled in step #2, 7. loads the corefile from step #6 into lldb, 8. verifies that lldb loaded a.out by reading the LC_NOTE load command from the corefile, calling dsym-for-uuid.sh with that UUID, got back the path to a.out and loaded it. whew! <rdar://problem/47562911> llvm-svn: 366378
* [lldb] Make log for ClangModulesDeclVendor's compiler flag less verboseRaphael Isemann2019-07-171-11/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently the ClangModulesDeclVendor is spamming the expression log with the compiler flags it is using, which creates a log that looks like this: ``` clang -fmodules -fimplicit-module-maps ``` This patch removes all these newlines and just prints the compiler flags in one line as you see in the command line: ``` clang -fmodules -fimplicit-module-maps [...] ``` Reviewers: shafik, davide Reviewed By: davide Subscribers: davide, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D64858 llvm-svn: 366347
* [NativePDB] Add a FromCompilerDecl for going from lldb -> clangNathan Lanza2019-07-172-0/+5
| | | | | | | | | | Summary: A common transformation in NativePDB is to go from lldb types to clang types and vice versa. This function automates one of those steps. Differential Revision: https://reviews.llvm.org/D64851 llvm-svn: 366345
* [ASTImporter] Fix LLDB lookup in transparent ctx and with ext srcGabor Marton2019-07-171-12/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With LLDB we use localUncachedLookup(), however, that fails to find Decls when a transparent context is involved and the given DC has external lexical storage. The solution is to use noload_lookup, which works well with transparent contexts. But, we cannot use only the noload_lookup since the slow case of localUncachedLookup is still needed in some other cases. These other cases are handled in ASTImporterLookupTable, but we cannot use that with LLDB since that traverses through the AST which initiates the load of external decls again via DC::decls(). We must avoid loading external decls during the import becuase ExternalASTSource is implemented with ASTImporter, so external loads during import results in uncontrolled and faulty import. Reviewers: shafik, teemperor, jingham, clayborg, a_sidorin, a.sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits, lldb-commits Tags: #clang, #lldb Differential Revision: https://reviews.llvm.org/D61333 llvm-svn: 366325
* [NativePDB] Make GetTranslationUnitDecl return an lldb CompilerDeclCtxNathan Lanza2019-07-172-10/+11
| | | | | | | | | | | Summary: We intend to make PdbAstBuilder abstract and implement PdbAstBuilderClang along with any other languages that wish to use PDBs. This is the first step. Differential Revision: https://reviews.llvm.org/D64852 llvm-svn: 366293
* [LanguageRuntime] Move ObjCLanguageRuntime into a pluginAlex Langford2019-07-1530-27/+917
| | | | | | | | | | | | | | Summary: Following up to my CPPLanguageRuntime change, I'm moving ObjCLanguageRuntime into a plugin as well. Reviewers: JDevlieghere, compnerd, jingham, clayborg Subscribers: mgorny, arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D64763 llvm-svn: 366148
* [DWARFContext] Strip leading dot in section namesJonas Devlieghere2019-07-131-0/+2
| | | | | | The LLVM context doesn't expect the leading dot in the section name. llvm-svn: 365978
* [LanguageRuntime] Move CPPLanguageRuntime into a pluginAlex Langford2019-07-1212-5/+464
| | | | | | | | | | | | Summary: This seems better suited to be in a plugin. Reviewers: JDevlieghere, clayborg, jingham, compnerd, labath Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D64599 llvm-svn: 365951
* [ObjectContainerBSDArchive] Simplify a few things (NFC)Jonas Devlieghere2019-07-122-61/+70
| | | | | | Differential revision: https://reviews.llvm.org/D64661 llvm-svn: 365950
* [Expression] Move IRDynamicChecks to ClangExpressionParserAlex Langford2019-07-124-17/+746
| | | | | | | | | | | | | | | | | | Summary: IRDynamicChecks in its current form is specific to Clang since it deals with the C language family. It is possible that we may want to instrument code generated for other languages, but we can factor in a more general mechanism to do so at a later time. This decouples ObCLanguageRuntime from Expression! Reviewers: compnerd, clayborg, jingham, JDevlieghere Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D64591 llvm-svn: 365853
* Add convenience methods to convert LLDB to LLVM data structures.Jonas Devlieghere2019-07-115-9/+51
| | | | | | | | | | This patch adds two convenience methods named GetAsLLVM to the LLDB counterparts of the DWARF DataExtractor and the DWARF context. The DWARFContext, once created, is cached for future usage. Differential revision: https://reviews.llvm.org/D64535 llvm-svn: 365819
* [lldb] Don't use __FUNCTION__ as a file nameRaphael Isemann2019-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: I saw while debugging that we call this file `ParseInternal`, which is not a very good name for our fake expression file and also adds this unnecessary link between the way we name this function and the other source location names we get from the expression parser. This patch is renaming it to `<lldb-expr>` which is closer to the way Clang names its buffers, it doesn't depend on the function name (which changes when I refactor this code) and it's easier to grep for. Reviewers: davide Reviewed By: davide Subscribers: abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D64545 llvm-svn: 365812
* [LLDB] Fix FreeBSD build.David Carlier2019-07-112-19/+24
| | | | | | | | | | | | To align with the LaunchThread change. Reviewers: MaskRay, mgorny Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D64398 llvm-svn: 365761
* [lldb] Fix handling of dollar characters in expr commandRaphael Isemann2019-07-101-31/+79
| | | | llvm-svn: 365698
* ObjectFileELF: Add support for gnu-style compressed sectionsPavel Labath2019-07-101-28/+31
| | | | | | | | | With this style, a compressed section is indicated by a "z" in the section name, instead of a section header flag. This patch consists of two small tweaks: - use an llvm Decompressor method in order to properly detect compressed sections - make sure we recognise .zdebug_info (and friends) when classifying section types. llvm-svn: 365654
* Revert accidental change to fileAaron Smith2019-07-101-3/+0
| | | | llvm-svn: 365593
* Try again to move common functionality from ProcessWindows into ProcessDebuggerAaron Smith2019-07-106-455/+726
| | | | | | | This reverts commit ed499a36b67cf46cbf66052cfe374c80a595f1c1 and addresses a problem causing a Windows build bot to hang. llvm-svn: 365592
* [lldb, windows] Update two more locations that use LaunchThread to the new ↵Stella Stamenova2019-07-091-14/+18
| | | | | | function signature llvm-svn: 365526
* Revert "Move common functionality from processwindows into processdebugger"Stella Stamenova2019-07-085-716/+452
| | | | | | | | This reverts commit 9c01eaff6aa3f59d91530f47b85bb470377a7780. The changes in this commit are causing several of the LLDB tests to hang and/or timeout. llvm-svn: 365371
* Process: generalise Windows thread setupSaleem Abdulrasool2019-07-071-10/+20
| | | | | | | | The Windows build currently cannot support debugging foreign targets or debugging Windows ARM NT and Windows ARM64 targets. Do not assume a x64/x86 host. This enables building lldb for Windows ARM64. llvm-svn: 365282
* [CplusPlus] ISVTableName is unused. NFCI.Davide Italiano2019-07-054-14/+0
| | | | | | | | | | | | Reviewers: teemperor, JDevlieghere Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D64265 llvm-svn: 365243
* Change LaunchThread interface to return an expected.Jonas Devlieghere2019-07-054-23/+45
| | | | | | | | | Change the interface to return an expected, instead of taking a Status pointer. Differential revision: https://reviews.llvm.org/D64163 llvm-svn: 365226
* Plugins: permit building on Windows ARM64Saleem Abdulrasool2019-07-041-15/+12
| | | | | | | | | | Rather than relying on `sizeof(void *)` to determine the architecture, use the `CMAKE_SYSTEM_PROCESSOR` variable. This should allow us to build for Windows and cross-compile. Without this, we would attempt to build the x64 plugin on ARM64 which would fail due to the `CONTEXT` type being defined for ARM64 rather than `x64`. llvm-svn: 365155
* Refactor ObjectFile::GetSDKVersionRaphael Isemann2019-07-033-44/+18
| | | | | | | | | | | | | | | | Summary: This patch modernizes the GetSDKVersion API and hopefully prevents problems such as the ones discovered in D61218. Reviewers: aprantl, jasonmolenda, clayborg Reviewed By: aprantl, clayborg Subscribers: clayborg, labath, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D61233 llvm-svn: 365090
* Add plugin.process.gdb-remote.use-libraries-svr4 optionAntonio Afonso2019-07-031-7/+36
| | | | | | | | | | | | | | | | | | | | | Summary: This option allow the toggling of the libraries-svr4 usage in ProcessGDBRemote. It's a follow up of https://reviews.llvm.org/D62503#1564296 and it's meant to test / tweak this new packet with, hopefully, minimum impact and in a faster way. Enable it with `settings set plugin.process.gdb-remote.use-libraries-svr4 true`. For now, by default it's false. I didn't put tests up for this but I did test it manually. Reviewers: labath, jankratochvil Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D64112 llvm-svn: 365059
* [Symbol] Add DeclVendor::FindTypesAlex Langford2019-07-023-45/+23
| | | | | | | | | | | | | Summary: Following up on the plan I outlined in D63622, we can remove the dependence on clang in all the places where we only want to find the types from the DeclVendor. This means that currently DeclVendor depends on clang, but centralizing the dependency makes it easier to refactor cleanly. Differential Revision: https://reviews.llvm.org/D63853 llvm-svn: 364962
* [Reproducer] Assert on unexpected packetJonas Devlieghere2019-07-011-0/+1
| | | | | | | | I'm not able to reproduce the reproducer flakiness we're seeing on GreenDragon. I want to add this assert to find out if the GDB remote packets are somehow getting out of sync when this happens. llvm-svn: 364852
* [Core] Generalize ValueObject::IsRuntimeSupportValueAlex Langford2019-07-011-1/+2
| | | | | | | | | | | | | | | Summary: Instead of falling back to ObjCLanguageRuntime, we should be falling back to every loaded language runtime. This makes ValueObject more language agnostic. Reviewers: labath, compnerd, JDevlieghere, davide Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D63240 llvm-svn: 364845
* [lldb] [Process/NetBSD] Use global enable bits for watchpointsMichal Gorny2019-07-011-2/+2
| | | | | | | | | | | Set global enable bits (i.e. bits 1, 3, 5, 7) to enable watchpoints on NetBSD rather than the local enable bits (0, 2, 4, 6). The former are necessary for watchpoints to be correctly recognized by the NetBSD kernel. The latter cause them to be reported as trace points. Differential Revision: https://reviews.llvm.org/D63792 llvm-svn: 364781
* [lldb] [Process/NetBSD] Fix segfault when handling watchpointMichal Gorny2019-07-011-10/+21
| | | | | | | | | | | | | | | Fix the watchpoint/breakpoint code to search for matching thread entry in m_threads explicitly rather than assuming that it will be present at specified index. The previous code segfault since it wrongly assumed that the index will match LWP ID which was incorrect even for a single thread (where index was 0 and LWP ID was 1). While fixing that off-by-one error would help for this specific task, I believe it is better to be explicit in what we are searching for. Differential Revision: https://reviews.llvm.org/D63791 llvm-svn: 364780
* [lldb] [Process/NetBSD] Support reading YMM registers via PT_*XSTATEMichal Gorny2019-07-012-2/+97
| | | | | | | | | | | | | Provide a (conditional) support for the new PT_GETXSTATE and PT_SETXSTATE ptrace() requests, and use them to implement getting and setting YMM registers. The functions used for splitting and recombining YMM register data are based on matching functions in FreeBSD plugin, with some simplification and updates to match NetBSD structures. Differential Revision: https://reviews.llvm.org/D63545 llvm-svn: 364779
* Revert "[lldb] [Process/NetBSD] Fix constructor after r363707"Michal Gorny2019-07-011-1/+1
| | | | | | | Now that r364751 has been reverted, we need to revert this fixup as well. llvm-svn: 364776
* Don't check the validity of newly contructed data buffersPavel Labath2019-07-016-42/+0
| | | | | | | | | | A bunch of places were checking that DataBufferHeap::GetBytes returns a non-null pointer right after constructing it. The only time when GetBytes returns a null pointer is if it is empty (and I'm not sure that even this is a good idea), but that is clearly not the case here, as the buffer was constructed with a non-zero size just a couple of lines back. llvm-svn: 364754
* Revert "Implement xfer:libraries-svr4:read packet"Pavel Labath2019-07-017-126/+4
| | | | | | | | | | | | | | | | | | | D62502, together with D62503 have broken the builds which have XML support enabled. Reverting D62503 (r364355) fixed that, but has broken has left some of the tests introduced by D62502 broken more or less nondeternimistically (it depended on whether the system happens to place the library list near unreadable pages of memory). I attempted to make a partial fix for this in r364748, but Jan Kratochvil pointed out that this reintroduces the problem which reverting D62503 was trying to solve. So instead, I back out the whole thing so we can get back to a clean slate that works for everyone. We can figure out a way forward from there. This reverts r364748, r363772 and r363707. llvm-svn: 364751
OpenPOWER on IntegriCloud