Commit Graph

13967 Commits

Author SHA1 Message Date
Tamas Berghammer be379e1590 Revert "Use BKPT instead of UDF for arm/thumb breakpoints"
This reverts commit 293c18e067d663e0fe93e6f3d800c2a4bfada2b0.

The BKPT instruction generates SIGBUS instead of SIGTRAP in the Linux
kernel on Nexus 6 - 5.1.1 (kernel version 3.10.40). Revert the CL
until we can figure out how can we hanble the SIGBUS or how to get
back a SIGTRAP using the BKPT instruction.

llvm-svn: 260969
2016-02-16 15:14:36 +00:00
Pavel Labath 91b1e19152 Bump up timeout in TestChangeProcessGroup
The test fails very rarely. I suspect this is simply because the inferior does not have enough
time to create the file under heavy load.

llvm-svn: 260951
2016-02-16 09:58:50 +00:00
Pavel Labath 35f26f613a Mark TestLldbGdbServer.test_written_M_content_reads_back_correctly as flaky on linux
I believe the root cause is the asynchronous arrival of inferior stdio (pr25652).

llvm-svn: 260950
2016-02-16 09:58:47 +00:00
Jason Molenda ebeff4c11e Fix buildbot failure because I got an include path wrong.
llvm-svn: 260932
2016-02-16 04:20:56 +00:00
Jason Molenda 62e0681afb Add -Wimplicit-fallthrough command line option to clang in
the xcode project file to catch switch statements that have a
case that falls through unintentionally.

Define LLVM_FALLTHROUGH to indicate instances where a case has code
and intends to fall through.  This should be in llvm/Support/Compiler.h;
Peter Collingbourne originally checked in there (r237766), then
reverted (r237941) because he didn't have time to mark up all the
'case' statements that were intended to fall through.  I put together
a patch to get this back in llvm http://reviews.llvm.org/D17063 but
it hasn't been approved in the past week.  I added a new
lldb-private-defines.h to hold the definition for now.

Every place in lldb where there is a comment that the fall-through
is intentional, I added LLVM_FALLTHROUGH to silence the warning.
I haven't tried to identify whether the fallthrough is a bug or
not in the other places.

I haven't tried to add this to the cmake option build flags.
This warning will only work for clang.

This build cleanly (with some new warnings) on macosx with clang
under xcodebuild, but if this causes problems for people on other
configurations, I'll back it out.

llvm-svn: 260930
2016-02-16 04:14:33 +00:00
Saleem Abdulrasool 1ee07253c7 Silence some clang warnings
Silences -Wmissing-brace and -Wformat-pedantic warnings from clang on Linux.  NFC.

llvm-svn: 260914
2016-02-15 21:50:28 +00:00
Jim Ingham b6bdfc522c Refinement of r260624. It is possible somebody might try to add to the map
while we are finalizing its elements.  Prevent that.

<rdar://problem/24554920>

llvm-svn: 260909
2016-02-15 20:04:15 +00:00
Saleem Abdulrasool 2f1d3ac99d ExpressionParser: silence some GCC warnings
Silence a -Wreorder warning about order of member initialization and a
-Wqual-cast warning about casting away constness.  NFC.

llvm-svn: 260868
2016-02-15 03:23:14 +00:00
Jason Molenda 5f826bbc51 Additional fix to my change in r259983 to handle the
case where a core file has a kernel binary and a user
process dyld in the same one.  Without this, we were
always picking the dyld and trying to process it as a
kernel.

<rdar://problem/24446112> 

llvm-svn: 260803
2016-02-13 04:15:02 +00:00
Siva Chandra 94d1855e08 [TestLibCxxAtomic] Skip for GCC.
Summary: This is the form on other libc++ tests.

Reviewers: sivachandra

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D17230

llvm-svn: 260793
2016-02-13 02:11:11 +00:00
Jim Ingham cbf6f9b243 Adding an SBThread::StepInto that takes an end-line, also moved the code that figures
out the address range for the step to SymbolContext.

llvm-svn: 260772
2016-02-13 00:31:47 +00:00
Siva Chandra 9fb970e422 [TestLibCxxAtomic] Fix Makefile so that the test builds on Linux.
Reviewers: granata.enrico

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D17227

llvm-svn: 260770
2016-02-13 00:09:42 +00:00
Sean Callanan 2a8fa2a888 Removed many JIT workarounds from IRForTarget.
Since IRExecutionUnit is now capable of looking up symbols, and the JIT is up to
the task of generating the appropriate relocations, we don't need to do all the
work that IRForTarget used to do to fixup symbols at the IR level.

We also don't need to allocate data manually (with its attendant bugs) because
the JIT is capable of doing so without crashing.

We also don't need the awkward lldb.call.realName metadata to determine what
calls are objc_msgSend, because they now just reference objc_msgSend.

To make this work, we ensure that we recognize which symbols are extern "C" and
report them to the compiler as such.  We also report the full Decl of functions
rather than just making up top-level functions with the appropriate types.

This should not break any testcases, but let me know if you run into any issues.

<rdar://problem/22864926>

llvm-svn: 260768
2016-02-13 00:01:46 +00:00
Sean Callanan f45270342c Fix stripping of _ when looking for symbols in IRExecutionUnit.
Previously we would try both versions of a symbol -- the one with _ in it and
the one without -- in all cases, because we didn't know what the current
platform's policy was.  However, stripping _ is only necessary on platforms
where _ is the prefix for global symbols.

There's an API that does this, though, on llvm::DataLayout, so this patch fixes
IRExecutionUnit to use that API to determine whether or not to strip _ from the
symbol or not.

llvm-svn: 260767
2016-02-12 23:55:13 +00:00
Enrico Granata fdecea7f59 Remove an unnecessary include
llvm-svn: 260761
2016-02-12 23:12:27 +00:00
Enrico Granata 75995b5e86 Data formatter support for libc++ std::atomic<T>
On libc++ std::atomic is a fairly simple data type (layout wise, at least), wrapping actual contents in a member variable named "__a_"

All the formatters are doing is "peel away" this intermediate layer and exposing user data as direct children or values of the std::atomic root variable

Fixes rdar://24329405

llvm-svn: 260752
2016-02-12 22:18:24 +00:00
Sean Callanan 8c05fb9fff Disable recognition of "using" declarations at translation-unit level.
Currently CountDeclLevels uses the ASTs which have no distinction between
separate translation units.  If one .o file has a "using" declaration at
translation unit level, that "using" declaration will be in the same translation
unit as functions from other .o files in the same module.  This leads to
erroneous name conflicts as the CountDeclLevels-based function filtering logic
accepts too many fucntions.

In the future we will identify the translation units for top-level Decls more
reliably and restore that functionality.  There's a TODO to that effect in the
code.

llvm-svn: 260747
2016-02-12 21:55:05 +00:00
Sean Callanan 8c62daf250 IRInterpreter now recognizes expressions with constants it doesn't handle.
If an instruction has a constant that IRInterpreter doesn't know how to deal
with (say, an array constant, because we can't materialize it to APInt) then we
used to ignore that and only fail during expression execution.  This is annoying
because if IRInterpreter had just returned false from CanInterpret(), the JIT
would have been used.

Now the IRInterpreter checks constants as part of CanInterpret(), so this should
hopefully no longer be an issue.

llvm-svn: 260735
2016-02-12 21:16:58 +00:00
Sean Callanan b281480203 Centralized symbol lookup in IRExecutionUnit, and fixed the code model.
I'm preparing to remove symbol lookup from IRForTarget, where it constitutes a
dreadful hack working around no-longer-existing JIT bugs.  Thanks to our 
contributors, IRForTarget has a lot of smarts that IRExecutionUnit doesn't have,
so I've cleaned them up a bit and moved them over to IRExecutionUnit.

Also for historical reasons, IRExecutionUnit used the "Small" code model on non-
ELF platforms (namely, OS X).  That's no longer necessary, and we can use the
same code model as everyone else on OS X.  I've fixed that.

llvm-svn: 260734
2016-02-12 21:11:25 +00:00
Siva Chandra 29d9bea93f Adjust for Python-3.
Summary:
This does not yet give us a clean testsuite run but it does help with:
1. Actually building on linux
2. Run the testsuite with over 70% tests passing on linux.

Reviewers: tfiala, labath, zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D17182

llvm-svn: 260721
2016-02-12 20:30:47 +00:00
Sean Callanan 7b3ef05a37 Objective-C++ is a kind of C++.
llvm-svn: 260715
2016-02-12 19:47:57 +00:00
Sean Callanan 92734d1b2b Make Target::CalculateProcess() return a sensible result.
The Calculate* functions in general should not derive any information that isn't
implicit, but for Target the process pointer is a member so it's fine to return
it for CalculateProcess().

llvm-svn: 260713
2016-02-12 19:45:31 +00:00
Sean Callanan abece15858 Renamed TestRdar12991846 to the more descriptive TestUnicodeLiterals.
Test cases should not be named after PR or Radar numbers.  It's fine to
annotate them with these numbers in comments, however.

llvm-svn: 260699
2016-02-12 18:42:00 +00:00
Enrico Granata 2543d29048 The data formatters for NSArray, NSDictionary and (only partially) NSSet contain logic to inspect the objects without running code.
However, they also contain fallback logic that - in cases where LLDB can't recognize the specific subclass - actually does run code in order to inspect those objects.

The argument for this logic was that these data types are critical enough that the risk of getting it wrong is outweighed by the advantage of always providing accurate child information.

Practical experience however shows that "po" - a code running data-inspection command - is quite frequently used, and not considered burdensome by users.
As such, this makes the code-running fallback in the data formatters a risk that carries very little actual reward. Also, unlike the time this code was originally written, we now have accurate class information for Objective-C, and thus we are less likely to improperly identify classes.

This commit removes support for the code-running fallback, and aligns the data formatters for NSArray, NSDictionary and NSSet to the general no-code-running behavior of other data formatters.

While it is possible for us to add support for some subclasses that are now no longer covered by static inspection alone, this is beyond the scope of this commit.

llvm-svn: 260664
2016-02-12 07:50:15 +00:00
Greg Clayton 9ddad935b9 Don't crash if we have a DIE that has a DW_AT_ranges attribute and yet the SymbolFileDWARF doesn't have a DebugRanges. If this happens print a nice error message to prompt the user to file a bug and attach the offending DWARF file so we can get the correct compiler fixed.
<rdar://problem/24458016>

llvm-svn: 260626
2016-02-12 00:07:16 +00:00
Jim Ingham 0ea010aecb When calling TypeSystemMap::Clear, objects being destroyed in the process of
clearing the map ended up calling back into the TypeSystemMap to do lookups.  
Not a good idea, and in this case it would cause a deadlock.

You would only see this when replacing the target contents after an exec, and only if you 
had stopped before the exec, evaluated an expression, then continued
on to the point where you did the exec.  

Fixed this by making sure the TypeSystemMap::Clear tears down the TypeSystems in the map before clearing the map.
I also add an expression before exec to the TestExec.py so that we'll catch this
issue if it crops up again in the future.

<rdar://problem/24554920>

llvm-svn: 260624
2016-02-12 00:03:19 +00:00
Greg Clayton 565aaf6194 Removed a bad assertion:
assert(((SymbolFileDWARF*)m_ast.GetSymbolFile())->UserIDMatches(die.GetDIERef().GetUID()) &&
       "Adding incorrect type to forward declaration map");

The problem is that "m_ast.GetSymbolFile()" can return a SymbolFileDWARFDebugMap. The code is doing the right thing if the assertion is ignored.

<rdar://problem/24437972>

llvm-svn: 260618
2016-02-11 23:36:57 +00:00
Ed Maste e3ddf4c25d XFAIL TestCommandScriptImmediateOutput on FreeBSD also
llvm-svn: 260589
2016-02-11 21:15:49 +00:00
Adrian McCarthy 6fadea62b5 Improve ReadRegister for RegisterContextWindowsx86
In some circumstances (notably, certain minidumps), the thread CONTEXT does not have values for the
control registers (EIP, ESP, EBP, EFLAGS).  There are flags in the CONTEXT which indicate which
portions are valid, but those flags weren't checked.  The old code would not detect this and give a
garbage value for the register.  The new code will log the problem and return an error.

I consolidated the error checking and logging into a helper function, which makes the big switch
statement easier to read and verify.

Ran tests to ensure this doesn't break anything.  Manually verified that a minidump without info on
the control registers now indicates the problem instead of giving bad information.

Differential Review: http://reviews.llvm.org/D17152

llvm-svn: 260559
2016-02-11 18:24:57 +00:00
Aidan Dodds 72f775253f [Renderscript] Fix typo in mips64 argument reading code.
A typo in the mips64 argument reading code would cause register passed arguments to be truncated to 32bits.

llvm-svn: 260546
2016-02-11 17:17:12 +00:00
Aidan Dodds f478678549 [Renderscript] Refactor target argument reading code.
This patch reworks the function argument reading code, allowing us to annotate arguments with their types.  The type/size information is needed to correctly parse arguments passed on the stack.

llvm-svn: 260525
2016-02-11 15:16:37 +00:00
Omair Javaid 62498ff8f5 Handle floating-point type homogeneous aggregate return values in ABISysV_arm
For details refer to review link given below.

Differential revision: http://reviews.llvm.org/D16975

llvm-svn: 260512
2016-02-11 11:41:22 +00:00
Jim Ingham b4a5aa239c Revert 260436. I pretty consistently upper-case the letter I use for the
short option as an aid to memory.  Like it's w because of the W in throW.

That helps me remember.  If we are going to take these out we should take them
all out.  But I kind of like them.

llvm-svn: 260452
2016-02-10 22:30:20 +00:00
Sean Callanan 3f9de74ba1 When importing Objective-C protocols, mark them as having external decls.
We already do this for Objective-C interfaces, but we never handled protocols
because the DWARF didn't represent them.  Nowadays, though, we can import them
from modules, and we have to mark them properly.

<rdar://problem/24193009>

llvm-svn: 260445
2016-02-10 22:00:32 +00:00
Zachary Turner fa61bb5be9 Fix copy/paste error in TestCModules.
llvm-svn: 260440
2016-02-10 21:47:36 +00:00
Enrico Granata 909e2cdc54 No reason for these two letters to be uppercase
llvm-svn: 260436
2016-02-10 21:30:20 +00:00
Greg Clayton ae088e52f3 Now that SymbolFileDWARF supports having types in completely separate .pcm file with "-fmodules -gmodules", each SymbolFileDWARF can reference module DWARF info by looking in other DWARF files. Then if you have 1000 .o files that each reference one or more .pcm files in their debug info, a simple Module::FindTypes(...) call can end up searching the same .pcm file over and over and over. Now all internal FindTypes methods in classes (ModuleList, Module, SymbolFile) now take an extra argument:
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files
    
Each time a SymbolFile::FindTypes() is called, it needs to check the searched_symbol_files list to make sure it hasn't already been asked to find the type and return immediately if it has been checked. This will stop circular dependencies from also crashing LLDB during type queries. 

This has proven to be an issue when debugging large applications on MacOSX that use DWARF in .o files. 

<rdar://problem/24581488>

llvm-svn: 260434
2016-02-10 21:28:13 +00:00
Zachary Turner b3cce5d33a Remove skipUnlessListedRemote.
This was supposed to have been removed but made it back in
accidentally.

llvm-svn: 260423
2016-02-10 19:53:45 +00:00
Zachary Turner 362e06d7ba Remove expectedFailureLinux decorator.
llvm-svn: 260422
2016-02-10 19:53:36 +00:00
Tamas Berghammer 5bfd4d0008 Revert "Improve the handling of missing elf symtab and missing symbol sizes"
This reverts commit 252dda67782f2cbf838e375bce21ed4191f6d9ce.

The commit caused several test failure on the OSX build bot.

llvm-svn: 260377
2016-02-10 12:10:58 +00:00
Ewan Crawford ea0636b554 [RenderScript] Refactor allocation expressions
Patch refractors RS plugin code specifying how format strings are used to JIT the runtime.

Author: Dean De Leo <dean@codeplay.com>
llvm-svn: 260372
2016-02-10 11:23:27 +00:00
Tamas Berghammer ed844cbc0f Improve the handling of missing elf symtab and missing symbol sizes
* Generate artificial symbol names from eh_fame during symbol parsing
  so these symbols are already present when we calcualte the size of
  the symbols where 0 is specified.
* Fix symbol size calculation for the last symbol in the file where
  it have to last until the end of the parent section.

Differential revision: http://reviews.llvm.org/D16996

llvm-svn: 260369
2016-02-10 10:43:34 +00:00
Tamas Berghammer 10e9923841 Fix handling of the arm IT instruction in the unwinder
The IT instruction can specify condition code for up to 4 consecutive
instruction and it is used quite often by clang in epilogues causing
an issue when trying to unwind from locations covered by the IT
instruction and for locatins inmediately after the IT instruction.

Changes made to fix it:
* Introduce the concept of conditional instruction block what is a list
  of consecutive instructions with the same condition. We update the
  unwind information during the conditional instruction block and when
  we reach the end of it (first instruction with a differemt condition)
  then we restore the unwind information we had before the condition.
* Fix a bug in the ARM instruction emulator where neither PC nor the
  ITSTATE was advanced when we reached an instruction what we can't
  decode.

After the change we have no regression on android-arm running the
regular test suit and TestStandardUnwind also passes when running it
with clang as the compiler (previously it failed on an IT instruction).

Differential revision: http://reviews.llvm.org/D16814

llvm-svn: 260368
2016-02-10 10:42:13 +00:00
Tamas Berghammer 1b6dacbb86 Use BKPT instead of UDF for arm/thumb breakpoints
The UDF instruction is deprecated in armv7 and in case of thumb2
instructions set it don't work well together with the IT instruction.

Differential revision: http://reviews.llvm.org/D16853

llvm-svn: 260367
2016-02-10 10:42:00 +00:00
Tamas Berghammer 2e912ec705 Add new option to lldb-server to display its version
llvm-svn: 260366
2016-02-10 10:35:48 +00:00
Mohit K. Bhakkad e92e3606dd [LLDB][MIPS] Generalise MIPS arch names
Patch by Nitesh Jain

Reviewers: clayborg, jaydeep.
Subscribers: zturner, bhushan, mohit.bhakkad, sagar, lldb-commits.
Differential Revision: http://reviews.llvm.org/D16840

llvm-svn: 260362
2016-02-10 06:58:13 +00:00
Jim Ingham c17d6bdbfb This is an idea to make "thread step-in --target" work for the common
case where you have:

1 ->    foo (bar(),
2            baz(),
3            lala());
4

You are sitting on line 1, and want to step into foo, but not bar, baz & lala.  Unfortunately
there are line table entries for lines 1-3, and lldb doesn't know anything about the nesting
of statement in these lines.  So we'll have to use the user's intelligence...  This patch adds:

(lldb) thread step-in -t foo --end-line 4

That tells lldb to keep stepping in till line 4, but stop if you step into foo.  I think I would
remember to use this when faced with some of the long gnarly call sequences in lldb.  But there
might be ways I haven't thought of to make it more convenient.  Jason suggests having "end" as a
special token for --end-line which just means keep going to the end of the function, I really want
to get into this thing...

There should be an SB API and tests, which will come if this seems useful.

llvm-svn: 260352
2016-02-10 03:25:24 +00:00
Enrico Granata 14086ed75d Change lldb.value.__int__() so that it takes into account the signedness of the value being cast to return a Python number with the proper value
The explicit APIs on SBValue obviously remain if one wants to be explicit in intent, or override this guess, but since __int__() has to pick one, an educated guess is definitely better than than always going to signed regardless

Fixes rdar://24556976

llvm-svn: 260349
2016-02-10 02:12:42 +00:00
Jim Ingham 78591726fd Add a missing break.
llvm-svn: 260345
2016-02-10 01:33:58 +00:00
Adrian McCarthy e286b8d652 Don't dereference the first element of an empty container.
llvm-svn: 260331
2016-02-10 00:06:50 +00:00