summaryrefslogtreecommitdiffstats
path: root/lldb/source
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-233-7/+60
| | | | | | 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
* [Logging] Fix format stringsJonas Devlieghere2019-07-232-18/+16
| | | | | | | Change format strings to use the `{}` syntax instead of the printf syntax when using LLDB_LOG. llvm-svn: 366824
* [lldb][NFC] Tablegenify processRaphael Isemann2019-07-232-25/+62
| | | | llvm-svn: 366804
* ProcessMachCore: Fix a -Wmisleading-indentation warningPavel Labath2019-07-231-36/+35
| | | | llvm-svn: 366803
* Fix windows build after r366791Pavel Labath2019-07-231-1/+3
| | | | | | | | | | | | A side effect of this commit was that it exchanged the order of types and compile units in the output of SymbolVendor::Dump. A couple of PDB tests dependened on that to assert the links between the two. While it wouldn't be too hard to update the tests, the change of ordering was not something I intended to do with that patch, and is easy to restore the original order, so I do just that. llvm-svn: 366798
* [lldb][NFC] Tablegenify sourceRaphael Isemann2019-07-232-19/+46
| | | | llvm-svn: 366795
* SymbolVendor: Move compile unit handling into the SymbolFile classPavel Labath2019-07-2314-130/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [lldb][NFC] Tablegenify disassembleRaphael Isemann2019-07-232-24/+41
| | | | llvm-svn: 366783
* [Logging] Replace LogIfAnyCategoriesSet with LLDB_LOG.Jonas Devlieghere2019-07-224-61/+32
| | | | | | | | 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
* [Symbol] Improve Variable::GetLanguageAlex Langford2019-07-222-14/+14
| | | | | | | | | | | | | | | | Summary: When trying to ascertain what language a variable belongs to, just checking the compilation unit is often not enough. In r364845 I added a way to check for a variable's language type, but didn't put it in Variable itself. Let's go ahead and put it in Variable. Reviewers: jingham, clayborg Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D64042 llvm-svn: 366733
* [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][NFC] Tablegenify breakpointRaphael Isemann2019-07-223-136/+265
| | | | llvm-svn: 366673
* [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-1924-12/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [lldb][NFC] Tablegenify targetRaphael Isemann2019-07-193-66/+168
| | | | llvm-svn: 366561
* [Target] Fix formatting and whitespace (NFC)Jonas Devlieghere2019-07-191-158/+148
| | | | llvm-svn: 366522
* [Target] Return an llvm::Expected from GetEntryPointAddress (NFC)Jonas Devlieghere2019-07-192-33/+30
| | | | | | | Instead of taking a status and potentially returning an invalid address, return an expected which is guaranteed to contain a valid address. llvm-svn: 366521
* check for interrupt from fgets on WindowsNathan Lanza2019-07-191-0/+3
| | | | | | | | Windows does not have the error EINTR when a blocking syscall is interrupted by a signal. The ReadFile API that fgets is implemented with instead use ERROR_OPERATION_ABORTED. Check for that after fgets. llvm-svn: 366520
* [NFC] Remove instances of unused ClangASTContext headerAlex Langford2019-07-193-3/+2
| | | | llvm-svn: 366519
* [Commands] Remove unused header from CommandObjectFrameAlex Langford2019-07-191-1/+0
| | | | llvm-svn: 366517
* [Breakpoint] Replace use of ClangASTContext with TypeSystemAlex Langford2019-07-181-2/+3
| | | | llvm-svn: 366495
* Fall back to dyld's _dyld_start when no LC_MAIN / main() func can be foundJason Molenda2019-07-184-30/+66
| | | | | | | | | | | | | | | | | | | | | | | | | 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-185-9/+9
| | | | | | | | 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
* [lldb][NFC] Tablegenify alias/regex/history/source/scriptRaphael Isemann2019-07-182-28/+69
| | | | | | | (Converting these commands together as they are all simple commands that share the same file). llvm-svn: 366440
* [lldb][NFC] Format 'type' commands in Options.tdRaphael Isemann2019-07-181-46/+98
| | | | llvm-svn: 366426
* [lldb] Tablegenify thread commands and fix completion bug for thread step-*Raphael Isemann2019-07-182-39/+100
| | | | | | | | | | Beside turning the options into the new tablegen format, this patch also fixes that a few commands had source file completions for the "count" and "end-linenumber" arguments (which both accepted only integers). Reason for that are that somehow we added a '1' instead of our usual '0' value to the initial value for completion. llvm-svn: 366425
* [lldb][NFC] Tablegenify type commandsRaphael Isemann2019-07-182-68/+101
| | | | llvm-svn: 366415
* 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
* Fix CreateFunctionTemplateSpecialization to prevent dangling poiner to stack ↵Shafik Yaghmour2019-07-171-3/+4
| | | | | | | | | | memory In ClangASTContext::CreateFunctionTemplateSpecializationInfo a TemplateArgumentList is allocated on the stack but is treated as if it is persistent in subsequent calls. When we exit the function func_decl will still point to the stack allocated memory. We will use TemplateArgumentList::CreateCopy instead which will allocate memory out of the DeclContext. Differential Revision: https://reviews.llvm.org/D64777 llvm-svn: 366365
* [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
* [lldb][NFC] Tablegenify watchpoint commandsRaphael Isemann2019-07-173-17/+46
| | | | | | | Part of the project that migrates these struct initializers to our new lldb-tablegen. llvm-svn: 366316
* [Target][NFCI] Remove commented out codeAlex Langford2019-07-171-2/+0
| | | | llvm-svn: 366295
* [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
* [Target][NFCI] Rename variableAlex Langford2019-07-171-8/+8
| | | | | | This variable doesn't have anything to do with clang. llvm-svn: 366292
* add a workaround in GetLine to account for ReadFile not reporintg errorNathan Lanza2019-07-161-0/+11
| | | | | | | | | | | | | | | | | | | | | | Summary: ReadFile on Windows is supposed to set ERROR_OPERATION_ABORTED according to the docs on MSDN. However, this has evidently been a known bug since Windows 8. Therefore, we can't detect if a signal interrupted in the fgets. So pressing ctrl-c causes the repl to end and the process to exit. A temporary workaround is just to attempt to fgets twice until this bug is fixed. A possible alternative would be to set a flag in the `sigint_handler` and simply check that flag in the true part of the if statement. However, signal handlers on Windows are asynchronous and this would require sleeping on the repl loop thread while still not necessarily guarnateeing that you caught the sigint. Reviewers: jfb Differential Revision: https://reviews.llvm.org/D64660 llvm-svn: 366281
* [lldb] Rename Options.inc to CommandOptions.inc [NFC]Raphael Isemann2019-07-165-7/+7
| | | | | | | | It seems having two Options.inc files in the same project is giving our custom Xcode project a hard time. This patch renames the new Options.inc to CommandOptions.inc to prevent this conflict. llvm-svn: 366196
* [Target] Remove unused method Target::GetDefaultClangModuleSearchPathsAlex Langford2019-07-161-7/+0
| | | | llvm-svn: 366161
* [LanguageRuntime] Move ObjCLanguageRuntime into a pluginAlex Langford2019-07-1533-30/+485
| | | | | | | | | | | | | | 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
* [lldb][doc] Document how our LLDB table gen initialized optionsRaphael Isemann2019-07-151-0/+98
| | | | | | | | | | | | | | | | Summary: This patch adds documentation that should make it easier to migrate from using the old initializers to the table gen format. Reviewers: jingham Reviewed By: jingham Subscribers: abidh, lldb-commits, JDevlieghere Tags: #lldb Differential Revision: https://reviews.llvm.org/D64670 llvm-svn: 366083
* [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-1213-9/+113
| | | | | | | | | | | | 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
OpenPOWER on IntegriCloud