summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h
Commit message (Collapse)AuthorAgeFilesLines
* Fixing a couple of wrong logical operator bugs.Ali Tamur2019-06-281-1/+1
| | | | llvm-svn: 364614
* [NFC] Remove ASCII lines from commentsJonas Devlieghere2019-04-101-6/+0
| | | | | | | | | | | | | | | | | | | | | | | A lot of comments in LLDB are surrounded by an ASCII line to delimit the begging and end of the comment. Its use is not really consistent across the code base, sometimes the lines are longer, sometimes they are shorter and sometimes they are omitted. Furthermore, it looks kind of weird with the 80 column limit, where the comment actually extends past the line, but not by much. Furthermore, when /// is used for Doxygen comments, it looks particularly odd. And when // is used, it incorrectly gives the impression that it's actually a Doxygen comment. I assume these lines were added to improve distinguishing between comments and code. However, given that todays editors and IDEs do a great job at highlighting comments, I think it's worth to drop this for the sake of consistency. The alternative is fixing all the inconsistencies, which would create a lot more churn. Differential revision: https://reviews.llvm.org/D60508 llvm-svn: 358135
* Change the scanning algorithm in ↵Jason Molenda2019-03-061-2/+4
| | | | | | | | | | | | | | | | | | | | | | | DynamicLoaderDarwinKernel::SearchForKernelNearPC. Currently when lldb might be doing a kernel debug session, it scans through memory by taking the current pc value and looking for a kernel at megabyte boundaries, up to 32MB behind $pc. This adjusts the algorithm to scan back at every 16k page boundary and to stop scanning as soon as we hit a memory read error. The addition of stopping at a memory read error saves us from tons of unnecessary packet traffic on generic targets where lldb might look for a kernel binary. I've been trying to think of how to construct a test for this; it's a bit tricky. A gdb-remote protocol test with the contents of a fake tiny kernel mach-o binary would satisify part of it, but this kernel path also directly calls over to dsymForUUID or DebugSymbols framework lookups to find the kernel binary as well. I'll keep thinking about this one, but it's so intertangled with these two external systems that it may be hard to do. <rdar://problem/48578197> llvm-svn: 355476
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Remove header grouping comments.Jonas Devlieghere2018-11-111-4/+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
* Move SafeMachO from Utility to HostPavel Labath2018-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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
* Some NFC changes to how we scan of kexts & kernels in memory in theJason Molenda2018-06-181-0/+6
| | | | | | | | | | | | | | | | | | 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
* Rename Error -> Status.Zachary Turner2017-05-121-1/+1
| | | | | | | | | | | | | | | 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
* Move FileSpec from Host -> Utility.Zachary Turner2017-03-221-2/+2
| | | | llvm-svn: 298536
* Move UUID from Core -> Utility.Zachary Turner2017-03-041-1/+1
| | | | llvm-svn: 296941
* Remove unused TimeValue includePavel Labath2016-11-091-1/+0
| | | | llvm-svn: 286372
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-307/+242
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* remove use of Mutex in favour of std::{,recursive_}mutexSaleem Abdulrasool2016-05-181-3/+3
| | | | | | | | | | This is a pretty straightforward first pass over removing a number of uses of Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there are interfaces which take Mutex::Locker & to lock internal locks. This patch cleans up most of the easy cases. The only non-trivial change is in CommandObjectTarget.cpp where a Mutex::Locker was split into two. llvm-svn: 269877
* ProcessMachCore scans through the core file pages looking for aJason Molenda2016-02-061-3/+3
| | | | | | | | | | | | | | | | | | | | user process dyld binary and/or a mach kernel binary image. By default, it prefers the kernel if it finds both. But if it finds two kernel binary images (which can happen when random things are mapped into memory), it may pick the wrong kernel image. DynamicLoaderDarwinKernel has heuristics to find a kernel in memory; once we've established that there is a kernel binary in memory, call over to that class to see if it can find a kernel address via its search methods. If it does, use that. Some minor cleanups to DynamicLoaderDarwinKernel while I was at it. <rdar://problem/24446112> llvm-svn: 259983
* Fix Clang-tidy modernize-use-override warnings in some files in ↵Eugene Zelenko2015-10-211-22/+19
| | | | | | | | source/Plugins; other minor fixes. Differential Revision: http://reviews.llvm.org/D13916 llvm-svn: 250872
* Workaround for collision between enum members in LLVM's MachO.h and system ↵Jim Ingham2014-04-021-0/+1
| | | | | | | | | | headers on Mac OS X (in particular mach/machine.h). <rdar://problem/16494607> llvm-svn: 205480
* Don’t #include “llvm/Support/MachO.h” in a header file if we can avoid ↵Greg Clayton2014-04-021-2/+0
| | | | | | it. llvm-svn: 205460
* <rdar://problem/13956179>Greg Clayton2013-05-221-3/+3
| | | | | | | | Fixed ProcessMachCore to be able to locate the main executeable in the core file even if it doesn't start at a core file address range boundary. Prior to this we only checked the first bytes of each range in the core file for mach_kernel or dyld. Now we still do this, but if we don't find the mach_kernel or dyld anywhere, we go through all core file ranges and check every 0x1000 to see if we can find dyld or the mach_kernel. Now that we can properly detect the mach_kernel at any address, we don't need to call "DynamicLoaderDarwinKernel::SearchForDarwinKernel(Process*)" anymore. llvm-svn: 182513
* <rdar://problem/13854277>Greg Clayton2013-05-101-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <rdar://problem/13594769> Main changes in this patch include: - cleanup plug-in interface and use ConstStrings for plug-in names - Modfiied the BSD Archive plug-in to be able to pick out the correct .o file when .a files contain multiple .o files with the same name by using the timestamp - Modified SymbolFileDWARFDebugMap to properly verify the timestamp on .o files it loads to ensure we don't load updated .o files and cause problems when debugging The plug-in interface changes: Modified the lldb_private::PluginInterface class that all plug-ins inherit from: Changed: virtual const char * GetPluginName() = 0; To: virtual ConstString GetPluginName() = 0; Removed: virtual const char * GetShortPluginName() = 0; - Fixed up all plug-in to adhere to the new interface and to return lldb_private::ConstString values for the plug-in names. - Fixed all plug-ins to return simple names with no prefixes. Some plug-ins had prefixes and most ones didn't, so now they all don't have prefixed names, just simple names like "linux", "gdb-remote", etc. llvm-svn: 181631
* ProcessMachCore had (until 2013-01-29) some simple checks to find a kernelJason Molenda2013-03-021-0/+3
| | | | | | | | | | | | | in a core file if it didn't start at the beginning of a memory segment. I added more sophisticated kernel location code to DynamicLoaderDarwinKernel and removed the simple one in ProcessMachCore. Unfortunately the kernel DynamicLoader doesn't get a chance to search around in memory unless there's a hint that this might be a kernel debug session. It was easy ot make the kernel location code static in DynamicLoaderDarwinKernel and call it from ProcessMachCore on the start of the session, so that's what I did. <rdar://problem/13326647> llvm-svn: 176405
* Change the order that the DarwinKernel DynamicLoader plugin usesJason Molenda2013-02-191-3/+0
| | | | | | | | | | | to search for kexts on the local system -- the ModuleList FindModule() method is the best first attempt, only call Symbols::DownloadObjectAndSymbolFile() if that has failed and this is the kernel binary which really needs to have its symbols located. <rdar://problem/13241893> llvm-svn: 175495
* Change the DarwinKernel DyanmicLoader to maintain a persist listJason Molenda2013-02-191-93/+132
| | | | | | | | | | | | of kernel extensions (kexts) that have been loaded into the kernel. Now when we hit the "kexts have changed" breakpoint we can avoid adding kexts multiple times, and can properly detect kext unloads and remove them from the Target's list of modules. <rdar://problem/13107639> <rdar://problem/13191016> llvm-svn: 175489
* <rdar://problem/12491235> Jason Molenda2013-01-301-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | Enhance lldb so it can search for a kernel in memory when attaching to a remote system. Remove some of the code that was doing this from ProcessMachCore and ProcessGDBRemote and put it in DynamicLoaderDarwinKernel. I've added a new setting, plugin.dynamic-loader.darwin-kernel.scan-type which can be set to none - for environments where reading random memory can cause a device crash basic - look at one fixed location in memory for a kernel load address, plus the contents of that address fast-scan - the default, tries "basic" and then looks for the kernel's mach header near the current pc value when lldb connects exhaustive-scan - on 32-bit targets, step through the entire range where the kernel can be loaded, looking for the kernel binary I don't have the setting set up correctly right now, I'm getting back unexpected values from the Property system, but I'll figure that out tomorrow and fix. Besides that, all of the different communication methods / types of kernels appear to be working correctly with these changes. llvm-svn: 173891
* Added the infrastructure necessary for plug-ins to be able to add their own ↵Greg Clayton2012-10-191-0/+3
| | | | | | | | | | | | | | | | | settings instead of having settings added to existing ones. In particular "target.disable-kext-loading" was added to "target" where it should actually be specific to the the dynamic loader plugin. Now the plug-in manager has the ability to create settings at the root level starting with "plugin". Each plug-in type can add new sub dictionaries, and then each plug-in can register a setting dictionary under its own short name. For example the DynamicLoaderDarwinKernel plug-in now registers a setting dictionary at: plugin dynamic-loader macosx-kernel (bool) disable-kext-loading To settings can be set using: (lldb) settings set plugin.dynamic-loader.macosx-kernel.disable-kext-loading true I currently only hooked up the DynamicLoader plug-ins, but the code is very easy to duplicate when and if we need settings for other plug-ins. llvm-svn: 166294
* Add a new target setting to disable automatic loading of kext imagesJason Molenda2012-10-191-2/+4
| | | | | | | | | | in a kernel debug session: settings set target.disable-kext-loading true <rdar://problem/12490623> llvm-svn: 166262
* <rdar://problem/11757916>Greg Clayton2012-08-291-38/+5
| | | | | | | | | | | | Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes: - Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file". - modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly - Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was. - modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile() Cleaned up header includes a bit as well. llvm-svn: 162860
* Commit missing function prototype.Greg Clayton2012-03-211-0/+3
| | | | llvm-svn: 153223
* Full core file support has been added for mach-o core files.Greg Clayton2012-02-131-130/+35
| | | | | | | | | | | | | | | | Tracking modules down when you have a UUID and a path has been improved. DynamicLoaderDarwinKernel no longer parses mach-o load commands and it now uses the memory based modules now that we can load modules from memory. Added a target setting named "target.exec-search-paths" which can be used to supply a list of directories to use when trying to look for executables. This allows one or more directories to be used when searching for modules that may not exist in the SDK/PDK. The target automatically adds the directory for the main executable to this list so this should help us in tracking down shared libraries and other binaries. llvm-svn: 150426
* Finishing the renaming from "MacOSX-Kernel" to "Darwin-Kernel".Greg Clayton2011-08-221-8/+8
| | | | llvm-svn: 138283
* Renaming "MacOSX-Kernel" to "Darwin-Kernel". The file contents and projectGreg Clayton2011-08-221-0/+443
commit will come shortly after this commit. llvm-svn: 138282
OpenPOWER on IntegriCloud