summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process
Commit message (Collapse)AuthorAgeFilesLines
...
* Support nwere versions of the Segger J-Link jtag board software.Jason Molenda2018-10-231-3/+12
| | | | | | | | | | | | | | | | | | | | | | Add support in ProcessGDBRemote::GetGDBServerRegisterInfo for recognizing a generic "arm" architecture that will be used if nothing better is available so that we don't ignore the register definitions if we didn't already have an architecture set. Also in ProcessGDBRemote::DoConnectRemote don't set the target arch unless we have a valid architecture to set it to. Platform::ConnectProcess will try to get the current target's architecture, or the default architecture, when creating the target for the connection to be attempted. If lldb was started with a target binary, we want to create this target with that architecture in case the remote gdb stub doesn't supply a qHostInfo arch. Add logging to Target::MergeArchitecture. <rdar://problem/34916465> llvm-svn: 345106
* [Windows] Fix a bug that causes lldb to freezeAaron Smith2018-10-102-5/+15
| | | | | | | | | | | | | | | | | | | | | Summary: If the process exits before any initial stop then notify the debugger of the error otherwise WaitForDebuggerConnection() will be blocked. An example of this issue is when a process fails to load a dependent DLL. In addition to the fix, remove a duplicate call to FreeProcessHandles() in DebuggerThread::HandleExitProcessEvent() and use decimal format for all thread IDs. Reviewers: rnk, zturner, aleksandr.urakov Reviewed By: zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D53090 llvm-svn: 344168
* Pull FixupBreakpointPCAsNeeded into base classPavel Labath2018-10-034-153/+1
| | | | | | | | | | | | | | | | | Summary: This function existed (with identical code) in both NativeProcessLinux and NativeProcessNetBSD, and it is likely that it would be useful to any future implementation of NativeProcessProtocol. Therefore I move it to the base class. Reviewers: krytarowski Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D52719 llvm-svn: 343683
* Fix NetBSD build for r343409Pavel Labath2018-09-301-1/+0
| | | | | | Forgot to remove the method declaration from the header. llvm-svn: 343411
* Pull GetSoftwareBreakpointPCOffset into base classPavel Labath2018-09-303-65/+5
| | | | | | | | | | | | | | | | | | | | | | Summary: This function encodes the knowledge of whether the PC points to the breakpoint instruction of the one following it after the breakpoint is "hit". This behavior mainly(*) depends on the architecture and not on the OS, so it makes sense for it to be implemented in the base class, where it can be shared between different implementations (Linux and NetBSD atm). (*) It is possible for an OS to expose a different API, perhaps by doing some fixups in the kernel. In this case, the implementation can override this function to implement custom behavior. Reviewers: krytarowski, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D52532 llvm-svn: 343409
* Replace pointer to C-array of PropertyDefinition with llvm::ArrayRefTatyana Krasnukha2018-09-272-5/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D52572 llvm-svn: 343181
* Fix ProcessKDP after r343130Tatyana Krasnukha2018-09-261-2/+2
| | | | llvm-svn: 343141
* Replace "nullptr-terminated" C-arrays of OptionValueEnumeration with safer ↵Tatyana Krasnukha2018-09-261-4/+4
| | | | | | | | llvm::ArrayRef Differential Revision: https://reviews.llvm.org/D49017 llvm-svn: 343130
* Change the unwinder to not use a hard-coded limit on theJason Molenda2018-09-251-1/+3
| | | | | | | | | | max number of stack frames to backtrace, make it a setting, target.process.thread.max-backtrace-depth. Add a test case for the setting. <rdar://problem/28759559> llvm-svn: 343029
* Replace boolean parameter with enum value according r342633Tatyana Krasnukha2018-09-251-2/+2
| | | | llvm-svn: 342998
* Replace boolean parameter with enum value according r342633Tatyana Krasnukha2018-09-201-1/+1
| | | | llvm-svn: 342671
* [NFC] Turn "load dependent files" boolean into an enumJonas Devlieghere2018-09-203-3/+3
| | | | | | | | | | | | | | 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
* NativeProcessProtocol: Sink ReadMemoryWithoutTrap into base classPavel Labath2018-09-134-24/+0
| | | | | | | | The two existing implementations have the function implemented identically, and there's no reason to believe that this would be different for other implementations. llvm-svn: 342167
* Move SafeMachO from Utility to HostPavel Labath2018-09-124-5/+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
* Reduce alignment on struct XSAVE, fixing a gcc warningPavel Labath2018-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | The warning is about heap-allocating a struct with bigger alignment requirements than the standard heap allocator provides. AFAICT, all uses of the XSAVE struct are already heap-allocated, so this high alignment does not actually have any effect and removing it should be NFC. I have also done some digging in the commit history. This alignment requirement was since the XSAVE struct was introduced in r180572 when adding AVX register support for linux. It does not mention the alignment specifically, so I am guessing this was just put there because the corresponging XSAVE cpu instruction requires its buffer to be 64-byte aligned. However, LLDB will not be normally reading this struct via the XSAVE instruction directly. Instead we will ask the kernel to copy the buffer saved when suspeding the inferior. This should not require such strict alignment (in fact, linux kernel will happily do this for any alignment). llvm-svn: 342029
* Speculative fix for NetBSD bot for r341758Pavel Labath2018-09-091-2/+2
| | | | llvm-svn: 341759
* Re-commit "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"Pavel Labath2018-09-094-93/+13
| | | | | | | | | | | | | This recommits r341487, which was reverted due to failing tests with clang. It turned out I had incorrectly expected that the literal arrays passed to ArrayRef constructor will have static (permanent) storage. This was only the case with gcc, while clang was constructing them on stack, leading to dangling pointers when the function returns. The fix is to explicitly assign static storage duration to the opcode arrays. llvm-svn: 341758
* Revert "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"Pavel Labath2018-09-084-14/+95
| | | | | | | This reverts commit r341487. Jan Kratochvil reports it breaks LLDB when compiling with clang. llvm-svn: 341747
* Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcodePavel Labath2018-09-054-95/+14
| | | | | | | | | | | | return the opcode as a Expected<ArrayRef> instead of a Status+pointer+size combo. I also move the linux implementation to the base class, as the trap opcodes are likely to be the same for all/most implementations of the class (except the arm one, where linux chooses a different opcode than what the arm spec recommends, which I keep linux-specific). llvm-svn: 341487
* Increase qHostInfo packet timeoutPavel Labath2018-08-311-0/+3
| | | | | | | | | Host info computation can involve DNS traffic (to compute the remote host name). On very unreliable networks (such as free WiFi on trains), this can take several seconds to complete or timeout. Increase the qHostInfo timeout to account for this. llvm-svn: 341164
* Move Predicate.h from Host to UtilityRaphael Isemann2018-08-304-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This class was initially in Host because its implementation used to be very OS-specific. However, with C++11, it has become a very simple std::condition_variable wrapper, with no host-specific code. It is also a general purpose utility class, so it makes sense for it to live in a place where it can be used by everyone. This has no effect on the layering right now, but it enables me to later move the Listener+Broadcaster+Event combo to a lower layer, which is important, as these are used in a lot of places (notably for launching a process in Host code). Reviewers: jingham, zturner, teemperor Reviewed By: zturner Subscribers: xiaobai, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D50384 llvm-svn: 341089
* Don't include the Age in the UUID for CvRecordPdb70 UUID records in minidump ↵Greg Clayton2018-08-291-2/+12
| | | | | | | | | | | | | | | | | files for Apple vendors. The CvRecordPdb70 structure looks like: struct CvRecordPdb70 { uint8_t Uuid[16]; llvm::support::ulittle32_t Age; // char PDBFileName[]; }; We were including the "Age" in the UUID for Apple vedors which caused us to not be able to match the UUID to built binaries. The "Age" field is set to zero in breakpad minidump files for Apple targets. Differential Revision: https://reviews.llvm.org/D51442 llvm-svn: 340966
* Restrict the set of plugins used for ProcessMinidumpLeonard Mosescu2018-08-232-8/+15
| | | | | | | | | | | | | | 1. The dynamic loaders should not be needed for loading minidumps and they may create problems (ex. the macOS loader resets the list of loaded sections, which for minidumps are already set up during minidump loading) 2. In general, the extra plugins can do extraneous work which hurts performance (ex. trying to set up implicit symbolic breakpoints, which in turn will trigger extra debug information loading) Differential Revision: https://reviews.llvm.org/D51176 llvm-svn: 340578
* Misc module/dwarf logging improvementsLeonard Mosescu2018-08-071-0/+6
| | | | | | | | | | | | | | This change improves the logging for the lldb.module category to note a few interesting cases: 1. Local object file found, but specs not matching 2. Local object file not found, using a placeholder module The handling and logging for the cases wehre we fail to load compressed dwarf symbols is also improved. Differential Revision: https://reviews.llvm.org/D50274 llvm-svn: 339161
* Fix a couple of extended-offsetof warnings that had slipped throughPavel Labath2018-08-071-3/+3
| | | | llvm-svn: 339130
* Move RegisterValue,Scalar,State from Core to UtilityPavel Labath2018-08-0763-84/+83
| | | | | | | | | | | | | 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
* Fix more offsetof issues.Greg Clayton2018-08-061-5/+5
| | | | llvm-svn: 339034
* Fix offsetof usage that got lost when passing patches between linux and mac.Greg Clayton2018-08-062-14/+16
| | | | llvm-svn: 339033
* Add support for ARM and ARM64 breakpad generated minidump files (version 2).Greg Clayton2018-08-069-18/+1597
| | | | | | | | | | | | | | | | In this patch I add support for ARM and ARM64 break pad files. There are two flavors of ARM: Apple where FP is R7, and non Apple where FP is R11. Added minimal tests that load up ARM64 and the two flavors or ARM core files with a single thread and known register values in each register. Each register is checked for the exact value. This is a fixed version of: https://reviews.llvm.org/D49750 The changes from D49750 are: Don't init the m_arch in the Initialize call as a system info isn't required. This keeps the thread list, module list and other tests from failing Added -Wextended-offsetof to Xcode project so we catch use extended usages of offsetof before submission Fixed any extended offset of warnings Differential Revision: https://reviews.llvm.org/D50336 llvm-svn: 339032
* Revert "Add support for ARM and ARM64 breakpad generated minidump files"Pavel Labath2018-08-039-1653/+76
| | | | | | | | This reverts commit r338734 (and subsequent fixups in r338772 and r338746), because it breaks some minidump unit tests and introduces a lot of compiler warnings. llvm-svn: 338828
* [lldb] Remove unused variable.David L. Jones2018-08-021-1/+0
| | | | | | The use of this variable was removed in r338734. It now causes unused variable warnings. llvm-svn: 338772
* Fix CMake build.Zachary Turner2018-08-021-0/+2
| | | | | | | Some new files were committed to the repository but not added to the CMakeLists.txt, so this patch fixes the build. llvm-svn: 338746
* Add support for ARM and ARM64 breakpad generated minidump filesGreg Clayton2018-08-028-75/+1651
| | | | | | | | In this patch I add support for ARM and ARM64 break pad files. There are two flavors of ARM: Apple where FP is R7, and non Apple where FP is R11. Added minimal tests that load up ARM64 and the two flavors or ARM core files with a single thread and known register values in each register. Each register is checked for the exact value. Differential Revision: https://reviews.llvm.org/D49750 llvm-svn: 338734
* [ProcessGDBRemote] handle result from ConnectToDebugserverJonas Devlieghere2018-07-251-1/+1
| | | | | | | We ignored the result from ConnectToDebugserver, causing certain errors (like a failed handshake) not to surface. llvm-svn: 337932
* Add support for parsing Breakpad minidump files that can have extra padding ↵Greg Clayton2018-07-231-2/+19
| | | | | | | | in the module, thread and memory lists. Differential Revision: https://reviews.llvm.org/D49579 llvm-svn: 337694
* Remove incorrect thread-pc-values clearingJason Molenda2018-07-121-1/+0
| | | | | | | | | | from ProcessGDBRemote::UpdateThreadIDsFromStopReplyThreadsValue. Patch by Venkata Ramanaiah. Differential Revision: https://reviews.llvm.org/D48868 llvm-svn: 336956
* Get rid of the C-string parameter in DoExecuteRaphael Isemann2018-07-121-3/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch gets rid of the C-string parameter in the RawCommandObject::DoExecute function, making the code simpler and less memory unsafe. There seems to be a assumption in some command objects that this parameter could be a nullptr, but from what I can see the rest of the API doesn't actually allow this (and other command objects and related code pieces dereference this parameter without any checks). Especially CommandObjectRegexCommand has error handling code for a nullptr that is now gone. Reviewers: davide, jingham, teemperor Reviewed By: teemperor Subscribers: jingham, lldb-commits Differential Revision: https://reviews.llvm.org/D49207 llvm-svn: 336955
* Restructure the minidump loading path and add early & explicit consistency ↵Leonard Mosescu2018-07-124-47/+139
| | | | | | | | | | | | | | | | | | | | | checks Corrupted minidumps was leading to unpredictable behavior. This change adds explicit consistency checks for the minidump early on. The checks are not comprehensive but they should catch obvious structural violations: streams with type == 0 duplicate streams (same type) overlapping streams truncated minidumps Another early check is to make sure we actually support the minidump architecture instead of crashing at a random place deep inside LLDB. Differential Revision: https://reviews.llvm.org/D49202 llvm-svn: 336918
* Remove unused variable m_header as it hasn't been used since it wasEric Christopher2018-07-122-6/+4
| | | | | | added in 2016. llvm-svn: 336884
* [windows] Fix out-of-memory failure in some of the testsStella Stamenova2018-07-111-22/+40
| | | | | | | | | | | | | | Summary: When ReadProcessMemory fails, bytes_read is sometimes set to a large garbage value. In that case, we need to set it back to zero before returning or the garbage value will be used to allocate memory later causing LLDB to crash with an out of memory error. Reviewers: asmith, zturner Reviewed By: zturner Subscribers: zturner, asmith, stella.stamenova, llvm-commits Differential Revision: https://reviews.llvm.org/D49159 llvm-svn: 336865
* [windows] LLDB shows the wrong values when register read is executed at a ↵Stella Stamenova2018-07-109-70/+76
| | | | | | | | | | | | | | | | | | | frame other than zero Summary: This is a clean version of the change suggested here: https://bugs.llvm.org/show_bug.cgi?id=37495 The main change is to follow the same pattern as non-windows targets and use an unwinder object to retrieve the register context. I also changed a couple of the comments to actually log, so that issues with unsupported scenarios can be tracked down more easily. Lastly, ClearStackFrames is implemented in the base class, so individual thread implementations don't have to override it. Reviewers: asmith, zturner, aleksandr.urakov Reviewed By: aleksandr.urakov Subscribers: emaste, stella.stamenova, tatyana-krasnukha, llvm-commits Differential Revision: https://reviews.llvm.org/D49111 llvm-svn: 336732
* [lldbsuite, windows] Don't crash LLDB when we try to retrieve a register on ↵Stella Stamenova2018-07-022-0/+6
| | | | | | | | | | | | | | | | Windows Summary: 1) When ReadRegister is called with a null register into on Windows, rather than crashing due to an access violation, simply return false. Not all registers and properties will be read or calculated correctly, but that is consistent with other platforms that also return false in that case 2) Update a couple of tests to reference pr37995 as their reason for failure since it is much more accurate. Support for floating point registers doesn't exist on Windows at all, rather than having issues. Reviewers: asmith, labath, zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D48844 llvm-svn: 336147
* Use the API's to get the TargetSP.Jim Ingham2018-06-261-1/+1
| | | | llvm-svn: 335690
* Represent invalid UUIDs as UUIDs with length zeroPavel Labath2018-06-261-12/+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
* Change AddressClass type from 'enum' to 'enum class'.Tatyana Krasnukha2018-06-261-3/+3
| | | | | | If we have a function with signature f(addr_t, AddressClass), it is easy to muddle up the order of arguments without any warnings from compiler. 'enum class' prevents passing integer in place of AddressClass and vice versa. llvm-svn: 335599
* Remove UUID::SetFromCStringPavel Labath2018-06-213-3/+3
| | | | | | Replace uses with SetFromStringRef. NFC. llvm-svn: 335246
* Replace HostInfo::GetLLDBPath with specific functionsPavel Labath2018-06-192-3/+3
| | | | | | | | | | | | | | | | | | | | | Summary: Instead of a function taking an enum value determining which path to return, we now have a suite of functions, each returning a single path kind. This makes it easy to move the python-path function into a specific plugin in a follow-up commit. All the users of GetLLDBPath were converted to call specific functions instead. Most of them were hard-coding the enum value anyway, so this conversion was simple. The only exception was SBHostOS, which I've changed to use a switch on the incoming enum value. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48272 llvm-svn: 335052
* Use llvm::VersionTuple instead of manual version marshallingPavel Labath2018-06-185-49/+18
| | | | | | | | | | | | | | | | | | 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-135-8/+16
| | | | | | | | | | | | | | | | 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
* [lit] Split test_set_working_dir TestProcessLaunch into two tests and fix it ↵Stella Stamenova2018-06-132-7/+23
| | | | | | | | | | | | | | | | | | | | | | on Windows Summary: test_set_working_dir was testing two scenario: failure to set the working dir because of a non existent directory and succeeding to set the working directory. Since the negative case fails on both Linux and Windows, the positive case was never tested. I split the test into two which allows us to always run both the negative and positive cases. The positive case now succeeds on Linux and the negative case still fails. During the investigation, it turned out that lldbtest.py will try to execute a process launch command up to 3 times if the command failed. This means that we could be covering up intermittent failures by running any test that does process launch multiple times without ever realizing it. I've changed the counter to 1 (though it can still be overwritten with the environment variable). This change also fixes both the positive and negative cases on Windows. There were a few issues: 1) In ProcessLauncherWindows::LaunchProcess, the error was not retrieved until CloseHandle was possibly called. Since CloseHandle is also a system API, its success would overwrite any existing error that could be retrieved using GetLastError. So by the time the error was retrieved, it was now a success. 2) In DebuggerThread::StopDebugging TerminateProcess was called on the process handle regardless of whether it was a valid handle. This was causing the process to crash when the handle was LLDB_INVALID_PROCESS (0xFFFFFFFF). 3) In ProcessWindows::DoLaunch we need to check that the working directory exists before launching the process to have the same behavior as other platforms which first check the directory and then launch process. This way we also control the exact error string. Reviewers: labath, zturner, asmith, jingham Reviewed By: labath Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D48050 llvm-svn: 334642
OpenPOWER on IntegriCloud