Commit Graph

1029 Commits

Author SHA1 Message Date
Pavel Labath 54d405033a Skip TestNoreturnUnwind on linux+clang+arm
I was over-eager to unable this test in r304976. It still fails in this
combination, at there does not seem to be anything we can do about it,
as the generated code does not preserve the link register.

llvm-svn: 305062
2017-06-09 08:33:59 +00:00
Pavel Labath c3c721222d Fix backtrace of noreturn functions situated at the end of a module
Summary:
When a call instruction is the last instruction in a function, the
backtrace PC will point past the end of the function. We already had
special code to handle that, but we did not handle the case where the PC
ends up outside of the bounds of the module containing the function,
which is a situation that occured in TestNoreturnUnwind on android for
some arch/compiler combinations.

I fix this by adding an argument to Address resolution code which states
that we are ok with addresses pointing to the end of a module/section to
resolve to that module/section.

I create a reproducible test case for this situation by hand-crafting an
executable which has a noreturn function at the end of a module.

Reviewers: jasonmolenda, jingham

Subscribers: lldb-commits

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

llvm-svn: 304976
2017-06-08 13:26:35 +00:00
Sean Callanan ddf802a04d [TypeSystem] Handle Clang AttributedTypes
When parsing types originating in modules, it is possible to encounter AttributedTypes 
(such as the type generated for NSString *_Nonnull). Some of LLDB's ClangASTContext 
methods deal with them; others do not. In particular, one function that did not was 
GetTypeInfo, causing TestObjCNewSyntax to fail.

This fixes that, treating AttributedType as essentially transparent and getting the 
information for the modified type.

In addition, however, TestObjCNewSyntax is a monolithic test that verifies a bunch of 
different things, all of which can break independently of one another. I broke it 
apart into smaller tests so that we get more precise failures when something (like 
this) breaks.

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

llvm-svn: 304510
2017-06-02 01:24:18 +00:00
Sean Callanan a77826c298 Added a testcase for local/namespaced name conflicts.
This works on SVN but is a bit fragile on the Swift branch.
I'm adding the test to both, so we have this path covered.

<rdar://problem/32372372>

llvm-svn: 304314
2017-05-31 17:18:10 +00:00
Abhishek Aggarwal 5bfee5f1c8 Added new API to SBStructuredData class
Summary:
 - Added API to access data types
    -- integer, double, array, string, boolean and dictionary data types
    -- Earlier user had to parse through the string output to get these
       values

 - Added Test cases for API testing

 - Added new StructuredDataType enum in public include file
   -- Replaced locally-defined enum in StructuredData.h with this new
      one       
   -- Modified other internal files using this locally-defined enum

Signed-off-by: Abhishek Aggarwal <abhishek.a.aggarwal@intel.com>

Reviewers: clayborg, lldb-commits

Reviewed By: clayborg

Subscribers: labath

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

llvm-svn: 304138
2017-05-29 08:25:46 +00:00
Pavel Labath 45dde23756 Recommit "RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false"
This is a resubmit of r303732, which was reverted due to a regression.

The original patch caused a regression in TestLoadUnload, which has only showed
up when running the remote test suite. The problem there was that we interrupted
the target just as it has hit the rendezvous breakpoint in the dlopen call. This
meant that the stop reason was set to "breakpoint" even though the event would
not have been broadcast if we had not stopped the process. I fix this by
checking StopInfo->ShouldNotify() before stopping.

I also add a new test for the handling of conditional breakpoints in
expressions, which I noticed to be broken (pr33164)

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

llvm-svn: 303848
2017-05-25 10:50:06 +00:00
Pavel Labath 7417558f59 Revert "RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false"
This reverts commit r303732, as it introduces a regression in
TestLoadUnload on android.

llvm-svn: 303740
2017-05-24 11:57:28 +00:00
Pavel Labath 0dc2ad1b13 RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false
Summary:
The function had logic to handle the case when the expression terminated
while we were trying to halt the process, but it failed to take into
account the possibility that the expression stopped because it hit a
breakpoint. This was caused by the fact that the handling of the stopped
events was duplicated for the "halting" and regular cases (the regular
case handled this situation correctly). I've tried to merge these two
cases into one to make sure they stay in sync.

I should call out that the two cases were checking whether the thread
plan has completed in slightly different ways. I am not sure what is the
difference between them, but I think the check should be the same in
both cases, whatever it is, so I just took the one from the regular
case, as that is probably more tested.

For the test, I modified TestUnwindExpression to run the expression with
a smaller timeout (this is how I found this bug originally). With a 1ms
one thread timeout, the test failed consistently without this patch.

Reviewers: jingham

Subscribers: lldb-commits

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

llvm-svn: 303732
2017-05-24 09:46:48 +00:00
Jim Ingham c1dd88c2e6 We shouldn't put actual tests in directories that contain
other test directories.

llvm-svn: 303643
2017-05-23 16:11:21 +00:00
Jason Molenda 631a0bb924 Don't override the SDKs and force the use of /System/Library/Frameworks to
find the python headers when buiding crashinfo.c
<rdar://problem/32288076> 

llvm-svn: 303465
2017-05-19 23:00:42 +00:00
Pavel Labath 1b8fe5ec8d Make TestConflictingSymbol run on non-darwin targets
For remote targets we need to call registerSharedLibrariesWithTarget to
make sure they are installed alongside main executable. This also
required a small fixup in the the mentioned function as in this case
"One" was both a directory name and a library name template. I fixed it
to make sure it checks that the string refers to a file before it
assumed it was a full library path.

llvm-svn: 303248
2017-05-17 11:47:44 +00:00
Sean Callanan 9c99faa856 [Expression parser] Look up module symbols before hunting globally
When it resolves symbol-only variables, the expression parser
currently looks only in the global module list. It should prefer
the current module.

I've fixed that behavior by making it search the current module
first, and only search globally if it finds nothing. I've also
added a test case.

After review, I moved the core of the lookup algorithm into
SymbolContext for use by other code that needs it.

Thanks to Greg Clayton and Pavel Labath for their help.

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

llvm-svn: 303223
2017-05-16 23:46:13 +00:00
Pavel Labath 26d49a640a Skip TestWatchedVarHitWhenInScope on android arm because it triggers a kernel bug
llvm-svn: 303160
2017-05-16 11:58:18 +00:00
Sean Callanan 732a6f432e [TypeSystem] Fix inspection of Objective-C object types
ptr_refs exposed a problem in ClangASTContext's implementation: it
uses an accessor to downcast a QualType to an
ObjCObjectPointerType, but the accessor is not fully general.
getAs() is the safer way to go.

I've added a test case that uses ptr_refs in a way that would
crash before the fix.

<rdar://problem/31363513>

llvm-svn: 303110
2017-05-15 19:55:20 +00:00
Pavel Labath b5c2a2d959 Disable a test in TestReturnValue on arm64 linux
as described in pr33042, we cannot reliably retrieve the return value on
arm64 in cases it is returned via x8 pointer. I tried to do this as
surgically as possible and disabled it only on targets I know to be
affected, as the code is still useful, even though it can only work on
best-effort basis.

llvm-svn: 303076
2017-05-15 16:25:28 +00:00
Sean Callanan 0f01fb39e3 xfail TestClassTemplateParameterPack on gcc to mollify lldb-x86_64-ubuntu-14.04-cmake.
llvm-svn: 302850
2017-05-11 23:38:21 +00:00
Sean Callanan 09e91ac6ab [DWARF parser] Produce correct template parameter packs
Templates can end in parameter packs, like this

template <class T...> struct MyStruct 
  { /*...*/ };

LLDB does not currently support these parameter packs; 
it does not emit them into the template argument list
at all. This causes problems when you specialize, e.g.:

template <> struct MyStruct<int> 
  { /*...*/ };
template <> struct MyStruct<int, int> : MyStruct<int> 
  { /*...*/ };

LLDB generates two template specializations, each with 
no template arguments, and then when they are imported 
by the ASTImporter into a parser's AST context we get a 
single specialization that inherits from itself, 
causing Clang's record layout mechanism to smash its
stack.

This patch fixes the problem for classes and adds
tests. The tests for functions fail because Clang's
ASTImporter can't import them at the moment, so I've
xfailed that test.

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

llvm-svn: 302833
2017-05-11 22:08:05 +00:00
Francis Ricci f88bf5acfe Add missing 'arch' key to valid qHostInfo keys
Summary:
'arch' is a valid qHostInfo key, but the unit
test for qHostInfo did not include it in the set of possible keys.

Reviewers: tfiala, labath

Subscribers: lldb-commits

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

llvm-svn: 302260
2017-05-05 17:18:08 +00:00
Pavel Labath 38c2059aec Fix segfault resulting from empty print prompt
Summary:
I have found a way to segfault lldb in 7 keystrokes! Steps to reproduce:
1) Launch lldb
2) Type `print` and hit enter. lldb will now prompt you to type a list of
    expressions, followed by an empty line.
3) Hit enter, indicating the end of your input.
4) Segfault!

After some investigation, I've found the issue in Host/common/Editline.cpp.
Editline::MoveCursor() relies on m_input_lines not being empty when the `to`
argument is CursorPosition::BlockEnd. This scenario, as far as I can tell,
occurs in one specific instance: In Editline::EndOrAddLineCommand() when the
list of lines being processed contains exactly one string (""). Meeting this
condition is fairly simple, I have posted steps to reproduce above.

Reviewers: krytarowski, zturner, labath

Reviewed By: labath

Subscribers: scott.smith, lldb-commits

Differential Revision: https://reviews.llvm.org/D32421
Patch by Alex Langford.

llvm-svn: 302225
2017-05-05 11:51:21 +00:00
Pavel Labath 3559f20f17 ABISysV_arm64: compute return value for large vectors correctly
Summary:
Arm64 Procedure Call Standard specifies than only vectors up to 16 bytes
are stored in v0 (which makes sense, as that's the size of the
register). 32-byte vector types are passed as regular structs via x8
pointer. Treat them as such.

This fixes TestReturnValue for arm64-clang. I also split the test case
into two so I can avoid the if(gcc) line, and annotate each test
instead. (It seems the vector type tests fail with gcc only when
targetting x86 arches).

Reviewers: tberghammer, eugene

Subscribers: aemerson, omjavaid, rengolin, srhines, lldb-commits

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

llvm-svn: 302220
2017-05-05 10:50:02 +00:00
Nitesh Jain dd12594345 [LLDB][MIPS] Fix TestStepOverBreakpoint.py failure.
Reviewers: jingham, labath

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 302139
2017-05-04 11:34:42 +00:00
Francis Ricci decd2d7701 Don't attempt to use mpx registers on unsupported platforms
Summary:
The existing cpp-level checks using PR_MPX_ENABLE_MANAGEMENT aren't sufficient,
as this isn't defined for linux kernel versions below 3.19.

Reviewers: valentinagiusti, zturner, labath

Subscribers: lldb-commits

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

llvm-svn: 302027
2017-05-03 15:00:04 +00:00
Pavel Labath 6b09f9d603 Windows fix for TestConflictingDefinition makefile
gnuwin32 rm does not like wildcards that match nothing even if we
specify -f (probably because the wildcard expansion happens in-process
there). We could use make $(wildcard) here, but it seems safer to
explicitly list the files here, just like the normal Makefile.rules
does.

llvm-svn: 302013
2017-05-03 11:27:35 +00:00
Sean Callanan 40d067cd7f Fixed a bug where we did not properly use the complete versions of Objective-C classes.
Also added a test case, thanks to Greg Clayton.

<rdar://problem/18913551>

llvm-svn: 301993
2017-05-03 00:41:43 +00:00
Pavel Labath 59bc6d1ce0 Android.rules: set "ar" path correctly
llvm-svn: 301918
2017-05-02 13:14:45 +00:00
Jim Ingham 7fca8c0757 Provide a mechanism to do some pre-loading of symbols up front.
Loading a shared library can require a large amount of work; rather than do that serially for each library,
this patch will allow parallelization of the symbols and debug info name indexes.

From scott.smith@purestorage.com

https://reviews.llvm.org/D32598

llvm-svn: 301609
2017-04-28 00:51:06 +00:00
Nitesh Jain 63a978ff09 [LLDB][MIPS] Forgot to add check in commit rl301530
Reviewers: ki.stfu, labath
Subscribers: jaydeep, bhushan, lldb-commits, slthakur

llvm-svn: 301537
2017-04-27 12:27:42 +00:00
Nitesh Jain 93d7ab9d82 [LLDB][MIPS] Fix TestMiExec.py failure.
Reviewers: ki.stfu, labath

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 301530
2017-04-27 10:21:46 +00:00
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