Commit Graph

17628 Commits

Author SHA1 Message Date
Raphael Isemann 7dd0aba0b2 Removed failing StreamTest case
The suspicious behavior is obviously because this method reads
OOB memory, so I'll remove it for now and re-add the test alongside
the fix later.

llvm-svn: 338491
2018-08-01 06:35:27 +00:00
Raphael Isemann b1dfad0601 Added initial unit test for LLDB's Stream class.
Summary:
This adds an initial small unit test for LLDB's Stream class, which should at least cover
most of the functions in the Stream class. StreamString is always in big endian
mode, so that's the only stream byte order path this test covers as of now. Also,
the binary mode still needs to be tested for all print methods.

Also adds some FIXMEs for wrong/strange result values of the Stream class that we hit
while testing those functions.

Reviewers: labath

Reviewed By: labath

Subscribers: probinson, labath, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D50027

llvm-svn: 338488
2018-08-01 06:04:48 +00:00
Eric Christopher 83c49e8ed4 Android is an environment and we were comparing the android triple
against the OS rather than the environment. Also update other
uses of OS when we meant environment in the android local code.

NFC intended.

llvm-svn: 338460
2018-07-31 23:53:24 +00:00
Eric Christopher 852e88ad85 Tidy up comment.
llvm-svn: 338459
2018-07-31 23:53:24 +00:00
Eric Christopher 926b7c71f3 Use UnknownVendor rather than UnknownArch since they're in two different enums
and we're switching on vendor and not arch.

llvm-svn: 338458
2018-07-31 23:53:23 +00:00
Raphael Isemann 56bf356a4b Remove Stream::UnitTest
Summary: No one is using this method, and it also doesn't really make a lot of sense to have it around.

Reviewers: davide

Reviewed By: davide

Subscribers: davide, lldb-commits

Differential Revision: https://reviews.llvm.org/D50026

llvm-svn: 338345
2018-07-31 01:21:36 +00:00
Raphael Isemann 129fe89ffb Remove unnecessary newlines from break command help text.
Summary:
We usually don't have trailing newlines in the short help strings. This just adds
unnecessary extra lines when printing the help text of these commands.

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D50015

llvm-svn: 338311
2018-07-30 21:41:13 +00:00
Jan Kratochvil cd9c15cda1 Remove friend class declarations from DWARFUnit and DWARFCompileUnit
They are no longer needed since D45170.

llvm-svn: 338224
2018-07-29 19:32:36 +00:00
Raphael Isemann 7bb4de47c9 Add the actually calculated completions to COMPLETION_MSG
Summary: Otherwise this assertion message is not very useful to whoever is reading the log.

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D49947

llvm-svn: 338179
2018-07-27 23:42:34 +00:00
Alex Langford 2f6a1018e0 Revert "Stop building liblldb with CMake's framework functionality"
This reverts r338154. This change is actually unnecessary, as the CMake
bug I referred to was actually not a bug but a misunderstanding of
CMake.

Original Differential Revision: https://reviews.llvm.org/D49888

llvm-svn: 338178
2018-07-27 23:38:58 +00:00
Raphael Isemann d4ff5ba926 Add missing boundary checks to variable completion.
Summary: Stopgap patch to at least stop all the crashes I get from this code.

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D49949

llvm-svn: 338177
2018-07-27 23:37:08 +00:00
Raphael Isemann 23d7a9ebbe Fix whitespace in the python test suite.
Summary:
The test suite has often unnecessary trailing whitespace, and sometimes
unnecessary trailing lines or a missing final new line. This patch just strips
trailing whitespace/lines and adds missing newlines at the end.

Subscribers: ki.stfu, JDevlieghere, christof, lldb-commits

Differential Revision: https://reviews.llvm.org/D49943

llvm-svn: 338171
2018-07-27 22:20:59 +00:00
Davide Italiano 2d396a912a Revert "Recommit [DataFormatters] Add formatter for C++17 std::optional."
This broke a linux bot which doesn't support -std=c++17. The solution
is to add a decorator to skip these tests on machines with older compilers.

llvm-svn: 338162
2018-07-27 20:38:01 +00:00
Davide Italiano 1d44c46539 Recommit [DataFormatters] Add formatter for C++17 std::optional.
This should have all the correct files now.
<rdar://problem/41471112>
Patch by Shafik Yaghmour.

Differential Revision:  https://reviews.llvm.org/D49271

llvm-svn: 338156
2018-07-27 19:57:30 +00:00
Alex Langford c1d4311c1b Stop building liblldb with CMake's framework functionality
Summary:
CMake has a bug in its ninja generator that prevents you from
installing targets that are built with framework support. Therefore, I want to
not rely on CMake's framework support.
See https://gitlab.kitware.com/cmake/cmake/issues/18216

Differential Revision: https://reviews.llvm.org/D49888

llvm-svn: 338154
2018-07-27 19:41:17 +00:00
Raphael Isemann 1a6d7ab55d Narrow the CompletionRequest API to being append-only.
Summary:
We currently allow any completion handler to read and manipulate the list of matches we
calculated so far. This leads to a few problems:

Firstly, a completion handler's logic can now depend on previously calculated results
by another handlers. No completion handler should have such an implicit dependency,
but the current API makes it likely that this could happen (or already happens). Especially
the fact that some completion handler deleted all previously calculated results can mess
things up right now.

Secondly, all completion handlers have knowledge about our internal data structures with
this API. This makes refactoring this internal data structure much harder than it should be.
Especially planned changes like the support of descriptions for completions are currently
giant patches because we have to refactor every single completion handler.

This patch narrows the contract the CompletionRequest has with the different handlers to:

1. A handler can suggest a completion.
2. A handler can ask how many suggestions we already have.

Point 2 obviously means we still have a  dependency left between the different handlers, but
getting rid of this is too large to just append it to this patch.

Otherwise this patch just completely hides the internal StringList to the different handlers.

The CompletionRequest API now also ensures that the list of completions is unique and we
don't suggest the same value multiple times to the user. This property has been so far only
been ensured by the `Option` handler, but is now applied globally. This is part of this patch
as the OptionHandler is no longer able to implement this functionality itself.

Reviewers: jingham, davide, labath

Reviewed By: davide

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D49322

llvm-svn: 338151
2018-07-27 18:42:46 +00:00
Alex Langford 60bdd09d10 Add back lldb-framework-headers target
In r338058 we removed the target `lldb-framework-headers`, which mean
lldb-framework no longer depended on `framework_headers`, so they never
actually got generated. This is a partial revert of r338058: I added
back the lldb-framework-headers target, but the framework-header-fix.sh
script still runs on the copied headers.

llvm-svn: 338074
2018-07-26 21:55:14 +00:00
Alex Langford 10c9e0e0d8 Make framework-header-fix process copied headers
Summary:
Previously the framework-header-fix script would change the sources
before they were copied, leading to unnecessary rebuilds on repeat
`ninja lldb` invocations. This runs the script on the headers after
they're copied into the produced LLDB.framework, meaning it doesn't
affect any files being built.

Patch by Keith Smiley <keithbsmiley@gmail.com>!

Differential Revision: https://reviews.llvm.org/D49779

llvm-svn: 338058
2018-07-26 19:04:46 +00:00
Raphael Isemann 223d921c6a Fix duplicate suggestions after an ambiguous command
Summary:
So far lldb is printing this when it finds an ambiguous command:
```
(lldb) g
Ambiguous command 'g'. Possible matches:
        gdb-remote
        gui
        gdb-remote
        gui
```
The duplicates come from the fact that we call the same query twice with the same parameters
and add it to the same list. This patch just removes the second query call to `GetCommandObject`.

As `GetCommandObject` is const and the name parameter is also not modified, this shouldn't break
anything else. I didn't merge the remaining if statement into the else as I think otherwise the
`if obj==nullptr do X else Y` pattern in there becomes hard to recognize.

Reviewers: davide

Reviewed By: davide

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D49866

llvm-svn: 338043
2018-07-26 17:14:18 +00:00
Raphael Isemann 6fcc7d703b Don't print two errors for unknown commands.
Summary:
We always print two error messages when we hit an unknown command. As the function
`CommandInterpreter::HandleCommand` that prints the second error message unconditionally called the `CommandInterpreter::ResolveCommandImpl` before (which prints the first error message), we can just remove
that second error message.

Fixes https://bugs.llvm.org/show_bug.cgi?id=38312

Reviewers: labath

Reviewed By: labath

Subscribers: labath, lldb-commits

Differential Revision: https://reviews.llvm.org/D49831

llvm-svn: 338040
2018-07-26 16:32:05 +00:00
Davide Italiano 4b58867d06 Revert "[DataFormatters] Add formatter for C++17 std::optional."
I forgot to git add some files. I'm going to recommit the correct
version at once soon.

llvm-svn: 337963
2018-07-25 21:18:20 +00:00
Davide Italiano 1d4a78ef04 [DataFormatters] Add formatter for C++17 std::optional.
<rdar://problem/41471112>

Patch by Shafik Yaghmour.

Differential Revision:  https://reviews.llvm.org/D49271

llvm-svn: 337959
2018-07-25 20:46:29 +00:00
Jonas Devlieghere 03772dd87b [ProcessGDBRemote] handle result from ConnectToDebugserver
We ignored the result from ConnectToDebugserver, causing certain errors
(like a failed handshake) not to surface.

llvm-svn: 337932
2018-07-25 15:20:15 +00:00
Stefan Granitz 2f842d68df Use LLVM's new ItaniumPartialDemangler in LLDB
Summary:
Replace the existing combination of FastDemangle and the fallback to llvm::itaniumDemangle() with LLVM's new ItaniumPartialDemangler. It slightly reduces complexity and slightly improves performance, but doesn't introduce conceptual changes. This patch is preparing for more fundamental improvements on LLDB's demangling approach.

Reviewers: friss, jingham, erik.pilkington, labath, clayborg, mgorny, davide, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: teemperor, JDevlieghere, labath, clayborg, davide, lldb-commits, mgorny, erik.pilkington

Differential Revision: https://reviews.llvm.org/D49612

llvm-svn: 337931
2018-07-25 15:19:04 +00:00
Pavel Labath 5457b426f5 Fix PythonString::GetString for >=python-3.7
The return value of PyUnicode_AsUTF8AndSize is now "const char *".

Thanks to Brett Neumeier for testing the patch out on python 3.7.

llvm-svn: 337908
2018-07-25 11:35:28 +00:00
Raphael Isemann bae7367cd9 Add unit tests for VMRange
Subscribers: clayborg, labath, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D49415

llvm-svn: 337873
2018-07-24 23:52:39 +00:00
Jason Molenda d5522568e4 Add DumpRegisterValue.cpp.
llvm-svn: 337865
2018-07-24 23:19:56 +00:00
Raphael Isemann ea832b9578 Remove unused History class
Summary: This class doesn't seem to be used anywhere, so we might as well remove the code.

Reviewers: labath

Reviewed By: labath

Subscribers: labath, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D49755

llvm-svn: 337855
2018-07-24 21:09:17 +00:00
Pavel Labath e03334cf6a Move dumping code out of RegisterValue class
Summary:
The dump function was the only part of this class which depended on
high-level functionality. This was due to the DumpDataExtractor
function, which uses info from a running target to control dump format
(although, RegisterValue doesn't really use the high-level part of
DumpDataExtractor).

This patch follows the same approach done for the DataExtractor class,
and extracts the dumping code into a separate function/file. This file
can stay in the higher level code, while the RegisterValue class and
anything that does not depend in dumping can stay go to lower layers.

The XCode project will need to be updated after this patch.

Reviewers: zturner, jingham, clayborg

Subscribers: lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D48351

llvm-svn: 337832
2018-07-24 15:48:13 +00:00
Pavel Labath 082bab1cff Reimplement EventDataBytes::Dump to avoid DumpDataExtractor
This is the only external non-trivial dependency of the Event classes.

llvm-svn: 337819
2018-07-24 10:49:14 +00:00
Raphael Isemann 6188a42592 Added unit test for StreamTee
Reviewers: davide

Reviewed By: davide

Subscribers: davide, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D49708

llvm-svn: 337778
2018-07-24 00:01:32 +00:00
Jason Molenda b794fc78fc Change sort-pbxproj.rb to find the project.pbxproj in the
most likely locations.  And have it overwrite the original
file with the sorted output.

llvm-svn: 337774
2018-07-23 23:34:50 +00:00
Greg Clayton 247aac81ab Fix Xcode project for unit tests.
llvm-svn: 337758
2018-07-23 22:22:46 +00:00
Raphael Isemann 9df80e8248 [cmake] Remove unused ${LLDB_PLUGINS} dependency from our Objective-C++ CMake config
Summary:
LLDB_PLUGINS doesn't exist as a variable, so this line doesn't add any dependencies and is
just confusing. It seems this slipped in from the gdb-remote CMake I was using as a CMake template.

The gdb-remote CMake itself is using a local LLDB_PLUGINS variable, so that code is fine.

Reviewers: davide

Reviewed By: davide

Subscribers: davide, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D49695

llvm-svn: 337741
2018-07-23 21:14:52 +00:00
Raphael Isemann 17af5b6e20 [NFC] Minor code refactoring.
Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D49696

llvm-svn: 337737
2018-07-23 20:56:49 +00:00
Greg Clayton 2dd7e5e222 Add support for parsing Breakpad minidump files that can have extra padding in the module, thread and memory lists.
Differential Revision: https://reviews.llvm.org/D49579

llvm-svn: 337694
2018-07-23 14:16:08 +00:00
Alexander Polyakov 19150571c5 Fix windows build after r337689
Added missing header.

llvm-svn: 337692
2018-07-23 14:10:30 +00:00
Alexander Polyakov e2183d508a [lldb-mi] Re-implement data-info-line command.
Summary: Now data-info-line command uses SB API instead of HandleCommand.

Reviewers: aprantl, clayborg, jingham

Reviewed By: aprantl

Subscribers: ki.stfu, lldb-commits

Differential Revision: https://reviews.llvm.org/D49062

llvm-svn: 337689
2018-07-23 13:02:41 +00:00
Jim Ingham 40fa4a1a55 Defend LoadImageUsingPaths against a path list
with empty paths on it.

llvm-svn: 337515
2018-07-20 01:20:18 +00:00
Raphael Isemann 3914833099 Added unit tests for Flags
Reviewers: labath

Reviewed By: labath

Subscribers: labath, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D49435

llvm-svn: 337475
2018-07-19 17:45:51 +00:00
Pavel Labath a274452924 ELF: Replace the header-extension unit test with a lit one
The new test checks that we are actually able to read data from these
kinds of elf headers correctly instead of just that we read the section
number correctly. It is also easier to figure out what's going on in the
test.

llvm-svn: 337459
2018-07-19 14:38:30 +00:00
Pavel Labath 67b8f573a7 Fix whitespace formatting in DWARFExpression::DumpLocation
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
2018-07-19 13:30:56 +00:00
Stella Stamenova a633e9dbde Fix variables.test after D49018
Summary: This one fixes variables.test after D49018. The test was broken because D49018 adds a location information to variables, but I hadn't noticed that, because I used 32-bit build to run tests, so the test looked to me already broken before that commit (the test relies on mangled names, but the mangling schemes are different for 32-bit and 64-bit).

Reviewers: stella.stamenova, lldb-commits

Reviewed By: stella.stamenova

Patch By: Aleksandr Urakov

Differential Revision: https://reviews.llvm.org/D49475

llvm-svn: 337397
2018-07-18 15:50:24 +00:00
Stella Stamenova 027a9fc2c5 [windows] Use a well-known path for ComSpec if we fail to retrieve it
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
2018-07-18 15:21:54 +00:00
Stella Stamenova 0f97581af7 [lit, lldbsuite] Remove tests that are duplicated between lit and lldb-suite
Summary: Several tests exist in both lit and lldbsuite. This removes the lit version of the duplicated tests.

Reviewers: asmith, zturner

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D49450

llvm-svn: 337393
2018-07-18 15:16:54 +00:00
Jason Molenda c6ab25deef Link the lldb driver ("lldb") against the llvm static
libraries because of the new prettystackprinter dependency.

llvm-svn: 337335
2018-07-17 23:44:09 +00:00
Alex Langford 97ba3b64dd Invert dependency between lldb-framework and lldb-suite
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
2018-07-17 18:28:51 +00:00
Jonas Devlieghere 4ab5731973 [CMake] Have check-lldb-unit use CMAKE_CURRENT_BINARY_DIR
llvm-lit uses `map_config` directives (generated at configuration-time) to
make it possible to pass a test path relative to the source instead of
the build folder (CMAKE_CURRENT_BINARY_DIR).

However, this doesn't work in the case of swift where the build
directory layout prevents llvm-lit from knowing about lldb and its test
paths. This caused check-lldb-unit to fail in this configuration, while
everything was working as expected upstream. This patch fixes the issue
by passing a path relative to the build directory. This was already the
case for check-lldb-lit.

llvm-svn: 337291
2018-07-17 15:11:15 +00:00
Jonas Devlieghere 2ad6e0a696 Move pretty stack trace printer into driver.
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
2018-07-17 10:04:19 +00:00
Alex Langford 8d33a085c3 [CMake] Give lldb tools functional install targets when building LLDB.framework
Summary:
This change makes the install targets for lldb tools functional when
building for the framework.

I am currently working on the install rules for lldb-framework and this will
let me make `install-lldb-framework` rely on `install-lldb-argdumper` for
instance. This is especially important for `install-lldb-framework-stripped`. It
is much better for `install-lldb-framework-stripped` to rely on
`install-lldb-argdumper-stripped` than to copy and strip lldb-argdumper
manually.

Differential Revision: https://reviews.llvm.org/D49038

llvm-svn: 337202
2018-07-16 19:19:56 +00:00