Commit Graph

17849 Commits

Author SHA1 Message Date
Davide Italiano a64157f19f [IRInterpreter] Minor cleanups, add comments. NFCI.
llvm-svn: 342280
2018-09-14 20:48:34 +00:00
Alex Langford fde4cda9f7 Fix lldb-vscode README.md
Summary: The readme was missing "-" characters to enable links

Patch by Nathan Lanza <nathan@lanza.io>

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

llvm-svn: 342266
2018-09-14 19:41:20 +00:00
Davide Italiano 5f6789ef6e [IRInterpreter] Fall back to JIT with 128-bit values.
They're not that common, and falling back is definitely
better than throwing an error instead of the result. If we
feel motivated, we might end up implementing support for these,
but it's unclear whether it's worth the effort/complexity.

Fixes PR38925.

<rdar://problem/44436068>

llvm-svn: 342262
2018-09-14 18:55:31 +00:00
Jim Ingham 19a5f6202c Make the eSearchDepthFunction searches work, add tests
using the scripted breakpoint resolver.

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

llvm-svn: 342259
2018-09-14 18:41:40 +00:00
Aleksandr Urakov 2fa5c28339 [PDB] Use the raw PDB symbol interface more accurately
Summary:
This patch adds some symbol tag checks before using the `IPDBRawSymbol`
interface to improve safety and readability.

Reviewers: zturner

Reviewed By: zturner

Subscribers: lldb-commits, stella.stamenova

Tags: #lldb

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

llvm-svn: 342208
2018-09-14 07:46:06 +00:00
Jim Ingham e19adf5470 svn add the new files...
I started from a clean slate to do the checkin, but forgot to svn add the new files.
Do that now.

Also add the one new source file to CMakeLists.txt

llvm-svn: 342190
2018-09-13 21:59:16 +00:00
Jim Ingham 2e9470402d Remember to sort the Xcode project file. NFC.
llvm-svn: 342188
2018-09-13 21:55:00 +00:00
Jim Ingham 3815e702e7 Add a "scripted" breakpoint type to lldb.
This change allows you to write a new breakpoint type where the
logic for setting breakpoints is determined by a Python callback
written using the SB API's.

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

llvm-svn: 342185
2018-09-13 21:35:32 +00:00
Raphael Isemann 7f88829cea Add support for descriptions with command completions.
Summary:
This patch adds a framework for adding descriptions to the command completions we provide.
It also adds descriptions for completed top-level commands so that we can test this code.

Completions are in general supposed to be displayed alongside the completion itself. The descriptions
can be used to provide additional information about the completion to the user. Examples for descriptions
are function signatures when completing function calls in the expression command or the binary name
when providing completion for a symbol.

There is still some boilerplate code from the old completion API left in LLDB (mostly because the respective
APIs are reused for non-completion related purposes, so the CompletionRequest doesn't make sense to be
used), so that's why I still had to change some function signatures. Also, as the old API only passes around a
list of matches, and the descriptions are for these functions just another list, I had to add some code that
essentially just ensures that both lists are always the same side (e.g. all the manual calls to
`descriptions->AddString(X)` below a `matches->AddString(Y)` call).

The initial command descriptions that come with this patch are just reusing the existing
short help that is already added in LLDB.

An example completion with descriptions looks like this:
```
(lldb) pl
Available completions:
        platform -- Commands to manage and create platforms.
        plugin   -- Commands for managing LLDB plugins.
```

Reviewers: #lldb, jingham

Reviewed By: #lldb, jingham

Subscribers: jingham, JDevlieghere, lldb-commits

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

llvm-svn: 342181
2018-09-13 21:26:00 +00:00
Pavel Labath 2ce2652716 NativeProcessProtocol: Sink ReadMemoryWithoutTrap into base class
The two existing implementations have the function implemented
identically, and there's no reason to believe that this would be
different for other implementations.

llvm-svn: 342167
2018-09-13 20:17:40 +00:00
George Rimar c6c7bfc4d2 [LLDB] - Improved DWARF5 support.
This patch improves the support of DWARF5.
Particularly the reporting of source code locations.

Differential revision: https://reviews.llvm.org/D51935

llvm-svn: 342153
2018-09-13 17:06:47 +00:00
Jonas Devlieghere bf2d112c15 [DWARFExpression] Read literars as unsigned values.
After landing r341457, we started seeing a failure on the swift-lldb
bots. The change was correct and pretty straightforward, a DW_OP_constu
was replaced with DW_OP_lit23, the value remaining identical.

  0x000000f4: DW_TAG_variable
		DW_AT_location    (0x00000000
		  [0x0000000100000a51,  0x0000000100000d47): DW_OP_lit23, DW_OP_stack_value)
		DW_AT_name        ("number")

However, this broke LLDB.

  (Int) number = <extracting data from value failed>

The value was read correctly, but apparently the value's type was different.
When reading a constu it was reading a uint64 (m_type = e_ulonglong) while for
the literal, it got a signed int (m_type = e_sint). This change makes sure we
read the value as an unsigned.

Differential revision: https://reviews.llvm.org/D51730

llvm-svn: 342142
2018-09-13 15:18:39 +00:00
Raphael Isemann 7e9649b86f Remove byte counting from SourceManager [NFC]
Summary:
Similar to what we did in D50681, we now stop manually byte counting here
in the SourceManager.

Reviewers: #lldb, JDevlieghere

Reviewed By: #lldb, JDevlieghere

Subscribers: JDevlieghere, abidh, lldb-commits

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

llvm-svn: 342121
2018-09-13 09:19:40 +00:00
Jason Molenda 9d0f9ced40 Commit my attempt to test the change to ProcessGDBRemote
in r336956.  This test doesn't actually test the change
that was submitted by Venkata, but it's a good one to
add.

llvm-svn: 342085
2018-09-12 21:35:02 +00:00
David Bolvansky d75a8fff7f Do not create new terminals when launching process on Windows with --no-stdio
Summary: Partially fixes PR38222

Reviewers: teemperor, zturner, stella.stamenova

Reviewed By: zturner, stella.stamenova

Subscribers: JDevlieghere, clayborg, labath, abidh, lldb-commits

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

llvm-svn: 342075
2018-09-12 19:50:45 +00:00
Jason Molenda 956ff0f8bf If we fail to get an armv7em-- disassembler from llvm, skip the
tests and don't mark this as a failure.  This happens when we've
linked against an llvm without the ARM target built in.  Davide
added some cmake conditionals to avoid building this test when the
target was absent from llvm's build, but we're still finding some
bots that manage to get in this situation.

<rdar://problem/44270082> 

llvm-svn: 342072
2018-09-12 19:30:03 +00:00
Alex Langford aad4027dc3 Add compatibility version to liblldb in framework builds
Summary:
Building LLDB with xcodebuild sets the compatibility version of liblldb
in LLDB.framework. Building the framework with cmake does not set the
compatibility version, and so it defaults to 0.0.0. This is a discrepency in the
difference between the xcode build and the cmake build.

I tested this change by building without this patch. From the build tree I ran
`otool -L Library/Frameworks/LLDB.framework/Versions/A/LLDB` and got this:
```
@rpath/LLDB.framework/Versions/A/LLDB (compatibility version 0.0.0, current version 8.0.0)
```

Did the same with this patch and the output contained this:
```
@rpath/LLDB.framework/Versions/A/LLDB (compatibility version 1.0.0, current version 8.0.0)
```

Reviewers: clayborg, labath

Subscribers: mgorny, lldb-commits

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

llvm-svn: 342066
2018-09-12 18:10:22 +00:00
Pavel Labath d9a58f5af1 Fix two issues in PDBASTParser
- gcc warning about using binary or for or-ing two comparisons (a == b | a == c)
- llvm style prefers static functions to functions in an anonymous namespace

llvm-svn: 342051
2018-09-12 12:26:11 +00:00
Pavel Labath 7704473172 Move SafeMachO from Utility to Host
Summary:
One of the conclusions of the discussion on D49740 was that SafeMachO is better
off in the Host module (as that's the only place which should include
mach/machine.h, which is what this header is working around). Also, Utility,
which is the only module which cannot include Host, should not be doing
anything with object file formats.

This patch implements that move, and also removes any unneded includes of that
file.

I've verified that MacOS still compiles after this.

Reviewers: jingham, zturner, teemperor

Subscribers: fedor.sergeev, lldb-commits

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

llvm-svn: 342050
2018-09-12 12:26:05 +00:00
Benjamin Kramer 88e18a6201 Remove another unused mislayered include.
llvm-svn: 342047
2018-09-12 11:31:18 +00:00
Benjamin Kramer 197f241614 Remove unused include that's also a layering violation.
llvm-svn: 342046
2018-09-12 11:27:10 +00:00
Raphael Isemann cad7a46a23 Remove manual byte counting from internal Stream methods.
Summary:
This patch removes the manual byte counting in all internal Stream methods.
This is now done by the automatic byte counting provided by calling `GetWrittenBytes()`
before and after writing the data (which is automatically done for us by the `ByteDelta`
utility class).

Reviewers: #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, labath, lldb-commits

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

llvm-svn: 342044
2018-09-12 10:20:41 +00:00
Raphael Isemann 10fb677285 Add a basic test for 'memory region'
Summary:
The 'memory region' command is at the moment not tested at all by our test suite.
This patch just adds a basic test that at least provides some basic testing.

Reviewers: #lldb, davide

Reviewed By: #lldb, davide

Subscribers: vsk, davide, lldb-commits

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

llvm-svn: 342042
2018-09-12 10:04:25 +00:00
Pavel Labath c9463097d9 Reduce alignment on struct XSAVE, fixing a gcc warning
The warning is about heap-allocating a struct with bigger alignment
requirements than the standard heap allocator provides.

AFAICT, all uses of the XSAVE struct are already heap-allocated, so this
high alignment does not actually have any effect and removing it should
be NFC.

I have also done some digging in the commit history. This alignment
requirement was since the XSAVE struct was introduced in r180572 when
adding AVX register support for linux. It does not mention the alignment
specifically, so I am guessing this was just put there because the
corresponging XSAVE cpu instruction requires its buffer to be 64-byte
aligned. However, LLDB will not be normally reading this struct via the
XSAVE instruction directly. Instead we will ask the kernel to copy the
buffer saved when suspeding the inferior. This should not require such
strict alignment (in fact, linux kernel will happily do this for any
alignment).

llvm-svn: 342029
2018-09-12 08:50:08 +00:00
Vedant Kumar a4529b00e4 [MIPS] Fix signed overflow in DADDIU emulation
This fixes a signed integer overflow diagnostic reported by ubsan.

rdar://44353380

llvm-svn: 342008
2018-09-11 23:04:05 +00:00
Shafik Yaghmour 443e20ba32 Refactoring std::function formatter to move core functionality into CPPLanguageRuntime
Patch by Shafik Yaghmour.

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

llvm-svn: 341991
2018-09-11 20:58:28 +00:00
Shafik Yaghmour e2da5c525e Remove undefined behavior around the use of StateType
rdar://problem/43530233

Patch by Shafik Yaghmour.

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

llvm-svn: 341957
2018-09-11 16:08:05 +00:00
Aleksandr Urakov 35725c9894 [PDB] Fix problems after rL341782
Summary:
This commit fixes following problems after rL341782:
- Broken SymbolFilePDBTests
- Warning on comparison of integers of different signs

Tags: #lldb

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

llvm-svn: 341942
2018-09-11 14:03:12 +00:00
Raphael Isemann 262dd8c9df Print the correct error when our DynamicCheckerFunctions fail to install
Summary:
The check is inverted here: If we have error messages, we should print those instead
of our default error message. But currently we print the default message when we
actually have a sensible error to print.

Fixes https://bugs.llvm.org/show_bug.cgi?id=38383
Thanks Nat for the patch!

Reviewers: #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, lldb-commits

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

llvm-svn: 341940
2018-09-11 13:59:47 +00:00
Raphael Isemann b658f1df35 [NFC] Fix compiler warning in TestArmv7Disassembly.cpp
The warning is
    comparison of integers of different signs: 'const int' and 'const unsigned long'
and triggered by
    EXPECT_EQ (num_of_instructions, inst_list.GetSize());
as num_of_instructions is an int in this comparison (and the RHS is size_t).

llvm-svn: 341931
2018-09-11 12:45:22 +00:00
Shafik Yaghmour f4babefdf1 Undoing first commit which added a space to a comment
llvm-svn: 341881
2018-09-10 23:18:32 +00:00
Shafik Yaghmour 3875643928 First test commit into svn, adding space to comment
llvm-svn: 341879
2018-09-10 23:12:29 +00:00
Davide Italiano ae3f793e9e Rollback "Fix raw address breakpoints not resolving".
It broke a bunch of bots. Ted confirmed, but can't revert for
now so I'm reverting on his behalf.

llvm-svn: 341878
2018-09-10 23:09:09 +00:00
Ted Woodward 860bafa07d Fix raw address breakpoints not resolving
Summary: An address breakpoint of the form "b 0x1000" won't resolve if it's created while the process isn't running. This patch deletes Address::SectionWasDeleted, renames Address::SectionWasDeletedPrivate to SectionWasDeleted (and makes it public), and changes the section check in Breakpoint::ModulesChanged back to its original form

Reviewers: jingham, #lldb

Reviewed By: jingham

Subscribers: davide, lldb-commits

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

llvm-svn: 341849
2018-09-10 18:19:01 +00:00
Aleksandr Urakov 709426b33a [PDB] Restore AST from PDB symbols
Summary:
This patch adds an implementation of retrieving of declarations and declaration
contexts based on PDB symbols.

PDB has different type symbols for const-qualified types, and this
implementation ensures that only one declaration was created for both const
and non-const types, but creates different compiler types for them.

The implementation also processes the case when there are two symbols
corresponding to a variable. It's possible e.g. for class static variables,
they has one global symbol and one symbol belonging to a class.

PDB has no info about namespaces, so this implementation parses the full symbol
name and tries to figure out if the symbol belongs to namespace or not,
and then creates nested namespaces if necessary.

Reviewers: asmith, zturner, labath

Reviewed By: asmith

Subscribers: aleksandr.urakov, teemperor, lldb-commits, stella.stamenova

Tags: #lldb

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

llvm-svn: 341782
2018-09-10 08:08:43 +00:00
Pavel Labath 4f5450742e Speculative fix for NetBSD bot for r341758
llvm-svn: 341759
2018-09-09 08:42:00 +00:00
Pavel Labath f8b825f689 Re-commit "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"
This recommits r341487, which was reverted due to failing tests with
clang. It turned out I had incorrectly expected that the literal arrays
passed to ArrayRef constructor will have static (permanent) storage.
This was only the case with gcc, while clang was constructing them on
stack, leading to dangling pointers when the function returns.

The fix is to explicitly assign static storage duration to the opcode
arrays.

llvm-svn: 341758
2018-09-09 06:01:12 +00:00
Pavel Labath 12286a2739 Revert "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"
This reverts commit r341487. Jan Kratochvil reports it breaks LLDB when
compiling with clang.

llvm-svn: 341747
2018-09-08 10:33:14 +00:00
David Bolvansky 85dacd1116 Check if a terminal supports colors on Windows properly
Summary:
Previously we SetUseColor(true) wrongly when output was not a terminal so it broken some (not public) bots.

Thanks for issue report, @stella.stamenova

Reviewers: stella.stamenova, zturner

Reviewed By: stella.stamenova

Subscribers: abidh, lldb-commits, stella.stamenova

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

llvm-svn: 341746
2018-09-08 07:15:56 +00:00
Davide Italiano fc89d18bb1 [XCodeproj] Remove extra whitespace in SBAPI path.
llvm-svn: 341732
2018-09-07 23:49:05 +00:00
Davide Italiano 6af9fe07b9 [Disassembler] Run ARM-specific tests only if the ARM backend is built.
<rdar://problem/44239070>

llvm-svn: 341714
2018-09-07 21:36:21 +00:00
Jason Molenda 25a1525e7e Add the Disassembler unit test dir.
llvm-svn: 341696
2018-09-07 18:51:10 +00:00
Jim Ingham 4911d36aa6 NFC: Move Searcher::Depth into lldb-enumerations as SearchDepth.
In a subsequent commit, I will need to expose the search depth
to the SB API's, so I'm moving this define into lldb-enumerations
where it will get added to the lldb module.

llvm-svn: 341690
2018-09-07 18:43:04 +00:00
Davide Italiano f06ffeee21 [Scalar] Commit the correct patch, forgot `git add`.
<rdar://problem/44229924>

llvm-svn: 341685
2018-09-07 18:22:27 +00:00
Jim Ingham effe60fdbd Add input files to the "prepare swig bindings" step.
This build phase had no inputs, so you always had to manually
delete LLDBWrapPython.cpp to get it to rebuild.  Add the correct
inputs.

llvm-svn: 341683
2018-09-07 18:10:26 +00:00
Davide Italiano 5ccc9df843 [Scalar] Fix undefined behaviour when converting double to long.
This showed up in an Ubsan build of lldb (inside the CFAbsoluteTime
data formatter). As we only care about the bit pattern, we just
round to the nearest double, and truncate to a size that fits
in ulonglong_t.

<rdar://problem/44229924>

llvm-svn: 341682
2018-09-07 18:03:43 +00:00
Alexander Polyakov 469304e8fb [ARC] Make char unsigned by default
Summary: This patch specifies 'char' default sign on ARC.

Reviewers: tatyana-krasnukha, clayborg

Reviewed By: tatyana-krasnukha, clayborg

Subscribers: clayborg, lldb-commits

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

llvm-svn: 341667
2018-09-07 14:45:32 +00:00
Jason Molenda 0dfb84ce9b Enable the fp-armv8 disassembler feature when disassembling Cortex-M
code.  This will enable disassembly of the optional subset of
neon that some Cortex cores support.  Add a unit test to check
that a few of these instructions disassemble as expected.

<rdar://problem/26674303> 

llvm-svn: 341623
2018-09-07 01:28:48 +00:00
Raphael Isemann ee65d57321 Reland [ClangUserExpression][NFC] Removed unused code
The GetLanguageForExpr has side effects, so we can't remove this
call without breaking the completion mechanism. However, we can
keep the change that gets rid of this unnecessary variable.

llvm-svn: 341535
2018-09-06 10:24:11 +00:00
Raphael Isemann 20c88ebf57 Revert "[ClangUserExpression][NFC] Removed unused code"
GetLanguageForExpr has side effects, so this actually breaks
the completion. Should fix TestExprCompletion.

llvm-svn: 341532
2018-09-06 09:42:44 +00:00