summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process
Commit message (Collapse)AuthorAgeFilesLines
...
* Simplify ObjectFile::GetArchitecturePavel Labath2019-01-031-2/+1
| | | | | | | | | | | | | | | | Summary: instead of returning the architecture through by-ref argument and a boolean value indicating success, we can just return the ArchSpec directly. Since the ArchSpec already has an invalid state, it can be used to denote the failure without the additional bool. Reviewers: clayborg, zturner, espindola Subscribers: emaste, arichardson, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D56129 llvm-svn: 350291
* Check that a pointer is valid and fix a log message on WindowsAaron Smith2019-01-031-2/+2
| | | | llvm-svn: 350281
* Fix "default argument for lambda parameter" (-Wpedantic) warningPavel Labath2018-12-271-2/+2
| | | | llvm-svn: 350089
* [NFC] Replace `compare` with (in)equality operator where applicable.Jonas Devlieghere2018-12-211-6/+6
| | | | | | | | Using compare is verbose, bug prone and potentially inefficient (because of early termination). Replace relevant call sites with the (in)equality operator. llvm-svn: 349972
* Overload GetMemoryRegions for the ProcessMinidumpTatyana Krasnukha2018-12-205-3/+22
| | | | | | Differential Revision: https://reviews.llvm.org/D55841 llvm-svn: 349767
* Don't forget to free the libcompression scratch buffer in the dtor.Jason Molenda2018-12-181-0/+3
| | | | llvm-svn: 349580
* Force libcompression calls to be enabled when building on DarwinJason Molenda2018-12-183-14/+37
| | | | | | | | | | | | | | | | systems. It has been available in the OS over over three years now. If lldb doesn't link against -lcompression, it should be an error. Allocate a scratch buffer for libcompression to use when decoding packets, instead of it having to allocate & free one on every call. Fix a typeo with the size of the buffer that compression_decode_buffer() is expanding into. <rdar://problem/41601084> llvm-svn: 349563
* Add "dump" command as a custom "process plugin" subcommand when ↵Greg Clayton2018-12-185-1/+300
| | | | | | | | | | | | | | | | | ProcessMinidump is used. Each process plug-in can create its own custom commands. I figured it would be nice to be able to dump things from the minidump file from the lldb command line, so I added the start of the some custom commands. Currently you can dump: minidump stream directory all linux specifc streams, most of which are strings each linux stream individually if desired, or all with --linux The idea is we can expand the command set to dump more things, search for data in the core file, and much more. This patch gets us started. Differential Revision: https://reviews.llvm.org/D55727 llvm-svn: 349429
* Remove /proc/pid/maps parsing code from NativeProcessLinuxPavel Labath2018-12-151-101/+18
| | | | | | A utility function doing this was added in r349182, so use that instead. llvm-svn: 349267
* Simplify Boolean expressionsJonas Devlieghere2018-12-1513-111/+78
| | | | | | | | | | | This patch simplifies boolean expressions acorss LLDB. It was generated using clang-tidy with the following command: run-clang-tidy.py -checks='-*,readability-simplify-boolean-expr' -format -fix $PWD Differential revision: https://reviews.llvm.org/D55584 llvm-svn: 349215
* Cache memory regions in ProcessMinidump and use the linux maps as the source ↵Greg Clayton2018-12-147-89/+325
| | | | | | | | | | | | | | | | | | | | | | | of the information if available Breakpad creates minidump files that sometimes have: - linux maps textual content - no MemoryInfoList Right now unless the file has a MemoryInfoList we get no region information. This patch: - reads and caches the memory region info one time and sorts it for easy subsequent access - get the region info from the best source in this order: - linux maps info (if available) - MemoryInfoList (if available) - MemoryList or Memory64List - returns memory region info for the gaps between regions (before the first and after the last) Differential Revision: https://reviews.llvm.org/D55522 llvm-svn: 349182
* Move Broadcaster+Listener+Event combo from Core into UtilityPavel Labath2018-12-147-9/+9
| | | | | | | | | | | | | | | | | | Summary: These are general purpose "utility" classes, whose functionality is not debugger-specific in any way. As such, I believe they belong in the Utility module. This doesn't break any particular dependency (yet), but it reduces the number of Core dependencies across the board. Reviewers: zturner, jingham, teemperor, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D55361 llvm-svn: 349157
* Fix MinidumpParser::GetFilteredModuleList() and test itGreg Clayton2018-12-131-19/+28
| | | | | | | | | | The MinidumpParser::GetFilteredModuleList() code was attempting to iterate through the entire module list and if it found more than one entry for a given module name, it wanted to pick the MinidumpModule with the lowest address. A bug existed where it wasn't doing that due to "exists" variable being inverted. "exists" was set to true if it was inserted, not if it existed. Furthermore, the order of the modules would be modified by sorting all modules from low address to high address (using MinidumpModule::base_of_image). This fix also maintains the original order which means your executable is at index 0 as intended instead of some random shared library. Tests were added to ensure this functionality doesn't regress. Differential Revision: https://reviews.llvm.org/D55614 llvm-svn: 349062
* ELF: Simplify program header iterationPavel Labath2018-12-122-23/+20
| | | | | | | | | | | | | Instead of GetProgramHeaderCount+GetProgramHeaderByIndex, expose an ArrayRef of all program headers, to enable range-based iteration. Instead of GetSegmentDataByIndex, expose GetSegmentData, taking a program header (reference). This makes the code simpler by enabling range-based loops and also allowed to remove some null checks, as it became locally obvious that some pointers can never be null. llvm-svn: 348928
* Do not use PATH_MAX with SmallStringStella Stamenova2018-12-102-3/+3
| | | | | | | | | | | | | | Summary: Instead use a more reasonable value to start and rely on the fact that SmallString will resize if necessary. Reviewers: labath, asmith Reviewed By: labath Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D55457 llvm-svn: 348775
* Remove some UB in RegisterContextDarwin_arm64.cppFrederic Riss2018-12-091-1/+11
| | | | llvm-svn: 348710
* gdb-remote: use elaborated type specifier for `Module`Saleem Abdulrasool2018-12-051-2/+2
| | | | | | | | When building with MSVC, the type `Module` is ambiguous due to both the lldb_private and llvm namespaces being used. Use the elaborated type instead to resolve the ambiguity. llvm-svn: 348332
* [PDB] Support PDB-backed expressions evaluation (+ fix stuck test)Aleksandr Urakov2018-12-031-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch contains several small fixes, which makes it possible to evaluate expressions on Windows using information from PDB. The changes are: - several sanitize checks; - make IRExecutionUnit::MemoryManager::getSymbolAddress to not return a magic value on a failure, because callers wait 0 in this case; - entry point required to be a file address, not RVA, in the ObjectFilePECOFF; - do not crash on a debuggee second chance exception - it may be an expression evaluation crash. Also fix detection of "crushed" threads in tests; - create parameter declarations for functions in AST to make it possible to call debugee functions from expressions; - relax name searching rules for variables, functions, namespaces and types. Now it works just like in the DWARF plugin; - fix endless recursion in SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc. Reviewers: zturner, asmith, stella.stamenova Reviewed By: stella.stamenova, asmith Tags: #lldb Differential Revision: https://reviews.llvm.org/D53759 llvm-svn: 348136
* [windows] Fix two minor bugs on WindowsStella Stamenova2018-12-012-5/+6
| | | | | | | 1. In ProcessWindows if we fail to allocate memory, we need to return LLDB_INVALID_ADDRESS rather than 0 or nullptr as that is the invalid address that LLDB looks for 2. In RegisterContextWindows in ReadAllRegisterValues, always create a new buffer. This is what the other platforms do and data_sp is always null in all tested scenarios on Windows as well llvm-svn: 348055
* Revert "[PDB] Support PDB-backed expressions evaluation"Stella Stamenova2018-11-302-4/+3
| | | | | | | | | This reverts commit dec87759523b2f22fcff3325bc2cd543e4cda0e7. This commit caused the tests on Windows to run forever rather than complete. Reverting until the commit can be fixed to not stall. llvm-svn: 348009
* [PDB] Support PDB-backed expressions evaluationAleksandr Urakov2018-11-302-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch contains several small fixes, which makes it possible to evaluate expressions on Windows using information from PDB. The changes are: - several sanitize checks; - make IRExecutionUnit::MemoryManager::getSymbolAddress to not return a magic value on a failure, because callers wait 0 in this case; - entry point required to be a file address, not RVA, in the ObjectFilePECOFF; - do not crash on a debuggee second chance exception - it may be an expression evaluation crash; - create parameter declarations for functions in AST to make it possible to call debugee functions from expressions; - relax name searching rules for variables, functions, namespaces and types. Now it works just like in the DWARF plugin; - fix endless recursion in SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc. Reviewers: zturner, asmith, stella.stamenova Reviewed By: stella.stamenova, asmith Tags: #lldb Differential Revision: https://reviews.llvm.org/D53759 llvm-svn: 347962
* [Reproducers] Improve reproducer API and add unit tests.Jonas Devlieghere2018-11-271-7/+11
| | | | | | | | | | | | | | | | | | | When I landed the initial reproducer framework I knew there were some things that needed improvement. Rather than bundling it with a patch that adds more functionality I split it off into this patch. I also think the API is stable enough to add unit testing, which is included in this patch as well. Other improvements include: - Refactor how we initialize the loader and generator. - Improve naming consistency: capture and replay seems the least ambiguous. - Index providers by name and make sure there's only one of each. - Add convenience methods for creating and accessing providers. Differential revision: https://reviews.llvm.org/D54616 llvm-svn: 347716
* Fix some compilation failures introduced in recent patches.Zachary Turner2018-11-141-3/+3
| | | | | | | | | | This fixes two compilation failures: 1) Designated initializers are C++20. We can't use them in LLVM. 2) thread_result_t is not a pointer type on all platforms, so returning nullptr is an error. llvm-svn: 346873
* Fix the "make_unique is ambiguous" compiler error.Haojian Wu2018-11-141-2/+2
| | | | llvm-svn: 346839
* Add GDB remote packet reproducer.Jonas Devlieghere2018-11-139-183/+775
| | | | llvm-svn: 346780
* Re-land "Extract construction of DataBufferLLVM into FileSystem"Jonas Devlieghere2018-11-123-10/+8
| | | | | | This fixes some UB in isLocal detected by the sanitized bot. llvm-svn: 346707
* Revert "Extract construction of DataBufferLLVM into FileSystem"Davide Italiano2018-11-123-8/+10
| | | | | | It broke the lldb sanitizer bots. llvm-svn: 346694
* Fix an unused variable warning. NFCAlexander Kornienko2018-11-121-0/+2
| | | | llvm-svn: 346651
* Remove header grouping comments.Jonas Devlieghere2018-11-11122-412/+1
| | | | | | | | 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-114-5/+5
| | | | | | | | | | 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
* Extract construction of DataBufferLLVM into FileSystemJonas Devlieghere2018-11-103-10/+8
| | | | | | | | | | This moves construction of data buffers into the FileSystem class. Like some of the previous refactorings we don't translate the path yet because the functionality hasn't been landed in LLVM yet. Differential revision: https://reviews.llvm.org/D54272 llvm-svn: 346598
* Unbreak the linux bot from the previous commit. Fred needed to useJason Molenda2018-11-101-0/+6
| | | | | | | | | some of the macros from mach/exc_resource.h to decode EXC_RESOURCE, but that header doesn't exist on non-apple platforms and StopInfoMachException.cpp needs to build on those systems. EXC_RESOURCE won't be decoded when lldb is built on non-darwin systems. llvm-svn: 346573
* Enable listening for EXC_RESOURCE events, and format machJason Molenda2018-11-101-0/+45
| | | | | | | | | | | | | | | | | | | | event as a thread stop reason if we receive one, using some macros to decode the payload. Patch originally written by Fred Riss, with a few small changes by myself. Writing a test for this is a little tricky because the mach exception data interpretation relies on header macros or function calls - it may change over time and writing a gdb_remote_client test for this would break as older encoding interpretation is changed. I'll tak with Fred about this more, but neither of us has been thrilled with the kind of tests we could write for it. <rdar://problem/13097323>, <rdar://problem/40144456> llvm-svn: 346571
* Work with a gdb-remote target that doesn't handle theJason Molenda2018-11-091-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | qWatchpointSupportInfo packet correctly. In GDBRemoteCommunicationClient::GetWatchpointSupportInfo, if the response to qWatchpointSupportInfo does not include the 'num' field, then we did not get an answer we understood, mark this target as not supporting that packet. In Target.cpp, rename the very confusingly named CheckIfWatchpointsExhausted to CheckIfWatchpointsSupported, and check the error status returned by Process::GetWatchpointSupportInfo. If we cannot determine what the number of supported watchpoints are, assume that they will work. We'll handle the failure later when we try to create/enable the watchpoint if the Z2 packet isn't supported. Add a gdb_remote_client test case. <rdar://problem/42621432> llvm-svn: 346561
* [FileSystem] Add convenience method to check for directories.Jonas Devlieghere2018-11-083-4/+3
| | | | | | | | | | | Replace calls to LLVM's is_directory with calls to LLDB's FileSytem class. For this I introduced a new convenience method that, like the other methods, takes either a path or filespec. This still uses the LLVM functions under the hood. Differential revision: https://reviews.llvm.org/D54135 llvm-svn: 346375
* [LLDB] Fix FreeBSD/Darwin buildDavid Carlier2018-11-042-9/+12
| | | | | | | | | | Reviewers: JDevlieghere, tatyana-krasnukha Reviwed By: tatyana-krasnukha Differential Revision: https://reviews.llvm.org/D54084 llvm-svn: 346109
* Fix NetBSD build after "Move path resolution logic out of FileSpec"Kamil Rytarowski2018-11-041-1/+1
| | | | | | D53915 llvm-svn: 346100
* NativeProcessProtocol: Simplify breakpoint setting codePavel Labath2018-11-042-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A fairly simple operation as setting a breakpoint (writing a breakpoint opcode) at a given address was going through three classes: NativeProcessProtocol which called NativeBreakpointList, which then called SoftwareBrekpoint, only to end up again in NativeProcessProtocol to do the actual writing itself. This is unnecessarily complex and can be simplified by moving all of the logic into NativeProcessProtocol class itself, removing a lot of boilerplate. One of the reeasons for this complexity was that (it seems) NativeBreakpointList class was meant to hold both software and hardware breakpoints. However, that never materialized, and hardware breakpoints are stored in a separate map holding only hardware breakpoints. Essentially, this patch makes software breakpoints follow that approach by replacing the heavy SoftwareBraekpoint with a light struct of the same name, which holds only the data necessary to describe one breakpoint. The rest of the logic is in the main class. As, at the lldb-server level, handling software and hardware breakpoints is very different, this seems like a reasonable state of things. Reviewers: krytarowski, zturner, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D52941 llvm-svn: 346093
* [FileSystem] Open File instances through the FileSystem.Jonas Devlieghere2018-11-021-2/+3
| | | | | | | | | | | This patch modifies how we open File instances in LLDB. Rather than passing a path or FileSpec to the constructor, we now go through the virtual file system. This is needed in order to make things work with the VFS in the future. Differential revision: https://reviews.llvm.org/D54020 llvm-svn: 346049
* [Windows] Fix Windows build after be053dd5a384a03da5a77552686900ddc7bfc178Aleksandr Urakov2018-11-022-7/+10
| | | | llvm-svn: 345956
* [File] Remove static method to get permissions.Jonas Devlieghere2018-11-011-4/+4
| | | | | | | This patch removes the static accessor in File to get a file's permissions. Permissions should be checked through the FileSystem class. llvm-svn: 345901
* [FileSystem] Move path resolution logic out of FileSpecJonas Devlieghere2018-11-0110-39/+51
| | | | | | | | | 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] Fix typo in ProcessFreeBSDJonas Devlieghere2018-11-011-1/+1
| | | | llvm-svn: 345860
* [FileSystem] Fix Exists call sitesJonas Devlieghere2018-11-012-2/+4
| | | | | | | There were some calls left to Exists() on non-darwin platforms (Windows, Linux and FreeBSD) that weren't yet updated to use the FileSystem. llvm-svn: 345857
* [FileSystem] Remove Exists() from FileSpecJonas Devlieghere2018-11-016-9/+12
| | | | | | | | | 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
* [Windows] A basic implementation of memory allocations in a debuggee processAleksandr Urakov2018-11-012-0/+69
| | | | | | | | | | | | | | | | | | | Summary: This patch adds a basic implementation of `DoAllocateMemory` and `DoDeallocateMemory` for Windows processes. For now it considers only the executable permission (and always allows reads and writes). Reviewers: zturner, asmith, stella.stamenova, labath, clayborg Reviewed By: zturner Subscribers: Hui, vsk, jingham, aleksandr.urakov, clayborg, abidh, teemperor, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D52618 llvm-svn: 345815
* [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
* [x86] Fix issues with a realigned stack in MSVC compiled applicationsAleksandr Urakov2018-10-302-53/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes issues with a stack realignment. MSVC maintains two frame pointers (`ebx` and `ebp`) for a realigned stack - one is used for access to function parameters, while another is used for access to locals. To support this the patch: - adds an alternative frame pointer (`ebx`); - considers stack realignment instructions (e.g. `and esp, -32`); - along with CFA (Canonical Frame Address) which point to the position next to the saved return address (or to the first parameter on the stack) introduces AFA (Aligned Frame Address) which points to the position of the stack pointer right after realignment. AFA is used for access to registers saved after the realignment (see the test); Here is an example of the code with the realignment: ``` struct __declspec(align(256)) OverAligned { char c; }; void foo(int foo_arg) { OverAligned oa_foo = { 1 }; auto aaa_foo = 1234; } void bar(int bar_arg) { OverAligned oa_bar = { 2 }; auto aaa_bar = 5678; foo(1111); } int main() { bar(2222); return 0; } ``` and here is the `bar` disassembly: ``` push ebx mov ebx, esp sub esp, 8 and esp, -100h add esp, 4 push ebp mov ebp, [ebx+4] mov [esp+4], ebp mov ebp, esp sub esp, 200h mov byte ptr [ebp-200h], 2 mov dword ptr [ebp-4], 5678 push 1111 ; foo_arg call j_?foo@@YAXH@Z ; foo(int) add esp, 4 mov esp, ebp pop ebp mov esp, ebx pop ebx retn ``` Reviewers: labath, zturner, jasonmolenda, stella.stamenova Reviewed By: jasonmolenda Subscribers: abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D53435 llvm-svn: 345577
* [Windows] Define generic arguments registers for Windows x64Aleksandr Urakov2018-10-261-6/+6
| | | | | | | | | | | | | | | | Summary: When evaluating expressions the generic arguments registers are required by ABI. This patch defines them. Reviewers: zturner, stella.stamenova, labath Subscribers: aleksandr.urakov, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D53753 llvm-svn: 345385
* Don't type-erase the SymbolContextItem enumeration.Zachary Turner2018-10-252-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When we get the `resolve_scope` parameter from the SB API, it's a `uint32_t`. We then pass it through all of LLDB this way, as a uint32. This is unfortunate, because it means the user of an API never actually knows what they're dealing with. We can call it something like `resolve_scope` and have comments saying "this is a value from the `SymbolContextItem` enumeration, but it makes more sense to just have it actually *be* the correct type in the actual C++ type system to begin with. This way the person reading the code just knows what it is. The reason to use integers instead of enumerations for flags is because when you do bitwise operations on enumerations they get promoted to integers, so it makes it tedious to constantly be casting them back to the enumeration types, so I've introduced a macro to make this happen magically. By writing LLDB_MARK_AS_BITMASK_ENUM after defining an enumeration, it will define overloaded operators so that the returned type will be the original enum. This should address all the mechanical issues surrounding using rich enum types directly. This way, we get a better debugger experience, and new users to the codebase can get more easily acquainted with the codebase because their IDE features can help them understand what the types mean. Differential Revision: https://reviews.llvm.org/D53597 llvm-svn: 345313
OpenPOWER on IntegriCloud