Commit Graph

1458 Commits

Author SHA1 Message Date
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
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
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
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
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 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
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
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
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
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
Pavel Labath 7cb4dfb083 Fix TestDataFormatterUnordered for older libc++ versions
clang recently started diagnosing "exception specification in
declaration does not match previous declaration" errors. Unfortunately
old libc++ versions had a bug, where they violated this rule, which
means that tests using this library version now fail due to build
errors.

Since it was easy to work around the bug by compiling this test with
-fno-exceptions, I do that here. If supporting old libc++ versions
becomes a burden, we'll have to revisit this.

llvm-svn: 337173
2018-07-16 14:37:58 +00:00
Jim Ingham c685f6c17f Make these tests c++ tests so they can be skipped on systems that don't support those tests.
llvm-svn: 337058
2018-07-13 22:31:59 +00:00
Jim Ingham 393fe62e33 Fix the libcxx set, multiset, vector and bitset formatters to work on 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
2018-07-13 19:28:32 +00:00
Frederic Riss 8e04d937b0 Fix TestAttachDenied on macOS Mojave
TestAttachDenied tries to attach to a process that is ptracing itself and
verifies that we error out. Starting with macOS Mojave, processes need
an entitlement to be able to ptrace. This commit adds the entitlement for
the test binary when building on Darwin.

llvm-svn: 337029
2018-07-13 17:45:43 +00:00
Stella Stamenova 7b68fa7fcd [lldbsuite] The test inside TestOverloadedFunctions.py has the wrong class name
Summary: It looks like the test file was copied from TestCPPStaticMethods.py because they have the same name. This means that the two tests will try to write to the same output files and will either overwrite each other's output or occasionally cause failures because they can't both access the same file.

Reviewers: asmith, zturner

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 336960
2018-07-12 23:02:33 +00:00
Davide Italiano a9d84cb9d8 [IRInterpreter] Fix misevaluation of interpretation expressions with `urem`.
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
2018-07-12 00:31:04 +00:00
Raphael Isemann c094d23f6f Allow specifying an exit code for the 'quit' command
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
2018-07-11 17:18:01 +00:00
Davide Italiano 87951b6693 [testsuite] Implement a category to skip libstdcxx tests
On systems where it's not supported.
As far as I understand Linux is the only systems which now ships
with libstdcxx (maybe NetBSD?, but I'm not entirely sure of the
state of lldb on the platform).
We could make this more fine grained looking for the header as
we do for libcxx. This is a little tricky as there's no such
thing as /usr/include/c++/v1, but libstdcxx encodes the version
number in the path (i.e. /usr/include/c++/5.4). I guess we might
match a regex, but it seems fragile to me.

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

llvm-svn: 336724
2018-07-10 20:37:24 +00:00
Davide Italiano ec34220f5c Rollback [test-suite] Add a decorator for the lack of libstdcxx on the system.
Pavel suggested an alternative approach that I'll try to implement.

llvm-svn: 336608
2018-07-09 21:56:28 +00:00
Raphael Isemann b69854f01c Don't take the address of an xvalue when printing an expr result
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
2018-07-09 18:57:11 +00:00
Davide Italiano 975c711358 [test-suite] Add a decorator for the lack of libstdcxx on the system.
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
2018-07-06 20:40:00 +00:00
Jim Ingham a5bdba4fa5 Remove a bunch more references to _LIBCPP_INLINE_VISIBILITY
and adjust the tests that needed it to set their breakpoints more robustly.

<rdar://problem/41867390>

llvm-svn: 336403
2018-07-06 00:16:21 +00:00
Jim Ingham 9555351339 Don't muck with _LIBCPP_INLINE_VISIBILITY just to get predictable line table 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
2018-07-05 23:11:27 +00:00
Dave Lee 8ab5c2db8a Fix and simplify lldb.command decorator
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
2018-07-04 16:11:43 +00:00
Alexander Polyakov 8c670ec73f [lldb-mi] Re-implement symbol-list-lines command.
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
2018-07-03 15:40:20 +00:00
Alexander Polyakov da0c081f7e Add new API to SBTarget and SBModule classes.
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
2018-07-03 14:22:44 +00:00
Alexander Polyakov fc018b071b [lldb-mi] Re-implement a few MI commands.
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
2018-07-02 23:54:06 +00:00
Stella Stamenova 696ce3770b [lldbsuite, windows] Don't crash LLDB when we try to retrieve a register on 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
2018-07-02 21:50:31 +00:00
Pavel Labath 564a33a6e8 Fix TestLoadUsingPaths on linux
we need to explicitly link the test program with -ldl for the dlopen
function to be available.

llvm-svn: 335956
2018-06-29 09:22:07 +00:00
Jim Ingham 0d231f7161 Add a way to load an image using a library name and list of paths.
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
2018-06-28 20:02:11 +00:00
Stella Stamenova aa6c3f50e3 [lldbsuite] Fix TestBreakpointHitCount on Windows
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
2018-06-28 19:42:30 +00:00
Pavel Labath abc0c6ad09 Skip core file tests on build configurations lacking necessary components
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
2018-06-28 14:23:04 +00:00
Jonas Devlieghere 8e93917e8d [SymbolFile] Implement GetCompleteObjCClass for .debug_names
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
2018-06-27 19:58:39 +00:00
Jim Ingham d6cbdc3767 This is not a debug info sensitive test.
llvm-svn: 335688
2018-06-26 23:31:44 +00:00
Pavel Labath f104d6b224 Fix TestThreadExit for gcc&libc++ combo
pseudo_barrier_wait() begins by decrementing an atomic variable. Since
these are always_inline in libc++, there is no line table anchor to
break on before we decrement it. This meant that on gcc we stopped after
the variable has been decremented, which meant that thread2 could have
exited, violating the test setup. On clang this wasn't a problem
because it generated some line table entries for the do{}while(0) loop
in the macro, so we still ended up stopping, before we touched the
variable.

I fix this by adding a dummy statement before the pseudo_barrier_wait()
command and setting the breakpoint there.

llvm-svn: 335476
2018-06-25 14:28:38 +00:00
Jan Kratochvil 8fbb1fc229 Make testcase classnames unique
Filenames with test results contain only the class name which makes it more
difficult to find it if the same class name is present in multiple *.py files.

packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py
-class ReturnValueTestCase(TestBase):
+class StepAvoidsNoDebugTestCase(TestBase):
as ReturnValueTestCase is already present in:
packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py

packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py
-class CreateDuringStepTestCase(TestBase):
+class CrashDuringStepTestCase(TestBase):
as CreateDuringStepTestCase is already present in:
packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py

packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
-class TestCStepping(TestBase):
+class StepUntilTestCase(TestBase):
as TestCStepping is already present in:
packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py

llvm-svn: 335431
2018-06-24 10:36:44 +00:00
Adrian Prantl 56a196c020 Mark this test as no debuginfo
llvm-svn: 335386
2018-06-22 20:26:53 +00:00
Pavel Labath 733ad45b9f Android.rules: Use libc++ by default
libstdc++ will soon be dropped from the android NDK. This patch makes
sure we are prepared for that by using libc++ in tests by default (i.e.,
except for libstdc++ data formatter tests).

Only a couple of small tweaks were needed to make this work:
- Add the libc++ include paths to CXXFLAGS only. This was necessary to
  make the tests compile with -fmodules. The modules tests have been
  disabled, but this way, they will be ready for them if they are
  enabled.
- in one test I had to add an explicit std::string copy to make sure the
  copy constructor is there for the expression evaluator to find it.

llvm-svn: 335344
2018-06-22 13:13:29 +00:00
Jonas Devlieghere 702e140d68 [DataFormatter] Add CFDictionary data formatter
Add data formatter for NSCFDictionary/CFDictionaryRef.

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

llvm-svn: 335271
2018-06-21 19:13:47 +00:00
Pavel Labath 30f2e61b97 Disable gmodules tests on linux
These tests are extremely environment-dependent. if the environment is
not module-enabled (which is the likely scenario), they won't test
anything. If one happens to have a module-enabled libc++, then the he
will start running into problems.

The first one is that the debug info in pcm file contains relocations
that ObjectFileELF doesn't handle (particularly on non-x86
architectures), but even after that is resolved, it seems we still are
unable to pull debug info out of the pcm file. I've filed pr37893 to
track that, and I am disabling gmodules tests on linux until these
issues are resolved.

llvm-svn: 335235
2018-06-21 13:55:19 +00:00
Pavel Labath 0583d7a56c Make test sources compatible with android+libcxx+modules
In a modules build, android is very picky about which symbols are
visible after including libc++ headers (e.g. <cstdio> defines only
std::printf and not ::printf).

This consolidates the tests where this was an issue to always include
the <c???> version of the headers and prefixes the symbols with std:: as
necessary.

Apart from that, there is no functional change in the tests.

llvm-svn: 335149
2018-06-20 17:32:48 +00:00
Pavel Labath 13c07c62d1 Make sure TestNumThreads works with libc++
The problem was that with libc++ the std::unique_lock declaration was
completely inlined, so there was no line table entry in the main.cpp
file to set a breakpoint on. Therefore, the breakpoint got moved to the
next line, but that meant the test would deadlock as the thread would
stop with the lock already held.

I fix that issue by adding a dummy statement before the std::unique_lock
line to anchor the breakpoint.

I think this should fix the issue because of which this test was
disabled on darwin, but someone should verify that before enabling it.

llvm-svn: 335132
2018-06-20 14:54:34 +00:00