summaryrefslogtreecommitdiffstats
path: root/lldb/source
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Defend LoadImageUsingPaths against a path listJim Ingham2018-07-201-0/+4
| | | | | | with empty paths on it. llvm-svn: 337515
* Fix whitespace formatting in DWARFExpression::DumpLocationPavel Labath2018-07-191-14/+14
| | | | | | | | we were printing an extra space before the start for the expression and an extra space after some dwarf operators. This makes sure we only print exactly one space **between** operators and nowhere else. llvm-svn: 337452
* [windows] Use a well-known path for ComSpec if we fail to retrieve itStella Stamenova2018-07-181-2/+7
| | | | | | | | | | | | | | Summary: Right now we always try to retrieve ComSpec and if we fail, we give up. This rarely fails, but we can update the logic so that we fail even less frequently. Since there is a well-known path (albeit not always correct), try the path when we failed to retrieve it. Note that on other platforms, we generally just return a well-known path without any checking. Reviewers: asmith, zturner, labath Reviewed By: zturner, labath Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D49451 llvm-svn: 337395
* Invert dependency between lldb-framework and lldb-suiteAlex Langford2018-07-171-2/+4
| | | | | | | | | | | | | | | | | Summary: Currently, if you build lldb-framework the entire framework doesn't actually build. In order to build the entire framework, you need to actually build lldb-suite. This abstraction doesn't feel quite right because lldb-framework truly does depend on lldb-suite (liblldb + related tools). In this change I want to invert their dependency. This will mean that lldb and finish_swig will depend on lldb-framework in a framework build, and lldb-suite otherwise. Instead of adding conditional logic everywhere to handle this, I introduce LLDB_SUITE_TARGET to handle it. Differential Revision: https://reviews.llvm.org/D49406 llvm-svn: 337311
* Move pretty stack trace printer into driver.Jonas Devlieghere2018-07-171-4/+0
| | | | | | | | | | | | We used to have a pretty stack trace printer in SystemInitializerCommon. This was disabled on Apple because we didn't want the library to be setting signal handlers, as this was causing issues when loaded into Xcode. However, I think it's useful to have this for the LLDB driver, so I moved it up to use the PrettyStackTraceProgram in the driver's main. Differential revision: https://reviews.llvm.org/D49377 llvm-svn: 337261
* Rollback r337070.Sterling Augustine2018-07-131-2/+0
| | | | | | Someone simultaneously fixed the breakage it was designed to fix. llvm-svn: 337071
* Update ClangASTContext for the new DependentVector type.Sterling Augustine2018-07-131-0/+2
| | | | | | https://reviews.llvm.org/D49326 llvm-svn: 337070
* Fix -Wswitch after introduction of clang;:Type::DependentVector in r337036Fangrui Song2018-07-131-0/+4
| | | | llvm-svn: 337063
* Fix the libcxx set, multiset, vector and bitset formatters to work on ↵Jim Ingham2018-07-132-5/+19
| | | | | | | | | | | | | | | | references. The synthetic child providers for these classes had a type expression that matched pointers & references to the type, but the Front End only worked on the actual object. I fixed this by adding a way for the Synthetic Child FrontEnd provider to request dereference, and then had these formatters use that mode. <rdar://problem/40849836> Differential Revision: https://reviews.llvm.org/D49279 llvm-svn: 337035
* Replaced more boilerplate code with CompletionRequest (NFC)Raphael Isemann2018-07-1324-535/+277
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: As suggested in D48796, this patch replaces even more internal calls that were using the old completion API style with a single CompletionRequest. In some cases we also pass an option vector/index, but as we don't always have this information, it currently is not part of the CompletionRequest class. The constructor of the CompletionRequest is now also more sensible. You only pass the user input, cursor position and your list of matches to the request and the rest will be inferred (using the same code we used before to calculate this). You also have to pass these match window parameters to it, even though they are unused right now. The patch shouldn't change any behavior. Reviewers: jingham Reviewed By: jingham Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48976 llvm-svn: 337031
* No longer pass a StringRef to the Python APIRaphael Isemann2018-07-131-2/+3
| | | | | | | | | | | | | | | | | | Summary: The refactoring patch for DoExecute missed this case of a variadic function that just silently accepts a StringRef which it then tries to reinterpret as a C-string. This should fix the Windows builds. Reviewers: stella.stamenova Reviewed By: stella.stamenova Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D49309 llvm-svn: 337030
* Adjust thread name column width depending on real name length.Tatyana Krasnukha2018-07-131-1/+5
| | | | | | Make 16-byte aligned field instead of truncating a name to 16 byte. llvm-svn: 336993
* Add abbreviated name for Debugger::EventHandlerThread.Tatyana Krasnukha2018-07-131-5/+8
| | | | | | On OS's where thread names are limited to 16 bytes, the full name was truncated to not very meaningful "r.event-handler". llvm-svn: 336991
* Convert a location information from PDB to a DWARF expressionJonas Devlieghere2018-07-134-1/+636
| | | | | | | | | | | | | | | | | | The current version of SymbolFilePDB::ParseVariableForPDBData function always initializes variables with an empty location. This patch adds the converter of a location information from PDB to a DWARF expression, so it becomes possible to watch values of variables of primitive data types. At the moment the converter supports only Static, TLS, RegRel, Enregistered and Constant PDB location types, but it seems that it's enough for most cases. There are still some problems with retrieving values of variables (e.g. we can't watch variables of composite types), but they look not relevant to the conversion to DWARF. Patch by: Aleksandr Urakov Differential revision: https://reviews.llvm.org/D49018 llvm-svn: 336988
* 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-1216-211/+216
| | | | | | | | | | | | | | | | | | | | | | 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
* [IRInterpreter] Fix misevaluation of interpretation expressions with `urem`.Davide Italiano2018-07-121-5/+5
| | | | | | | | | | | | | | | | Scalar::MakeUnsigned was implemented incorrectly so it didn't really change the sign of the type (leaving signed types signed). This showed up as a misevaluation when IR-interpreting urem but it's likely to arise in other contexts. This commit fixes the definition, and adds a test to make sure this won't regress in future (hopefully). Fixes rdar://problem/42038760 and LLVM PR38076 Differential Revision: https://reviews.llvm.org/D49155 llvm-svn: 336872
* [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
* Allow specifying an exit code for the 'quit' commandRaphael Isemann2018-07-113-1/+74
| | | | | | | | | | | | | | | | | | | Summary: This patch adds the possibility to specify an exit code when calling quit. We accept any int, even though it depends on the user what happens if the int is out of the range of what the operating system supports as exit codes. Fixes rdar://problem/38452312 Reviewers: davide, jingham, clayborg Reviewed By: jingham Subscribers: clayborg, jingham, lldb-commits Differential Revision: https://reviews.llvm.org/D48659 llvm-svn: 336824
* Refactor ClangUserExpression::Parse [NFC]Raphael Isemann2018-07-102-30/+63
| | | | | | | | | | | | | | | | Summary: This patch splits out functionality from the `Parse` method into different methods. This benefits the code completion work (which should reuse those methods) and makes the code a bit more readable. Note that this patch is as minimal as possible. Some of the code in the new methods definitely needs more refactoring. Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48339 llvm-svn: 336734
* [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
* Refactor parsing of option lists with a raw string suffix.Raphael Isemann2018-07-108-232/+179
| | | | | | | | | | | | | | | | | | | | | | Summary: A subset of the LLDB commands follows this command line interface style: <command name> [arguments] -- <string suffix> The parsing code for this interface has been so far been duplicated into the different command objects which makes it hard to maintain and reuse elsewhere. This patches improves the situation by adding a OptionsWithRaw class that centralizes the parsing logic and allows easier testing. The different commands now just call this class to extract the arguments and the raw suffix from the provided user input. Reviewers: jingham Reviewed By: jingham Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D49106 llvm-svn: 336723
* [ObjCRuntime] Add support for obfuscation in tagged pointers.Davide Italiano2018-07-094-7/+54
| | | | | | | | | | | | | This is the default in MacOS Mojave. No testcases, as basically we have a lot of coverage (and the testsuite fails quite a bit without this change in Beta 3). Thanks to Fred Riss for helping me with this patch (fixing bugs/nondeterminism). <rdar://problem/38305553> llvm-svn: 336607
* Don't take the address of an xvalue when printing an expr resultRaphael Isemann2018-07-091-3/+2
| | | | | | | | | | | | | | | | | | | | Summary: If we have an xvalue here, we will always hit the `err_typecheck_invalid_lvalue_addrof` error in 'Sema::CheckAddressOfOperand' when trying to take the address of the result. This patch uses the fallback code path where we store the result in a local variable instead when we hit this case. Fixes rdar://problem/40613277 Reviewers: jingham, vsk Reviewed By: vsk Subscribers: vsk, friss, lldb-commits Differential Revision: https://reviews.llvm.org/D48303 llvm-svn: 336582
* Address a few post facto review comments from Adrian.Jim Ingham2018-07-051-5/+5
| | | | | | Thanks, Adrian! llvm-svn: 336398
* Add new API to SBTarget and SBModule classes.Alexander Polyakov2018-07-032-0/+23
| | | | | | | | | | | | | | Summary: The new API allows to find a list of compile units related to target/module. Reviewers: aprantl, clayborg Reviewed By: aprantl Subscribers: jingham, lldb-commits Differential Revision: https://reviews.llvm.org/D48801 llvm-svn: 336200
* [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
* Refactoring for for the internal command line completion API (NFC)Raphael Isemann2018-07-0216-368/+374
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch refactors the internal completion API. It now takes (as far as possible) a single CompletionRequest object instead o half a dozen in/out/in-out parameters. The CompletionRequest contains a common superset of the different parameters as far as it makes sense. This includes the raw command line string and raw cursor position, which should make the `expr` command possible to implement (at least without hacks that reconstruct the command line from the args). This patch is not intended to change the observable behavior of lldb in any way. It's also as minimal as possible and doesn't attempt to fix all the problems the API has. Some Q&A: Q: Why is this not fixing all the problems in the completion API? A: Because is a blocker for the expr command completion which I want to get in ASAP. This is the smallest patch that unblocks the expr completion patch and which allows trivial refactoring in the future. The patch also doesn't really change the internal information flow in the API, so that hopefully saves us from ever having to revert and resubmit this humongous patch. Q: Can we merge all the copy-pasted code in the completion methods (like computing the current incomplete arg) into CompletionRequest class? A: Yes, but it's out of scope for this patch. Q: Why the `word_complete = request.GetWordComplete(); ... ` pattern? A: I don't want to add a getter that returns a reference to the internal integer. So we have to use a temporary variable and the Getter/Setter instead. We don't throw exceptions from what I can tell, so the behavior doesn't change. Q: Why are we not owning the list of matches? A: Because that's how the previous API works. But that should be fixed too (in another patch). Q: Can we make the constructor simpler and compute some of the values from the plain command? A: I think this works, but I rather want to have this in a follow up commit. Especially when making nested request it's a bit awkward that the parsed arguments behave as both input/output (as we should in theory propagate the changes on the nested request back to the parent request if we don't want to change the behavior too much). Q: Can't we pass one const request object and then just return another result object instead of mixing them together in one in/out parameter? A: It's hard to get keep the same behavior with that pattern, but I think we can also get a nice API with just a single request object. If we make all input parameters read-only, we have a clear separation between what is actually an input and what an output parameter (and hopefully we get rid of the in-out parameters). Q: Can we throw out the 'match' variables that are not implemented according to the comment? A: We currently just forward them as in the old code to the different methods, even though I think they are really not used. We can easily remove and readd them once every single completion method just takes a CompletionRequest, but for now I prefer NFC behavior from the perspective of the API user. Reviewers: davide, jingham, labath Reviewed By: jingham Subscribers: mgorny, friss, lldb-commits Differential Revision: https://reviews.llvm.org/D48796 llvm-svn: 336146
* UUID: Add support for arbitrary-sized module IDsPavel Labath2018-06-293-103/+59
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: The data structure is optimized for the case where the UUID size is <= 20 bytes (standard length emitted by the GNU linkers), but larger sizes are also possible. I've modified the string conversion function to support the new sizes as well. For standard UUIDs it maintains the traditional formatting (4-2-2-2-6). If a UUID is shorter, we just cut this sequence short, and for longer UUIDs it will just repeat the last 6-byte block as long as necessary. I've also modified ObjectFileELF to take advantage of the new UUIDs and avoid manually padding the UUID to 16 bytes. While there, I also made sure the computed UUID does not depend on host endianness. Reviewers: clayborg, lemo, sas, davide, espindola Subscribers: emaste, arichardson, lldb-commits Differential Revision: https://reviews.llvm.org/D48633 llvm-svn: 335963
* Fix use-after-free in CommandCompletions.cppPavel Labath2018-06-291-1/+1
| | | | | | | | | | The code was creating a StringRef to a temporary std::string. The solution is to just drop the .str() from the original StringRef. This manifested it self as the new TestCompletions test failing in some configurations. llvm-svn: 335960
* Add a way to load an image using a library name and list of paths.Jim Ingham2018-06-285-17/+211
| | | | | | | | | | This provides an efficient (at least on Posix platforms) way to offload to the target process the search & loading of a library when all we have are the library name and a set of potential candidate locations. <rdar://problem/40905971> llvm-svn: 335912
* Skip core file tests on build configurations lacking necessary componentsPavel Labath2018-06-281-0/+12
| | | | | | | | | | | | | | | | | | | Summary: To successfully open a core file, we need to have LLVM built with support for the relevant target. Right now, if one does not have the appropriate targets configured, the tests will fail. This patch uses the GetBuildConfiguration SB API to inform the test (and anyone else who cares) about the list of supported LLVM targets. The test then uses this information to approriately skip the tests. Reviewers: clayborg, jingham Subscribers: martong, lldb-commits Differential Revision: https://reviews.llvm.org/D48641 llvm-svn: 335859
* Retrieve a function PDB symbol correctly from nested blocksPavel Labath2018-06-281-33/+34
| | | | | | | | | | | | | | | | | | | Summary: This patch fixes a problem with retrieving a function symbol by an address in a nested block. In the current implementation of ResolveSymbolContext function it retrieves a symbol with PDB_SymType::None and then checks if found symbol's tag equals to PDB_SymType::Function. So, if nested block's symbol was found, ResolveSymbolContext does not resolve a function. Reviewers: asmith, labath, zturner Reviewed By: asmith, labath Differential Revision: https://reviews.llvm.org/D47939 Patch by Aleksandr Urakov <aleksandr.urakov@jetbrains.com> llvm-svn: 335822
* [SymbolFile] Implement GetCompleteObjCClass for .debug_namesJonas Devlieghere2018-06-272-1/+44
| | | | | | | | | | | | | | | When running the test suite with .debug_names a bunch of tests were failing because GetCompleteObjCClass was not yet implemented for DebugNamesDWARFIndex. This patch adds the required logic. We use the .debug_names to find the Objective-C class and then rely on DW_AT_APPLE_objc_complete_type to find the complete type. If we can't find it or the attribute is not supported, we return a list of potential complete types. Differential revision: https://reviews.llvm.org/D48596 llvm-svn: 335776
* Add missing constness.Tatyana Krasnukha2018-06-276-6/+6
| | | | llvm-svn: 335711
* Move AddressClass to private enums since API doesn't provide any functions ↵Tatyana Krasnukha2018-06-274-16/+3
| | | | | | | | to manage it. This change allows to make AddressClass strongly typed enum and not to have issues with old versions of SWIG that don't support enum classes. llvm-svn: 335710
* Use the API's to get the TargetSP.Jim Ingham2018-06-261-1/+1
| | | | llvm-svn: 335690
* The Process class ivar ivar was changed to a weak pointer, but was still _sp.Jim Ingham2018-06-261-2/+2
| | | | | | Fix that to _wp. llvm-svn: 335689
* Represent invalid UUIDs as UUIDs with length zeroPavel Labath2018-06-268-108/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2619-145/+145
| | | | | | 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
* A little cleanup in ObjectFileMachO::GetSDKVersion. Jason Molenda2018-06-251-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | This method does one of two things: 1. finds a minimum os deployment version # in a Mach-O load command and saves the three parts in the m_sdk_version, or 2. finds no valid min os version # load command, pushes a sentinel value on the m_sdk_version vector so we don't search the same load commands multiple times. There was a little bug when we found a load command with a version of 0.0.0 - the method would not add anything to the m_sdk_version vector but would declare that a success. It would not push the sentinel value to the vector. There was code later in the method which assumed that the vector always had a sentinel value, at least, and that code could crash when this method was called back when evaluating a Swift expression. (these version #'s are fetched lazily so it wouldn't happen when the object file was parsed, only when doing an expression that needed the version #). <rdar://problem/41372699> llvm-svn: 335556
* [LLDB] Select helper sign comparison fixDavid Carlier2018-06-251-2/+2
| | | | | | | | | | | | The constant could be unsigned thus explicit cast to silent compilation warnings Reviewers: aprantl Reviewed By: aprantl Differential Revision: https://reviews.llvm.org/D48540 llvm-svn: 335489
* Revert "[FileSpec] Always normalize"Jonas Devlieghere2018-06-251-6/+104
| | | | | | | | This reverts r335432 because remove_dots() is expensive and measuring its impact showed an observable performance regression (https://reviews.llvm.org/D45977#1078510). llvm-svn: 335448
* [FileSpec] Always normalizeJonas Devlieghere2018-06-241-104/+6
| | | | | | | | Removing redundant components from the path seems pretty harmless. Rather than checking whether this is necessary and then actually doing so, always invoke remove_dots to start with a normalized path. llvm-svn: 335432
* [FileSpec] Refactor append and prepend implemenetations. NFCJonas Devlieghere2018-06-241-94/+20
| | | | | | | | Replaces custom implementations of append and prepend with calls to llvm's path library. This is part of a series of patches (started in D48084) to delegate common operations to llvm::sys::path. llvm-svn: 335430
* ResolveAddress: check returned value of resolving functions.Tatyana Krasnukha2018-06-221-7/+8
| | | | llvm-svn: 335341
* Remove dead codeFrederic Riss2018-06-221-42/+20
| | | | | | | | Our DWARF parsing code had a workaorund for Objective-C "self" not being marked as artifial by the compiler. Clang has been doing this since 2010, so let's just drop the workaround. llvm-svn: 335313
OpenPOWER on IntegriCloud