summaryrefslogtreecommitdiffstats
path: root/lldb/source
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix typeo in CPU_TYPE_ARM64_32 for older SDKs.Jason Molenda2019-10-311-1/+1
|
* [Symbol] Change ClangASTContext::GetCXXClassName return typeAlex Langford2019-10-312-20/+19
| | | | | | | | | Summary: Instead of filling out a std::string and returning a bool to indicate success, returning a std::string directly and testing to see if it's empty seems like a cleaner solution overall. Differential Revision: https://reviews.llvm.org/D69641
* Upstream diff from swift-lldb.Adrian Prantl2019-10-311-1/+1
| | | | This is very likely untested, but it looks like an obviously correct change.
* minidump: Create memory regions from the sections of loaded modulesPavel Labath2019-10-311-19/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Not all minidumps contain information about memory permissions. However, it is still important to know which regions of memory contain potentially executable code. This is particularly important for unwinding on win32, as the default unwind method there relies on scanning the stack for things which "look like" code pointers. This patch enables ProcessMinidump to reconstruct the likely permissions of memory regions using the sections of loaded object files. It only does this if we don't have a better source (memory info list stream, or linux /proc/maps) for this information, and only if the information in the object files does not conflict with the information in the minidump. Theoretically that last bit could be improved, since the permissions obtained from the MemoryList streams is also only a very rough guess, but it did not seem worthwhile to complicate the implementation because of that because there will generally be no overlap in practice as the MemoryList will contain the stack contents and not any module data. The patch adds a test checking that the module section permissions are entered into the memory region list, and also a test which demonstrate that now the unwinder is able to correctly find return addresses even in minidumps without memory info list streams. There's one TODO left in this patch, which is that the "memory region" output does not give any indication about the "don't know" values of memory region permissions (it just prints them as if they permission bit was set). I address this in a follow up. Reviewers: amccarth, clayborg Subscribers: mgrang, lldb-commits Differential Revision: https://reviews.llvm.org/D69105
* [lldb] Fix offset intersection bug between MPX and AVX registersGuilherme Andrade2019-10-315-4/+21
| | | | | | | | | | | | | | | | | Summary: This change increases the offset of MPX registers (by 128) so they do not overlap with the offset associated with AVX registers. That was causing MPX data in GDBRemoteRegisterContext::m_reg_data to get overwritten. Reviewers: labath Reviewed By: labath Subscribers: JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68874
* [LLDB] [Windows] Fix Windows-specific race condition in LLDB for session ↵Martin Storsjö2019-10-313-10/+5
| | | | | | | | | | | | | | | lifetime This can e.g. happen if the debugged executable exits before the initial stop, e.g. if it fails to load dependent DLLs. Add a virtual destructor to ProcessDebugger and let it clean up the session, and make ProcessWindows::OnExitProcess call ProcessDebugger::OnExitProcess for shared parts. Fix suggestion by Adrian McCarthy. Differential Revision: https://reviews.llvm.org/D69503
* [LLDB] [PECOFF] Fix error handling for executables that object::createBinary ↵Martin Storsjö2019-10-311-6/+9
| | | | | | | | | | | | | | errors out on llvm::object::createBinary returns an Expected<>, which requires not only checking the object for success, but also requires consuming the Error, if one was set. Use LLDB_LOG_ERROR for this case, and change an existing similar log statement to use it as well, to make sure the Error is consumed even if the log channel is disabled. Differential Revision: https://reviews.llvm.org/D69646
* [LLDB] [Windows] Remove a TODO which probably won't be implementedMartin Storsjö2019-10-311-2/+0
| | | | | | | | | | | | | Contrary to WoW64 on x86_64, there's no struct similar to WOW64_CONTEXT defined, for storing and handling the CPU state of an ARM32 process from an ARM64 process. Thus, making an ARM64 lldb-server able to control ARM32 processes seems infeasible at the moment. (The normal CONTEXT struct has a different layout on each architecture. In addition to this, a WOW64_CONTEXT struct always is defined, that can store the CPU state of an x86_32 process, to allow handling it from an x86_64 process. But there's no similar universally available struct for ARM32.)
* [LLDB] [PECOFF] Don't crash in ReadImageDataByRVA for addresses out of rangeMartin Storsjö2019-10-311-1/+4
| | | | | | This can happen e.g. when unwinding doesn't work perfectly. Differential Revision: https://reviews.llvm.org/D69502
* Only ask once if we have no commands. NFC.Jim Ingham2019-10-301-7/+5
|
* Run clang-format on lldb/source/Commands (NFC)Adrian Prantl2019-10-3023-443/+385
| | | | | These files had a lot of whitespace errors in them which was a constant source of merge conflicts downstream.
* [LLDB][PythonFile] fix dangerous borrow semantics on python2Lawrence D'Anna2019-10-301-13/+15
| | | | | | | | | | | | | | | | | | | | Summary: It is inherently unsafe to allow a python program to manipulate borrowed memory from a python object's destructor. It would be nice to flush a borrowed file when python is finished with it, but it's not safe to do on python 2. Python 3 does not suffer from this issue. Reviewers: labath, mgorny Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69532
* minidump: Rename some architecture constantsPavel Labath2019-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | The architecture enum contains two kinds of contstants: the "official" ones defined by Microsoft, and unofficial constants added by breakpad to cover the architectures not described by the first ones. Up until now, there was no big need to differentiate between the two. However, now that Microsoft has defined https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-system_info a constant for ARM64, we have a name clash. This patch renames all breakpad-defined constants with to include the prefix "BP_". This frees up the name "ARM64", which I'll re-introduce with the new "official" value in a follow-up patch. Reviewers: amccarth, clayborg Subscribers: lldb-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D69285
* COFF: Set section permissionsPavel Labath2019-10-301-0/+10
| | | | | | | | | | | | Summary: This enables us to reason about whether a given address can be executable, for instance during unwinding. Reviewers: amccarth, mstorsjo Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D69102
* [LLDB][breakpoints] ArgInfo::count -> ArgInfo::max_positional_argsLawrence D'Anna2019-10-292-41/+56
| | | | | | | | | | | | | | | | | | | | Summary: Move breakpoints from the old, bad ArgInfo::count to the new, better ArgInfo::max_positional_args. Soon ArgInfo::count will be no more. It looks like this functionality is already well tested by `TestBreakpointCommandsFromPython.py`, so there's no need to write additional tests for it. Reviewers: labath, jingham, JDevlieghere Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69468
* [ValueObjectDisplay] Generalize the description of an option.Davide Italiano2019-10-291-1/+1
|
* [LLDB][Python] fix another fflush issue on NetBSDLawrence D'Anna2019-10-293-16/+21
| | | | | | | | | | | | | | | | Summary: Here's another instance where we were calling fflush on an input stream, which is illegal on NetBSD. Reviewers: labath, mgorny Reviewed By: mgorny Subscribers: krytarowski, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69488
* [lldb][NFC] Make LLVMUserExpression::DoExecute return earlyRaphael Isemann2019-10-291-144/+142
| | | | The giant if-else isn't conforming to LLVM code style.
* [LLDB] [PECOFF] Use FindSectionByID to associate symbols to sectionsMartin Storsjö2019-10-291-1/+1
| | | | | | | | The virtual container/header section caused the section list to be offset by one, but by using FindSectionByID, the layout of the section list shouldn't matter. Differential Revision: https://reviews.llvm.org/D69366
* Add support for DW_AT_export_symbols for anonymous structsshafik2019-10-283-11/+10
| | | | | | | | | Summary: We add support for DW_AT_export_symbols to detect anonymous struct on top of the heuristics implemented in D66175 This should allow us to differentiate anonymous structs and unnamed structs. We also fix TestTypeList.py which was incorrectly detecting an unnamed struct as an anonymous struct. Differential Revision: https://reviews.llvm.org/D68961
* Correct size_t format specifierShu-Chun Weng2019-10-261-1/+1
| | | | Differential Revision: https://reviews.llvm.org/D69455
* lldb/minidump: Refactor memory region computation codePavel Labath2019-10-256-64/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal of this refactor is to enable ProcessMinidump to take into account the loaded modules and their sections when computing the permissions of various ranges of memory, as discussed in D66638. This patch moves some of the responsibility for computing the ranges from MinidumpParser into ProcessMinidump. MinidumpParser still does the parsing, but ProcessMinidump becomes responsible for answering the actual queries about memory ranges. This will enable it (in a follow-up patch) to augment the information obtained from the parser with data obtained from actual object files. The changes in the actual code are fairly straight-forward and just involve moving code around. MinidumpParser::GetMemoryRegions is renamed to BuildMemoryRegions to emphasize that it does no caching. The only new thing is the additional bool flag returned from this function. This indicates whether the returned regions describe all memory mapped into the target process. Data obtained from /proc/maps and the MemoryInfoList stream is considered to be exhaustive. Data obtained from Memory(64)List is not. This will be used to determine whether we need to augment the data or not. This reshuffle means that it is no longer possible/easy to test some of this code via unit tests, as constructing a ProcessMinidump instance is hard. Instead, I update the unit tests to only test the parsing of the actual data, and test the answering of queries through a lit test using the "memory region" command. The patch also includes some tweaks to the MemoryRegion class to make the unit tests easier to write. Reviewers: amccarth, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D69035
* lldb/COFF: Create a separate "section" for the file headerPavel Labath2019-10-251-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | In an attempt to ensure that every part of the module's memory image is accounted for, D56537 created a special "container section" spanning the entire image. While that seemed reasonable at the time (and it still mostly does), it did create a problem of what to put as the "file size" of the section, because the image is not continuous on disk, as we generally assume (which is why I put zero there). Additionally, this arrangement makes it unclear what kind of permissions should be assigned to that section (which is what my next patch does). To get around these, this patch partially reverts D56537, and goes back to top-level sections. Instead, what I do is create a new "section" for the object file header, which is also being loaded into memory, though its not considered to be a section in the strictest sense. This makes it possible to correctly assign file size section, and we can later assign permissions to it as well. Reviewers: amccarth, mstorsjo Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D69100
* Add the ability to pass extra args to a Python breakpoint callback.Jim Ingham2019-10-2512-103/+282
| | | | | | | | | | | | | | | | | For example, it is pretty easy to write a breakpoint command that implements "stop when my caller is Foo", and it is pretty easy to write a breakpoint command that implements "stop when my caller is Bar". But there's no way to write a generic "stop when my caller is..." function, and then specify the caller when you add the command to a breakpoint. With this patch, you can pass this data in a SBStructuredData dictionary. That will get stored in the PythonCommandBaton for the breakpoint, and passed to the implementation function (if it has the right signature) when the breakpoint is hit. Then in lldb, you can say: (lldb) break com add -F caller_is -k caller_name -v Foo More generally this will allow us to write reusable Python breakpoint commands. Differential Revision: https://reviews.llvm.org/D68671
* Fix compilation error in ObjectFileMachO::ParseSymtabVedant Kumar2019-10-251-2/+5
|
* ValueObject: Fix a crash related to children address type computationPavel Labath2019-10-252-45/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes a crash encountered when debugging optimized code. If some variable has been completely optimized out, but it's value is nonetheless known, the compiler can replace it with a DWARF expression computing its value. The evaluating these expressions results in a eValueTypeHostAddress Value object, as it's contents are computed into an lldb buffer. However, any value that is obtained by dereferencing pointers in this object should no longer have the "host" address type. Lldb had code to account for this, but it was only present in the ValueObjectVariable class. This wasn't enough when the object being described was a struct, as then the object holding the actual pointer was a ValueObjectChild. This caused lldb to dereference the contained pointer in the context of the host process and crash. Though I am not an expert on ValueObjects, it seems to me that this children address type logic should apply to all types of objects (and indeed, applying applying the same logic to ValueObjectChild fixes the crash). Therefore, I move this code to the base class, and arrange it to be run everytime the value is updated. The test case is a reduced and simplified version of the original debug info triggering the crash. Originally we were dealing with a local variable, but as these require a running process to display, I changed it to use a global one instead. Reviewers: jingham, clayborg Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D69273
* [lldb] [Host/netbsd] Set Arg0 for 'platform process list -v'Michał Górny2019-10-251-0/+1
| | | | Differential Revision: https://reviews.llvm.org/D69400
* [lldb] [Python] Do not attempt to flush() a read-only fdMichal Gorny2019-10-241-5/+7
| | | | | | | | | | | | | | | Summary: When creating a FileSP object, do not flush() the underlying file unless it is open for writing. Attempting to flush() a read-only fd results in EBADF on NetBSD. Reviewers: lawrence_danna, labath, krytarowski Reviewed By: lawrence_danna, labath Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D69320
* [Mips] Use appropriate private label prefix based on Mips ABIMirko Brkusanin2019-10-233-6/+14
| | | | | | | | | | MipsMCAsmInfo was using '$' prefix for Mips32 and '.L' for Mips64 regardless of -target-abi option. By passing MCTargetOptions to MCAsmInfo we can find out Mips ABI and pick appropriate prefix. Tags: #llvm, #clang, #lldb Differential Revision: https://reviews.llvm.org/D66795
* [lldb] Adjust for the new class_rw_t layout.Jonas Devlieghere2019-10-221-0/+12
| | | | | | | | | The field holding the "ro" will now be a union. If the low bit is set, then it isn't an ro and it needs to be dereferenced once more to get to it. If the low bit isn't set, then it is a proper class_ro_t No dedicated test is needed as this code path will trigger when running the existing Objective-C tests under a current version of the runtime.
* remove multi-argument form of PythonObject::Reset()Lawrence D'Anna2019-10-227-479/+316
| | | | | | | | | | | | | | | | | | | | Summary: With this patch, only the no-argument form of `Reset()` remains in PythonDataObjects. It also deletes PythonExceptionState in favor of PythonException, because the only call-site of PythonExceptionState was also using Reset, so I cleaned up both while I was there. Reviewers: JDevlieghere, clayborg, labath, jingham Reviewed By: labath Subscribers: mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69214 llvm-svn: 375475
* [LLDB] [Windows] Initial support for ARM register contextsMartin Storsjo2019-10-216-3/+1213
| | | | | | Differential Revision: https://reviews.llvm.org/D69226 llvm-svn: 375392
* eliminate nontrivial Reset(...) from TypedPythonObjectLawrence D'Anna2019-10-193-39/+75
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This deletes `Reset(...)`, except for the no-argument form `Reset()` from `TypedPythonObject`, and therefore from `PythonString`, `PythonList`, etc. It updates the various callers to use assignment, `As<>`, `Take<>`, and `Retain<>`, as appropriate. followon to https://reviews.llvm.org/D69080 Reviewers: JDevlieghere, clayborg, labath, jingham Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69133 llvm-svn: 375350
* [LLDB] bugfix: command script add -f doesn't work for some callablesLawrence D'Anna2019-10-192-8/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When users define a debugger command from python, they provide a callable object. Because the signature of the function has been extended, LLDB needs to inspect the number of parameters the callable can take. The rule it was using to decide was weird, apparently not tested, and giving wrong results for some kinds of python callables. This patch replaces the weird rule with a simple one: if the callable can take 5 arguments, it gets the 5 argument version of the signature. Otherwise it gets the old 4 argument version. It also adds tests with a bunch of different kinds of python callables with both 4 and 5 arguments. Reviewers: JDevlieghere, clayborg, labath, jingham Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69014 llvm-svn: 375333
* [Reproducer] Improve reproducer help (NFC)Jonas Devlieghere2019-10-181-2/+12
| | | | | | Provide a little more detail for the reproducer command. llvm-svn: 375292
* [Reproducer] Use ::rtrim() to remove trailing control characters.Jonas Devlieghere2019-10-181-4/+2
| | | | | | | | Pavel correctly pointed out that removing all control characters from the working directory is overkill. It should be sufficient to just strip the last ones. llvm-svn: 375259
* ProcessMinidump: Suppress reporting stop for signal '0'Joseph Tremoulet2019-10-181-1/+12
| | | | | | | | | | | | | | | | | | | | | | | Summary: The minidump exception stream can report an exception record with signal 0. If we try to create a stop reason with signal zero, processing of the stop event won't find anything, and the debugger will hang. So, simply early-out of RefreshStateAfterStop in this case. Also set the UnixSignals object in DoLoadCore as is done for ProcessElfCore. Reviewers: labath, clayborg, jfb Reviewed By: labath, clayborg Subscribers: dexonsmith, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68096 llvm-svn: 375244
* LLDB: Use LLVM's type for minidump ExceptionStream [NFC]Joseph Tremoulet2019-10-186-61/+32
| | | | | | | | | | | | | | | | Summary: The types defined for it in LLDB are now redundant with core types. Reviewers: labath, clayborg Reviewed By: clayborg Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68658 llvm-svn: 375243
* SystemInitializerCommon fix compilation on linuxPavel Labath2019-10-181-1/+2
| | | | | | | | | | | C++ defines two overloads of std::iscntrl. One in <cctype> and one in <locale>. On linux we seem to include both which makes the std::erase_if call ambiguous. Wrap std::iscntrl call in a lambda to ensure regular overload resolution. llvm-svn: 375221
* [lldb][NFC] Fix typo in DWARFASTParserClang.cppRaphael Isemann2019-10-171-2/+2
| | | | llvm-svn: 375187
* eliminate one form of PythonObject::Reset()Lawrence D'Anna2019-10-172-27/+5
| | | | | | | | | | | | | | | | | | | | | | Summary: I'd like to eliminate all forms of Reset() and all public constructors on these objects, so the only way to make them is with Take<> and Retain<> and the only way to copy or move them is with actual c++ copy, move, or assignment. This is a simple place to start. Reviewers: JDevlieghere, clayborg, labath, jingham Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69080 llvm-svn: 375182
* clean up the implementation of PythonCallable::GetNumArgumentsLawrence D'Anna2019-10-172-35/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The current implementation of PythonCallable::GetNumArguments is not exception safe, has weird semantics, and is just plain incorrect for some kinds of functions. Python 3.3 introduces inspect.signature, which lets us easily query for function signatures in a sane and documented way. This patch leaves the old implementation in place for < 3.3, but uses inspect.signature for modern pythons. It also leaves the old weird semantics in place, but with FIXMEs grousing about it. We should update the callers and fix the semantics in a subsequent patch. It also adds some tests. Reviewers: JDevlieghere, clayborg, labath, jingham Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68995 llvm-svn: 375181
* (NFC) Delete variable made unused by llvm-svn: 375160Sterling Augustine2019-10-171-1/+0
| | | | | | | | | | | | Reviewers: aprantl Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69143 llvm-svn: 375174
* Modernize the rest of the Find.* API (NFC)Adrian Prantl2019-10-1743-579/+408
| | | | | | | | | | | | This patch removes the size_t return value and the append parameter from the remainder of the Find.* functions in LLDB's internal API. As in the previous patches, this is motivated by the fact that these parameters aren't really used, and in the case of the append parameter were frequently implemented incorrectly. Differential Revision: https://reviews.llvm.org/D69119 llvm-svn: 375160
* [lldb] Don't emit artificial constructor declarations as global functionsRaphael Isemann2019-10-171-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | Summary: When we have a artificial constructor DIE, we currently create from that a global function with the name of that class. That ends up causing a bunch of funny errors such as "must use 'struct' tag to refer to type 'Foo' in this scope" when doing `Foo f`. Also causes that constructing a class via `Foo()` actually just calls that global function. The fix is that when we have an artificial method decl, we always treat it as handled even if we don't create a CXXMethodDecl for it (which we never do for artificial methods at the moment). Fixes rdar://55757491 and probably some other radars. Reviewers: aprantl, vsk, shafik Reviewed By: aprantl Subscribers: jingham, shafik, labath, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68130 llvm-svn: 375151
* [Reproducer] Surface error if setting the cwd failsJonas Devlieghere2019-10-171-2/+7
| | | | | | | Make sure that we surface an error if setting the current working directory fails during replay. llvm-svn: 375146
* [ARC] Add SystemV ABITatyana Krasnukha2019-10-175-1/+737
| | | | | | Differential Revision: https://reviews.llvm.org/D55724 llvm-svn: 375123
* [ARC] Basic support in gdb-remote process pluginTatyana Krasnukha2019-10-174-1/+11
| | | | | | Differential Revision: https://reviews.llvm.org/D55718 llvm-svn: 375122
* delete SWIG typemaps for FILE*Lawrence D'Anna2019-10-174-49/+7
| | | | | | | | | | | | | | | | | | Summary: The SWIG typemaps for FILE* are no longer used, so this patch deletes them. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68963 llvm-svn: 375073
* SBCommandReturnObject: change LLDB_RECORD_METHOD(..., FILE *, ...) to use ↵Fangrui Song2019-10-171-11/+10
| | | | | | | | | | | | | | | | | | | LLDB_RECORD_DUMMY POSIX says FILE is a typedef to a structure containing information about a file. The structure is unspecified, i.e. it may be an incomplete type, as is the case on musl (`struct _IO_FILE` is an implementation detail that is not exposed). `LLDB_RECORD_METHOD(..., (FILE *), ...)` transitively uses sizeof(FILE) and requires the structure to be complete. Change it to LLDB_RECORD_DUMMY to fix the build failure on musl (regression of D57475). Reviewed By: JDevlieghere, labath, lawrence_danna Differential Revision: https://reviews.llvm.org/D68872 llvm-svn: 375072
OpenPOWER on IntegriCloud