summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix TestGdbRemoteLibrariesSvr4SupportPavel Labath2019-07-011-2/+2
| | | | | | | | | | | | | D62502 had a bug (visible only with D62503 reverted), where it would error out if attempting to read a string from memory and the memory page after the string happened to be unmapped. This fixes the problem by checking for whether ReadMemory read *any* bytes, instead of checking whether it returned an error. A greater question is whether ReadMemory should even return an error if it read at least one byte, but I'm leaving that for a separate patch. llvm-svn: 364748
* Remove null checks of results of new expressionsPavel Labath2019-07-0115-52/+15
| | | | | | | | operator new doesn't return a null pointer, even if one turns off exceptions (it calls std::terminate instead). Therefore, all of this is dead code. llvm-svn: 364744
* Revert "[GDBRemote] Remove code that flushes GDB remote packets"Jonas Devlieghere2019-06-301-0/+7
| | | | | | | Reverting this again as it doesn't appear to solve the flakiness on the LLDB standalone bot. llvm-svn: 364722
* Use const auto *Fangrui Song2019-06-291-5/+5
| | | | llvm-svn: 364702
* Get the expression parser to handle missing weak symbols.Jim Ingham2019-06-282-6/+14
| | | | | | | | | | MachO only for this patch. Differential Revision: https://reviews.llvm.org/D63914 <rdar://problem/51463642> llvm-svn: 364686
* [GDBRemote] Remove code that flushes GDB remote packetsJonas Devlieghere2019-06-281-7/+0
| | | | | | | | | | | | | | The arbitrary timeout when flushing GDB remote packets caused non-determinism and flakiness between test runs. I suspect it is what's causing the flakiness of the reproducer tests on GreenDragon, and want to see if removing it causes that to go away. This change was originally introduced in r197579 to discard a `$T02thread:01;#4` that QEMU was sending. If anybody knows how to test that this continues working after removing this code, I'd love to hear it. llvm-svn: 364669
* Make sure the thread list is updated before you set the stop reasonJim Ingham2019-06-281-7/+10
| | | | | | | | | | | | | | | on a thread. When talking to some older gdb-remote stubs, We were getting a stop reason from the stop reply packet and setting it on the relevant thread before we updated the full stop list. That would get discarded when the full list was updated. Also, if you already have a thread list when you go to see if there is an Operating System plugin, and you do indeed load a new OS plugin, you have to re-fetch the thread list or it will only show the raw threads. Differential Revision: https://reviews.llvm.org/D62887 llvm-svn: 364666
* Fixing a couple of wrong logical operator bugs.Ali Tamur2019-06-282-2/+2
| | | | llvm-svn: 364614
* [lldb] [Plugins/SysV-x86_64] NetBSD is also using SysV ABIMichal Gorny2019-06-271-0/+1
| | | | | | | | | | | Reenable SysV x86_64 ABI usage on NetBSD that was accidentally removed in r364216. This fixes numerous test failures with messages similar to the following: error: Can't run the expression locally: Interpreter doesn't handle one of the expression's opcodes llvm-svn: 364503
* [Reproducers] Fix flakiness and off-by-one during replay.Jonas Devlieghere2019-06-271-6/+25
| | | | | | | | | | | | | | | | | | | | | | | This fixes two replay issues that caused the tests to behave erratically: 1. It fixes an off-by-one error, where all replies where shifted by 1 because of a `+` packet that should've been ignored. 2. It fixes another off-by-one-error, where an asynchronous ^C was offsetting all subsequent packets. The reason is that we 'synchronize' requests and replies. In reality, a stop reply is only sent when the process halt. During replay however, we instantly report the stop, as the reply to packets like continue (vCont). Both packets should be ignored, and indeed, checking the gdb-remote log, no unexpected packets are received anymore. Additionally, be more pedantic when it comes to unexpected packets and return an failure form the replay server. This way we should be able to catch these things faster in the future. llvm-svn: 364494
* Support nested target.xml register definition files, lack of reg group markers.Jason Molenda2019-06-262-60/+88
| | | | | | | | | | | | | | | | | | | | | The qemu x86_64 target returns a target.xml register definition file which includes other xml files and they include others, etc. Also, the registers are not put in register groups like lldb wants to see. This patch (1) puts registers that aren't in a register group in a "general" register group, (2) change ProcessGDBRemote::GetGDBServerRegisterInfo to be a method that starts the parsing, asking a recurisve function to fetch and parse target.xml, (3) adds ProcessGDBRemote::GetGDBServerRegisterInfoXMLAndProcess which can recusively call itself to read and parse included xml files, (4) in addition to expecting the top-level <target> element (which only happens in the top level xml file), also an xml file that consists of a <feature> node - read the register defintions and includes from that <feature> element. <rdar://problem/49537922> Differential revision: https://reviews.llvm.org/D63802 llvm-svn: 364484
* Revert "Add ReadCStringFromMemory for faster string reads"Antonio Afonso2019-06-252-6/+7
| | | | | | | | This reverts commit a7335393f50246b59db450dc6005f7c8f29e73a6. It seems this is breaking a bunch of tests (https://reviews.llvm.org/D62503#1549874) so reverting until I find the time to repro and fix. llvm-svn: 364355
* DWARF: Add support for type units+split dwarf comboPavel Labath2019-06-256-14/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With the last round of refactors, supporting type units in dwo files becomes almost trivial. This patch contains a couple of small fixes, which taken as a whole make type units work in the split dwarf scenario (both DWARF4 and DWARF5): - DWARFContext: make sure we actually read the debug_types.dwo section - DWARFUnit: set string offsets base on all units in the dwo file, not just the main CU - ManualDWARFIndex: index all units in the file - SymbolFileDWARFDwo: Search for the single compile unit in the file, as we can no longer assume it will be the first one The last part makes it obvious that there is still some work to be done here, namely that we do not support dwo files with multiple compile units. That is something that should be easier after the DIERef refactors, but it still requires more work. Tests are added for the type units+split dwarf + dwarf4/5 scenarios, as well as a test that checks we behave reasonably in the presence of dwo files with multiple CUs. Reviewers: clayborg, JDevlieghere, aprantl Subscribers: arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D63643 llvm-svn: 364274
* [ABI] Remove unused variables in ABIWindows_x86_64Alex Langford2019-06-241-4/+0
| | | | llvm-svn: 364223
* [ABI] Implement Windows ABI for x86_64Alex Langford2019-06-247-10/+2115
| | | | | | | | | | | | | | | | | | Summary: Implement the ABI for WIndows-x86_64 including register info and calling convention. Handled nested struct returned in register (SysV doesn't have it supported) Reviewers: xiaobai, compnerd Reviewed By: compnerd Subscribers: labath, jasonmolenda, fedor.sergeev, mgorny, teemperor, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D62213 llvm-svn: 364216
* Move common functionality from processwindows into processdebuggerAaron Smith2019-06-245-452/+716
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change extracts functionalities from processwindows into a introduced processdebugger that can be reused in native process debugging. The main reason is that the native process debugging can't directly be based on processwindows or be implemented as a pass-through to this plugin since the plugin has ties to Target and Process classes that are needed in host debugging but not necessary in native debugging. Reviewers: labath, Hui, jfb, clayborg, amccarth Reviewed By: labath Subscribers: amccarth, dexonsmith, mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D63166 llvm-svn: 364210
* [Target] Decouple ObjCLanguageRuntime from LanguageRuntimeAlex Langford2019-06-212-2/+4
| | | | | | | | | | | | Summary: ObjCLanguageRuntime was being pulled into LanguageRuntime because of Breakpoint Preconditions. If we move BreakpointPrecondition out of Breakpoint, we can extend the LanguageRuntime plugin interface so that LanguageRuntimes can give us a BreakpointPrecondition for exceptions. Differential Revision: https://reviews.llvm.org/D63181 llvm-svn: 364098
* [lldb] [Process] Introduce common helpers to split/recombine YMM dataMichal Gorny2019-06-213-58/+32
| | | | | | | | | | | | | | | | | Introduce two common helpers to take care of splitting and recombining YMM registers to/from XSAVE-like data. Since FreeBSD, Linux and NetBSD all use XSAVE-like data structures but with potentially different field layouts, the function takes two pointers -- to XMM register and to YMM high bits, and copies the data from/to YMMReg type. While at it, remove support for big endian. To mine and Pavel Labath's combined knowledge, there is no such thing on x86. Furthermore, assuming that the YMM register data would be swapped for big endian seems to be a weird assumption. Differential Revision: https://reviews.llvm.org/D63610 llvm-svn: 364042
* DWARF: Add "dwo_num" field to the DIERef classPavel Labath2019-06-2123-138/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When dwo support was introduced, it used a trick where debug info entries were referenced by the offset of the compile unit in the main file, but the die offset was relative to the dwo file. Although there was some elegance to it, this representation was starting to reach its breaking point: - the fact that the skeleton compile unit owned the DWO file meant that it was impossible (or at least hard and unintuitive) to support DWO files containing more than one compile unit. These kinds of files are produced by LTO for example. - it made it impossible to reference any DIEs in the skeleton compile unit (although the skeleton units are generally empty, clang still puts some info into them with -fsplit-dwarf-inlining). - (current motivation) it made it very hard to support type units placed in DWO files, as type units don't have any skeleton units which could be referenced in the main file This patch addresses this problem by introducing an new "dwo_num" field to the DIERef class, whose purpose is to identify the dwo file. It's kind of similar to the dwo_id field in DWARF5 unit headers, but while this is a 64bit hash whose main purpose is to catch file mismatches, this is just a smaller integer used to indentify a loaded dwo file. Currently, this is based on the index of the skeleton compile unit which owns the dwo file, but it is intended to be eventually independent of that (to support the LTO use case). Simultaneously the cu_offset is dropped to conserve space, as it is no longer necessary. This means we can remove the "BaseObjectOffset" field from the DWARFUnit class. It also means we can remove some of the workarounds put in place to support the skeleton-unit+dwo-die combo. More work is needed to remove all of them, which is out of scope of this patch. Reviewers: JDevlieghere, clayborg, aprantl Subscribers: mehdi_amini, dexonsmith, arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D63428 llvm-svn: 364009
* [lldb] [Process/NetBSD] Remove unnecessary register buffer abstractionMichal Gorny2019-06-204-117/+12
| | | | | | | | | | | | | | | | | Remove most of the abstraction over ptrace() register operations, as it has little value and introduces more code than it saves. Instead, leave a single ptrace() wrapper method and call it directly from ReadRegisterSet() and WriteRegisterSet() with correct PT_* request and buffer. Remove the remaining direct ReadGPR() and WriteGPR() invocations with ReadRegisterSet() and WriteRegisterSet(). Cleanup suggested by Pavel Labath in D63545. Differential Revision: https://reviews.llvm.org/D63594 llvm-svn: 363923
* Fix -Wmismatched-tags introduced in r363910Pavel Labath2019-06-203-4/+1
| | | | | | | | That commit changed DIERef from a struct to a class, but did not update the forward-declarations. This fixes one forward-declaration, and removes other (unused) decls. llvm-svn: 363915
* DWARF: Provide accessors to DIERef fieldsPavel Labath2019-06-209-24/+65
| | | | | | | | | | | | | | | | | | | | | | Summary: Instead of accessing the fields directly, use accessor functions to provide access to the DIERef components. This allows us to decouple the external interface, from the internal representation. The external interface can use llvm::Optional and similar goodies, while the data can still be stored internally in a more compact representation. I also document the purpose of the existing DIERef fields. The main motivation for this change is a need to introduce an additional field to the DIERef class, but I believe the change has its own merit. Reviewers: JDevlieghere, aprantl, clayborg Subscribers: arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D63400 llvm-svn: 363910
* [Process] Remove unused field from HistoryThreadAlex Langford2019-06-1910-49/+17
| | | | | | | | | | | | | | Summary: These fields are unused and have been since their inception, from what I can tell. Reviewers: compnerd, JDevlieghere, davide, labath Subscribers: kubamracek, lldb-commits Differential Revision: https://reviews.llvm.org/D63357 llvm-svn: 363881
* [lldb] [Process/NetBSD] Fix constructor after r363707Michal Gorny2019-06-191-1/+1
| | | | llvm-svn: 363827
* [lldb] [Process/NetBSD] Remove unnecessary FPU presence checks for x86_64Michal Gorny2019-06-191-53/+1
| | | | | | | | | | Remove the checks for FPU presence, FXSAVE support and usage from the code for x86_64. Those are always true for this architecture, and in fact are hardcoded to true inside NetBSD kernel. Differential Revision: https://reviews.llvm.org/D63554 llvm-svn: 363823
* DWARF: Make DIERefs always validPavel Labath2019-06-1914-124/+101
| | | | | | | | | | | | | | | | | | | | | Summary: This patch makes the DIERef class always valid by default constructor and operator bool. This allows one to express the validity of a DIERef in the type system. Places which are working with potentially-invalid DIERefs have been updated to use Optional<DIERef> instead. The constructor taking a DWARFFormValue was not needed, as all places which were constructing a DIERef this way were immediately converting it into a DWARFDIE or a user_id. This can be done without constructing an intermediate DIERef. Reviewers: JDevlieghere, clayborg, aprantl Subscribers: arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D63399 llvm-svn: 363767
* Add ReadCStringFromMemory for faster string readsAntonio Afonso2019-06-182-7/+6
| | | | | | | | | | | | | | | | | | | | | | | Summary: This is the fifth patch to improve module loading in a series that started here (where I explain the motivation and solution): D62499 Reading strings with ReadMemory is really slow when reading the path of the shared library. This is because we don't know the length of the path so use PATH_MAX (4096) and these strings are actually super close to the boundary of an unreadable page. So even though we use process_vm_readv it will usually fail because the read size spans to the unreadable page and we then default to read the string word by word with ptrace. This new function is very similar to another ReadCStringFromMemory that already exists in lldb that makes sure it never reads cross page boundaries and checks if we already read the entire string by finding '\0'. I was able to reduce the GetLoadedSharedLibraries call from 30ms to 4ms (or something of that order). Reviewers: clayborg, xiaobai, labath Reviewed By: labath Subscribers: emaste, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D62503 llvm-svn: 363750
* Implement xfer:libraries-svr4:read packetAntonio Afonso2019-06-187-3/+125
| | | | | | | | | | | | | | | | | | | Summary: This is the fourth patch to improve module loading in a series that started here (where I explain the motivation and solution): D62499 Implement the `xfer:libraries-svr4` packet by adding a new function that generates the list and then in Handle_xfer I generate the XML for it. The XML is really simple so I'm just using string concatenation because I believe it's more readable than having to deal with a DOM api. Reviewers: clayborg, xiaobai, labath Reviewed By: labath Subscribers: emaste, mgorny, srhines, krytarowski, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D62502 llvm-svn: 363707
* DWARF: Avoid storing DIERefs in long-lived containersPavel Labath2019-06-174-51/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A user_id_t carries the same information as a DIERef, but it takes up less space. Furthermore, DIERef::operator<'s implementation is very questionable, as it does not take the cu_offset and section fields into account. Using just the die offset was correct in the days when all debug info lived in a single section, but since we started supporting DWO debug info, this was no longer true. The comparison operator could be fixed, but it seems like using the user_id_t for these purposes is a better idea overall. I think this did not cause any bugs, because the only place the comparison operator was used is in m_function_scope_qualified_name_map, and this one is local to a dwo file, but I am not 100% sure of that. Reviewers: clayborg, JDevlieghere Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D63322 llvm-svn: 363528
* Implement GetSharedLibraryInfoAddressAntonio Afonso2019-06-145-29/+161
| | | | | | | | | | | | | | | | | | | | | Summary: This is the third patch to improve module loading in a series that started here (where I explain the motivation and solution): D62499 Add functions to read the r_debug location to know where the linked list of loaded libraries are so I can generate the `xfer:libraries-svr4` packet. I'm also using this function to implement `GetSharedLibraryInfoAddress` that was "not implemented" for linux. Most of this code was inspired by the current ds2 implementation here: https://github.com/facebook/ds2/blob/master/Sources/Target/POSIX/ELFProcess.cpp. Reviewers: clayborg, xiaobai, labath Reviewed By: clayborg, labath Subscribers: emaste, krytarowski, mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D62501 llvm-svn: 363458
* Don't try to parse ObjC method if CU isn't ObjCGreg Clayton2019-06-141-20/+24
| | | | | | | | Improve manual indexing performance when indexing non objective C code. Differential Revision: https://reviews.llvm.org/D63171 llvm-svn: 363441
* DWARF: port debug_ranges/rnglists over to DWARFContextPavel Labath2019-06-146-37/+35
| | | | llvm-svn: 363400
* DWARF: Remove unused includes from DWARFDebugAranges.h/cppPavel Labath2019-06-142-15/+3
| | | | llvm-svn: 363382
* Have DWARFUnit store a *reference* to SymbolFileDWARFPavel Labath2019-06-1416-117/+84
| | | | | | | | | | | | Previously it was storing a *pointer*, which left open the possibility of this pointer being null. We never made use of that possibility (it does not make sense), and most of the code was already assuming that. However, there were a couple of null-checks scattered around the code. This patch replaces the reference with a pointer, making the non-null-ness explicit, and removes the remaining null-checks. llvm-svn: 363381
* DWARFIndex: s/ReportInvalidDIEOffset/ReportInvalidDIERefPavel Labath2019-06-147-27/+17
| | | | | | | | | | | | In a dwo/debug_types world, the die offset is not enough to uniquely idendify a debug info entry. Pass the the entire DIERef object instead. This is technically NFC, because only AppleIndex implemented this method (and there, the die offset *is* enough for unique identification). However, this makes the code simpler, and simplifies some of the follow-up patches. llvm-svn: 363373
* [C++20] add Basic consteval specifierGauthier Harnisch2019-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: this revision adds Lexing, Parsing and Basic Semantic for the consteval specifier as specified by http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1073r3.html with this patch, the consteval specifier is treated as constexpr but can only be applied to function declaration. Changes: - add the consteval keyword. - add parsing of consteval specifier for normal declarations and lambdas expressions. - add the whether a declaration is constexpr is now represented by and enum everywhere except for variable because they can't be consteval. - adapt diagnostic about constexpr to print constexpr or consteval depending on the case. - add tests for basic semantic. Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: eraman, efriedma, rnkovacs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61790 llvm-svn: 363362
* DWARF: Don't create lldb CompileUnits for DWARF type unitsPavel Labath2019-06-1311-199/+244
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Type units don't represent actual compilations and a lot of the operations that we do with lldb compile units (getting their line tables, variables, etc.) don't make sense for them. There is also a lot more of them (sometimes over 100x), so making them more lightweight pays off. The main change in this patch is that we stop creating lldb CompileUnits for DWARF type units. The trickiest part here is that the SymbolFile interface requires that we assign consecutive sequence IDs to the compile units we create. As DWARF type and compile units can come in any order (in v5), this means we can no longer use 1-1 mapping between DWARF and lldb compile units. Instead I build a translation table between the two indices. To avoid pessimizing the case where there are no type units, I build the translation table only in case we have at least one type unit. Additionaly, I also tried to strenghted type safete by replacing DWARFUnit with DWARFCompileUnit where applicable. Though that was not stricly necessary, I found it a good way to ensure that the transformations I am doing here make sense. In the places where I was changing the function signatures, and where it was obvious that the objects being handled were not null, I also replaced pointers with references. There shouldn't be any major functional change with this patch. The only change I observed is that now the types in the type units will not be parsed when one calls Module::ParseAllDebugSymbols, unless they are referenced from other compile units. This makes sense, given how ParseAllDebugSymbols is implemented (it iterates over all compile units), and it only matters for one hand-writted test where I did not bother to reference the types from the compile units (which I now do). Reviewers: clayborg, JDevlieghere, aprantl Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D63005 llvm-svn: 363250
* [Reproducers] Simplify providers with nested Info struct (NFC)Jonas Devlieghere2019-06-121-11/+8
| | | | | | | | | This replaces the `info` typedef with a nested struct named Info. This means we now have FooProvider and FooProvider::Info, instead of two related but separate classes FooProvider and FooInfo. This change is mostly cosmetic. llvm-svn: 363211
* Re-land r363103 ("When reading ObjC class table, use new SPI if it is avail")Jason Molenda2019-06-121-4/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | with a call to snprintf() to find the size of the formatted string, malloc memory, then snprintf again to format it into the buffer, instead of calling asprintf. Orig commit msg: When reading ObjC class table, use new SPI if it is avail In the latest OS betas, the objc runtime has a special interface for the debugger, class_getNameRaw(), instead of the existing class_getName(), which will return class names in their raw, unmangled (in the case of swift) form. When lldb can access the unmangled names of classes, it won't need to fetch them out of the inferior process after we run our "get the objc class table" expression. If the new interface is absent (debugging a process on an older target), lldb will fall back to class_getName and reading any class names that it got back in demangled form, at a bit of a performance cost on the first expression. <rdar://problem/50688054> llvm-svn: 363206
* [Expression] Add PersistentExpressionState::GetCompilerTypeFromPersistentDeclAlex Langford2019-06-122-0/+19
| | | | | | | | | | | | | | | | Summary: PersistentStateExpressions (e.g. ClangPersistentVariables) have the ability to define types using expressions that persist throughout the debugging session. GetCompilerTypeFromPersistentDecl is a useful operation to have if you need to use any of those persistently declared types, like in CommandObjectMemory. This decouples clang from CommandObjectMemory and decouples Plugins from Commands in general. Differential Revision: https://reviews.llvm.org/D62797 llvm-svn: 363183
* Recognise debug_types.dwo as a debug info sectionPavel Labath2019-06-122-0/+2
| | | | | | This is a preparatory patch to allow reading type units from dwo files. llvm-svn: 363146
* DWARF: Share line tables of type unitsPavel Labath2019-06-1210-105/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch creates a cache of file lists in line tables referenced by type units. This cache is used to avoid parsing a line table twice (since a file list will generally be shared by many type units). It also sets things up in a way that parsing of DW_AT_decl_file attributes will keep working even when we stop creating lldb compile units for dwarf type units, but it stops short of actually doing that. This means that the request for files now go directly to SymbolFileDWARF instead of being routed there indirectly via the lldb_private::CompileUnit class. As a result of this, a number of occurences of SymbolContext variables in DWARFASTParserClang have become unused, so I remove them. This patch reduces the number of times a file list is being parsed, but the situation is still suboptimal, as the parsed list is being copied multiple times. This will be fixed when we stop creating CompileUnits for DWARF type units. Reviewers: clayborg, aprantl, JDevlieghere Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D62894 llvm-svn: 363143
* [LLDB] Fix FreeBSD buildDavid Carlier2019-06-121-1/+1
| | | | | | | | | | | | The auxiliary vector method had the wrong signature. Reviewers: MaskRay, teemperor, aadsm Reviewed By: MaskRay, teemperor Differential Revision: https://reviews.llvm.org/D63187 llvm-svn: 363135
* Back out r363103 ("When reading ObjC class table, use new SPI if it is avail")Jason Molenda2019-06-121-50/+4
| | | | | | because it breaks the windows bot - asprintf() is not available. llvm-svn: 363115
* [LanguageRuntime] Simplify CreateExceptionSearchFilter in derived classesAlex Langford2019-06-112-8/+4
| | | | llvm-svn: 363109
* When reading ObjC class table, use new SPI if it is availJason Molenda2019-06-111-4/+50
| | | | | | | | | | | | | | | | | | In the latest OS betas, the objc runtime has a special interface for the debugger, class_getNameRaw(), instead of the existing class_getName(), which will return class names in their raw, unmangled (in the case of swift) form. When lldb can access the unmangled names of classes, it won't need to fetch them out of the inferior process after we run our "get the objc class table" expression. If the new interface is absent (debugging a process on an older target), lldb will fall back to class_getName and reading any class names that it got back in demangled form, at a bit of a performance cost on the first expression. <rdar://problem/50688054> llvm-svn: 363103
* Add support to read aux vector valuesAntonio Afonso2019-06-1115-203/+142
| | | | | | | | | | | | | | | | | | | | Summary: This is the second patch to improve module loading in a series that started here (where I explain the motivation and solution): https://reviews.llvm.org/D62499 I need to read the aux vector to know where the r_debug map with the loaded libraries are. The AuxVector class was made generic so it could be reused between the POSIX-DYLD plugin and NativeProcess*. The class itself ended up in the ProcessUtility plugin. Reviewers: clayborg, xiaobai, labath, JDevlieghere Reviewed By: clayborg, labath, JDevlieghere Subscribers: emaste, JDevlieghere, mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D62500 llvm-svn: 363098
* [Target][NFC] Rename GetCPPLanguageRuntime to GetAlex Langford2019-06-101-2/+1
| | | | | | | This is a followup to rL362981, in which I moved GetObjCLanguageRuntime from Process to ObjCLanguageRuntime, renaming it to Get along the way. llvm-svn: 362984
* Create a generic handler for Xfer packetsAntonio Afonso2019-06-104-63/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first of a few patches I have to improve the performance of dynamic module loading on Android. In this first diff I'll describe the context of my main motivation and will then link to it in the other diffs to avoid repeating myself. ## Motivation I have a few scenarios where opening a specific feature on an Android app takes around 40s when lldb is attached to it. The reason for that is because 40 modules are dynamicly loaded at that point in time and each one of them is taking ~1s. ## The problem To learn about new modules we have a breakpoint on a linker function that is called twice whenever a module is loaded. One time just before it's loaded (so lldb can check which modules are loaded) and another right after it's loaded (so lldb can check again which ones are loaded and calculate the diference). It's figuring out which modules are loaded that is taking quite some time. This is currently done by traversing the linked list of loaded shared libraries that the linker maintains in memory. Each item in the linked list requires its own `x` packet sent to the gdb server (this is android so the network also plays a part). In my scenario there are 400+ loaded libraries and even though we read 0x800 worth of bytes at a time we still make ~180 requests that end up taking 150-200ms. We also do this twice, once before the module is loaded (state = eAdd) and another right after (state = eConsistent) which easly adds up to ~400ms per module. ## A solution **Implement `xfer:libraries-svr4` in lldb-server:** I noticed in the code that loads the new modules that it had support for the `xfer:libraries-svr4` packet (added ~4 years ago to support the ds2 debug server) but we didn't support it in lldb-server. This single packet returns an xml list of all the loaded modules by the process. The advantage is that there's no more need to make 180 requests to read the linked list. Additionally this new requests takes around 10ms. **More efficient usage of the `xfer:libraries-svr4` packet in lldb:** When `xfer:libraries-svr4` is available the Process class has a `LoadModules` function that requests this packet and then loads or unloads modules based on the current list of loaded modules by the process. This is the function that is used by the DYLDRendezvous class to get the list of loaded modules before and after the module is loaded. However, this is really not needed since the LoadModules function already loaded or unloaded the modules accordingly. I changed this strategy to call LoadModules only once (after the process has loaded the module). **Bugs** I found a few issues in lldb while implementing this and have submitted independent patches for them. I tried to devide this into multiple logical patches to make it easier to review and discuss. ## Tests I wanted to put these set of diffs up before having all the tests up and running to start having them reviewed from a techical point of view. I'm also having some trouble making the tests running on linux so I need more time to make that happen. # This diff The `xfer` packages follow the same protocol, they are requested with `xfer:<object>:<read|write>:<annex>:<offset,length>` and a return that starts with `l` or `m` depending if the offset and length covers the entire data or not. Before implementing the `xfer:libraries-svr4` I refactored the `xfer:auxv` to generically handle xfer packets so we can easly add new ones. The overall structure of the function ends up being: * Parse the packet into its components: object, offset etc. * Depending on the object do its own logic to generate the data. * Return the data based on its size, the requested offset and length. Reviewers: clayborg, xiaobai, labath Reviewed By: labath Subscribers: mgorny, krytarowski, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D62499 llvm-svn: 362982
* [Target] Remove Process::GetObjCLanguageRuntimeAlex Langford2019-06-1017-49/+49
| | | | | | | | | | | Summary: In an effort to make Process more language agnostic, I removed GetCPPLanguageRuntime from Process. I'm following up now with an equivalent change for ObjC. Differential Revision: https://reviews.llvm.org/D63052 llvm-svn: 362981
OpenPOWER on IntegriCloud