summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process
Commit message (Collapse)AuthorAgeFilesLines
...
* Add XCOFF triple object format type for AIXJason Liu2019-03-121-0/+2
| | | | | | | | | This patch adds an XCOFF triple object format type into LLVM. This XCOFF triple object file type will be used later by object file and assembly generation for the AIX platform. Differential Revision: https://reviews.llvm.org/D58930 llvm-svn: 355989
* [Reproducers] Add a test to ensure we can reuse the reproducer dir.Jonas Devlieghere2019-03-121-1/+1
| | | | | | | | Yesterday I noticed a reproducer test failing after making a local change. Removing the reproducer directory solved the issue. Add a test case that detects this. llvm-svn: 355941
* Bring Doxygen comment syntax in sync with LLVM coding style.Adrian Prantl2019-03-1120-93/+93
| | | | | | This changes '@' prefix to '\'. llvm-svn: 355841
* [lldb] [Process] Add proper support for NetBSD core files with threadsMichal Gorny2019-03-082-30/+191
| | | | | | | | | | | | | | Improve the support for processing NetBSD cores. Fix reading process identifier, thread information and associating the terminating signal with the correct thread. Includes test cases for single-threaded program receiving SIGSEGV, and two dual-threaded programs: one where thread receives the signal, and the other one when the whole process is signalled. Differential Revision: https://reviews.llvm.org/D32149 llvm-svn: 355736
* Promote more debug-only assertions to regular assertions.Adrian Prantl2019-03-071-4/+0
| | | | llvm-svn: 355568
* Pass ConstString by value (NFC)Adrian Prantl2019-03-066-6/+6
| | | | | | | | | | | | | | | | | My apologies for the large patch. With the exception of ConstString.h itself it was entirely produced by sed. ConstString has exactly one const char * data member, so passing a ConstString by reference is not any more efficient than copying it by value. In both cases a single pointer is passed. But passing it by value makes it harder to accidentally return the address of a local object. (This fixes rdar://problem/48640859 for the Apple folks) Differential Revision: https://reviews.llvm.org/D59030 llvm-svn: 355553
* Try to fix OSX compilation failure.Zachary Turner2019-03-061-1/+4
| | | | llvm-svn: 355531
* Resubmit "Don't include UnixSignals.h from Host."Zachary Turner2019-03-061-1/+1
| | | | | | | | This was reverted because it breaks the GreenDragon bot, but the reason for the breakage is lost, so I'm resubmitting this now so we can find out what the problem is. llvm-svn: 355528
* Fix core files for 32 bit architectures that are supported in ProcessELFCore.cppGreg Clayton2019-03-061-5/+5
| | | | | | | | | | Core files need to know the size of the PRSTATUS header so that we can grab the register values that follow it. The code that figure out this size was using a hard coded list of architecture cores instead of relying on 32 or 64 bit for most cores. The fix here fixes core files for 32 bit ARM. Prior to this the PRSTATUS header size was being returned as zero and the register values were being taken from the first bytes of the PRSTATUS struct (signo, etc). Differential Revision: https://reviews.llvm.org/D58985 llvm-svn: 355526
* Refactor user/group name resolving codePavel Labath2019-03-041-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This creates an abstract base class called "UserIDResolver", which can be implemented to provide user/group ID resolution capabilities for various objects. Posix host implement a PosixUserIDResolver, which does that using posix apis (getpwuid and friends). PlatformGDBRemote forwards queries over the gdb-remote link, etc. ProcessInstanceInfo class is refactored to make use of this interface instead of taking a platform pointer as an argument. The base resolver class already implements caching and thread-safety, so implementations don't have to worry about that. The main motivating factor for this was to remove external dependencies from the ProcessInstanceInfo class (so it can be put next to ProcessLaunchInfo and friends), but it has other benefits too: - ability to test the user name caching code - ability to test ProcessInstanceInfo dumping code - consistent interface for user/group resolution between Platform and Host classes. Reviewers: zturner, clayborg, jingham Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D58167 llvm-svn: 355323
* [lldb] [Process/gdb-remote] Use '127.0.0.1' in ConnectLocally()Michal Gorny2019-03-031-1/+1
| | | | | | | | | | | | | | | | Use '127.0.0.1' instead of 'localhost' in ConnectLocally() function as this is the specific address the server is bound to. Using 'localhost' may involve trying IPv6 first which may accidentally be used by another service. While technically it might be interesting to support IPv6 here, it would need to be supported properly, with the connection copying family and address from the listening socket, and possibly without relying on existence of 'localhost' at all. Differential Revision: https://reviews.llvm.org/D58883 llvm-svn: 355285
* Move Host/Symbols.cpp to Symbols/LocateSymbolFile.cppZachary Turner2019-02-272-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Given that we have a target named Symbols, one wonders why a file named Symbols.cpp is not in this target. To be clear, the functions exposed from this file are really focused on *locating* a symbol file on a given host, which is where the ambiguity comes in. However, it makes more sense conceptually to be in the Symbols target. While some of the specific places to search for symbol files might change depending on the Host, this is not inherently true in the same way that, for example, "accessing the file system" or "starting threads" is fundamentally dependent on the Host. PDBs, for example, recently became a reality on non-Windows platforms, and it's theoretically possible that DSYMs could become a thing on non MacOSX platforms (maybe in a remote debugging scenario). Other types of symbol files, such as DWO, DWP, etc have never been tied to any Host platform anyway. After this patch, there is only one remaining dependency from Host to Target. Differential Revision: https://reviews.llvm.org/D58730 llvm-svn: 355032
* Avoid two-stage initialization of MinidumpParserPavel Labath2019-02-224-147/+126
| | | | | | | | | remove the Initialize function, move the things that can fail into the static factory function. The factory function now returns Expected<Parser> instead of Optional<Parser> so that it can give a reason why creation failed. llvm-svn: 354668
* Add Facebook Minidump directory streams and options to dump them.Greg Clayton2019-02-193-2/+162
| | | | | | | | Facebook creates minidump files that contain specific information about why things crash. Adding ways to dump these allows tools to be made that can auto download symbols based on the information that is contained in the minidump files. Differential Revision: https://reviews.llvm.org/D58398 llvm-svn: 354385
* Revert "minidump: Add ability to attach (breakpad) symbol files to ↵Pavel Labath2019-02-191-71/+43
| | | | | | | | | | | | | | | | | | placeholder modules" This reverts r354263, because it uncovered a problem in handling of the minidumps with conflicting UUIDs. If a minidump contains two files with the same UUID, we will not create to placeholder modules for them, but instead reuse the first one for the second instance. This creates a problem because these modules have their load address hardcoded in them (and I've added an assert to verify that). Technically this is not a problem with this patch, as the same issue existed in the previous implementation, but it did not have the assert which would diagnose that. Nonetheless, I am reverting this until I figure out what's the best course of action in this situation. llvm-svn: 354324
* minidump: Add ability to attach (breakpad) symbol files to placeholder modulesPavel Labath2019-02-181-43/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This re-commits r353677, which was reverted due to test failures on the windows bot. The issue there was that ObjectFilePECOFF vended its base address through the incorrect interface. SymbolFilePDB depended on that, which lead to assertion failures when SymbolFilePDB was attempting to use the placeholder object files as a base. This has been fixed in r354258 It also fixes one small problem in the original patch. The issue was that the Module class would attempt to overwrite the object file we created in CreateModuleFromObjectFile if the file corresponding to the placeholder object file happened to exist (but we have already disqualified it due to UUID mismatch. The fix is simple -- we set the m_did_load_objfile flag to properly record the fact that we have already created an object file for the module. The original commit message was: The reason this wasn't working was that ProcessMinidump was creating odd object-file-less modules, and SymbolFileBreakpad required the module to have an associated object file because it needed to get its base address. This fixes that by introducing a PlaceholderObjectFile to serve as a dummy object file. The general idea for this is taken from D55142, but I've reworked it a bit to avoid the need for the PlaceholderModule class. Now that we have an object file, our modules are sufficiently similar to regular modules that we can use the regular Module class almost out of the box -- the only thing I needed to tweak was the Module::CreateModuleFromObjectFile functon to set the module's FileSpec in addition to it's architecture. This wasn't needed for ObjectFileJIT (the other user of CreateModuleFromObjectFile), but it shouldn't hurt it either, and the change seems like a straightforward extension of this function. Reviewers: clayborg, lemo, amccarth Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D57751 llvm-svn: 354263
* Return better error message from GDBRemoteCommunication::ConnectLocallyPavel Labath2019-02-181-3/+4
| | | | llvm-svn: 354256
* Revert "Don't include UnixSignals.h from Host."Davide Italiano2019-02-151-1/+1
| | | | | | It broke the modules green dragon buildbot. llvm-svn: 354177
* [win] Resolve the module only if there isn't one alreadyStella Stamenova2019-02-151-4/+2
| | | | | | | | | | | | | | | | | | Summary: This commit modifies the OnLoadModule method to resolve the module unless we already have one Change by Hui Huang to fix the failing LLDB tests on Windows Reviewers: labath, asmith Subscribers: abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D58303 llvm-svn: 354172
* Don't include UnixSignals.h from Host.Zachary Turner2019-02-151-1/+1
| | | | | | | | | | | | | | | | | Host had a function to get the UnixSignals instance corresponding to the current host architecture. This means that Host had to include a file from Target. To break this dependency, just make this a static function directly in UnixSignals. We already have the function UnixSignals::Create(ArchSpec) anyway, so we just need to have UnixSignals::CreateForHost() which determines which value to pass for the ArchSpec. The goal here is to eventually break the Host->Target->Host circular dependency. Differential Revision: https://reviews.llvm.org/D57780 llvm-svn: 354168
* Remove alignment from struct XSAVE altogetherPavel Labath2019-02-151-1/+1
| | | | | | | | | | | | | I reduced the alignment of this struct in r342029 to avoid compiler warnings about under-aligned allocations, but it turns out that this still causes problems with some compilers (see r353778). As I hinted in r342029, I don't believe any special aligment is necessary here (the only reason for that would be if we used some aligned SSE instructions to access this buffer, but I don't see any reason why we should do that), so here I go all the way, and remove the alignment requirements (except the ones naturally imposed by basic types) altogether. llvm-svn: 354125
* Fix for build bot problem from last changeAaron Smith2019-02-151-3/+3
| | | | llvm-svn: 354100
* Implement GetLoadAddress for the Windows process pluginAaron Smith2019-02-153-26/+19
| | | | | | | | | | | | | | | | Summary: When a process is loaded, update its sections with the load address to resolve any created breakpoints. For the remote debugging case, the debugged process is launched remotely so GetLoadAddress is intended to pass the load address from remote to LLDB (client). Reviewers: zturner, llvm-commits, clayborg, labath Reviewed By: labath Subscribers: mgorny, sas, Hui, clayborg, labath, lldb-commits Differential Revision: https://reviews.llvm.org/D56237 llvm-svn: 354099
* Move UnwindTable from ObjectFile to ModulePavel Labath2019-02-141-11/+8
| | | | | | | | | | | | | | | Summary: This is a preparatory step to enable adding extra unwind strategies by symbol file plugins. This has been discussed on the lldb-dev mailing list: <http://lists.llvm.org/pipermail/lldb-dev/2019-February/014703.html>. Reviewers: jasonmolenda, clayborg, espindola Subscribers: lemo, emaste, lldb-commits, arichardson Differential Revision: https://reviews.llvm.org/D58129 llvm-svn: 354033
* [gdb-remote] Sanity check platform pointerAaron Smith2019-02-141-2/+5
| | | | llvm-svn: 354012
* Replace 'ap' with 'up' suffix in variable names. (NFC)Jonas Devlieghere2019-02-1329-116/+116
| | | | | | | | | | | | | | | | | The `ap` suffix is a remnant of lldb's former use of auto pointers, before they got deprecated. Although all their uses were replaced by unique pointers, some variables still carried the suffix. In r353795 I removed another auto_ptr remnant, namely redundant calls to ::get for unique_pointers. Jim justly noted that this is a good opportunity to clean up the variable names as well. I went over all the changes to ensure my find-and-replace didn't have any undesired side-effects. I hope I didn't miss any, but if you end up at this commit doing a git blame on a weirdly named variable, please know that the change was unintentional. llvm-svn: 353912
* Have Stream::PutCStringAsRawHex8 take llvm::StringRefPavel Labath2019-02-126-42/+42
| | | | | | | | | This enables the function to be called with a StringRef without jumping through any hoops. I rename the function to "PutStringAsRawHex8" to honor the extended interface. I also remove ".c_str()" from any calls to this function I could find. llvm-svn: 353841
* Remove redundant ::get() for smart pointer. (NFC)Jonas Devlieghere2019-02-122-2/+2
| | | | | | | | This commit removes redundant calls to smart pointer’s ::get() method. https://clang.llvm.org/extra/clang-tidy/checks/readability-redundant-smartptr-get.html llvm-svn: 353795
* Use std::make_shared in LLDB (NFC)Jonas Devlieghere2019-02-1125-106/+161
| | | | | | | | | | | Unlike std::make_unique, which is only available since C++14, std::make_shared is available since C++11. Not only is std::make_shared a lot more readable compared to ::reset(new), it also performs a single heap allocation for the object and control block. Differential revision: https://reviews.llvm.org/D57990 llvm-svn: 353764
* Revert "minidump: Add ability to attach (breakpad) symbol files to ↵Pavel Labath2019-02-111-75/+43
| | | | | | | | | | | placeholder modules" The commit has broken TestMiniDump.py on windows. Reverting while I investigate. This reverts r353677. llvm-svn: 353686
* minidump: Add ability to attach (breakpad) symbol files to placeholder modulesPavel Labath2019-02-111-43/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The reason this wasn't working was that ProcessMinidump was creating odd object-file-less modules, and SymbolFileBreakpad required the module to have an associated object file because it needed to get its base address. This fixes that by introducing a PlaceholderObjectFile to serve as a dummy object file. The general idea for this is taken from D55142, but I've reworked it a bit to avoid the need for the PlaceholderModule class. Now that we have an object file, our modules are sufficiently similar to regular modules that we can use the regular Module class almost out of the box -- the only thing I needed to tweak was the Module::CreateModuleFromObjectFile functon to set the module's FileSpec in addition to it's architecture. This wasn't needed for ObjectFileJIT (the other user of CreateModuleFromObjectFile), but it shouldn't hurt it either, and the change seems like a straightforward extension of this function. Reviewers: clayborg, lemo, amccarth Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D57751 llvm-svn: 353677
* [lldb-server] Improve support on WindowsAaron Smith2019-02-071-33/+28
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit contains the following changes: - Rewrite vfile close/read/write packet handlers with portable routines from lldb. This removes #if(s) and allows the handlers to work on Windows. - Fix a bug in File::Write. This is intended to write data at an offset to a file but actually writes at the current position of the file. - Add a default boolean argument 'should_close_fd' to FileSystem::Open to let the user decide whether to close the fd or not. Reviewers: zturner, llvm-commits, labath Reviewed By: zturner Subscribers: Hui, labath, abidh, lldb-commits Differential Revision: https://reviews.llvm.org/D56231 llvm-svn: 353446
* [gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenvAaron Smith2019-02-071-39/+38
| | | | | | | | | | | | Reviewers: zturner, llvm-commits, labath, serge-sans-paille Reviewed By: labath Subscribers: Hui, labath, lldb-commits Differential Revision: https://reviews.llvm.org/D56230 llvm-svn: 353440
* Fix incorrect log messages in NativeProcessLinux (pr40588)Pavel Labath2019-02-071-4/+4
| | | | | | | | | | | The "signal" argument was removed from the MonitorCallback function, but not from the log statements within it. This wasn't noticed because the name "signal" suddenly started referring to the libc function with that name. This fixes that. llvm-svn: 353419
* Add a warning to GDBRemoteRegisterContext (if packet logging enabled)Jason Molenda2019-02-061-0/+8
| | | | | | | if the size of the g packet response was smaller than expected and is going to be ignored. llvm-svn: 353269
* Fixes for the ProcessLaunchInfo movePavel Labath2019-02-041-1/+1
| | | | llvm-svn: 353049
* Move FileAction, ProcessInfo and ProcessLaunchInfo from Target to HostPavel Labath2019-02-044-4/+4
| | | | | | | | | | | | | | | | | | | | | | | Summary: These classes describe the details of the process we are about to launch, and so they are naturally used by the launching code in the Host module. Previously they were present in Target because that is the most important (but by far not the only) user of the launching code. Since the launching code has other customers, must of which do not care about Targets, it makes sense to move these classes to the Host layer, next to the launching code. This move reduces the number of times that Target is included from host to 8 (it used to be 14). Reviewers: zturner, clayborg, jingham, davide, teemperor Subscribers: emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D56602 llvm-svn: 353047
* [LLDB] FreeBSD suppress compilation warningDavid Carlier2019-01-311-1/+1
| | | | | | | | | | | | Reviewers: labath, teemperor Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D57506 M source/Plugins/Process/FreeBSD/ProcessMonitor.cpp llvm-svn: 352744
* Fix some warnings in building LLDB.Zachary Turner2019-01-291-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D57413 llvm-svn: 352557
* Refactor HAVE_LIBCOMPRESSION and related code in GDBRemoteCommunicationRaphael Isemann2019-01-252-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The field `m_decompression_scratch_type` is only used when `HAVE_LIBCOMPRESSION` is defined, which caused a warning which I fixed in rLLDB350675 by just marking the variable as always used. This patch fixes this in a better way by only defining the variable (and the related `m_decompression_scratch` variable) when `HAVE_LIBCOMPRESSION` is defined. This also required changing the way we handle `HAVE_LIBCOMPRESSION` works, as this was previously always defined on macOS within the source file but not in the header. Now it's always defined from within our config header when CMake defines it or when we are on macOS. The field initialization was moved to the header to prevent that we have `#ifdef` within our initializer list. Reviewers: #lldb, jasonmolenda, sgraenitz, labath Reviewed By: labath Subscribers: labath, beanz, mgorny, lldb-commits, dblaikie Differential Revision: https://reviews.llvm.org/D57011 llvm-svn: 352175
* [Process/NetBSD] Add missing linkage to -lutilMichal Gorny2019-01-241-0/+1
| | | | | | | | | | | | Add missing linkage to fix build failure with LLD: ld: error: undefined symbol: kinfo_getvmmap >>> referenced by NativeProcessNetBSD.cpp >>> NativeProcessNetBSD.cpp.o:(lldb_private::process_netbsd::NativeProcessNetBSD::PopulateMemoryRegionCache()) in archive lib/liblldbPluginProcessNetBSD.a Differential Revision: https://reviews.llvm.org/D57193 llvm-svn: 352116
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-19302-1208/+906
| | | | | | | | | | | | | | | | | 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
* Make sure to fill in the compiler register number so when we try to ↵Greg Clayton2019-01-182-15/+17
| | | | | | | | backtrace using EH frame, it works. Prior to this, backtraces could fail due to not being able to convert a EH frame register number to LLDB register number. llvm-svn: 351564
* [Reproducers] Refactor reproducer infoJonas Devlieghere2019-01-181-13/+14
| | | | | | | | | | | | | | | | | | | | | In the original reproducer design, I expected providers to be more dynamic than they turned out. For example, we don't have any instances where one provider has multiple files. Additionally, I expected there to be less locality between capture and replay, with the provider being defined in one place and the replay code to live in another. Both contributed to the design of the provider info. This patch refactors the reproducer info to be something static. This means less magic strings and better type checking. The new design still allows for the capture and replay code to live in different places as long as they both have access to the new statically defined info class. I didn't completely get rid of the index, because it is useful for (1) sanity checking and (2) knowing what files are used by the reproducer. Differential revision: https://reviews.llvm.org/D56814 llvm-svn: 351501
* [lldb-server] Add unnamed pipe support to PipeWindowsAaron Smith2019-01-102-7/+3
| | | | | | | | | | | | | | | | | Summary: This adds unnamed pipe support in PipeWindows to support communication between a debug server and child process. Modify PipeWindows::CreateNew to support the creation of an unnamed pipe. Rename the previous method that created a named pipe to PipeWindows::CreateNewNamed. Reviewers: zturner, llvm-commits Reviewed By: zturner Subscribers: Hui, labath, lldb-commits Differential Revision: https://reviews.llvm.org/D56234 llvm-svn: 350784
* Change std::sort to llvm::sort to detect non-determinism.Jonas Devlieghere2019-01-082-7/+7
| | | | | | | | | | LLVM added wrappers to std::sort (r327219) that randomly shuffle the container before sorting. The goal is to uncover non-determinism due to undefined sorting order of objects having the same key. This can be enabled with -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON. llvm-svn: 350679
* Fix unused private field warning.Raphael Isemann2019-01-081-2/+3
| | | | | | | | | | Summary: The member is private and unused if HAVE_LIBCOMPRESSION is undefined, which triggers Clang's -Wunused-private-field warning. Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D56458 llvm-svn: 350675
* ProcessLaunchInfo: Remove Target referencePavel Labath2019-01-081-2/+4
| | | | | | | | | | | | | | | | | | | | | Summary: The target was being used in FinalizeFileActions to provide default values for stdin/out/err. Also, most of the logic of this function was very specific to how the lldb's Target class wants to launch processes, so I, move it to Target::FinalizeFileActions, inverting the dependency. The only piece of logic that was useful elsewhere (lldb-server) was the part which sets up a pty and relevant file actions. I've kept this part as ProcessLaunchInfo::SetUpPtyRedirection. This makes ProcessLaunchInfo independent of any high-level lldb constructs. Reviewers: zturner, jingham, teemperor Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D56196 llvm-svn: 350617
* Use the minidump exception record if presentLeonard Mosescu2019-01-073-16/+27
| | | | | | | | If the minidump contains a saved exception record use it automatically. Differential Revision: https://reviews.llvm.org/D56293 llvm-svn: 350546
* RangeMap.h: merge RangeDataArray and RangeDataVectorPavel Labath2019-01-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The main difference between the classes was supposed to be the fact that one is backed by llvm::SmallVector, and the other by std::vector. However, over the years, they have accumulated various other differences too. This essentially removes the std::vector version, as that is pretty much identical to llvm::SmallVector<T, 0>, and combines their interfaces. It does not attempt to do a more significant refactoring, even though there is still a lot of duplication in this file, as it is hard to tell which quirk of some API is depended on by somebody (and, a previous, more ambitious attempt at this in D16769 has failed). I also add some tests, including one which demonstrates one of the quirks/bugs of the API I have noticed in the process. Reviewers: clayborg, teemperor, tberghammer Subscribers: mgorny, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D56170 llvm-svn: 350380
OpenPOWER on IntegriCloud