Commit Graph

14668 Commits

Author SHA1 Message Date
Greg Clayton 4a9d83a55e Fix a memory leak in InstructionLLVMC where it held onto a strong reference to the DisassemblerLLVMC which in turn had a vector of InstructionSP causing the strong cycle. This is fixed now.
Rules are as follows for internal code using lldb::DisassemblerSP and lldb::InstructionSP:
1 - The disassembler needs to stay around as long as instructions do as the Instruction subclass now has a weak pointer to the disassembler
2 - The public API has been fixed so that if you get a SBInstruction, it will hold onto a strong reference to the disassembler in a new InstructionImpl class

This will keep code like like: 

inst = lldb.target.ReadInstructions(frame.GetPCAddress(), 1).GetInstructionAtIndex(0)
inst.GetMnemonic()

Working as expected (not the SBInstructionList() that was returned by SBTarget.ReadInstructions() is gone, but "inst" has a strong reference inside of it to the disassembler and the instruction.
                                                     
All code inside the LLDB shared library was verified to correctly hold onto the disassembler instance in all places.

<rdar://problem/24585496>

llvm-svn: 272069
2016-06-07 22:56:40 +00:00
Pavel Labath f0f62d8451 Revert "Make lldbinline.py regenerate the Makefile each time it builds."
This reverts commit r272024 as it is not windows-compatible.

llvm-svn: 272062
2016-06-07 21:29:46 +00:00
Pavel Labath 5de59348fe Don't use SO_REUSEADDR for *client* sockets
Summary:
In the case of client sockets, we are not binding to a specific port, so we
should be able to just request a new one. Disregarding refactors, this code
has been here since the initial LLDB checkin, so I was unable to figure out
whether it was added as a fix for a specific problem, or just for symmetry
with server sockets, but I see no side-effect from removing it now. I was
still able to create 10000 connections within a couple of seconds, so I think
it's unlikely we will exhaust the port space (previously, I would get an
error after a couple thousand connections).

This fixes an occasional issue with connecting to the android debug bridge
deamon on OSX when running the test suite, which would occasionaly fail with
EADDRINUSE. My best guess is that this was happening because two processes
were assigned the same client port number, and then things blew up because
they were both trying to connect to the same ADB server port. I have not
observed this issue happening on Linux or Windows.

Reviewers: clayborg

Subscribers: tberghammer, danalbert, lldb-commits

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

llvm-svn: 272041
2016-06-07 18:36:38 +00:00
Greg Clayton c11e249bfd LLDB is leaking memory in Editline.cpp on MacOSX.
When USE_SETUPTERM_WORKAROUND is enabled, we were calling setupterm() multiple times and leaking memory on each subsequent call. This is now fixed by calling setupterm() once in the constructor and tracking if we have already setup a terminal for a file descriptor.

Calls to "el_set (m_editline, EL_ADDFN, ..." were leaking memory. If we switch over to call el_wset with wide strings when LLDB_EDITLINE_USE_WCHAR is set, then we no longer leak memory each time we construct a new Editline object.

The calls to "el_set (m_editline, EL_ADDFN, ..." were changed over to call "el_wset (m_editline, EL_ADDFN, ...". Note that when LLDB_EDITLINE_USE_WCHAR is not defined, then el_wset is #define'ed to el_set. All strings are wrapped in EditLineConstString which will use wide strings when needed, and normal C strings when LLDB_EDITLINE_USE_WCHAR is not defined.

<rdar://problem/26677627>

llvm-svn: 272036
2016-06-07 18:16:39 +00:00
Sean Callanan 968bb72f58 Make lldbinline.py regenerate the Makefile each time it builds.
If a lldbinline test's source file changed language, then the Makefile wasn't
updated.  This was a problem if the Makefile was checked into the repository.

Now lldbinline.py always regenerates the Makefile and asserts if the
newly-generated version is not the same as the one already there.  This ensures
that the repository will never be out of date without a buildbot failing.

http://reviews.llvm.org/D21032

llvm-svn: 272024
2016-06-07 17:22:18 +00:00
Jason Molenda c7afda5a09 Add support for using armv7 compact unwind information
as an asynchronous unwind plan source.

Two small fixes to the compact unwind dumper tool for
armv7 encodings.

A change to DWARFCallFrameInfo to strip the 0th bit on
addresses in eh_frame sections when armv7.  In the 
clang generated examples I have, the 0th bit is set for
thumb functions and that's causing the unwinder to pick
the wrong function for eh_frame info.

llvm-svn: 271970
2016-06-07 02:19:54 +00:00
Francis Ricci 80dbd154fa Don't remove PIE executables when using svr4 packets
Summary:
Because PIE executables have an e_type of llvm::ELF::ET_DYN,
they are not of type eTypeExecutable, and were being removed
when svr4 packets were used.

Reviewers: clayborg, ADodds, tfiala, sas

Subscribers: lldb-commits

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

llvm-svn: 271899
2016-06-06 15:00:50 +00:00
Carlo Kok 490d18b3c5 (Minor tweak) Make RegisterContextWindows_x86/x64::GetRegisterInfoAtIndex
return NULL for an invalid register.

The unwind logic asks for the "return address register" which doesn't exist
on x86/x86_64, returns -1 and calls this with -1 as a parameter, ends up 
out of scope of the array bounds for g_register_infos and later SIGSEGVs 
on accessing. This now matches the other GetRegisterInfoAtIndex for
other platforms.

llvm-svn: 271876
2016-06-06 09:40:27 +00:00
Stephane Sezer 04a89fd826 Fix function name lookup in IRExecutionEngine.cpp.
Summary:
Without this commit, when `log enable lldb expr` is enabled, the
disassembly of JIT'ed code is never displayed.

Reviewers: spyffe, clayborg

Subscribers: lldb-commits

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

llvm-svn: 271863
2016-06-06 02:50:46 +00:00
Jason Molenda 159ccb49b3 Add armv7 compact unwind printing to the compact-unwind-dumper.c tool
as a prototype for adding armv7 compact unwind reading to lldb.

llvm-svn: 271774
2016-06-04 04:10:15 +00:00
Greg Clayton 6e85115272 Fix a printf warning.
llvm-svn: 271716
2016-06-03 19:45:05 +00:00
Greg Clayton 73cc4c4ced Add support in debug LLDB builds (if LLDB_CONFIGURATION_DEBUG is defined) where we can set an environment variable named LLDB_DWARF_DONT_COMPLETE_TYPENAMES that can contain one or more typenames separated by ';' characters. This will cause us to not complete any types whose names match and can help us to try and reproduce issues we see in bugs.
So you can launch LLDB with the environment variable:

% LLDB_DWARF_DONT_COMPLETE_TYPENAMES=Foo;Bar;Baz lldb

llvm-svn: 271696
2016-06-03 17:59:26 +00:00
Tamas Berghammer 50ce381a5c Fix makefile for TestExternCSymbols
llvm-svn: 271618
2016-06-03 01:03:04 +00:00
Sean Callanan 34ab28a470 Fixed a problem where we couldn't call extern "C" functions.
Some compilers do not mark up C++ functions as extern "C" in the DWARF, so LLDB
has to fall back (if it is about to give up finding a symbol) to using the base
name of the function.

This fix also ensures that we search by full name rather than "auto," which
could cause unrelated C++ names to be found.  Finally, it adds a test case.

<rdar://problem/25094302>

llvm-svn: 271551
2016-06-02 17:59:47 +00:00
Greg Clayton 218b3b9ac5 LLDB needs to be able to handle DW_AT_GNU_dwo_name that are relative to the DW_AT_comp_dir when using -gmodules with DWARF in .o files on darwin.
<rdar://problem/26590227> 

llvm-svn: 271545
2016-06-02 17:22:42 +00:00
Greg Clayton 93c99cf059 Fixed a problem where -gmodules debug info would be loaded by the DWO file support accidentally and cause 1000s of files to be mapped into LLDB's address space for each .o file that reference a module.
<rdar://problem/26580266> -gmodules causes LLDB.framework to map hundreds of copies of the same .pcm file

llvm-svn: 271543
2016-06-02 17:19:39 +00:00
Tamas Berghammer 858aba0666 Fix JavaArraySyntheticFrontEnd for non-reference ValueObject.
Summary: Fix missing return after checking that m_backend is not a pointer or reference type.

Reviewers: clayborg, tberghammer

Subscribers: lldb-commits

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

llvm-svn: 271453
2016-06-02 00:45:38 +00:00
Devin Coughlin a10ab76b16 [tsan] Prefer mangled name looking up variable declaration for racy address
For Thread Sanitizer reports, LLDB tries to find a global variable declaration
corresponding to the racy address in order to provide a filename and line
number. This commit changes the lookup of the variable to use the mangled
name for lookup and fall back to the demangled version if unavailable. This
is needed to report locations of races on Swift global variables.

I've also added a test to make sure we look up C++ globals correctly.

rdar://problem/26459401

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

llvm-svn: 271433
2016-06-01 21:32:45 +00:00
Greg Clayton 892fa7dbcb Add more verification on consectutive bitfields otherwise clang will assert.
We need to verify that consecutive bitfields have higher offsets and don't overlap. The issues was found by running a broken version of recent clangs where the bitfield offsets were being emitted incorrectly. To guard against this we now verify and toss out any invalid bitfields and print a message that indicates to file a bug against the compiler.

<rdar://problem/25737621>

llvm-svn: 271343
2016-05-31 22:29:56 +00:00
Chris Bieneman c12cabb4f4 [CMake] Update to requiring CMake 3.4.3
Summary:
This is as per the discussions on developer lists:

http://lists.llvm.org/pipermail/llvm-dev/2016-April/098780.html
http://lists.llvm.org/pipermail/llvm-dev/2016-May/100058.html

Subscribers: lldb-commits

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

llvm-svn: 271328
2016-05-31 20:21:44 +00:00
Todd Fiala 7aa4d977ea Implement ProcessInfo::Dump(), log gdb-remote stub launch
This change implements dumping the executable, triple,
args and environment when using ProcessInfo::Dump().

It also tweaks the way Args::Dump() works so that it prints
a configurable label rather than argv[{index}]={value}. By
default it behaves the same, but if the Dump() method with
the additional arg is provided, it can be overridden. The
environment variables dumped as part of ProcessInfo::Dump()
make use of that.

lldb-server has been modified to dump the gdb-remote stub's
ProcessInfo before launching if the "gdb-remote process" channel
is logged.

llvm-svn: 271312
2016-05-31 18:32:20 +00:00
Cameron Desrochers 64f6c6644e [LLDB] Make sure that indexing is done before clearing DIE info
"ClearDIEs()" was being called too soon, before everyone was done using the DIEs.

This fix delays the calls to ::ClearDIEs() until all compile units have been indexed.

1 - Call "::ExtractDIEsIfNeeded()" on all compile units on separate threads. See if each CU has the DIEs parsed and remember this.
2 - Index all compile units on separate threads.
3 - Clear any DIEs in any compile units that didn't have their DIEs parsed after all compile units have been indexed.

Patch by phlav

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

llvm-svn: 271209
2016-05-30 15:32:51 +00:00
Todd Fiala 873a2ab4be fix up lldb-server platform on Apple hosts
r259714 introduces the transport method into the
URL passed to the gdb-remote stub.  On debugserver,
this is not supported and prevented debugserver from
being launched by lldb-server in platform mode.

This change skips the transport method addition from
r259714 when on Apple hosts.

llvm-svn: 270961
2016-05-27 04:04:52 +00:00
Greg Clayton 4141c7af82 Add a new "lldb" log channel named "demangle". If we have crashes that are related to demangling, we now can enable this logging and we will be able to reproduce demangler crashes (usually due to overflowing the stack) without needing someone's project.
<rdar://problem/25221899>                                                                     

llvm-svn: 270941
2016-05-27 00:17:18 +00:00
Jim Ingham 1cf8f5937a Lock the access to the BreakpointLocationCollection.
I was investigating an odd crash in lldb when the breakpoint site
goes to bump the hit counts of the locations it implements.  I noticed
that the BreakpointLocationCollection wasn't locking itself for access and
modification.  I don't see how that can cause the crash I'm seeing, but still
this is the right thing to do...

<rdar://problem/25178205>

llvm-svn: 270939
2016-05-26 23:55:04 +00:00
Jim Ingham 13683c65cd Don't cache the stret/vrs. non-stret code pointer as static data in the runtime.
It belongs in the instance, since then when you change architectures it can be adjusted
appropriately.

<rdar://problem/26308079>

llvm-svn: 270938
2016-05-26 23:49:49 +00:00
Greg Clayton ceeb521127 With -gmodules, we have been having a harder time always finding a type when we need one.
We have seen cases where we have been unable to find an argument type for a function, or we find one from another language, and then we try to create a function type by calling:

lldb_private::ClangASTContext::CreateFunctionType(clang::ASTContext*, lldb_private::CompilerType const&, lldb_private::CompilerType const*, unsigned int, bool, unsigned int)

This fix will ensure that all arguments to lldb_private::ClangASTContext::CreateFunctionType() are in order by checking:
- AST is valid
- if arguments are specified we have a valid argument array
- return type is valid
- return type is a clang type
- all argument types are valid
- all argument types are clang types

If any of these fail, we return an invalid CompilerType. If we don't return an invalid type, clang will crash anyway, and LLDB must not crash even in the presence of bad or missing debug info.

<rdar://problem/25172715>

llvm-svn: 270932
2016-05-26 22:33:25 +00:00
Greg Clayton 23c12ca922 Make sure that we succeed in starting a definition before we complete it and emit an error if we fail to start the definition.
ClangASTContext::StartTagDeclarationDefinition(...) was starting definitions for any TagType instances that have TagDecl, but ClangASTContext::CompleteTagDeclarationDefinition(...) was getting the type to a CXXRecordDecl with:

    clang::CXXRecordDecl *cxx_record_decl = qual_type->getAsCXXRecordDecl();
    
The problem is that getAsCXXRecordDecl() might dig a bit deeper into a type and dig out a different decl, which means we might call ClangASTContext::StartTagDeclarationDefinition(...), but it might not do anything, and then we might call ClangASTContext::CompleteTagDeclarationDefinition(...) and it might try to complete something that didn't have its definition started and this will crash.

This change fixes that, and also makes sure that starting a definition succeeds before any calls to ClangASTContext::CompleteTagDeclarationDefinition().
                                                    
<rdar://problem/24091798>

llvm-svn: 270891
2016-05-26 19:24:02 +00:00
Greg Clayton 6c42e06312 Guard against the C++ destructor chain by not letting the debugger list clean up after itself in the C++ destructor chain.
If users call "static void lldb::SBDebugger::Terminate()" we will clean up the debugger list, and users can individually destroy debugger instances with "static void lldb::SBDebugger::Destroy(SBDebugger &)". But if we let the C++ destructor chain tear down this list, other threads that might still be running as the main thread exits can now crash if they access the debugger list. We stop this by leaking the debugger list and its mutex.

<rdar://problem/26372169>

llvm-svn: 270869
2016-05-26 16:51:23 +00:00
Pavel Labath a0adeb69ab [cmake] Remove the LLDB versions of the exception-controlling variables
Summary:
One can still use the LLVM variables to control this: LLVM_ENABLE_EH, LLVM_ENABLE_RTTI. It's not
clear to me why one would want to control these at lldb level and it's generally not even a good
idea to compile parts of the same binary with different values of these flags.

Reviewers: zturner, tfiala

Subscribers: lldb-commits

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

llvm-svn: 270863
2016-05-26 16:11:04 +00:00
Pavel Labath 95d6c7731c [cmake] Add a big warning about a libstdc++ issue
Summary:
Recent increase in the usage of std::weak_ptr has caused us to rediscover an issue in libstdc++
versions prior to 4.9 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59656>, which make this class
unusable without exceptions in the presence of multiple threads. It's virtualy impossible to work
around this issue without implementing our own shared_ptr/weak_ptr substitutes, which does not
seem like a good idea.

Therefore, I am adding a big CMake warning which warns you about this issue if you're attempting
a to do a build which is suceptible to this problem and suggests possible alternatives. Right
now, nothing spectacular will happen if you ignore this warning (all the crashes I have seen
occur during process shutdown), but there's no guarantee the situation will not change in the
future.

Reviewers: tberghammer, tfiala, nitesh.jain, omjavaid, emaste, krytarowski

Subscribers: lldb-commits

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

llvm-svn: 270854
2016-05-26 15:16:11 +00:00
Todd Fiala 94eb010fe9 Add "-gmodules" support to the test suite.
This change adds the capability of building test inferiors
with the -gmodules flag to enable module debug info support.
Windows is excluded per @zturner.

Reviewers: granata.enrico, aprantl, zturner, labath

Subscribers: zturner, labath, lldb-commits

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

llvm-svn: 270848
2016-05-26 13:57:03 +00:00
Pavel Labath 23ef3695d4 [cmake] Add ability to customize (and skip) debugserver codesign
Summary:
This adds the ability to customize the debugserver codesign process via cmake cache variable. The
user can set the codesign indentity (with the default being the customary lldb_codesign), and if
the identity is set to a empty string, the codesign step is skipped completely.

We needed the last feature to enable building lldb on buildservers which do not have the right
certificates installed.

Reviewers: sas, tberghammer

Subscribers: lldb-commits

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

llvm-svn: 270832
2016-05-26 08:38:10 +00:00
Pavel Labath 0314b00daa Avoid using stdio in TestVirtual
Summary:
using stdio in tests does not work on windows, and it is not completely reliable on linux.
Avoid using stdio in this test, as it is not necessary for this purpose.

Reviewers: clayborg

Subscribers: lldb-commits, zturner

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

llvm-svn: 270831
2016-05-26 08:38:02 +00:00
Jason Molenda 0bc8994a4c Small further refinement to the check in ObjectFileMachO::ParseSymtab
which looks for binaries missing an LC_FUNCTION_STARTS section because
it was stripped/not emitted.  If we see a normal user process binary
(executable, dylib, framework, bundle) without LC_FUNCTION_STARTS, that
is unusual and we should disallow instruction emulation because that
binary has likely been stripped a lot.

If this is a non-user process binary -- a kernel, a standalone bare-board
binary, a kernel extension (kext) -- and there is no LC_FUNCTION_STARTS,
we should not assume anything about the binary and allow instruction
emulation as we would normally do.

<rdar://problem/26453952> 

llvm-svn: 270818
2016-05-26 04:22:47 +00:00
Greg Clayton a61d0a5b01 Make sure to try and take the process stop lock when calling:
uint32_t SBProcess::GetNumQueues();
SBQueue SBProcess::GetQueueAtIndex (size_t index);

Otherwise this code will run when the process is running and cause problems.

<rdar://problem/26482744>

llvm-svn: 270803
2016-05-26 00:08:39 +00:00
Enrico Granata fee0aba006 It has been brought to my attention that, given two variables
T x;
U y;

doing

x = *((T*)y)

is undefined behavior, even if sizeof(T) == sizeof(U), due to pointer aliasing rules

Fix up a couple of places in LLDB that were doing this, and transform them into a defined and safe memcpy() operation

Also, add a test case to ensure we didn't regress by doing this w.r.t. tagged pointer NSDate instances

llvm-svn: 270793
2016-05-25 23:19:01 +00:00
Omair Javaid 1b356bf898 Mark some aarch64-linux specific xfails marking bug entries
TestBSDArchives.py and TestWatchLocation.py fail due to unicode error and bug has already been reported for arm and macOSx.

TestConstVariables.py fails because lldb cant figure out frame variable type when used in expr.

llvm-svn: 270780
2016-05-25 22:30:05 +00:00
Enrico Granata acfe8fadaa Add logging to ValueObjectSyntheticFilter such that one can trace through the creation of synthetic children
llvm-svn: 270770
2016-05-25 21:38:32 +00:00
Enrico Granata f02be230f6 Fix an issue where LLDB would crash if one tried to 'frame variable' an unordered_map more than once in a stop due to the synthetic provider not properly caching the ValueObjects it was returning for the child elements
Fixes rdar://26470909

llvm-svn: 270752
2016-05-25 20:38:33 +00:00
Omair Javaid 0d435b6933 Mark some arm-linux specific xfails marking bug entries
TestCallUserAnonTypedef.py and TestIRInterpreter.py fail to limitation of JIT expressions in handling hard float ABI targets.
TestBSDArchives.py fails due to python unicode error.
TestBuiltinTrap.py fails due to wrong line information generated by some gcc versions.

llvm-svn: 270745
2016-05-25 18:48:39 +00:00
Pavel Labath df2ad4c531 Add unit tests for ModuleCache
Reviewers: ovyalov, zturner

Subscribers: lldb-commits

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

llvm-svn: 270684
2016-05-25 10:48:16 +00:00
Jason Molenda ec90b5d030 Include <mutex> in Process.h - Jim's change in r270593 added a std::mutex
ivar and this header is needed for it to compile on linux, judging by the
build bots.

llvm-svn: 270662
2016-05-25 05:14:16 +00:00
Jason Molenda b667c20222 Add support for arm64 compact unwind tables, used on darwin arm64
systems (ios, tvos, watchos).  It's a simple format to use now that
I have i386/x86_64 supported already.

The unwind instructions are only valid at call sites -- that is,
when lldb is unwinding a frame in the middle of the stack.  It
cannot be used for the currently executing frame; it has no information
about prologues/epilogues/etc.

<rdar://problem/12062336> 

llvm-svn: 270658
2016-05-25 04:20:28 +00:00
Enrico Granata 34c77c3c93 Fix an issue where the NSDate data formatter was not using the proper alignment on watchOS targets
Fixes rdar://problem/23298264

llvm-svn: 270621
2016-05-24 22:11:57 +00:00
Jason Molenda 63294b730d Ach, editing too many files at once. Make this file compile again.
llvm-svn: 270620
2016-05-24 22:05:22 +00:00
Jason Molenda 94ddce2c0e In r268475 I made a change to ObjectFileMachO so that if it is
missing an LC_FUNCTION_STARTS section, we assume it has been
aggressively stripped (it is *very* unusual for anyone to strip
LC_FUNCTION_STARTS) so we disable assembly instruction unwind plan
creation.

Kernel extensions (kexts) don't have LC_FUNCTION_STARTS, but we
almost always have good symbol bounds just with the linker symbols.
So add an exception to allow assembly instruction unwind plan
creation for kexts even though they lack LC_FUNCTION_STARTS.

<rdar://problem/26453952> 

llvm-svn: 270618
2016-05-24 21:46:23 +00:00
Kuba Brecka 042975183e Reword the "Happened at" TSan-reported thread to contain a thread id.
llvm-svn: 270608
2016-05-24 20:35:28 +00:00
Ed Maste dfbdf80962 xfail TestRedefinitionsInline with older Clang
This fails on FreeBSD 10 with the system compiler, Clang 3.4.1.

llvm.org/pr27845

llvm-svn: 270603
2016-05-24 19:51:11 +00:00
Jim Ingham 3cc425837d Lock out Process::RunThreadPlan so only one can be in flight at a time.
What with all sorts of folks (TSAN, ASAN, queue detection, etc...) trying to
gather info by calling functions down in the lower layers of lldb, we've started
to see people running expressions simultaneously.  The expression evaluation part
is okay, but only one RunThreadPlan can be active at a time.  I added a lock to
enforce that.

<rdar://problem/26431072>

llvm-svn: 270593
2016-05-24 18:29:36 +00:00
Francis Ricci 15a2165d64 Skip leading spaces when decoding hex values
Summary:
The StringExtractor functions using stroull will already
skip leading whitespace (ie GetU64). Make sure that the manual
hex parsing functions also skip leading whitespace.

This is important for members of the gdb protocol which are defined
as using whitespace separators (ie qfThreadInfo, qC, etc). While
lldb-server does not use the whitespace separators, gdb-remotes
should work if they do, as the whitespace is defined by the gdb-remote
protocol.

Reviewers: vharron, jasonmolenda, clayborg

Subscribers: sas, lldb-commits

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

llvm-svn: 270592
2016-05-24 18:19:45 +00:00
Oleksiy Vyalov 3154e77795 Replace file system forbidden symbols in the hostname which passed to the ModuleCache.
http://reviews.llvm.org/D20548

llvm-svn: 270590
2016-05-24 18:09:05 +00:00
Kuba Brecka 6602e692ef Improve wording in TSan reports involving global variables. Don't repeat hex addresses that are the same.
llvm-svn: 270588
2016-05-24 17:47:23 +00:00
Pavel Labath 4f23d1e27c Add a missing include to ItaniumABILanguageRuntime.h
some (I'm not sure why only some, actually) implementations of std::map require the value type to
be a fully specified type when declaring then. This make sure TypeAndOrName is.

llvm-svn: 270570
2016-05-24 15:32:40 +00:00
Sagar Thakur ad5b55a277 [LLDB][MIPS] Fix floating point handling in case of thread step-out
Patch by Nitesh Jain.

Summary: These patch fix thread step-out for hard and soft float.

Reviewers: jaydeep, bhushan, clayborg
Differential Revision: http://reviews.llvm.org/D20416

llvm-svn: 270564
2016-05-24 14:52:50 +00:00
Chaoren Lin 1245c2b39b Make sure TestRedefinitionsInInlines.py actually inlines.
Reviewers: spyffe

Subscribers: lldb-commits

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

llvm-svn: 270493
2016-05-23 21:44:34 +00:00
Zachary Turner 76f3def58a xfail TestRedefinitionsInline on Windows.
llvm-svn: 270490
2016-05-23 21:22:11 +00:00
Greg Clayton c226778768 We have many radars showing that stepping through C++ code can result in slow steps.
One of the things slowing us down is that ItaniumABILanguageRuntime class doesn't cache vtable to types in a map. This causes us, on every step, for every variable, to read the first pointer in a C++ type that could be dynamic and lookup the symbol, possibly in every symbol file (some symbols files on Darwin can end up having thousands of .o files when using DWARF in .o files, so thousands of .o files are searched each time). 

This fix caches lldb_private::Address (the resolved vtable symbol address in section + offset format) to TypeAndOrName instances inside the one ItaniumABILanguageRuntime in a process. This allows caching of dynamic types and stops us from always doing deep searches in each file.

<rdar://problem/18890778>

llvm-svn: 270488
2016-05-23 20:37:24 +00:00
Todd Fiala 562469cc69 add cmake files to Xcode project
This makes it easier to use Xcode revision diffing tools on them.

llvm-svn: 270476
2016-05-23 18:56:05 +00:00
Sean Callanan 5ba3215fe3 Removed the m_decl_objects map from ClangASTContext.
m_decl_objects is problematic because it assumes that each VarDecl has a unique
variable associated with it.  This is not the case in inline contexts.

Also the information in this map can be reconstructed very easily without
maintaining the map.  The rest of the testsuite passes with this cange, and I've
added a testcase covering the inline contexts affected by this.

<rdar://problem/26278502>

llvm-svn: 270474
2016-05-23 18:30:59 +00:00
Zachary Turner fa7f948237 Always rerun all tests on Windows.
There is flakiness somewhere in the core infrastructure on Windows,
so to get the buildbot reliably green we need to mark all tests
as flaky.

llvm-svn: 270460
2016-05-23 17:32:04 +00:00
Enrico Granata 64c034da2b SBValue::CreateValueFromData didn’t check whether the SBType passed into it is in fact a valid type - this can lead to LLDB crashing upon access
Committing on behalf of Sebastian Theophil

llvm-svn: 270456
2016-05-23 17:11:14 +00:00
Saleem Abdulrasool 3b0bde2c2c SymbolFile: remove an unused variable
Address a -Wunused-but-set-variable warning from gcc.  NFC.

llvm-svn: 270377
2016-05-22 20:16:53 +00:00
Kuba Brecka 1a349b8d65 Reword ThreadSanitizer messages to use a lowercase 't' in thread names when in the middle of a sentence.
llvm-svn: 270365
2016-05-22 14:56:33 +00:00
Kuba Brecka 52ded8072a Reword ThreadSanitizer message for invalid mutex reports.
llvm-svn: 270364
2016-05-22 14:32:45 +00:00
Kuba Brecka 00d7c563d2 A better fix of incorrectly used locking in HistoryThread and HistoryUnwind.
llvm-svn: 270363
2016-05-22 14:19:11 +00:00
Kuba Brecka d9b228128b Revert r270358 ("Fix an incorrectly used locking in HistoryThread and HistoryUnwind").
llvm-svn: 270359
2016-05-22 14:05:28 +00:00
Kuba Brecka 7380f25d29 Fix an incorrectly used locking in HistoryThread and HistoryUnwind, where unique_lock's release() was called causing the mutex to stay locked.
llvm-svn: 270358
2016-05-22 12:24:38 +00:00
Greg Clayton 259d786065 Adopt mmap flags that allow mmap'ed memory to be less crash prone.
On Darwin if a mmap file is code signed and the code signature is invalid, it used to crash. If we specify the MAP_RESILIENT_CODESIGN mmap flag when mapping a file for reading, we can avoid crashing.

Another mmap flag named MAP_RESILIENT_MEDIA allows us to survive if we mmap files that are on removable media like network servers or removable hard drives. If a file was mapped and later the media that had the file became unavailable, we would crash when we would touch the next page that wasn't paged in. Now it will return zeroes and stop of from us from crashing.

<rdar://problem/25918698>

llvm-svn: 270254
2016-05-20 19:18:20 +00:00
Tamas Berghammer 216963a723 Revert rL270207: "[LLDB][MIPS] Fix floating point handling in case of thread step-out"
The CL causes a build breakage on platforms where sizeof(double) == sizeof(long double)
and it incorrectly assumes that sizeof(double) and sizeof(long double) is the same
on the host and the target.

llvm-svn: 270214
2016-05-20 13:07:16 +00:00
Sagar Thakur b189db627c [LLDB][MIPS] Fix Floating point Registers Encoding
Patch by Nitesh Jain.

Summary: Currently floating point regsiters has eEncodingUint encoding. Hence register write  '1.25' will failed. This patch add eEncodingIEEE754 encoding for floating point registers( - ). This patch will fix test_fp_register_write in TestRegisters.py

Reviewers: clayborg, sagar
Subscribers: mohit.bhakkad, jaydeep, bhushan, sdardis, lldb-commits
Differential: D18853
llvm-svn: 270208
2016-05-20 12:11:52 +00:00
Sagar Thakur 71b1decd72 [LLDB][MIPS] Fix floating point handling in case of thread step-out
Patch by Nitesh Jain.

Summary: These patch fix thread step-out for hard and soft float.

Reviewers: clayborg, bhushan, jaydeep
Subscribers: mohit.bhakkad, sagar, sdardis
Differential: D20416
llvm-svn: 270207
2016-05-20 12:07:27 +00:00
Tamas Berghammer 059e5fb44f Work around android-arm NDK bug exposed by rL269992
In the android-arm ndk there is a duplicated typedef in link.h
and in unwind.h causing build erros. This CL introduces a HACK
to prevent LLVM from finding unwind.h to fix the issue.

llvm-svn: 270201
2016-05-20 10:58:55 +00:00
Jason Molenda 1ebb2c92f2 Some changes to prevent searching down the stack for saved register
values for the pc or return address register.

On ios with arm64 and a binary that has multiple functions without 
individual symbol boundaries, we end up with an assembly profile
unwind plan that says lr=<same> - that is, the link register contents
are unmodified from the caller's value.  This gets the unwinder in
a loop.  

When we're off the 0th frame, we never want to look to a caller for
a pc or return-address register value.

Add checks to ReadGPRValue and ReadRegister to prevent both the pc
and ra register values from recursing.

If this causes problems with backtraces on android, let me know or
back it out and I'll look into it -- but I think these are
straightforward and don't expect problems.

<rdar://problem/24610365> 

llvm-svn: 270162
2016-05-20 00:16:14 +00:00
Jim Ingham d9e02c4f3c Remove a should have been deleted extra assignment to a variable.
Also fix up the formatting a bit, it looks like something was inserting
actual tabs.  Replace with 4 spaces.

llvm-svn: 270148
2016-05-19 22:22:57 +00:00
Sean Callanan 37e2664f30 Fixed a crash if a FunctionDecl couldn't be imported.
llvm-svn: 270097
2016-05-19 19:23:37 +00:00
Bryan Chan 01319e93ab Avoid an assertion failure when a bit field is extracted from a value of the same size.
Summary: One of the cases handled by ValueObjectChild::UpdateValue() uses the entire width of the parent's scalar value as the size of the child, and extracts the child by calling Scalar::ExtractBitfield(). This seems valid but APInt::trunc(), APInt::sext() and APInt::zext() assert that the bit field must not have the same size as the parent scalar. Replacing those calls with sextOrTrunc(), zextOrTrunc(), sextOrSelf() and zextOrSelf() fixes the assertion failures.

Reviewers: uweigand, labath

Subscribers: labath, lldb-commits

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

llvm-svn: 270062
2016-05-19 13:51:20 +00:00
Tamas Berghammer 87530300cd Fix build after rL270009
llvm-svn: 270040
2016-05-19 10:53:10 +00:00
Saleem Abdulrasool bb19a13c0b second pass over removal of Mutex and Condition
llvm-svn: 270024
2016-05-19 05:13:57 +00:00
Jason Molenda 1fec404da0 Check that __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ is defined
before comparing the value of it.
<rdar://problem/26333564> 

llvm-svn: 270015
2016-05-19 02:16:41 +00:00
Jim Ingham 906d91e762 Fix error propagation from the Z0 packet in gdb-remote breakpoint setting.
The error was not getting propagated to the caller, so the higher layers thought the breakpoint
was successfully set & resolved.

I added a testcase, but it assumes 0x0 is not a valid place to set a breakpoint.  On most systems
that is true, but if it isn't true of your system, either find another good place and add it to the
test, or x-fail the test.

<rdar://problem/26345962>

llvm-svn: 270014
2016-05-19 02:13:44 +00:00
Enrico Granata 109dd2e2a2 Fix an issue where debugserver would not properly vend OS version information on iOS devices
The __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED macro is only defined on OS X, so the check as written compiled the code out for iOS
The right thing to do is compile the code out for older OSX versions, but leave iOS alone

rdar://26333564

llvm-svn: 270004
2016-05-18 23:59:24 +00:00
Eugene Zelenko 000752f171 Fix standalone LLDB build, when LLVM/Clang were built with LLVM_INSTALL_TOOLCHAIN_ONLY=ON.
Fix standalone build with CMake 2.8.12.2.

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

llvm-svn: 269996
2016-05-18 22:50:08 +00:00
Omair Javaid bc782a866b xfail TestTopLevelExprs for arm and aarch64 linux
TestTopLevelExprs fails on arm and aarch64 linux similar to behaviour on android.
A bug exists here: llvm.org/pr27787. 

This patch marks xfail on arm and aarch64.

llvm-svn: 269980
2016-05-18 20:45:12 +00:00
Saleem Abdulrasool 16ff860469 remove use of Mutex in favour of std::{,recursive_}mutex
This is a pretty straightforward first pass over removing a number of uses of
Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there
are interfaces which take Mutex::Locker & to lock internal locks. This patch
cleans up most of the easy cases. The only non-trivial change is in
CommandObjectTarget.cpp where a Mutex::Locker was split into two.

llvm-svn: 269877
2016-05-18 01:59:10 +00:00
Omair Javaid c675cfa8a9 xfail TestWatchLocation.py for arm-linux targets
TestWatchLocation.py fails on arm-linux target due to unicode error in lldb testsuite.
This is a known issue and same test fails on OS X with similar reason.
I have reported a bug and marked this test as xfail for arm-linux targets.

llvm-svn: 269860
2016-05-17 23:01:56 +00:00
Zachary Turner 8d4d151bb2 Allow custom formatting of session log file names.
Differential Revision: http://reviews.llvm.org/D20306

llvm-svn: 269793
2016-05-17 18:02:34 +00:00
Tamas Berghammer 75f8f6e111 xfail TestTopLevelExprs for Android API 21-22 (llvm.org/pr27787)
llvm-svn: 269759
2016-05-17 12:42:25 +00:00
Todd Fiala 85df931dea Look for CMake.app when searching for cmake
On OS X systems, look for /Applications/CMake.app and ~/Applications/CMake.app
versions of the cmake command line binary when trying harder to find a cmake not
on the system path.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 269713
2016-05-16 22:29:15 +00:00
Greg Clayton 2920b36401 Make sure we notify that the section module was loaded when SBTarget::SetSectionLoadAddress() is called. Also make sure that the section module is unloaded when SBTarget::ClearSectionLoadAddress() or SBTarget::ClearModuleLoadAddress() is called.
<rdar://problem/25119335>

llvm-svn: 269707
2016-05-16 21:14:44 +00:00
Sean Callanan 84fee5852c Fixed and re-enabled the Clang modules testcase.
Macros work again after Clang r269554.  This testcase just needed some small
tweaks to get it going again.

llvm-svn: 269704
2016-05-16 21:11:21 +00:00
Sean Callanan da255efa2a Test diamond virtual inheritance in top-level expressions.
llvm-svn: 269698
2016-05-16 20:55:10 +00:00
Greg Clayton 58b794ae50 Don't crash when OS plug-in returns None from any of the functions we might call.
<rdar://problem/24489419>

llvm-svn: 269686
2016-05-16 20:07:38 +00:00
Enrico Granata 429e1f9b1d Make LLDB print out an explicit marker when it's displaying formatters that are part of a disabled category
Fixes rdar://26202006

llvm-svn: 269673
2016-05-16 17:27:26 +00:00
Pavel Labath 204ef66540 Bump up adb timeout more
still seeing very rare timeouts on the buildbot.

llvm-svn: 269648
2016-05-16 11:41:36 +00:00
Omair Javaid 32558a1615 Xfail TestCrashDuringStep and TestCreateDuringInstructionStep on arm-linux
Both of above tests fail on arm and bugs have been reported on android already.
Adding arm-linux decorator because android decorator doesnt xfail these test when run on linux. 

llvm-svn: 269647
2016-05-16 11:21:49 +00:00
Pavel Labath 57a77118ba Remove Mutex from NativeProcessLinux
NPL now assumes it is running from a single thread now, so its thread-safety is untested
anyway (and if that assumption is broken, we'll have bigger problems (due to ptrace restrictions)
than a couple of missing mutexes).

llvm-svn: 269640
2016-05-16 09:18:30 +00:00
Saleem Abdulrasool 0eadc53f6d test: remove use of undefined variables
The variables referenced in the print message are not defined.  Simply state
that the requisite script is not found.  Correct grammar to indicate that the
tests are rather likely to fail rather than unlikely to fail.

llvm-svn: 269628
2016-05-16 03:13:12 +00:00
Saleem Abdulrasool c0d0e36197 test: add missing splat
The parameter here is a list, not a string.  Ensure that the we splat the list
into arguments prior to invoke os.path.join.  This would previously fail with a
`startswith` is not a member of `list`.

llvm-svn: 269627
2016-05-16 03:13:08 +00:00
Saleem Abdulrasool 81eadde6ca test: add missing parameter
Add the missing required parameter to the function.  This permits tests to get a
bit further before failing.

llvm-svn: 269626
2016-05-16 03:13:05 +00:00