Commit Graph

4314 Commits

Author SHA1 Message Date
Eric Christopher 10b4354136 Temporarily Revert "[lldb][NFC] Add more test for builtin formats"
as it's failing on the debian buildbots:

http://lab.llvm.org:8011/builders/lldb-x86_64-debian/builds/12531

This reverts commit 90c1af106a.
2020-06-20 14:21:42 -07:00
Raphael Isemann 90c1af106a [lldb][NFC] Add more test for builtin formats
The previous tests apparently missed a few code branches in DumpDataExtractor
code. Also renames the 'test_instruction' which had the same name as another
test (and Python therefore ignored the test entirely).
2020-06-20 19:31:40 +02:00
Raphael Isemann ab888262b3 [lldb] Skip TestBuiltinFormats.py on arm for now 2020-06-20 11:22:44 +02:00
Jonas Devlieghere 8027f04a6d [lldb/Test] Disable TestBuiltinFormats.py on Windows
Disable the test to turn the Windows bot green again until Raphael has
time to investigate.
2020-06-19 22:41:29 -07:00
Jonas Devlieghere 7a9a341953 [lldb/Test] Temporarily skip watch simulator in TestSimulatorPlatform.py
The simulator doesn't launch on green-dragon-10.

rdar://problem/64552748
2020-06-19 22:41:29 -07:00
Raphael Isemann aa7cd42993 [lldb][NFC] Add test for builtin formats 2020-06-19 22:33:02 +02:00
Raphael Isemann be18df3d23 [lldb] Fix that SIGWINCH crashes IOHandlerEditline when we are not using the editline backend
Summary:
TerminalSizeChanged is called from our SIGWINCH signal handler but the
IOHandlerEditline currently doesn't check if we are actually using the real
editline backend. If we're not using the real editline backend, `m_editline_up`
won't be set and `IOHandlerEditline::TerminalSizeChanged` will access
the empty unique_ptr. In a real use case we don't use the editline backend
when we for example read input from a file. We also create some temporary
IOHandlerEditline's during LLDB startup it seems that are also treated
as non-interactive (apparently to read startup commands).

This patch just adds a nullptr check for`m_editline_up` as we do in the rest of
IOHandlerEditline.

Fixes rdar://problem/63921950

Reviewers: labath, friss

Reviewed By: friss

Subscribers: abidh, JDevlieghere

Differential Revision: https://reviews.llvm.org/D81729
2020-06-19 19:14:16 +02:00
Adrian Prantl 7e825abd57 Repair support for launching ios/tv/watch simulator binaries through platform
and delete a bunch (but not all) redundant code. If you compare the remaining implementations of Platform*Simulator.cpp, there is still an obvious leftover cleanup task.

Specifically, this patch

- removes SDK initialization from dotest (there is equivalent but more
  complete code in Makefile.rules)

- make Platform*Simulator inherit the generic implementation of
  PlatformAppleSimulator (more can be done here)

- simplify the platform logic in Makefile.rules

- replace the custom SDK finding logic in Platform*Simulator with XcodeSDK

- adds a test for each supported simulator

Differential Revision: https://reviews.llvm.org/D81980
2020-06-19 09:42:44 -07:00
Raphael Isemann 6331c7d0be [lldb] Disable complex tests on Windows
The tests fail to compile there:
```
complex/main.c:4:16: error: expected ';' at end of declaration
  float complex complex_float = -1.5f + -2.5f * I;
               ^
               ;
```
2020-06-19 18:40:08 +02:00
Raphael Isemann 85e7e3b1c9 [lldb] Fix TestComplexInt on ARM
On the buildbot long and int have the same size but long and long long don't,
so the bug where we find the first type by size will produce a different error.
Make the test dynamic based on int/long/long long size to fix the bot.
2020-06-19 17:47:16 +02:00
Raphael Isemann 3e66bd291f [lldb][NFC] Add test for C99 and GCC complex types
LLDB has a lot of code for supporting complex types but we don't have a single
test for it. This adds some basic tests and documents the found bugs.
2020-06-19 16:22:16 +02:00
Jonas Devlieghere 64c87a94ca [lldb/Test] Fix tests that rely on logfiles with reproducers.
Now that the log file is included in the reproducers, the path needs to
be remapped for the test to find the new file in the reproducer.
2020-06-17 10:09:06 -07:00
Muhammad Omair Javaid e29b31513f [lldb] Remove xfail aarch64/linux from TestBuiltinTrap.py
The underlying clang bug seems to have been fixed in and test is
consistently passing on aarch64-linux buildbot.
2020-06-17 15:48:59 +05:00
Jonas Devlieghere c151230533 [lldb/Test] Cleanup TestJITLoaderGDB and make it compatible with reproducers 2020-06-16 15:46:14 -07:00
Jonas Devlieghere c0f1dcf31e [lldb/Test] Pass the lldb_tool_dir when setting the lldb-repro substitutions
Otherwise LIT can't find the lldb-repro script in standalone builds.
2020-06-16 13:56:16 -07:00
Jonas Devlieghere 4dd3dfe8e3 [lldb/Python] Fix the infinitely looping Python prompt bug
Executing commands below will get you bombarded by a wall of Python
command prompts (>>> ).

$ echo 'foo' | ./bin/lldb -o script
$ cat /tmp/script
script
print("foo")
$ lldb --source /tmp/script

The issue is that our custom input reader doesn't handle EOF. According
to the Python documentation, file.readline always includes a trailing
newline character unless the file ends with an incomplete line. An empty
string signals EOF. This patch raises an EOFError when that happens.

[1] https://docs.python.org/2/library/stdtypes.html#file.readline

Differential revision: https://reviews.llvm.org/D81898
2020-06-16 11:05:19 -07:00
Xing GUO 8a2ff19272 [lldb][test] Trying to fix build bot after 0431e4bcb2 2020-06-13 23:53:13 +08:00
Raphael Isemann a8c755545b [lldb] Test creating persistent variables with $[digit] names 2020-06-12 16:12:33 +02:00
Raphael Isemann f52e4129a7 [lldb][NFC] Modernize TestPersistentVariables 2020-06-12 16:06:05 +02:00
Raphael Isemann 91728b9172 [lldb] Don't print IRForTarget errors directly to the console
Summary:

When we get an error back from IRForTarget we directly print that error to the
debugger output stream instead of putting it in the result object. The result
object only gets a vague "The expression could not be prepared to run in the
target" error message that doesn't actually tell the user what went wrong.

This patch just puts the IRForTarget errors into the status object that is
returned to the caller instead of directly printing it to the debugger. Also
updates one test that now can actually check for the error message it is
supposed to check for (instead of the default error which is all we had before).

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D81654
2020-06-12 10:27:25 +02:00
Jonas Devlieghere 526e0c8d15 [lldb/Test] Fix ASan/TSan workaround for Xcode Python 3
The Python 3 interpreter in Xcode has a relative RPATH and dyld fails to
load it when we copy it into the build directory.

This patch adds an additional check that the copied binary can be
executed. If it doesn't, we assume we're dealing with the Xcode python
interpreter and return the path to the real executable. That is
sufficient for the sanitizers because only system binaries need to be
copied to work around SIP.

This patch also moves all that logic out of LLDBTest and into the lit
configuration so that it's executed only once per test run, instead of
once for every test. Although I didn't benchmark the difference this
should result in a mild speedup.

Differential revision: https://reviews.llvm.org/D81696
2020-06-11 19:36:42 -07:00
Jonas Devlieghere 8d8ec55035 [lldb/Test] Unify DYLD_INSERT_LIBRARIES solution for ASan and TSan
Add the same fix for loading the sanitizer runtime for TSan as we
currently have for ASan and unify the code with a helper function.
2020-06-11 16:04:46 -07:00
Ilya Bukonkin 3b43f00629 [lldb] Check if thread was suspended during previous stop added.
Encountered the following situation: Let we started thread T1 and it hit
breakpoint on B1 location. We suspended T1 and continued the process.
Then we started thread T2 which hit for example the same location B1.
This time in a breakpoint callback we decided not to stop returning
false.

Expected result: process continues (as if T2 did not hit breakpoint) its
workflow with T1 still suspended. Actual result: process do stops (as if
T2 callback returned true).

Solution: We need invalidate StopInfo for threads that was previously
suspended just because something that is already inactive can not be the
reason of stop. Thread::GetPrivateStopInfo() may be appropriate place to
do it, because it gets called (through Thread::GetStopInfo()) every time
before process reports stop and user gets chance to change
m_resume_state again i.e if we see m_resume_state == eStateSuspended
it definitely means it was set during previous stop and it also means
this thread can not be stopped again (cos' it was frozen during
previous stop).

Differential revision: https://reviews.llvm.org/D80112
2020-06-11 15:02:46 -07:00
Jonas Devlieghere 351823fbf1 [lldb/Test] Add 'std-module' category and skip them with reproducers
These tests are flaky on the reproducer bot. I suspect it has something
to do with the module cache. Skipping the whole category while I
investigate the issue.
2020-06-10 14:59:05 -07:00
Pavel Labath 42229b6de7 [lldb] XFAIL TestForwardDeclaration.test_debug_names on windows
Before 539b47c9 this test was not actually using the debug_names section
because the -gdwarf added by Makefile.rules on windows overrode the
-gdwarf-5 flag from CFLAGS_EXTRAS. Now that -gdwarf-5 is respected, the
test is failing.
2020-06-10 17:09:51 +02:00
Jonas Devlieghere 7dd86c9e7c [lldb/Reproducers] Skip test_remove_placeholder_add_real_module with reproducers
Modules are not orphaned and it finds the existing module with the same
UUID from test_partial_uuid_match.
2020-06-09 16:17:53 -07:00
Jaroslav Sevcik fac5d05eb7 [lldb] Fix and enable Windows minidump tests
SBFileSpec.fullpath always uses the forward slash to join the directory with the
base name. This causes mismatches when comparing Windows paths with backslashes
in two of the minidump tests. To get around that we just compare the directory
names separately from the filenames.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D81465
2020-06-09 20:03:44 +00:00
Jonas Devlieghere de019b88dd [lldb/Interpreter] Support color in CommandReturnObject
Color the error: and warning: part of the CommandReturnObject output,
similar to how an error is printed from the driver when colors are
enabled.

Differential revision: https://reviews.llvm.org/D81058
2020-06-09 10:45:45 -07:00
Raphael Isemann 70a21887f7 [lldb] Test compatibility between a class type from a member function expr and its original version 2020-06-09 15:48:00 +02:00
Jan Kratochvil 4515d35f5c [lldb] Fix DW_TAG_GNU_call_site-DW_AT_low_pc as produced by GCC
D80519 <https://reviews.llvm.org/D80519>
added support for `DW_TAG_GNU_call_site` but
Bug 45886 <https://bugs.llvm.org/show_bug.cgi?id=45886>
found one case did not work.

There is:

  0x000000b1:     DW_TAG_GNU_call_site
                    DW_AT_low_pc  (0x000000000040111e)
                    DW_AT_abstract_origin (0x000000cc "a")
  ...
  0x000000cc:   DW_TAG_subprogram
                  DW_AT_name      ("a")
                  DW_AT_prototyped        (true)
                  DW_AT_low_pc    (0x0000000000401109)
                  ^^^^^^^^^^^^ - here it did overwrite the 'low_pc' variable containing value 0x40111e we wanted
                  DW_AT_high_pc   (0x0000000000401114)
                  DW_AT_frame_base        (DW_OP_call_frame_cfa)
                  DW_AT_GNU_all_call_sites        (true)

DW_TAG_GNU_call_site attributes order as produced by GCC:
0x000000b1:     DW_TAG_GNU_call_site
                  DW_AT_low_pc  (0x000000000040111e)
                  DW_AT_abstract_origin (0x000000cc "a")

clang produces the attributes in opposite order:
0x00000064:     DW_TAG_GNU_call_site
                  DW_AT_abstract_origin (0x0000002a "a")
                  DW_AT_low_pc  (0x0000000000401146)

Differential Revision: https://reviews.llvm.org/D81334
2020-06-09 13:41:41 +02:00
Pavel Labath 731fee8b42 [lldb] Fail evaluation of DWARF expressions with unknown opcodes
Previously, we were simply ignoring them and continuing the evaluation.
This behavior does not seem useful, because the resulting value will
most likely be completely bogus.
2020-06-08 15:52:28 +02:00
Pavel Labath 0081149f96 [lldb/DWARF] Fix PC value for artificial tail call frames for the "GNU" case
Summary:
The way that the support for the GNU dialect of tail call frames was
implemented in D80519 meant that the were reporting very bogus PC values
which pointed into the middle of an instruction: the -1 trick is
necessary for the address to resolve to the right function, but we
should still be reporting a more realistic PC value -- I say "realistic"
and not "real", because it's very debatable what should be the correct
PC value for frames like this.

This patch achieves that my moving the -1 from SymbolFileDWARF into the
stack frame computation code. The idea is that SymbolFileDWARF will
merely report whether it has provided an address of the instruction
after the tail call, or the address of the call instruction itself. The
StackFrameList machinery uses this information to set the "behaves like
frame zero" property of the artificial frames (the main thing this flag
does is it controls the -1 subtraction when looking up the function
address).

This required a moderate refactor of the CallEdge class, because it was
implicitly assuming that edges pointing after the call were real calls
and those pointing the the call insn were tail calls. The class now
carries this information explicitly -- it carries three mostly
independent pieces of information:
- an address of interest in the caller
- a bit saying whether this address points to the call insn or after it
- whether this is a tail call

Reviewers: vsk, dblaikie

Subscribers: aprantl, mgrang, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D81010
2020-06-08 14:44:36 +02:00
Jaroslav Sevcik 6143874f73 [lldb] Disable remove-add module test on Windows
This disables the test introduced by
1beffc1888
on Windows.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D81363
2020-06-08 08:21:07 +00:00
Jaroslav Sevcik 1beffc1888 Support build-ids of other sizes than 16 in UUID::SetFromStringRef
SBTarget::AddModule currently handles the UUID parameter in a very
weird way: UUIDs with more than 16 bytes are trimmed to 16 bytes. On
the other hand, shorter-than-16-bytes UUIDs are completely ignored. In
this patch, we change the parsing code to handle UUIDs of arbitrary
size.

To support arbitrary size UUIDs in SBTarget::AddModule, this patch
changes UUID::SetFromStringRef to parse UUIDs of arbitrary length. We
subtly change the semantics of SetFromStringRef - SetFromStringRef now
only succeeds if the entire input is consumed to prevent some
prefix-parsing confusion. This is up for discussion, but I believe
this is more consistent - we always return false for invalid UUIDs
rather than sometimes truncating to a valid prefix. Also, all the
call-sites except the API and interpreter seem to expect to consume
the entire input.

This also adds tests for adding existing modules 4-, 16-, and 20-byte
build-ids. Finally, we took the liberty of testing the minidump
scenario we care about - removing placeholder module from minidump and
replacing it with the real module.

Reviewed By: labath, friss

Differential Revision: https://reviews.llvm.org/D80755
2020-06-07 10:03:41 +00:00
Jan Kratochvil 8fc1e307f9 [lldb] [nfc] Fix comment in testcase DW_TAG_variable-DW_AT_const_value.s 2020-06-06 23:31:30 +02:00
Jim Ingham a976a7fcae Disable this test for Windows.
The printf expression crashes with the message:

Attempted to dereference an invalid pointer

Someone who knows more about Windows should suggest how to fix this.
2020-06-04 10:51:01 -07:00
Jan Kratochvil 476f520a0b [lldb] Fix SLEB128 decoding
Bug 46181 shows SLEB128 0xED9A924C00011151 decoded as 0xffffffff80011151.
        LLDB show a wrong value for function argument
        https://bugs.llvm.org/show_bug.cgi?id=46181

Differential Revision: https://reviews.llvm.org/D81119
2020-06-04 19:41:24 +02:00
Gongyu Deng 2e8f304f5e [lldb] tab completion for `command script delete'
Summary: Added the tab completion for `command script delete`.

Reviewers: teemperor, JDevlieghere

Reviewed By: teemperor

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D80775
2020-06-04 10:19:03 +02:00
Jim Ingham f4d4273265 Add a test for preserving state on the non-expr thread across expression evaluation.
There may be another test that tests this but I couldn't find one.
2020-06-03 14:30:35 -07:00
Vedant Kumar 4699a7e230 [lldb/StringPrinter] Support strings with invalid utf8 sub-sequences
Support printing strings which contain invalid utf8 sub-sequences, e.g.
strings like "hello world \xfe", instead of bailing out with "Summary
Unavailable".

I took the opportunity here to delete some hand-rolled utf8 -> utf32
conversion code and replace it with calls into llvm's Support library.

rdar://61554346
2020-06-03 12:24:23 -07:00
Muhammad Omair Javaid 884aaf7f64 [LLDB] skip TestCreateDuringInstructionStep on arm/linux
There are sporadic failures in this test on arm. I am marking it
skipped as labath suggested flaky decorators no longer work.
2020-06-03 16:18:41 +05:00
Pavel Labath de04375ac5 [lldb] Skip tests exercising DW_OP_GNU_entry_value with dsymutil
It seems that this opcode needs explicit support in dsymutil. Disable
these tests until that is implemented.
2020-06-02 18:31:15 +02:00
Pavel Labath bddd288826 [lldb/DWARF] Add support for pre-standard GNU call site attributes
Summary:
The code changes are very straight-forward -- just handle both DW_AT_GNU
and DW_AT_call versions of all tags and attributes. There is just one
small gotcha: in the GNU version, DW_AT_low_pc was used both for the
"return pc" and the "call pc" values, depending on whether the tag was
describing a tail call, while the official scheme uses different
attributes for the two things.

Reviewers: vsk, dblaikie

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D80519
2020-06-02 12:57:51 +02:00
Muhammad Omair Javaid cbfae97ca8 [LLDB] Mark TestCreateDuringInstructionStep as flaky on Linux
This patch marks TestCreateDuringInstructionStep.py as flakey for Linux.
This is failing randomly on arm/aarch64. I will monitor buildbot and
skip it if it fails again.
2020-06-02 14:08:28 +05:00
Jonas Devlieghere 382f6d37a1 [lldb/Test] Add test for man page and lldb --help output 2020-06-01 13:04:45 -07:00
Jonas Devlieghere 2388a096e7 [lldb/Test] use GetLoadAddress from scripted thread plan
Commit 0800529fe6 adds a runtime error which triggers when using
SBAddress properties that use the current process/target from a
non-interactive session. TestThreadPlanCommands.py was doing exactly
this and this patch fixes that by use GetLoadAddress instead.
2020-05-29 23:04:08 -07:00
Jonas Devlieghere 0800529fe6 [lldb/Bindings] Raise exception when using properties that rely on lldb.target
Several SBAddress properties use the lldb.target or lldb.process
convenience variables which are only set under the interactive script
interpreter. Unfortunately, users have been using these properties in
Python script and commands. This patch raises a Python exception to
force users to use GetLoadAddress instead.

Differential revision: https://reviews.llvm.org/D80848
2020-05-29 22:11:21 -07:00
Fred Riss 977f00123a [lldb/test] Fix TestAppleSimulatorOSType when multiple runtimes are installed
One can have multiple simulator runtimes installed, supporting
various generations of OSs. The logic in TestAppleSimulatorOSType
might select a rnutime older than the one targeted by the current
tools, preventing the executable from running. This commit changes
the test to look for the most recent runtime available instead.
2020-05-29 08:30:04 -07:00
Pavel Labath 2c22c14735 [lldb] Make "inline" tests more configurable
Summary:
This patch adds two new arguments to the MakeInlineTest function. The
main motivation is a follow-up patch I'm preparing, but they seem
generally useful.

The first argument allows the user to specify the "build dictionary".
With this argument one can avoid the need to provide a custom Makefile
if all he needs is to override a couple of make variables. This hooks in
neatly into the existing dictionary support for non-inline tests.

The second argument specifies the name of the test. This could be used
to provide better names to the generated test classes, but it's mainly
useful in conjuction with the first argument: now that we can specify a
custom build dictionary, it may sometimes make sense to run the same
test twice with different build configurations. To achieve that, we need
to give the two tests different names, and this argument achieves that.

The usage of the arguments is demonstrated via TestBasicEntryValues.py.

Reviewers: vsk, JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D80518
2020-05-29 11:36:11 +02:00
Jonas Devlieghere b950c261d9 [lldb/Reproducers] Add top-level-target check-lldb-reproducers
This adds a new target `check-lldb-reproducers` that replaces the old
`check-lldb-repro`. The latter would only run the shell tests, while
`check-lldb-reproducers` includes the API tests as well. The new target
will be used on GreenDragon.

It's still possible to run just the shell tests with reproducers,
although now that requires crafting the lit invocation yourself. The
parameters haven't changed and are the shame for the API and shell
tests:

  --param lldb-run-with-repro=capture
  --param lldb-run-with-repro=replay

This patch also updates the reproducer documentation.
2020-05-28 10:48:16 -07:00