Commit Graph

1011 Commits

Author SHA1 Message Date
Nitesh Jain b43729bc39 [LLDB][MIPS] Fix typo in TestStepOverWatchpoint.py.
Subscribers: jaydeep, bhushan, lldb-commits, slthakur
llvm-svn: 301295
2017-04-25 06:12:59 +00:00
Sean Callanan 831c72f4a9 Name the C++ source files for two tests correctly.
llvm-svn: 301280
2017-04-24 23:58:36 +00:00
Sean Callanan c0dd0181d3 Fixed two bad Makefiles that might be breaking Linux.
llvm-svn: 301277
2017-04-24 23:49:06 +00:00
Sean Callanan c02a1c0312 [Expression parser] Return both types and variables
Many times a user wants to access a type when there's a variable of
the same name, or a variable when there's a type of the same name.
Depending on the precise context, currently the expression parser
can fail to resolve one or the other.

This is because ClangExpressionDeclMap has logic to limit the
amount of information it searches, and that logic sometimes cuts
down the search prematurely. This patch removes some of those early
exits.

In that sense, this patch trades performance (early exit is faster)
for correctness.

I've also included two new test cases showing examples of this
behavior – as well as modifying an existing test case that gets it
wrong.

llvm-svn: 301273
2017-04-24 23:14:04 +00:00
Sean Callanan b494578afb [DWARF] Fix lookup in the abstract origins of inlined blocks/functions
LLDB uses clang::DeclContexts for lookups, and variables get put into
the DeclContext for their abstract origin. (The abstract origin is a 
DWARF pointer that indicates the unique definition of inlined code.) 
When the expression parser is looking for variables, it locates the 
DeclContext for the current context. This needs to be done carefully, 
though, e.g.:

__attribute__ ((always_inline)) void f(int a) {
  {
    int b = a * 2;
  }
}

void g() {
  f(3);
}
Here, if we're stopped in the inlined copy of f, we have to find the 
DeclContext corresponding to the definition of f – its abstract 
origin. Clang doesn't allow multiple functions with the same name and 
arguments to exist. It also means that any variables we see must be 
placed in the appropriate DeclContext.

[Bug 1]: When stopped in an inline block, the function 
GetDeclContextDIEContainingDIE for that block doesn't properly
construct a DeclContext for the abstract origin for inlined
subroutines. That means we get duplicated function DeclContexts, but
function arguments only get put in the abstract origin's DeclContext, 
and as a result when we try to look for them in nested contexts they 
aren't found.

[Bug 2]: When stopped in an inline block, the DWARF (for space 
reasons) doesn't explicitly point to the abstract origin for that 
block. This means that the function GetClangDeclContextForDIE returns
a different DeclContext for each place the block is inlined. However, 
any variables defined in the block have abstract origins, so they 
will only get placed in the DeclContext for their abstract origin.

In this fix, I've introduced a test covering both of these issues,
and fixed them.

Bug 1 could be resolved simply by making sure we look up the abstract
origin for inlined functions when looking up their DeclContexts on 
behalf of nested blocks.

For Bug 2, I've implemented an algorithm that makes the DeclContext 
for a block be the containing DeclContext for the closest entity we
would find during lookup that has an abstract origin pointer. That
means that in the following situation:

{ // block 1
  int a;
  { // block 2
    int b;
  }
}
if we looked up the DeclContext for block 2, we'd find the block 
containing the abstract origin of b, and lookup would proceed 
correctly because we'd see b and a. However, in the situation

{ // block 1
  int a;
  { // block 2
  }
}
since there isn't anything to look up in block 2, we can't determine 
its abstract origin (and there is no such pointer in the DWARF for 
blocks). However, we can walk up the parent chain and find a, and its 
abstract origin lives in the abstract origin of block 1. So we simply 
say that the DeclContext for block 2 is the same as the DeclContext 
for block 1, which contains a. Lookups will return the same results.

Thanks to Jim Ingham for review and suggestions.

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

llvm-svn: 301263
2017-04-24 22:11:10 +00:00
Pavel Labath b4f6a95680 Update two android XFAILS
- XFAIL on TestNoreturnUnwind on all architectures
- TestStaticVariables fails with clang-3.8 as well

llvm-svn: 301186
2017-04-24 15:23:21 +00:00
Pavel Labath 69883aa043 Skip TestLibCxxAtomic with gcc
older versions of libc++ (still used on some linux systems) are not
compatible with gcc.

llvm-svn: 300837
2017-04-20 12:30:30 +00:00
Pavel Labath 68e3886e57 Recompute ArchSpec core after MergeFrom
Summary:
MergeFrom was updating the architecture if the target triple did not
have it set. However, it was leaving the core field as invalid. This
resulted in assertion failures in core file tests as a missing core
meant we were unable to compute the address byte size properly.

Add a unit test for the new behaviour.

Reviewers: jingham, clayborg

Subscribers: lldb-commits

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

llvm-svn: 300836
2017-04-20 12:30:18 +00:00
Pavel Labath 7b46633c4b Make TestStaticVariables XFAIL more specific
The test fails because an older clang did not emit the required debug
info (I am not sure when this got added, but clang-3.7 certainly did not
work yet). The actual platform has nothing to do with this.

llvm-svn: 300834
2017-04-20 11:28:07 +00:00
Pavel Labath a93310ad2a Add libc++ category the three more tests
I thought my previous commit got the last ones but somehow I missed
these. This also resurrects TestDataFormatterLibcxxSet, which got
commented out in r263859 as a part of some seemingly unrelated change.

llvm-svn: 300833
2017-04-20 11:27:58 +00:00
Jim Ingham aab5be0505 Fix !N and !-N commands and add a test case.
<rdar://problem/31713267>

llvm-svn: 300785
2017-04-19 23:21:04 +00:00
Pavel Labath 7c437023ca Fix TestRegisterVariables for clang/arm
Clang rejects __attribute__((regparm)) when targetting arm. The default
calling convention passes arguments in registers anyway, so we can just
remove them in this case.

llvm-svn: 300670
2017-04-19 10:13:29 +00:00
Jim Ingham eb236735e5 Add back code to implement "frame var -a,-l,-g" filters.
r285226 dropped the code that did these checks.  I am pretty
sure that was inadvertent, so I added that back in and added
a test for it.

<rdar://problem/31661252>

llvm-svn: 300564
2017-04-18 16:52:16 +00:00
Jim Ingham 5cfe9294fe TestStaticVariables still fails on Linux.
llvm-svn: 300519
2017-04-18 00:44:14 +00:00
Jim Ingham 7c0d74aa2b This test is succeeding on macOS with clang.
llvm-svn: 300517
2017-04-18 00:20:59 +00:00
Pavel Labath f0565cc84a Add libc++ category to the remaining libc++ data formatters
llvm-svn: 300054
2017-04-12 12:32:58 +00:00
Pavel Labath da7b15df70 Fix TestCppIncompleteTypes for android/clang
LDFLAGS contains some .a files. If it is specified before the relevant
object files, undefined symbol errors occur.

llvm-svn: 300048
2017-04-12 10:59:34 +00:00
Pavel Labath d3656a03ab Fix libc++ vector<bool> data formatter (bug #32553)
Summary:
The iteration list through the available data formatters was undefined,
which meant that the vector<bool> formatter kicked in only in cases
where it happened to be queried before the general vector formatter. To
fix this, I merge the two data formatter entries into one, and select
which implementation to use in the factory function.

Reviewers: jasonmolenda, tberghammer, EricWF

Subscribers: lldb-commits

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

llvm-svn: 300047
2017-04-12 10:59:24 +00:00
Pavel Labath 74207ad7ba Fix TestGuessLanguage for gcc
gcc emits DW_LANG_C89 even if we specify -std=c99 during compilation.
Since this isn't an lldb bug, but just the way the compiler happens to
be implemented, I teach the test to expect this situation correctly.

llvm-svn: 300046
2017-04-12 10:13:50 +00:00
Pavel Labath efe4e412ad Android.rules: setup correct objcopy path
This fixes a couple of tests when using android clang as a compiler.

llvm-svn: 300045
2017-04-12 10:13:47 +00:00
Jim Ingham bdbdd22937 Teach SBFrame how to guess its language.
<rdar://problem/31411646>

llvm-svn: 300012
2017-04-12 00:19:54 +00:00
Pavel Labath 0df645dda4 Add missing annotation to TestDataFormatterUnordered
llvm-svn: 299934
2017-04-11 12:26:33 +00:00
Jason Molenda 969230a702 Mark this test as XFAIL on all platforms, it's happening everywhere.
llvm.org/pr32553 and <rdar://problem/30646077> are tracking this.

llvm-svn: 299807
2017-04-07 23:20:22 +00:00
Tamas Berghammer 95776ad5b8 XFAIL TestDataFormatterLibcxxVBool on Linux & Android
The skipping logic for the test have been fixed recently but the test is
very flakey on the buildbot.

llvm-svn: 299677
2017-04-06 18:15:43 +00:00
Pavel Labath 46f1d4a12c Annotate some more libc++ tests with the new category
This makes sure we are able to run them properly on android.

llvm-svn: 299588
2017-04-05 20:34:26 +00:00
Sean Callanan 894c147104 The darwin_log tests are very fragile and currently do not properly assess the state of that functionality.
I have put them all in their own category, and made that category disabled by default.

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

llvm-svn: 299587
2017-04-05 20:33:39 +00:00
Ilia K a97973ab4e Enable lldm-mi commands -stack-list-locals -stack-list-variables and -var-create to work only with variables in scope
Patch by ayuckhulk

Reviewers: abidh, lldb-commits, ki.stfu

Reviewed By: ki.stfu

Tags: #lldb

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

llvm-svn: 299417
2017-04-04 08:00:28 +00:00
Jason Molenda 498ff61e2d Skip three test cases that are asserting on macosx as of r299199. A quick
look showed that the target's arch has no core / byte order and so when
AuxVector::AuxVector calls into a dataextractor and sets the byte size to 0,
it asserts.  e.g.

  m_arch = {
    m_triple = (Data = "x86_64--linux", Arch = x86_64, SubArch = NoSubArch, Vendor = UnknownVendor, OS = Linux, Environment = UnknownEnvironment, ObjectFormat = ELF)
    m_core = kCore_invalid
    m_byte_order = eByteOrderInvalid
    m_flags = 0x00000000
    m_distribution_id = <no value available>
  }

<rdar://problem/31380097> 

llvm-svn: 299408
2017-04-04 01:09:20 +00:00
Tamas Berghammer 4c08fe2841 Add support for sythetic operator dereference
Summary:
After this change a sythetic child provider can generate a special child
named "$$dereference$$" what if present is used when "operator*" or
"operator->" used on a ValueObject. The goal of the change is to make
expressions like "up->foo" work inside the "frame variable" command.

Reviewers: labath, jingham

Subscribers: lldb-commits

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

llvm-svn: 299251
2017-03-31 20:23:22 +00:00
Tamas Berghammer af8953a025 Do not dereference std::unique_ptr by default
Summary:
Displaying the object pointed by the unique_ptr can cause an infinite
recursion when we have a pointer loop so this change stops that
behavior. Additionally it makes the unique_ptr act more like a class
containing a pointer (what is the underlying truth) instead of some
"magic" class.

Reviewers: labath, jingham

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

llvm-svn: 299249
2017-03-31 20:07:20 +00:00
Nitesh Jain 706c520558 [LLDB][MIPS] Fix Core file Architecture and OS information.
Reviewers: labath, clayborg

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 299199
2017-03-31 11:06:25 +00:00
Pavel Labath 01a28ca7f8 Centralize libc++ test skipping logic
Summary:
This aims to replace the different decorators we've had on each libc++
test with a single solution. Each libc++ will be assigned to the
"libc++" category and a single central piece of code will decide whether
we are actually able to run libc++ test in the given configuration by
enabling or disabling the category (while giving the user the
opportunity to override this).

I started this effort because I wanted to get libc++ tests running on
android, and none of the existing decorators worked for this use case:
 - skipIfGcc - incorrect, we can build libc++ executables on android
 with gcc (in fact, after this, we can now do it on linux as well)
 - lldbutil.skip_if_library_missing - this checks whether libc++.so is
 loaded in the proces, which fails in case of a statically linked
 libc++ (this makes copying executables to the remote target easier to
 manage).

To make this work I needed to split out the pseudo_barrier code from the
force-included file, as libc++'s atomic does not play well with gcc on
linux, and this made every test fail, even though we need the code only
in the threading tests.

So far, I am only annotating one of the tests with this category. If
this does not break anything, I'll proceed to update the rest.

Reviewers: jingham, zturner, EricWF

Subscribers: srhines, lldb-commits

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

llvm-svn: 299028
2017-03-29 21:01:14 +00:00
Zachary Turner d0410b6f34 Delete TestLLVM.py
This was added to workaround a limitation in LLVM's implementation
of getting the current user's home directory, since it would
only look at the value of $HOME, but we did not want to rely
on that being set so we would also look in the password database.

Adding the ability to look in the password database to LLVM was
a straightforward patch that was submitted in r298513, so since
that is done this test is no longer needed.

llvm-svn: 298519
2017-03-22 17:08:25 +00:00
Jim Ingham 9a4bce70fa FindTypes should find "struct TypeName" as well as "TypeName".
This fixes a bug introduced by r291559.  The Module's FindType was 
passing the original name not the basename in the case where it didn't
find any separators.  I also added a testcase for this.

<rdar://problem/31159173>

llvm-svn: 298331
2017-03-21 02:13:50 +00:00
Jim Ingham 1aa0ed4e0d Get ObjectFileMachO to handle @executable_path
Only do this when we are debugging an executable, since we
don't have a good way to trace from an ObjectFile back to its
containing executable.  Detecting pre-run libs before running
is "best effort" in lldb, but this one is pretty easy.

llvm-svn: 298290
2017-03-20 19:21:31 +00:00
Pavel Labath 6b42b3b7a3 Fix remote test suite directory creation
r298203 make SBPlatform::MakeDirectory less recursive, which breaks the
test suite creation of test directory hierarchy creation on the remote
target. Since the function was never fully recursive, and the name does
not imply recursiveness, I fix the problem by modifying the test runner
to do the recursion manually.

I also make the runner complain more loudly when it fails to create the
directory -- previously it just printed the error to stdout and caused
most of the tests to hang, which is not very helpful in diagnosing the
problem.

llvm-svn: 298261
2017-03-20 16:07:17 +00:00
Tim Hammerquist f73c6c7e84 allow for specification of compiler/lldb executables basename
llvm-svn: 298123
2017-03-17 21:00:35 +00:00
Tim Hammerquist 848582181e executables should be validated before spawning subprocesses
dotest.py script doesn't validate executables passed on the command line
before spawning dozens of subprocesses, all of which fail silently,
leaving an empty results file.

We should validate the lldb and compiler executables on
configuration, aborting when given invalid paths, to prevent numerous,
cryptic, and spurious failures.

<rdar://problem/31117272>

llvm-svn: 298111
2017-03-17 18:10:58 +00:00
Pavel Labath 225b79524d Remove HostThreadLinux/Free/NetBSD
Summary:
These classes existed only because of the GetName() static function,
which can be moved to a more natural place anyway. I move the linux
version to NativeProcessLinux (and get rid of ProcFileReader), the
freebsd version to ProcessFreeBSD (and fix a bug where it was using the
current process ID, instead of the inferior pid), and remove the NetBSD
version (which was probably incorrect anyway, as it assumes the current
process instead of the inferior.

I also add an llgs test to that verifies thread names are read
correctly.

Reviewers: zturner, krytarowski, emaste

Subscribers: lldb-commits, mgorny

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

llvm-svn: 298058
2017-03-17 09:51:23 +00:00
Pavel Labath 2aaab29574 Fix TestMoveNearest for remote targets
Launching a process with shared libraries on remote targets requires a
special dance, which I forgot to do in r297830.

llvm-svn: 297834
2017-03-15 13:32:17 +00:00
Pavel Labath 32a8b7c3a7 Fix TestMoveNearest breakage on darwin
It seems that on darwin we are not able to resolve breakpoints in the
test shared library until the process has started. That seems
unfortunate, but it is not the purpose of this test, so work around that
by starting the process before doing the rest of our checks.

llvm-svn: 297830
2017-03-15 12:32:18 +00:00
Pavel Labath bf37a037d0 BreakpointResolverFileLine: Restrict move-to-nearest-code from moving across function boundaries
Summary:
This fixes the case where a user tries to set a breakpoint on a source
line outside of any function (e.g. because that code is #ifdefed out, or
the compiler did not emit code for the function, etc.) and we would
silently move the breakpoint to the next function.

Now we check whether the line range of the resolved symbol context
function matches the original line number. We reject any breakpoint
locations that appear to move the breakpoint into a new function. This
filtering only happens if we have full debug info available (e.g. in
case of -gline-tables-only compilation, we still set the breakpoint on
the nearest source line).

Reviewers: jingham

Subscribers: lldb-commits

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

llvm-svn: 297817
2017-03-15 09:53:10 +00:00
Pavel Labath 6de25ec61a dotest.py: remove the ability to specify different architectures/compilers in a single invocation
Summary:
This has been broken at least since the new test result framework was
added, which was over a year ago. It looks like nobody has missed it
since.

Removing this makes the gmodules handling code saner, as it already did
not know how to handle the multiple-compilers case.

My motivation for this is libc++ data formatters support on android -- I
am trying make a central way of determining whether libc++ tests can be
run, and without this, I would have to resort to similar hacks as the
gmodules code.

Reviewers: jingham, zturner

Subscribers: danalbert, tfiala, lldb-commits

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

llvm-svn: 297811
2017-03-15 08:51:59 +00:00
Chris Bieneman 265ca535ab [CMake] Override debugserver to use the build tree on Darwin
This patch adds support to the test suite for overriding the path to debugserver, and uses the override to point to the build tree's debugserver on Darwin.

llvm-svn: 297776
2017-03-14 20:04:46 +00:00
Pavel Labath 7163ecb429 Android.rules: Add libc++ support
Summary:
This adds support for building libc++ tests when targetting android. The
tests are still not passing due to several other problems, but this way
we can at least build them.

Reviewers: eugene, EricWF, danalbert

Subscribers: srhines, lldb-commits

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

llvm-svn: 297616
2017-03-13 12:07:48 +00:00
Tim Hammerquist e4885f8999 fix xunit attribute parsing
llvm-svn: 297538
2017-03-11 00:58:41 +00:00
Jason Molenda 73b76ce563 Mark this as skipped for now. There is a race condition with
SectionLoadList exposed by this test.  Greg tried to chase it down
& got pretty far but the isn't correct so we'll disable this test
for now until I can figure that out.

<rdar://problem/30899227> 

llvm-svn: 297440
2017-03-10 05:33:27 +00:00
Zachary Turner 30fdb05ddb Make the LLDB test suite work with MSVC 2017 on Windows.
llvm-svn: 297405
2017-03-09 19:54:23 +00:00
Pavel Labath 9ef5778038 Android.rules: fix computation of gcc toolchain directory on arm
The toolchain directory for arm android targets was computed
incorrectly. The architecture part should be arm, and the environment
part androideabi. This fixes that.

llvm-svn: 297279
2017-03-08 14:57:15 +00:00
Jason Molenda cfbdbe4a76 Back to xfailing this. For some reason on our buildbots
it fails, but it works on the local workstations.  I'll
need to figure out what the difference is between these.
<rdar://problem/30915340> 

llvm-svn: 297259
2017-03-08 06:45:34 +00:00