summaryrefslogtreecommitdiffstats
path: root/lldb
Commit message (Collapse)AuthorAgeFilesLines
...
* Retrieve a function PDB symbol correctly from nested blocksStella Stamenova2018-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. It is very simple to reproduce this. For example, in the next program ``` int main() { auto r = 0; for (auto i = 1; i <= 10; i++) { r += i & 1 + (i - 1) & 1 - 1; } return r; } ``` if we will stop inside the cycle and will do a backtrace, the top element will be broken. But how we can test this? I thought to add an option to lldb-test to allow search a function by address, but the address may change when the compiler will be changed. Patch by: Aleksandr Urakov Reviewers: asmith, labath, zturner Reviewed By: asmith, labath Subscribers: stella.stamenova, llvm-commits Differential Revision: https://reviews.llvm.org/D47939 llvm-svn: 336564
* Add LLDB_API to SBAddress's operator==.Alexander Polyakov2018-07-071-2/+2
| | | | | | | | | | Summary: Add LLDB_API to SBAddress's operator== to fix lldb-mi build on Windows. Patch by Aleksandr Urakov! Differential Revision: https://reviews.llvm.org/D49006 llvm-svn: 336494
* Fix build on Windows with SDK build version >= 17134.Tatyana Krasnukha2018-07-071-5/+0
| | | | | | Platform.h doesn't define signal() and SIGINT since commit r263858. Code was compiled successfully because signal.h didn't have "ifndef" include guard in previous versions of Windows SDK. Now it does. llvm-svn: 336483
* [test-suite] Add a decorator for the lack of libstdcxx on the system.Davide Italiano2018-07-0610-26/+21
| | | | | | | | | This generalizes a bunch of target-specific tests. MacOS has no libstdcxx anymore, and neither does FreeBSD (or Windows). <rdar://problem/41896105> llvm-svn: 336463
* Remove a bunch more references to _LIBCPP_INLINE_VISIBILITYJim Ingham2018-07-068-40/+18
| | | | | | | | and adjust the tests that needed it to set their breakpoints more robustly. <rdar://problem/41867390> llvm-svn: 336403
* Address a few post facto review comments from Adrian.Jim Ingham2018-07-052-6/+10
| | | | | | Thanks, Adrian! llvm-svn: 336398
* Don't muck with _LIBCPP_INLINE_VISIBILITY just to get predictable line table ↵Jim Ingham2018-07-051-9/+8
| | | | | | | | | | | | | | | entries. This test was trying to stop at a variety of std::vector calls. It looks like the test was failing because various inlined std functions left no line table entries for the line that invoked the inlined function. The author worked around that by undefining _LIBCPP_INLINE_VISIBILITY. That's an internal libcxx macro, we really shouldn't be playing around with it. Better to just force ourselves to stop where we want using some other non-inlineable statement. printf seems a good candidate... <rdar://problem/41867390> llvm-svn: 336397
* [CMake] Simplify a few framework build rulesAlex Langford2018-07-051-2/+2
| | | | llvm-svn: 336395
* Fixed redefinition warnings with LLVM_ENABLE_MODULESRaphael Isemann2018-07-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It seems we both have the HAVE_LIBCOMPRESSION define in the config header and in the source files definitions of some files. This causes that the Config.h header emits the following warning when we compile the Host module: ``` In file included from <module-includes>:21: In file included from /Users/teemperor/llvm/llvm/tools/lldb/include/lldb/Host/MainLoop.h:13: tools/lldb/include/lldb/Host/Config.h:33:9: warning: 'HAVE_LIBCOMPRESSION' macro redefined [-Wmacro-redefined] ^ <command line>:1:9: note: previous definition is here ^ ``` It's not really clear why the define is in both places (the commit message just says it fixes some unspecified bug), but we can easily work around this by just guarding our define in Config.h. Reviewers: aprantl Reviewed By: aprantl Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D48977 llvm-svn: 336377
* [lit] Don't require semicolon separatorJonas Devlieghere2018-07-042-4/+11
| | | | | | | | | This patch removes the requirement for a semicolon as a separator when passing arguments to lit. It relies on the shlex module that is part of Python to do simple lexical analysis, similar to what happens in a Unix shell. llvm-svn: 336290
* Fix and simplify lldb.command decoratorDave Lee2018-07-044-21/+53
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change fixes one issue with `lldb.command`, and also reduces the implementation. The fix: a command function's docstring was not shown when running `help <command_name>`. This is because the docstring attached the source function is not propagated to the decorated function (`f.__call__`). By returning the original function, the docstring will be properly displayed by `help`. Also with this change, the command name is assumed to be the function's name, but can still be explicitly defined as previously. Additionally, the implementation was updated to: * Remove inner class * Remove use of `inspect` module * Remove `*args` and `**kwargs` Reviewers: clayborg Reviewed By: clayborg Subscribers: keith, xiaobai, lldb-commits Differential Revision: https://reviews.llvm.org/D48658 llvm-svn: 336287
* [CMake] Remove redundant path componentJonas Devlieghere2018-07-041-1/+1
| | | | | | | Fixes spurious path component introduced in r336278. The variable is cached so might require you to re-run CMake. llvm-svn: 336279
* [CMake] Use LLVM_RUNTIME_OUTPUT_INTDIR for LLDB exectuableJonas Devlieghere2018-07-041-1/+4
| | | | | | | | | | Apparently there's a difference between using LLVM_RUNTIME_OUTPUT_INTDIR and LLVM_BINARY_DIR. The former will point to the current binary directory (i.e. that where lldb is built) while the former will always point to LLVM's. This was causing trouble for the swift build but should be a transparent for upstream lldb. llvm-svn: 336278
* [CMake] Move some variables aroundJonas Devlieghere2018-07-042-3/+13
| | | | | | | | | This improves consistency by creating a CMake variable for the dsymutil path. The motivation is that for Swift, the dsymutil binary and the lldb binary live in different directories and we need an option to configure this from the build script. llvm-svn: 336272
* Ammend "Fix MSVC2015 compilation failure after r336206 patch".Alexander Polyakov2018-07-031-0/+2
| | | | llvm-svn: 336235
* Fix MSVC2015 compilation failure after r336206 patch.Alexander Polyakov2018-07-031-0/+6
| | | | | | Added missing headers. llvm-svn: 336212
* [lldb-mi] Re-implement symbol-list-lines command.Alexander Polyakov2018-07-0314-282/+101
| | | | | | | | | | | | | | Summary: Now this command uses SB API instead of HandleCommand. Reviewers: aprantl, clayborg Reviewed By: aprantl, clayborg Subscribers: ki.stfu, eraman, lldb-commits Differential Revision: https://reviews.llvm.org/D48802 llvm-svn: 336206
* Add new API to SBTarget and SBModule classes.Alexander Polyakov2018-07-038-0/+135
| | | | | | | | | | | | | | 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
* Re-sort the lldb.xcodeproj project file and commit the scriptJason Molenda2018-07-032-2557/+2798
| | | | | | | | | | | | that I used to sort it to scripts/sort-pbxproj.rb. It turns out that Xcode will perturb the order of the file lists every time we add a file, following its own logic, and unfortunately we'll still end up with lots of merge conflicts when that tries to merge to the github swift repositories. We talked this over and we're going to keep it in a canonical state by running this script over it when Xcode tries to reorder it. llvm-svn: 336158
* [lldb-mi] Re-implement a few MI commands.Alexander Polyakov2018-07-028-463/+190
| | | | | | | | | | | | | | | Summary: This patch updates exec-next-instruction, exec-step-instruction, exec-finish, exec-interrupt commands to use SB API instead of HandleCommand. Reviewers: aprantl, clayborg Reviewed By: aprantl Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D48520 llvm-svn: 336155
* FIx XCode project files for lldbRaphael Isemann2018-07-021-2554/+2560
| | | | | | | | | | | | | Summary: Fixes the XCode builds that started failing when i added CompletionRequest.cpp/.h. The patch is so large because XCode decided to write the lines back in its own order, but essentially we only added on e file. Subscribers: srhines, lldb-commits Differential Revision: https://reviews.llvm.org/D48858 llvm-svn: 336154
* Fixed compilation failure after the code completion refactor patchRaphael Isemann2018-07-022-4/+4
| | | | | | | | Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48855 llvm-svn: 336149
* [lldbsuite, windows] Don't crash LLDB when we try to retrieve a register on ↵Stella Stamenova2018-07-025-12/+18
| | | | | | | | | | | | | | | | 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-0224-479/+536
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [lldb-mi] Clean up and update a few MI commands.Alexander Polyakov2018-06-292-51/+35
| | | | | | | | | | | | | | | | | Summary: This patch updates a few MI commands using a new way of handling an errors in lldb-mi and removes unnecessary m_lldbResult variables. Reviewers: aprantl, clayborg, labath Reviewed By: aprantl, clayborg Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D47992 llvm-svn: 336009
* Add a test for reading lld-generated build-idsPavel Labath2018-06-297-18/+50
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This test makes sure we are able to read the shorter build-ids which are generated by lld. To make this work, I've extended lldb-test to print the UUID of the loaded object file. I've renamed the lldb-test subcommand from "module-sections" to "object-file" to reflect the fact it prints more than just the sections. I've also added the module Architecture to the output, so we could avoid printing the entire symbol file information just to get the ArchSpec details in the lc_version_min test (which was also the only test in it's folder not using the module-sections command). Reviewers: aprantl, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48646 llvm-svn: 335967
* UUID: Add support for arbitrary-sized module IDsPavel Labath2018-06-295-128/+97
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix TestLoadUsingPaths on linuxPavel Labath2018-06-291-0/+1
| | | | | | | we need to explicitly link the test program with -ldl for the dlopen function to be available. llvm-svn: 335956
* Modernize completion testsPavel Labath2018-06-291-53/+32
| | | | | | | | | Now that we have gmock, we can use its matchers to better express the test assertions. The main advantage of this is that when things fail, the test will now print the expected and actual lists of completed strings instead of just a not-very-helpful "false is not true" message. llvm-svn: 335955
* Fix path completion test case added in rL335905 on WindowsRaphael Isemann2018-06-281-4/+2
| | | | | | | | | | | | | | | | | | Summary: The test fails because we don't rewrite the slash behind `foo` to the OS specific separator (as the completion API doesn't support this kind of rewriting). However, we assume that this part of the string is rewritten in the test case, which broke on Windows. Reviewers: stella.stamenova Reviewed By: stella.stamenova Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48746 llvm-svn: 335934
* Add a way to load an image using a library name and list of paths.Jim Ingham2018-06-2814-18/+479
| | | | | | | | | | 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
* [lldbsuite] Fix TestBreakpointHitCount on WindowsStella Stamenova2018-06-281-1/+1
| | | | | | | | | | | | Summary: On Windows, the newer DIA SDKs end up producing function names that contain the return type as well. This means that the function name returned in the test will contain the return type (int) in addition to the name of the function and the type of the input (a(int)). To account for the possibility of both, the test should pass if the function name matches either pattern. Reviewers: zturner, asmith Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D48654 llvm-svn: 335906
* Added test case for: r334978 - Fixed file completion for paths that start ↵Raphael Isemann2018-06-281-5/+21
| | | | | | | | | | | | | | with '~' Reviewers: labath Reviewed By: labath Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48665 llvm-svn: 335905
* Skip core file tests on build configurations lacking necessary componentsPavel Labath2018-06-283-0/+33
| | | | | | | | | | | | | | | | | | | 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-284-57/+107
| | | | | | | | | | | | | | | | | | | 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-273-4/+60
| | | | | | | | | | | | | | | 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-278-8/+8
| | | | llvm-svn: 335711
* Move AddressClass to private enums since API doesn't provide any functions ↵Tatyana Krasnukha2018-06-2714-60/+37
| | | | | | | | 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
* Fix a single typo in SBSymbolContextDave Lee2018-06-271-1/+1
| | | | | | | | | | | | | | Summary: Fix a "Manay" in SBSymbolContext.i Reviewers: xiaobai Reviewed By: xiaobai Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48620 llvm-svn: 335709
* 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-262-5/+5
| | | | | | Fix that to _wp. llvm-svn: 335689
* This is not a debug info sensitive test.Jim Ingham2018-06-261-0/+2
| | | | llvm-svn: 335688
* Reverting r335656, SWIG doesn't like "enum class".Jim Ingham2018-06-261-1/+1
| | | | llvm-svn: 335659
* Amend "Change AddressClass type from 'enum' to 'enum class'".Tatyana Krasnukha2018-06-261-1/+1
| | | | | | r335599 changes usages of AddressClass, but doesn't change the type itself. llvm-svn: 335656
* Represent invalid UUIDs as UUIDs with length zeroPavel Labath2018-06-2612-144/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2623-164/+164
| | | | | | 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
* Fix windows build for r335541.Alexander Polyakov2018-06-251-0/+2
| | | | | | I didn't include <functional> header and used std::function. llvm-svn: 335552
* Implement new methods for handling an error in MI commands.Alexander Polyakov2018-06-252-0/+68
| | | | | | | | | | | | | | | | Summary: The new methods take SBError object and call handler, specified by user, depending on SBError status. Reviewers: aprantl, clayborg, labath Reviewed By: aprantl, clayborg Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D48295 llvm-svn: 335541
OpenPOWER on IntegriCloud