Commit Graph

17682 Commits

Author SHA1 Message Date
Vedant Kumar 6504d4390f Delete a dead Function constructor (NFC)
llvm-svn: 339206
2018-08-07 23:48:40 +00:00
Vedant Kumar 33e51b142c [StackFrame] Add more clarifying comments to StackFrameList (NFC)
llvm-svn: 339205
2018-08-07 23:48:25 +00:00
Raphael Isemann ab48bd2a8d Removed doxygen comment that doesn't fit to function signature
llvm-svn: 339204
2018-08-07 23:47:05 +00:00
Raphael Isemann 12d74b911d Removed duplicated commented-out code [NFC]
llvm-svn: 339202
2018-08-07 23:24:24 +00:00
Alexander Polyakov a320e39acd Add documentation for SBTarget::AppendImageSearchPath
llvm-svn: 339189
2018-08-07 21:41:59 +00:00
Jim Ingham 7aa4ed9b5f If a function starts with line number 0, don't try to check if a breakpoint crossed function boundaries.
clang doesn't use line number 0 (to mean artifically generated code) very often, but swift does it
quite often.  We were rejecting all by line breakpoints in functions that started at line 0.  But that's
a special marker so we can just not do this test in that case.

llvm-svn: 339182
2018-08-07 21:09:55 +00:00
Jim Ingham b303009b9f Fix the Xcode project for the Core -> Utility moves.
Scalar.{h,cpp}, RegisterValue.{h,cpp}, State.{h,cpp} were moved.

llvm-svn: 339181
2018-08-07 21:05:34 +00:00
Stella Stamenova 5fa14d971d [lit, python] Change the order of the quotes in the lit cfg file
Double quotes are always correct in paths on windows while single quotes only work sometimes. By swapping the order of the quotes in the subsitution we guarantee that the quotes will be correct on Windows. Both sets work correctly on Linux in the test environment.

llvm-svn: 339180
2018-08-07 20:58:02 +00:00
Alexander Polyakov 65bd2f6c85 [lldb-mi] Re-implement target-select command
Now target-select uses SB API instead of HandleCommand.

This patch has been reviewed along with the r339175.

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

llvm-svn: 339178
2018-08-07 20:45:46 +00:00
Alexander Polyakov 3e7b9db2d9 Add new API to SBTarget class
Summary:
The new API appends an image search path to the
target's path mapping list.

Reviewers: aprantl, clayborg, labath

Reviewed By: aprantl

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 339175
2018-08-07 20:23:57 +00:00
Leonard Mosescu 9ba51579fb Misc module/dwarf logging improvements
This change improves the logging for the lldb.module category to note a few interesting cases:

1. Local object file found, but specs not matching
2. Local object file not found, using a placeholder module

The handling and logging for the cases wehre we fail to load compressed dwarf
symbols is also improved.

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

llvm-svn: 339161
2018-08-07 18:00:30 +00:00
Alexander Polyakov 57e6dd7222 [lldb-mi] Re-implement MI HandleProcessEventStateSuspended.
Summary: Now this function uses SB API instead of HandleCommand.

Reviewers: aprantl, clayborg, labath

Reviewed By: aprantl

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 339160
2018-08-07 17:55:26 +00:00
Alex Langford 8e5e2af33b Add instructions for building LLDB on Mac OS X with CMake
Summary:
There were previously no instructions for building LLDB on Mac OS X
with CMake. It's sufficiently close to building on Linux/FreeBSD/NetBSD that a
well-motivated developer could figure out the steps themselves. However, having
an explicit guide is better and can provide Mac OS X specific configurations
(e.g. LLDB_BUILD_FRAMEWORK).

Reviewers: labath, clayborg

Subscribers: emaste, krytarowski

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

llvm-svn: 339155
2018-08-07 17:34:13 +00:00
Tatyana Krasnukha f174259ec2 Check result after setting PC value.
llvm-svn: 339153
2018-08-07 16:46:11 +00:00
Pavel Labath 87730a6391 Move ScalarTest to follow the class being tested
This should have been a part of r339127, but I missed it somehow.

llvm-svn: 339136
2018-08-07 13:10:16 +00:00
Pavel Labath 1e4b50d40b Fix a couple of extended-offsetof warnings that had slipped through
llvm-svn: 339130
2018-08-07 12:16:49 +00:00
Pavel Labath d821c997aa Move RegisterValue,Scalar,State from Core to Utility
These three classes have no external dependencies, but they are used
from various low-level APIs. Moving them down to Utility improves
overall code layering (although it still does not break any particular
dependency completely).

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

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

llvm-svn: 339127
2018-08-07 11:07:21 +00:00
Stella Stamenova f0db95499b [lit, python] Always add quotes around the python path in lit
Summary:
The issue with the python path is that the path to python on Windows can contain spaces. To make the tests always work, the path to python needs to be surrounded by quotes.

This is a companion change to: https://reviews.llvm.org/D50206

Reviewers: asmith, zturner

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

llvm-svn: 339076
2018-08-06 22:37:53 +00:00
Stephane Sezer 0c679b7108 Revert "Add a relocation for R_AARCH64_ABS32 in ObjectFileELF"
This reverts commit f055ce7eb893cd0d17ebcfd4125018f46f983aff.

llvm-svn: 339071
2018-08-06 22:21:28 +00:00
Stephane Sezer b015ca6f52 Add a relocation for R_AARCH64_ABS32 in ObjectFileELF
Summary:
.rela.debug_info relocations are being done via
ObjectFileELF::ApplyRelocations for aarch64. Currently, the switch case
that iterates over the relocation type is only implemented for a few
different types and `assert(false)`es over the rest.

Implement the relocation for R_AARCH64_ABS32 in ApplyRelocations

Reviewers: sas, xiaobai, peter.smith, clayborg, javed.absar, espindola

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

Change by Nathan Lanza <lanza@fb.com>

llvm-svn: 339068
2018-08-06 22:04:08 +00:00
Vedant Kumar 9452359887 [IRMemoryMap] Avoid redundant zero-init in the Allocation constructor (NFC)
In the lldb-bench/arithmetic benchmark, 1.7% of the total running time
is spent zero-initializing a std::vector that has already been zeroed.

llvm-svn: 339051
2018-08-06 20:13:52 +00:00
Greg Clayton 1508dd8b86 Fix more offsetof issues.
llvm-svn: 339034
2018-08-06 17:26:53 +00:00
Greg Clayton d6836209a7 Fix offsetof usage that got lost when passing patches between linux and mac.
llvm-svn: 339033
2018-08-06 17:07:50 +00:00
Greg Clayton 19c8f394bc Add support for ARM and ARM64 breakpad generated minidump files (version 2).
In this patch I add support for ARM and ARM64 break pad files. There are two flavors of ARM: Apple where FP is R7, and non Apple where FP is R11. Added minimal tests that load up ARM64 and the two flavors or ARM core files with a single thread and known register values in each register. Each register is checked for the exact value.

This is a fixed version of: https://reviews.llvm.org/D49750

The changes from D49750 are:

Don't init the m_arch in the Initialize call as a system info isn't required. This keeps the thread list, module list and other tests from failing
Added -Wextended-offsetof to Xcode project so we catch use extended usages of offsetof before submission
Fixed any extended offset of warnings

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

llvm-svn: 339032
2018-08-06 16:56:10 +00:00
Stefan Granitz c238ca24b0 Fix Mangled::Compare()
llvm-svn: 339015
2018-08-06 14:15:21 +00:00
Stefan Granitz 4af5a83a48 Add ConstString::IsNull() to tell between null vs. empty strings and fix usage in Mangled::GetDemangledName()
Summary: `IsEmpty()` and `operator bool() == false` have equal semantics. Usage in Mangled::GetDemangledName() was incorrect. What it actually wants is a check for null-string. Split this off of D50071 and added a test to clarify usage.

Reviewers: labath, jingham

Subscribers: erik.pilkington, lldb-commits

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

llvm-svn: 339014
2018-08-06 14:15:17 +00:00
Pavel Labath 19a357adf8 Change ConstString::SetCStringWithMangledCounterpart to use StringRef
This should simplify the upcoming demangling patch (D50071). While I was
in there, I also added a quick test for the function.

llvm-svn: 338995
2018-08-06 08:27:59 +00:00
Raphael Isemann 7022b5369d Remove duplicated code in CommandObjectQuit
Summary:
We already have the same check directly before, so this code can never be
reached (as seen in the test coverage).

Subscribers: lldb-commits

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

llvm-svn: 338976
2018-08-06 00:04:51 +00:00
Raphael Isemann 13ff0d8d58 Added unit test for StringList
Reviewers: labath

Reviewed By: labath

Subscribers: mgorny, lldb-commits

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

llvm-svn: 338961
2018-08-04 17:28:21 +00:00
Raphael Isemann 5b9c465d7e Fixed header of StringLexer.h
llvm-svn: 338952
2018-08-04 05:53:07 +00:00
Leonard Mosescu 3da16f8393 Fix a bug in VMRange
I noticed a suspicious failure:

[ RUN ] VMRange.CollectionContains
llvm/src/tools/lldb/unittests/Utility/VMRangeTest.cpp:146: Failure
Value of: VMRange::ContainsRange(collection, VMRange(0x100, 0x104))

Actual: false
Expected: true

Looking at the code, it is a very real bug:

class RangeInRangeUnaryPredicate {
public:
  RangeInRangeUnaryPredicate(VMRange range) : _range(range) {} // note that _range binds to a temporary!
  bool operator()(const VMRange &range) const {
    return range.Contains(_range);
  }
  const VMRange &_range;
};

This change fixes the bug.

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

llvm-svn: 338949
2018-08-04 02:15:26 +00:00
Alex Langford 72cb10c364 Modify lldb_suite.py to enable python debugging
Summary:
pudb and pdb interfere with the behavior of the inspect module. calling
`inspect.getfile(inspect.currentframe())` returns a different result
depending on whether or not you're in a debugger. Calling
`os.path.abspath` on the result of `inspect.getfile(...)` normalizes the
result between the two environments.

Patch by Nathan Lanza <lanza@fb.com>

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

llvm-svn: 338923
2018-08-03 21:37:01 +00:00
Raphael Isemann 79e9921ce2 Replace LLDB's LEB128 implementation with the one from LLVM
Reviewers: davide, labath

Reviewed By: labath

Subscribers: lldb-commits

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

llvm-svn: 338920
2018-08-03 20:51:31 +00:00
Raphael Isemann 286ac07199 Add raw_ostream wrapper to the Stream class
Summary:
This wrapper will allow us in the future to reuse LLVM methods from within the
Stream class.

Currently no test as this is intended to be an internal class that shouldn't have any
NFC. The test for this change will be the follow up patch that migrates LLDB's
LEB128 implementation to the one from LLVM.

This change also adds custom move/assignment methods to Stream, as LLVM
raw_ostream doesn't support these. As our internal stream has anyway no state,
we can just keep the same stream object around.

Reviewers: davide, labath

Reviewed By: labath

Subscribers: xiaobai, labath, lldb-commits

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

llvm-svn: 338901
2018-08-03 16:56:33 +00:00
Pavel Labath 659cee52fc Revert "Add support for ARM and ARM64 breakpad generated minidump files"
This reverts commit r338734 (and subsequent fixups in r338772 and
r338746), because it breaks some minidump unit tests and introduces a
lot of compiler warnings.

llvm-svn: 338828
2018-08-03 08:47:22 +00:00
David L. Jones f0a57378aa [lldb] Remove unused variable.
The use of this variable was removed in r338734. It now causes unused variable warnings.

llvm-svn: 338772
2018-08-02 21:45:05 +00:00
Stella Stamenova 0faca0f09f [lldbsuite, windows] Mark tests as XFAIL on Windows or skip them
Summary:
1) Several tests that are flakey on windows fail the run even if they are marked as expected to be flakey. This is because they fail frequently enough that even a retry won't help
2) Skip several tests on Windows that will occasionally hang rather than failing or exiting. This is causing the entire test suite to hang

Reviewers: asmith, labath, zturner

Reviewed By: zturner

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

llvm-svn: 338769
2018-08-02 21:26:19 +00:00
Zachary Turner af3367d2ff Fix CMake build.
Some new files were committed to the repository but not added
to the CMakeLists.txt, so this patch fixes the build.

llvm-svn: 338746
2018-08-02 17:44:41 +00:00
Greg Clayton 2d953f22a0 Add support for ARM and ARM64 breakpad generated minidump files
In this patch I add support for ARM and ARM64 break pad files. There are two flavors of ARM: Apple where FP is R7, and non Apple where FP is R11. Added minimal tests that load up ARM64 and the two flavors or ARM core files with a single thread and known register values in each register. Each register is checked for the exact value.

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

llvm-svn: 338734
2018-08-02 16:46:15 +00:00
Raphael Isemann 92b16738a1 Add byte counting mechanism to LLDB's Stream class.
Summary:
This patch allows LLDB's Stream class to count the bytes it has written to so far.

There are two major motivations for this patch:

The first one is that this will allow us to get rid of all the handwritten byte counting code
we have in LLDB so far. Examples for this are pretty much all functions in LLDB that
take a Stream to write to and return a size_t, which usually represents the bytes written.

By moving to this centralized byte counting mechanism, we hopefully can avoid some
tricky errors that happen when some code forgets to count the written bytes while
writing something to a stream.

The second motivation is that this is needed for the migration away from LLDB's `Stream`
and towards LLVM's `raw_ostream`. My current plan is to start offering a fake raw_ostream
class that just forwards to a LLDB Stream.

However, for this raw_ostream wrapper we need to fulfill the raw_ostream interface with
LLDB's Stream, which currently lacks the ability to count the bytes written so far (which
raw_ostream exposes by it's `tell()` method). By adding this functionality it is trivial to start
rolling out our raw_ostream wrapper (and then eventually completely move to raw_ostream).

Also, once this fake raw_ostream is available, we can start replacing our own code writing
to LLDB's Stream by LLVM code writing to raw_ostream. The best example for this is the
LEB128 encoding we currently ship, which can be replaced with by LLVM's version which
accepts an raw_ostream.

From the point of view of the pure source changes this test does, we essentially just renamed
the Write implementation in Stream to `WriteImpl` while the `Write` method everyone is using
to write its raw bytes is now just forwarding and counting the written bytes.

Reviewers: labath, davide

Reviewed By: labath

Subscribers: JDevlieghere, lldb-commits

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

llvm-svn: 338733
2018-08-02 16:38:34 +00:00
Tim Northover ccb06e720d Move ClangHighlighter.cpp to hopefully better place in Xcode project.
But with a write-only format, who can really say?

llvm-svn: 338712
2018-08-02 12:50:23 +00:00
Stefan Granitz 149fede165 Unit test for Symtab::InitNameIndexes
Summary: In order to exploit the potential of LLVM's new ItaniumPartialDemangler for indexing in LLDB, we expect conceptual changes in the implementation of the InitNameIndexes function. Here is a unit test that aims at covering all relevant code paths in that function.

Reviewers: labath, jingham, JDevlieghere

Reviewed By: JDevlieghere

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

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

llvm-svn: 338695
2018-08-02 10:13:18 +00:00
Raphael Isemann 0d7e7166b8 Added missing highlighter files to XCode project
llvm-svn: 338669
2018-08-02 03:01:09 +00:00
Raphael Isemann 566afa0ab2 [LLDB] Added syntax highlighting support
Summary:
This patch adds syntax highlighting support to LLDB. When enabled (and lldb is allowed
to use colors), printed source code is annotated with the ANSI color escape sequences.

So far we have only one highlighter which is based on Clang and is responsible for all
languages that are supported by Clang. It essentially just runs the raw lexer over the input
and then surrounds the specific tokens with the configured escape sequences.

Reviewers: zturner, davide

Reviewed By: davide

Subscribers: labath, teemperor, llvm-commits, mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 338662
2018-08-02 00:30:15 +00:00
Raphael Isemann 8fa58b1d17 Remove unnecessary target from TestCompletion patch
As Jim pointed out, we don't need to manually create a target
here because we already create a target implicitly in the very
next line (which means we just created a target and don't use it).

This patch just removes the line that creates the first unused target.

llvm-svn: 338657
2018-08-01 23:54:37 +00:00
Davide Italiano 6699fc34dd [DWARFASTParser] Remove special cases for `llvm-gcc`
Reviewed by: aprantl, labath.

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

llvm-svn: 338638
2018-08-01 21:13:45 +00:00
Raphael Isemann f4590de992 Fix out-of-bounds read in Stream::PutCStringAsRawHex8
Summary:
When I added the Stream unit test (r338488), the build bots failed due to an out-of-
bound reads when passing an empty string to the PutCStringAsRawHex8 method.
In r338491 I removed the test case to fix the bots.

This patch fixes this in PutCStringAsRawHex8 by always checking for the terminating
null character in the given string (instead of skipping it the first time). It also re-adds the
test case I removed.

Reviewers: vsk

Reviewed By: vsk

Subscribers: vsk, lldb-commits

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

llvm-svn: 338637
2018-08-01 21:07:18 +00:00
Raphael Isemann 95d8c464d8 Fixed documentation for PutHex8 [NFC]
The previous documentation was just copied from PrintfAsRawHex8
but doesn't actually fit to the PutHex8 method.

llvm-svn: 338611
2018-08-01 18:38:19 +00:00
Raphael Isemann a4c88c8484 Remove outdated documentation for Stream's LEB128 methods
There is no format parameter for any of these methods.

llvm-svn: 338605
2018-08-01 18:28:54 +00:00
Alex Langford 36706fd977 Introduce install-lldb-framework target
Summary:
Previously, I thought that install-liblldb would fail because CMake had
a bug related to installing frameworks. In actuality, I misunderstood the
semantics of `add_custom_target`: the DEPENDS option refers to specific files,
not targets. Therefore `install-liblldb` should rely on the actual liblldb
getting generated rather than the target.

This means that the previous patch I committed (to stop relying on CMake's
framework support) is no longer needed and has been reverted. Using CMake's
framework support greatly simplifies the implementation.

`install-lldb-framework` (and the stripped variant) is as simple as
depending on `install-liblldb` because CMake knows that liblldb was built as a
framework and will install the whole framework for you. The stripped variant
will depend on the stripped variants of individual tools only to ensure they
actually are stripped as well.

Reviewers: labath, sas

Subscribers: mgorny, lldb-commits

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

llvm-svn: 338594
2018-08-01 17:21:18 +00:00