summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/DynamicLoader
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement WindowsDYLD::DidAttach for use with gdb-server attachNathan Lanza2018-12-061-1/+35
| | | | | | | | | | | | | | | Summary: Windows lldb debugging currently uses a process plugin to handle launching and attaching to a process. Launching a process via a debug server (e.g. ds2) and attaching to it with `gdb-remote port` currently doesn't communicate address information of the executable properly. Implement DynamicLoaderWindowsDYLD::DidAttach which allow us to obtain the proper executable load address. Differential Revision: https://reviews.llvm.org/D55383 llvm-svn: 348526
* Revert "Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD"Zachary Turner2018-11-181-44/+2
| | | | | | | This breaks many tests on Windows, which now all fail with an error such as "Unable to read memory at address <xxxxxxxx>". llvm-svn: 347174
* Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLDNathan Lanza2018-11-151-2/+44
| | | | | | | | | | | | | | | Summary: This commit implements basic DidAttach and DidLaunch for the windows DynamicLoader plugin which allow us to load shared libraries from the inferior. Reviewers: sas, zturner Reviewed By: zturner Differential Revision: https://reviews.llvm.org/D54544 llvm-svn: 346994
* Remove header grouping comments.Jonas Devlieghere2018-11-1113-48/+0
| | | | | | | | This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
* Remove comments after header includes.Jonas Devlieghere2018-11-111-1/+1
| | | | | | | | | | This patch removes the comments following the header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. Differential revision: https://reviews.llvm.org/D54385 llvm-svn: 346625
* [FileSystem] Move path resolution logic out of FileSpecJonas Devlieghere2018-11-016-17/+17
| | | | | | | | | This patch removes the logic for resolving paths out of FileSpec and updates call sites to rely on the FileSystem class instead. Differential revision: https://reviews.llvm.org/D53915 llvm-svn: 345890
* [FileSystem] Remove Exists() from FileSpecJonas Devlieghere2018-11-012-2/+2
| | | | | | | | | This patch removes the Exists method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53845 llvm-svn: 345854
* [FileSystem] Extend file system and have it use the VFS.Jonas Devlieghere2018-10-311-1/+1
| | | | | | | | | | | | | | | | This patch extends the FileSystem class with a bunch of functions that are currently implemented as methods of the FileSpec class. These methods will be removed in future commits and replaced by calls to the file system. The new functions are operated in terms of the virtual file system which was recently moved from clang into LLVM so it could be reused in lldb. Because the VFS is stateful, we turned the FileSystem class into a singleton. Differential revision: https://reviews.llvm.org/D53532 llvm-svn: 345783
* Upstreaming the BridgeOS device support and the Jason Molenda2018-10-116-7/+18
| | | | | | | | | | | | | | | LC_BUILD_VERSION load command handling - this commit is a combination of patches by Adrian Prantl and myself. llvm::Triple::BridgeOS isn't defined yet, so all references to that are currently commented out. Also update Xcode project file to build the NativePDB etc plugins. <rdar://problem/43353615> llvm-svn: 344209
* Replace pointer to C-array of PropertyDefinition with llvm::ArrayRefTatyana Krasnukha2018-09-271-2/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D52572 llvm-svn: 343181
* Replace "nullptr-terminated" C-arrays of OptionValueEnumeration with safer ↵Tatyana Krasnukha2018-09-261-9/+8
| | | | | | | | llvm::ArrayRef Differential Revision: https://reviews.llvm.org/D49017 llvm-svn: 343130
* [NFC] Turn "load dependent files" boolean into an enumJonas Devlieghere2018-09-205-8/+5
| | | | | | | | | | | | | | This is an NFC commit to refactor the "load dependent files" parameter from a boolean to an enum value. We want to be able to specify a default, in which case we decide whether or not to load the dependent files based on whether the target is an executable or not (i.e. a dylib). This is a dependency for D51934. Differential revision: https://reviews.llvm.org/D51859 llvm-svn: 342633
* Move SafeMachO from Utility to HostPavel Labath2018-09-124-4/+3
| | | | | | | | | | | | | | | | | | | | | | Summary: One of the conclusions of the discussion on D49740 was that SafeMachO is better off in the Host module (as that's the only place which should include mach/machine.h, which is what this header is working around). Also, Utility, which is the only module which cannot include Host, should not be doing anything with object file formats. This patch implements that move, and also removes any unneded includes of that file. I've verified that MacOS still compiles after this. Reviewers: jingham, zturner, teemperor Subscribers: fedor.sergeev, lldb-commits Differential Revision: https://reviews.llvm.org/D50383 llvm-svn: 342050
* [NFC] Fixed enum constant in boolean context errorDavid Bolvansky2018-09-031-5/+6
| | | | | | | | | | | | | | | | | | | Summary: /home/xbolva00/LLVM/llvm/tools/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp:656:59: warning: enum constant in boolean context [-Wint-in-bool-context] if (mh.magic == llvm::MachO::MH_CIGAM || llvm::MachO::MH_MAGIC) ^~~~~~~~ /home/xbolva00/LLVM/llvm/tools/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp:658:62: warning: enum constant in boolean context [-Wint-in-bool-context] if (mh.magic == llvm::MachO::MH_CIGAM_64 || llvm::MachO::MH_MAGIC_64) Reviewers: JDevlieghere, teemperor Reviewed By: teemperor Subscribers: abidh, lldb-commits Differential Revision: https://reviews.llvm.org/D51600 llvm-svn: 341340
* Move RegisterValue,Scalar,State from Core to UtilityPavel Labath2018-08-074-4/+4
| | | | | | | | | | | | | These three classes have no external dependencies, but they are used from various low-level APIs. Moving them down to Utility improves overall code layering (although it still does not break any particular dependency completely). The XCode project will need to be updated after this change. Differential Revision: https://reviews.llvm.org/D49740 llvm-svn: 339127
* Represent invalid UUIDs as UUIDs with length zeroPavel Labath2018-06-262-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: During the previous attempt to generalize the UUID class, it was suggested that we represent invalid UUIDs as length zero (previously, we used an all-zero UUID for that). This meant that some valid build-ids could not be represented (it's possible however unlikely that a checksum of some file would be zero) and complicated adding support for variable length build-ids (should a 16-byte empty UUID compare equal to a 20-byte empty UUID?). This patch resolves these issues by introducing a canonical representation for an invalid UUID. The slight complication here is that some clients (MachO) actually use the all-zero notation to mean "no UUID has been set". To keep this use case working (while making it very explicit about which construction semantices are wanted), replaced the UUID constructors and the SetBytes functions with named factory methods. - "fromData" creates a UUID from the given data, and it treats all bytes equally. - "fromOptionalData" first checks the data contents - if all bytes are zero, it treats this as an invalid/empty UUID. Reviewers: clayborg, sas, lemo, davide, espindola Subscribers: emaste, lldb-commits, arichardson Differential Revision: https://reviews.llvm.org/D48479 llvm-svn: 335612
* Remove UUID::SetFromCStringPavel Labath2018-06-211-1/+1
| | | | | | Replace uses with SetFromStringRef. NFC. llvm-svn: 335246
* Remove some instances of manual UUID pretty-printingPavel Labath2018-06-202-48/+9
| | | | | | | Identical functionality is already offered by the UUID::getAsString method. llvm-svn: 335163
* Some NFC changes to how we scan of kexts & kernels in memory in theJason Molenda2018-06-182-32/+58
| | | | | | | | | | | | | | | | | | DynamicLoaderDarwinKernel plugin. Created a new function ReadMachHeader and instead of reading through the target cached memory reader, start by reading only a mach header sized chunk of memory, then check it for a valid mach-o magic # and use the size of the load commands to pre-fetch the entire load commands of the kext which is the only thing we're going to read, instead of letting the generic mach-o parser read it in 512 byte chunks. Functionally this is doing exactly the same thing as before, but by cutting down on the # of packets going back and forth, even on a local connection it's close to a quarter faster than it was before. <rdar://problem/38570146> llvm-svn: 334995
* Use llvm::VersionTuple instead of manual version marshallingPavel Labath2018-06-182-13/+7
| | | | | | | | | | | | | | | | | | Summary: This has multiple advantages: - we need only one function argument/instance variable instead of three - no need to default initialize variables - no custom parsing code - VersionTuple has comparison operators, which makes version comparisons much simpler Reviewers: zturner, friss, clayborg, jingham Subscribers: emaste, lldb-commits Differential Revision: https://reviews.llvm.org/D47889 llvm-svn: 334950
* [FileSpec] Make style argument mandatory for SetFile. NFCJonas Devlieghere2018-06-134-6/+8
| | | | | | | | | | | | | | | | SetFile has an optional style argument which defaulted to the native style. This patch makes that argument mandatory so clients of the FileSpec class are forced to think about the correct syntax. At the same time this introduces a (protected) convenience method to update the file from within the FileSpec class that keeps the current style. These two changes together prevent a potential pitfall where the style might be forgotten, leading to the path being updated and the style unintentionally being changed to the host style. llvm-svn: 334663
* Add missing includes to some LLDB headers.Raphael Isemann2018-05-261-0/+2
| | | | | | | | | | Summary: When compiling with modules, these missing includes cause the build to fail (as the header can't be compiled into a module). Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D47412 llvm-svn: 333345
* Enable ProcessMachCore plugin on non-apple platformsPavel Labath2018-05-221-4/+1
| | | | | | | | | | | | | | | | | | | Summary: The plugin already builds fine on other platforms (linux, at least). All that was necessary was to revitalize the hack in PlatformDarwinKernel (not a very pretty hack, but it gets us going at least). I haven't done a thorough investigation of the state of the plugin on other platforms, but at least the two core file tests we have seem to pass, so I enable them. Reviewers: JDevlieghere, jasonmolenda Subscribers: lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D47133 llvm-svn: 332997
* Enable AUTOBRIEF in doxygen configuration.Adrian Prantl2018-05-023-22/+25
| | | | | | | | | | | | | | This brings the LLDB configuration closer to LLVM's and removes visual clutter in the source code by removing the @brief commands from comments. This patch also reflows the paragraphs in all doxygen comments. See also https://reviews.llvm.org/D46290. Differential Revision: https://reviews.llvm.org/D46321 llvm-svn: 331373
* Reflow paragraphs in comments.Adrian Prantl2018-04-309-391/+333
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is intended as a clean up after the big clang-format commit (r280751), which unfortunately resulted in many of the comment paragraphs in LLDB being very hard to read. FYI, the script I used was: import textwrap import commands import os import sys import re tmp = "%s.tmp"%sys.argv[1] out = open(tmp, "w+") with open(sys.argv[1], "r") as f: header = "" text = "" comment = re.compile(r'^( *//) ([^ ].*)$') special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$') for line in f: match = comment.match(line) if match and not special.match(match.group(2)): # skip intentionally short comments. if not text and len(match.group(2)) < 40: out.write(line) continue if text: text += " " + match.group(2) else: header = match.group(1) text = match.group(2) continue if text: filled = textwrap.wrap(text, width=(78-len(header)), break_long_words=False) for l in filled: out.write(header+" "+l+'\n') text = "" out.write(line) os.rename(tmp, sys.argv[1]) Differential Revision: https://reviews.llvm.org/D46144 llvm-svn: 331197
* Advanced guessing of rendezvous breakpoint (resubmit)Eugene Zemtsov2018-01-112-67/+132
| | | | | | | | | | | | | When rendezvous structure is not initialized we need to set up rendezvous breakpoint anyway. In this case the code will locate dynamic loader (interpreter) and look for known function names. This is r322209, but with fixed VDSO loading fixed. Bug: https://bugs.llvm.org/show_bug.cgi?id=25806 Differential Revision: https://reviews.llvm.org/D41533 llvm-svn: 322251
* Revert "Advanced guessing of rendezvous breakpoint"Eugene Zemtsov2018-01-102-126/+42
| | | | | | | This reverts commit r322209, because it broke TestNoreturnUnwind,TestInferiorAssert and TestNumThreads on i386. llvm-svn: 322229
* Advanced guessing of rendezvous breakpointEugene Zemtsov2018-01-102-42/+126
| | | | | | | | | | | When rendezvous structure is not initialized we need to set up rendezvous breakpoint anyway. In this case the code will locate dynamic loader (interpreter) and look for known function names. Bug: https://bugs.llvm.org/show_bug.cgi?id=25806 Differential Revision: https://reviews.llvm.org/D41533 llvm-svn: 322209
* Use a static_cast instead of a C cast, NFCVedant Kumar2017-12-061-1/+1
| | | | | | Pointed out by Davide Italiano in post-commit review. llvm-svn: 319935
* Fix warning in DynamicLoaderDarwinKernel.cpp, NFCVedant Kumar2017-12-011-1/+1
| | | | llvm-svn: 319597
* We had a situation where a kext was inlined into the kernel,Jason Molenda2017-11-301-0/+10
| | | | | | | | | | | | but still listed in the kernel's kext table with the kernel binary UUID. This resulted in the kernel text section being loaded at the kext address and problems ensuing. Instead, if there is a kext with the same UUID as the kernel, lldb should skip over it. <rdar://problem/35757689> llvm-svn: 319500
* Move ArchSpec to the Utility modulePavel Labath2017-11-132-8/+1
| | | | | | | | | | | | | The rationale here is that ArchSpec is used throughout the codebase, including in places which should not depend on the rest of the code in the Core module. This commit touches many files, but most of it is just renaming of #include lines. In a couple of cases, I removed the #include ArchSpec line altogether, as the file was not using it. In one or two places, this necessitated adding other #includes like lldb-private-defines.h. llvm-svn: 318048
* Implement trampoline step-through for Windows-x86.Stephane Sezer2017-09-221-1/+43
| | | | | | | | | | | | | | | | | | Summary: This is required to be able to step through calls to external functions that are not properly marked with __declspec(dllimport). When a call like this is emitted, the linker will inject a trampoline to produce an indirect call through the IAT. Reviewers: zturner, jingham Reviewed By: jingham Subscribers: sas, jingham, lldb-commits Differential Revision: https://reviews.llvm.org/D22231 llvm-svn: 314045
* Clean up lldb-types.hPavel Labath2017-07-181-13/+1
| | | | | | | | | | | | | | | | | | | | Summary: It defined a couple of types (condition_t) which we don't use anymore, as we have c++11 goodies now. I remove these definitions. Also it unnecessarily included a couple of headers which weren't necessary for it's operation. I remove these, and place the includes in the relevant files (usually .cpp, usually in Host code) which use them. This allows us to reduce namespace pollution in most of the lldb files which don't need the OS-specific definitions. Reviewers: zturner, jingham Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D35113 llvm-svn: 308304
* [LLDB][ppc64le] Rename enums in AuxVectorPavel Labath2017-07-113-74/+75
| | | | | | | | | | | | | | | | | Summary: On linux on ppc64le some of the enums in AuxVector have the same name as macros defined in the system. Reviewers: mikesart, labath Reviewed By: labath Subscribers: joerg, gut, krytarowski, lldb-commits Differential Revision: https://reviews.llvm.org/D35065 Patch by Bruno Rosa <bruno.rosa@eldorado.org.br> llvm-svn: 307632
* Move StructuredData from Core to UtilityPavel Labath2017-06-273-3/+3
| | | | | | | | | | | | | | | | Summary: It had a dependency on StringConvert and file reading code, which is not in Utility. I've replaced that code by equivalent llvm operations. I've added a unit test to demonstrate that parsing a file still works. Reviewers: zturner, jingham Subscribers: kubamracek, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D34625 llvm-svn: 306394
* [linux] Change the way we load vdso pseudo-modulePavel Labath2017-06-202-10/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is basically a revert of D16107 and parts of D10800, which were trying to get vdso loading working. They did this by implementing a generic load-an-elf-file from memory approach, which is not correct, since we cannot assume that an elf file is loaded in memory in full (it usually isn't, as there's no need to load section headers for example). This meant that we would read garbage instead of section sizes, and if that garbage happened to be a large number, we would crash while trying to allocate a buffer to accomodate the hypothetical section. Instead of this, I add a bit of custom code to load the vdso to DynamicLoaderPOSIXDYLD (which already needed to handle the vdso specially). I determine the size of the memory to read using Process::GetMemoryRegionInfo, which is information coming from the OS, and cannot be forged by a malicious/misbehaving application. Reviewers: eugene, clayborg Subscribers: lldb-commits, ravitheja, tberghammer, emaste Differential Revision: https://reviews.llvm.org/D34352 llvm-svn: 305780
* Update StructuredData::String to return StringRefs.Zachary Turner2017-05-121-4/+4
| | | | | | | | It was returning const std::string& which was leading to unnecessary copies all over the place, and preventing people from doing things like Dict->GetValueForKeyAsString("foo", ref); llvm-svn: 302875
* Rename Error -> Status.Zachary Turner2017-05-1217-46/+46
| | | | | | | | | | | | | | | This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
* Be a little more permissive in DynamicLoaderMacOS::CanLoadImageJim Ingham2017-05-061-8/+9
| | | | | | | | | | | | | If we can't find the "is dyld locked" symbol, assume it is safe to load the image unless we only have 1 image loaded - in which case we are in _dyld_start and it is definitely NOT safe. Also add a little better errors to that function, and better logging in SBProcess.cpp. <rdar://problem/30174817> llvm-svn: 302327
* Battery of NetBSD support improvementsKamil Rytarowski2017-03-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Include initial support for: - single step mode (PT_STEP) - single step trap handling (TRAP_TRACE) - exec() trap (TRAP_EXEC) - add placeholder interfaces for FPR - initial code for NetBSD core(5) files - minor tweaks While there improve style of altered elf-core/ files. This code raises the number of passing tests on NetBSD to around 50% (600+/1200+). The introduced code is subject to improve afterwards for additional features and bug fixes. Sponsored by <The NetBSD Foundation> Reviewers: labath, joerg, emaste, kettenis Reviewed By: labath Subscribers: srhines, #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D31450 llvm-svn: 299109
* Move FileSpec from Host -> Utility.Zachary Turner2017-03-226-11/+11
| | | | llvm-svn: 298536
* Create instance of DynamicLoaderPOSIXDYLD on NetBSDKamil Rytarowski2017-03-211-2/+3
| | | | | | | | | | | | | | | | | | | | | Summary: NetBSD is a modern ELF UNIX-like system. There is requires DynamicLoaderPOSIXDYLD e.g. for ELF AUXV reading from the client. Sponsored by <The NetBSD Foundation> Reviewers: labath, joerg, kettenis Reviewed By: labath Subscribers: #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D31192 llvm-svn: 298409
* Add dependency on DynamicLoaderStatic to Utility.Zachary Turner2017-03-041-0/+1
| | | | llvm-svn: 296944
* Move DataBuffer / DataExtractor and friends from Core -> Utility.Zachary Turner2017-03-044-8/+8
| | | | llvm-svn: 296943
* Move UUID from Core -> Utility.Zachary Turner2017-03-045-5/+5
| | | | llvm-svn: 296941
* Move Log from Core -> Utility.Zachary Turner2017-03-039-9/+9
| | | | | | | | | All references to Host and Core have been removed, so this class can now safely be lowered into Utility. Differential Revision: https://reviews.llvm.org/D30559 llvm-svn: 296909
* Remove some dead code in FileSpec.Zachary Turner2017-03-031-0/+3
| | | | | | | | This in turn triggered some fallout where other files had been transitively picking up includes that they needed from FileSpec.h, so I've fixed those up as well. llvm-svn: 296855
* Fix a bug in r294611 w.r.t. Darwin Kernel debugging.Jim Ingham2017-02-281-0/+7
| | | | | | <rdar://problem/30735021> llvm-svn: 296504
* Move classes from Core -> Utility.Zachary Turner2017-02-022-2/+2
| | | | | | | | | | | | | | | | | | | | | | | This moves the following classes from Core -> Utility. ConstString Error RegularExpression Stream StreamString The goal here is to get lldbUtility into a state where it has no dependendencies except on itself and LLVM, so it can be the starting point at which to start untangling LLDB's dependencies. These are all low level and very widely used classes, and previously lldbUtility had dependencies up to lldbCore in order to use these classes. So moving then down to lldbUtility makes sense from both the short term and long term perspective in solving this problem. Differential Revision: https://reviews.llvm.org/D29427 llvm-svn: 293941
OpenPOWER on IntegriCloud