platform/upstream/llvm.git
9 years agoUse CLANG_LIBDIR_SUFFIX when looking for the gold plugin.
Rafael Espindola [Tue, 3 Feb 2015 16:33:53 +0000 (16:33 +0000)]
Use CLANG_LIBDIR_SUFFIX when looking for the gold plugin.

Patch by İsmail Dönmez!

llvm-svn: 227979

9 years agoFurther revise too-restrictive test CodeGen/PowerPC/tls-pic.ll
Bill Schmidt [Tue, 3 Feb 2015 16:29:52 +0000 (16:29 +0000)]
Further revise too-restrictive test CodeGen/PowerPC/tls-pic.ll

llvm-svn: 227978

9 years agoRevise too-restrictive test CodeGen/PowerPC/tls-pic.ll
Bill Schmidt [Tue, 3 Feb 2015 16:24:05 +0000 (16:24 +0000)]
Revise too-restrictive test CodeGen/PowerPC/tls-pic.ll

llvm-svn: 227977

9 years ago[PowerPC] Yet another approach to __tls_get_addr
Bill Schmidt [Tue, 3 Feb 2015 16:16:01 +0000 (16:16 +0000)]
[PowerPC] Yet another approach to __tls_get_addr

This patch is a third attempt to properly handle the local-dynamic and
global-dynamic TLS models.

In my original implementation, calls to __tls_get_addr were hidden
from view until the asm-printer phase, at which point the underlying
branch-and-link instruction was created with proper relocations.  This
mostly worked well, but I used some repellent techniques to ensure
that the TLS_GET_ADDR nodes at the SD and MI levels correctly received
input from GPR3 and produced output into GPR3.  This proved to work
badly in the presence of multiple TLS variable accesses, with the
copies to and from GPR3 being scheduled incorrectly and generally
creating havoc.

In r221703, I addressed that problem by representing the calls to
__tls_get_addr as true calls during instruction lowering.  This had
the advantage of removing all of the bad hacks and relying on the
existing call machinery to properly glue the copies in place. It
looked like this was going to be the right way to go.

However, as a side effect of the recent discovery of problems with
linker optimizations for TLS, we discovered cases of suboptimal code
generation with this strategy.  The problem comes when tls_get_addr is
called for the same address, and there is a resulting CSE
opportunity.  It turns out that in such cases MachineCSE will common
the addis/addi instructions that set up the input value to
tls_get_addr, but will not common the calls themselves.  MachineCSE
does not have any machinery to common idempotent calls.  This is
perfectly sensible, since presumably this would be done at the IR
level, and introducing calls in the back end isn't commonplace.  In
any case, we end up with two calls to __tls_get_addr when one would
suffice, and that isn't good.

I presumed that the original design would have allowed commoning of
the machine-specific nodes that hid the __tls_get_addr calls, so as
suggested by Ulrich Weigand, I went back to that design and cleaned it
up so that the copies were properly held together by glue
nodes.  However, it turned out that this didn't work either...the
presence of copies to physical registers kept the machine-specific
nodes from being commoned also.

All of which leads to the design presented here.  This is a return to
the original design, except that no attempt is made to introduce
copies to and from GPR3 during instruction lowering.  Virtual registers
are used until prior to register allocation.  At that point, a special
pass is run that identifies the machine-specific nodes that hide the
tls_get_addr calls and introduces the copies to and from GPR3 around
them.  The register allocator then coalesces these copies away.  With
this design, MachineCSE succeeds in commoning tls_get_addr calls where
possible, and we get nice optimal code generation (better than GCC at
the moment, which does not common these calls).

One additional problem must be dealt with:  After introducing the
mentions of the physical register GPR3, the aggressive anti-dependence
breaker sees opportunities to improve scheduling by selecting a
different register instead.  Flags must be used on the instruction
descriptions to tell the anti-dependence breaker to keep its hands in
its pockets.

One thing missing from the original design was recording a definition
of the link register on the GET_TLS_ADDR nodes.  Doing this was found
to be insufficient to force a stack frame to be created, which led to
looping behavior because two different LR values were stored at the
same address.  This appears to have been an oversight in
PPCFrameLowering::determineFrameLayout(), which is repaired here.

Because MustSaveLR() returns true for calls to builtin_return_address,
this changed the expected behavior of
test/CodeGen/PowerPC/retaddr2.ll, which now stacks a frame but
formerly did not.  I've fixed the test case to reflect this.

There are existing TLS tests to catch regressions; the checks in
test/CodeGen/PowerPC/tls-store2.ll proved to be too restrictive in the
face of instruction scheduling with these changes, so I fixed that
up.

I've added a new test case based on the PrettyStackTrace module that
demonstrated the original problem. This checks that we get correct
code generation and that CSE of the calls to __get_tls_addr has taken
place.

llvm-svn: 227976

9 years agoMake ELFLinkingContext own LinkerScript buffers
Rafael Auler [Tue, 3 Feb 2015 16:08:57 +0000 (16:08 +0000)]
Make ELFLinkingContext own LinkerScript buffers

Currently, no one owns script::Parser buffers, but yet ELFLinkingContext gets
updated with StringRef pointers to data inside Parser buffers. Since this buffer
is locally owned inside GnuLdDriver::evalLinkerScript(), as soon as this
function finishes, all pointers in ELFLinkingContext that comes from linker
scripts get invalid. The problem is that we need someone to own linker scripts
data structures and, since ELFLinkingContext transports references to linker
scripts data, we can simply make it also own all linker scripts data.

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

llvm-svn: 227975

9 years agoMark <experimental/system_error> as complete
Eric Fiselier [Tue, 3 Feb 2015 16:04:45 +0000 (16:04 +0000)]
Mark <experimental/system_error> as complete

llvm-svn: 227974

9 years ago[libcxx] Add <experimental/system_error>
Eric Fiselier [Tue, 3 Feb 2015 16:03:24 +0000 (16:03 +0000)]
[libcxx] Add <experimental/system_error>

Summary:
This patch just adds the variable templates in <experimental/system_error>.

see: https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#syserror

Reviewers: jroelofs, danalbert, K-ballo, mclow.lists

Reviewed By: mclow.lists

Subscribers: chandlerc, cfe-commits

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

llvm-svn: 227973

9 years agoImprove test to actually check for a folded load.
Sanjay Patel [Tue, 3 Feb 2015 15:37:18 +0000 (15:37 +0000)]
Improve test to actually check for a folded load.

This test was checking for lack of a "movaps" (an aligned load)
rather than a "movups" (an unaligned load). It also included
a store which complicated the checking.

Add specific CPU runs to prevent subtarget feature flag overrides
from inhibiting this optimization.

llvm-svn: 227972

9 years agoRevert: Revert r227804: Use fseek/ftell instead of fseeko/ftello when Newlib is the...
Jonathan Roelofs [Tue, 3 Feb 2015 15:34:17 +0000 (15:34 +0000)]
Revert: Revert r227804: Use fseek/ftell instead of fseeko/ftello when Newlib is the libc

EricWF has updated the compilers on his buildbots. Hopefully they won't crash now.

llvm-svn: 227971

9 years agoAdd test case for r227805
Tobias Grosser [Tue, 3 Feb 2015 15:11:02 +0000 (15:11 +0000)]
Add test case for r227805

llvm-svn: 227970

9 years ago[X86][MMX] Improve transfer from mmx to i32
Bruno Cardoso Lopes [Tue, 3 Feb 2015 14:46:49 +0000 (14:46 +0000)]
[X86][MMX] Improve transfer from mmx to i32

Improve EXTRACT_VECTOR_ELT DAG combine to catch conversion patterns
between x86mmx and i32 with more layers of indirection.

Before:
  movq2dq %mm0, %xmm0
  movd %xmm0, %eax
After:
  movd %mm0, %eax

llvm-svn: 227969

9 years ago[ASan] Remove ifdefs for MAC_OS_X_VERSION_10_6, as ASan assumes OSX >= 10.6
Alexander Potapenko [Tue, 3 Feb 2015 12:47:15 +0000 (12:47 +0000)]
[ASan] Remove ifdefs for MAC_OS_X_VERSION_10_6, as ASan assumes OSX >= 10.6

llvm-svn: 227968

9 years ago[ASan] Add __asan_ prefix for "mz_*" allocation/deallocation functions
Alexander Potapenko [Tue, 3 Feb 2015 12:38:10 +0000 (12:38 +0000)]
[ASan] Add __asan_ prefix for "mz_*" allocation/deallocation functions
and make them global so that they're not removed by `strip -x`.

llvm-svn: 227967

9 years agoEnabling testing ASAN on AArch64
Renato Golin [Tue, 3 Feb 2015 11:26:52 +0000 (11:26 +0000)]
Enabling testing ASAN on AArch64

Also, disabling BuiltinLongJmpTest, as it fails for ARM and PPC as well.

Patch by Christophe Lyon.

llvm-svn: 227966

9 years agoAdding AArch64 support to ASan instrumentation
Renato Golin [Tue, 3 Feb 2015 11:20:45 +0000 (11:20 +0000)]
Adding AArch64 support to ASan instrumentation

For the time being, it is still hardcoded to support only the 39 VA bits
variant, I plan to work on supporting 42 and 48 VA bits variants, but I
don't have access to such hardware at the moment.

Patch by Chrystophe Lyon.

llvm-svn: 227965

9 years agoRestore the signal handler for Windows as it is not presistent there.
Hafiz Abid Qadeer [Tue, 3 Feb 2015 11:20:00 +0000 (11:20 +0000)]
Restore the signal handler for Windows as it is not presistent there.

On windows, signal handler is reset to default once a signal is received.
This causes doing ctrl-c twice on console (or pressing suspend button twice
in eclipse ide which uses SIGINT to stop the debuggee) to crash lldb-mi on
windows. Although there is very tiny window (after signal handler is called
and before we restore the handler) where default handler will be in place.
But this is hardly a problem in practice as IDEs generally disable their suspend
button once it has been presses.

llvm-svn: 227964

9 years ago[X86] Make fxsave64/fxrstor64/xsave64/xsrstor64/xsaveopt64 parseable in AT&T syntax...
Craig Topper [Tue, 3 Feb 2015 11:03:57 +0000 (11:03 +0000)]
[X86] Make fxsave64/fxrstor64/xsave64/xsrstor64/xsaveopt64 parseable in AT&T syntax. Also make them the default output.

llvm-svn: 227963

9 years ago[X86] Add Requires[In64BitMode] around MOVSX64rr32/MOVSX64rm32. This makes it more...
Craig Topper [Tue, 3 Feb 2015 11:03:43 +0000 (11:03 +0000)]
[X86] Add Requires[In64BitMode] around MOVSX64rr32/MOVSX64rm32. This makes it more strictly mutexed with the ARPL instruction 32-bit mode. Helps with some disassembler changes I'm experimenting with. Should be NFC.

llvm-svn: 227962

9 years ago[lld][ARM] Add relocations to perform function calls
Denis Protivensky [Tue, 3 Feb 2015 10:48:37 +0000 (10:48 +0000)]
[lld][ARM] Add relocations to perform function calls

Added relocations to perform function calls with and without passing arguments.
ARM-only, Thumb-only and mixed mode code generations are supported.
Only simple veneers (direct instruction modification) are supported as ARM-Thumb interwork.

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

llvm-svn: 227961

9 years agoTest commit. No changes.
Pavel Labath [Tue, 3 Feb 2015 10:38:21 +0000 (10:38 +0000)]
Test commit. No changes.

llvm-svn: 227960

9 years ago[ASan] Add use_madv_dontdump flag.
Yury Gribov [Tue, 3 Feb 2015 10:15:15 +0000 (10:15 +0000)]
[ASan] Add use_madv_dontdump flag.

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

llvm-svn: 227959

9 years agoFix CLI commands in lldb-mi.
Hafiz Abid Qadeer [Tue, 3 Feb 2015 10:05:54 +0000 (10:05 +0000)]
Fix CLI commands in lldb-mi.

This patch fixes execution of CLI commands in MI mode. The CLI commands are
executed using "-interpreter-exec" command. The bug was in the
CMICmnLLDBDebugSessionInfo class which contained the following members:
SBProcess, SBTarget, SBDebugger and SBListener, but CLI commands don't affect
them and they aren't updated. Therefore some members can contain incorrect
(or obsolete) reference and it can cause an error. My patch removes these
members and uses getters that provides the updated instance every time it is used.

Patch from Ilia K ki.stfu@gmail.com. Approved by Greg.

llvm-svn: 227958

9 years agoMove "inline" to the right place.
Daniel Jasper [Tue, 3 Feb 2015 09:54:58 +0000 (09:54 +0000)]
Move "inline" to the right place.

llvm-svn: 227957

9 years agoAdd some overloads so that floating point literals can be AST matched properly.
Daniel Jasper [Tue, 3 Feb 2015 09:45:52 +0000 (09:45 +0000)]
Add some overloads so that floating point literals can be AST matched properly.

I am not entirely sure whether the implemented sematics are ideal. In
particular, should floatLiteral(equals(0.5)) match "0.5f" and should
floatLiteral(equals(0.5f)) match "0.5". With the overloads in this
patch, the answer to both questions is yes, but I am happy to change
that.

llvm-svn: 227956

9 years ago[NFC] Fix typo
Johannes Doerfert [Tue, 3 Feb 2015 08:55:01 +0000 (08:55 +0000)]
[NFC] Fix typo

llvm-svn: 227955

9 years agoMS ABI: Records with fields with required aligmnet shouldn't be common
David Majnemer [Tue, 3 Feb 2015 08:49:32 +0000 (08:49 +0000)]
MS ABI: Records with fields with required aligmnet shouldn't be common

llvm-svn: 227954

9 years agoAST: Hoist RT->getDecl() into a variable
David Majnemer [Tue, 3 Feb 2015 08:49:29 +0000 (08:49 +0000)]
AST: Hoist RT->getDecl() into a variable

llvm-svn: 227953

9 years agoChange void* name_token to const void* to address warnings.
Bruce Mitchener [Tue, 3 Feb 2015 08:01:34 +0000 (08:01 +0000)]
Change void* name_token to const void* to address warnings.

Reviewers: granata.enrico, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 227952

9 years agoCast to (const OptionPermissions*) to avoid warning.
Bruce Mitchener [Tue, 3 Feb 2015 07:59:26 +0000 (07:59 +0000)]
Cast to (const OptionPermissions*) to avoid warning.

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 227951

9 years agoMS ABI: Records with required alignment can't have common linkage
David Majnemer [Tue, 3 Feb 2015 07:35:55 +0000 (07:35 +0000)]
MS ABI: Records with required alignment can't have common linkage

This fixes PR22441.

llvm-svn: 227950

9 years agoOnly access TLOF via the TargetMachine, not TargetLowering.
Eric Christopher [Tue, 3 Feb 2015 07:22:52 +0000 (07:22 +0000)]
Only access TLOF via the TargetMachine, not TargetLowering.

llvm-svn: 227949

9 years agoDefine a runOnMachineFunction for the Hexagon AsmPrinter and
Eric Christopher [Tue, 3 Feb 2015 06:40:22 +0000 (06:40 +0000)]
Define a runOnMachineFunction for the Hexagon AsmPrinter and
use it to initialize the subtarget.

llvm-svn: 227948

9 years agoMigrate away from using a Subtarget except for the one place we want
Eric Christopher [Tue, 3 Feb 2015 06:40:19 +0000 (06:40 +0000)]
Migrate away from using a Subtarget except for the one place we want
to use it. Use the triple to determine OS format bits at the module
level.

llvm-svn: 227947

9 years ago[analyzer] Change ccc-analyzer to accept both -isystem <path> and -isystem<path>
Ted Kremenek [Tue, 3 Feb 2015 06:23:36 +0000 (06:23 +0000)]
[analyzer] Change ccc-analyzer to accept both -isystem <path> and -isystem<path>

Patch by Thomas Hauth!

llvm-svn: 227946

9 years ago[PBQP Regalloc] Pre-spill vregs that have no legal physregs.
Lang Hames [Tue, 3 Feb 2015 06:14:06 +0000 (06:14 +0000)]
[PBQP Regalloc] Pre-spill vregs that have no legal physregs.

The PBQP::RegAlloc::MatrixMetadata class assumes that matrices have at least two
rows/columns (for the spill option plus at least one physreg). This patch
ensures that that invariant is met by pre-spilling vregs that have no physreg
options so that no node (and no corresponding edges) need be added to the PBQP
graph.

This fixes a bug in an out-of-tree target that was identified by Jonas Paulsson.
Thanks for tracking this down Jonas!

llvm-svn: 227942

9 years agoResurrect initializers for NumLoads and NumStores in LoopVectorizationLegality to...
NAKAMURA Takumi [Tue, 3 Feb 2015 03:55:06 +0000 (03:55 +0000)]
Resurrect initializers for NumLoads and NumStores in LoopVectorizationLegality to suppress undefined behavior.

FIXME: Shall they be managed in LAA?
llvm-svn: 227940

9 years ago[modules] Be sure to load the lexical definition of a class template
Richard Smith [Tue, 3 Feb 2015 03:32:14 +0000 (03:32 +0000)]
[modules] Be sure to load the lexical definition of a class template
specialization from an update record exactly once, even if we needed to fake up
the definition.

llvm-svn: 227939

9 years agoAdd an expectall() API that allows you to pass a list of patterns and have pexpect...
Enrico Granata [Tue, 3 Feb 2015 03:11:59 +0000 (03:11 +0000)]
Add an expectall() API that allows you to pass a list of patterns and have pexpect match *ALL* of them instead of just picking one

llvm-svn: 227938

9 years agoReally, really, really don't build llvm-pdbdump on MSVC < 2013.
Andrew Kaylor [Tue, 3 Feb 2015 03:08:25 +0000 (03:08 +0000)]
Really, really, really don't build llvm-pdbdump on MSVC < 2013.

There was a typo in the last attempt.

llvm-svn: 227937

9 years agoMake it easier to see what's going on by tracing the test case
Enrico Granata [Tue, 3 Feb 2015 02:46:36 +0000 (02:46 +0000)]
Make it easier to see what's going on by tracing the test case

llvm-svn: 227936

9 years agoFixed bugs in the multi-threaded access in HostInfoBase. Prior to this fix, static...
Greg Clayton [Tue, 3 Feb 2015 02:05:44 +0000 (02:05 +0000)]
Fixed bugs in the multi-threaded access in HostInfoBase. Prior to this fix, static bool variables were used but this is not sufficient. We now use std::call_once in all places where the previous static bool code was used to try to implement thread safety.

This was causing code that opened multiple targets to try and get a path to debugserver from the GDB remote communication class, and it would get the LLDB path and some instances would return empty strings and it would cause debugserver to not be found.

<rdar://problem/18756927>

llvm-svn: 227935

9 years agoPropagate a better error message to the C api.
Rafael Espindola [Tue, 3 Feb 2015 01:53:03 +0000 (01:53 +0000)]
Propagate a better error message to the C api.

llvm-svn: 227934

9 years agoFix TestThreadStepOut on Linux with LLGS
Chaoren Lin [Tue, 3 Feb 2015 01:51:56 +0000 (01:51 +0000)]
Fix TestThreadStepOut on Linux with LLGS

Remove implicit stop action on $vCont package for threads where no
explicit action or default action specified based on the specification
(they have to stay in there original state).

llvm-svn: 227933

9 years agoFix compilation error and cleanup in ThreadStateCoordinatorTest
Chaoren Lin [Tue, 3 Feb 2015 01:51:54 +0000 (01:51 +0000)]
Fix compilation error and cleanup in ThreadStateCoordinatorTest

llvm-svn: 227932

9 years agoAdd missing switch cases to silence warnings.
Chaoren Lin [Tue, 3 Feb 2015 01:51:50 +0000 (01:51 +0000)]
Add missing switch cases to silence warnings.

llvm-svn: 227931

9 years agoImplement setting and clearing watchpoints.
Chaoren Lin [Tue, 3 Feb 2015 01:51:47 +0000 (01:51 +0000)]
Implement setting and clearing watchpoints.

llvm-svn: 227930

9 years agoMoving header files from source/Host/common to proper location.
Chaoren Lin [Tue, 3 Feb 2015 01:51:38 +0000 (01:51 +0000)]
Moving header files from source/Host/common to proper location.

llvm-svn: 227929

9 years agoMake ThreadStateCoordinator to handle properly failed stop/resume operations.
Chaoren Lin [Tue, 3 Feb 2015 01:51:30 +0000 (01:51 +0000)]
Make ThreadStateCoordinator to handle properly failed stop/resume operations.

llvm-svn: 227928

9 years agoMark TestProcessLaunch.test_set_working_dir_with_dwarf as expected to fail in LLGS...
Chaoren Lin [Tue, 3 Feb 2015 01:51:28 +0000 (01:51 +0000)]
Mark TestProcessLaunch.test_set_working_dir_with_dwarf as expected to fail in LLGS mode due llvm.org/pr20265

llvm-svn: 227927

9 years agoShare crash information between LLGS and local POSIX debugging with
Chaoren Lin [Tue, 3 Feb 2015 01:51:25 +0000 (01:51 +0000)]
Share crash information between LLGS and local POSIX debugging with
CrashReason class. Deliver crash information from LLGS to lldb via
description field of thread stop packet.

llvm-svn: 227926

9 years agoMark several tests as XFAIL with new expectedFailureLLGS decorator since they are...
Chaoren Lin [Tue, 3 Feb 2015 01:51:18 +0000 (01:51 +0000)]
Mark several tests as XFAIL with new expectedFailureLLGS decorator since they are failing in Darwin for the same reason.

llvm-svn: 227925

9 years agoModify ThreadStateCoodrinator in order to resume threads if stop wasn't requested.
Chaoren Lin [Tue, 3 Feb 2015 01:51:15 +0000 (01:51 +0000)]
Modify ThreadStateCoodrinator in order to resume threads if stop wasn't requested.

llvm-svn: 227924

9 years agoRefactor ptrace commands in NativeProcessLinux to use Error as result return type.
Chaoren Lin [Tue, 3 Feb 2015 01:51:12 +0000 (01:51 +0000)]
Refactor ptrace commands in NativeProcessLinux to use Error as result return type.

llvm-svn: 227923

9 years agoadded some missing ABIs
Chaoren Lin [Tue, 3 Feb 2015 01:51:10 +0000 (01:51 +0000)]
added some missing ABIs

llvm-svn: 227922

9 years agoFixed TestInferiorChanged
Chaoren Lin [Tue, 3 Feb 2015 01:51:06 +0000 (01:51 +0000)]
Fixed TestInferiorChanged

replaced expected stop reason 'address invalid' with 'signal SIGSEGV'

llvm-svn: 227921

9 years agoFixed TestInferiorCrashing failures
Chaoren Lin [Tue, 3 Feb 2015 01:51:05 +0000 (01:51 +0000)]
Fixed TestInferiorCrashing failures

LLGS debugging is outputting different thread stop reasons than
local linux debugging.  The stop reasons are reasonable so I've left
left them alone.  Might update them to match darwin in the future.

llvm-svn: 227920

9 years agoAdded support for writing registers larger than 64 bits
Chaoren Lin [Tue, 3 Feb 2015 01:51:03 +0000 (01:51 +0000)]
Added support for writing registers larger than 64 bits

llvm-svn: 227919

9 years agoLLGS local - signal stops inferior in debugger
Chaoren Lin [Tue, 3 Feb 2015 01:51:02 +0000 (01:51 +0000)]
LLGS local - signal stops inferior in debugger

NativeProcessLinux::MonitorSignal was automatically resuming threads
that stopped due to a signal.  This is inconsistent with the
behavior of lldb and gdb.  This change removes the automatic resume.

Fixes
TestSendSignal.py
TestSignalsAPI.py
if PLATFORM_LINUX_FORCE_LLGS_LOCAL is in the environment vars.

llvm-svn: 227918

9 years agoFix up NativeProcessLinux::Interrupt() to use thread state coordinator mechanism.
Chaoren Lin [Tue, 3 Feb 2015 01:51:00 +0000 (01:51 +0000)]
Fix up NativeProcessLinux::Interrupt() to use thread state coordinator mechanism.

llvm-svn: 227917

9 years agoAdded code to prevent "administrative stop" from overwriting a real stop reason.
Chaoren Lin [Tue, 3 Feb 2015 01:50:57 +0000 (01:50 +0000)]
Added code to prevent "administrative stop" from overwriting a real stop reason.

Note this code path should not happen - it implies a bug in another part of
the code.  For the thread to receive the stop signal as it is handled, the
and for it to already have a stop reason, it implies the kernel was able to
tell the thread that it stopped while it was stopped.  More likely this
seems to indicate a bug where an actual thread start was not getting correctly
logged.  If it does get hit, we'll want to understand the sequence to figure
out if it is truly legitimate or if it implies another bug.

llvm-svn: 227916

9 years agoFix step commands that mix running threads and stepping threads.
Chaoren Lin [Tue, 3 Feb 2015 01:50:56 +0000 (01:50 +0000)]
Fix step commands that mix running threads and stepping threads.

This fixes https://github.com/tfiala/lldb/issues/62.

llvm-svn: 227915

9 years agoDisabled local-llgs hijacking of state on startup; passed along signo to killed process.
Chaoren Lin [Tue, 3 Feb 2015 01:50:54 +0000 (01:50 +0000)]
Disabled local-llgs hijacking of state on startup; passed along signo to killed process.

It looks like Shawn's fix addresses what the initial hijacking was trying
to accomplish per conversations with Greg and Jim.  The hijacking was
causing several tests to hang (#61, #62, #63, #64, #67, possibly more).
These tests now just fail rather than hang with this modification.

llvm-svn: 227914

9 years agoFix some bugs in llgs thread state handling.
Chaoren Lin [Tue, 3 Feb 2015 01:50:51 +0000 (01:50 +0000)]
Fix some bugs in llgs thread state handling.

* When the thread state coordinator is told to skip sending a stop request
  for a running thread that is ignored (e.g. the thread that steps in a
  step operation is technically running and should not have a stop sent
  to it, since it will stop of its own accord per the kernel step operation),
  ensure the deferred signal notification logic still waits for the
  skipped thread.  (i.e. we want to defer the notification until the
  stepping thread is indeed stopped, we just don't want to send it a tgkill).

* Add ThreadStateCoordinator::RequestResumeAsNeeded().  This variant of the
  RequestResume() method does not call the error function when the thread
  is already running.  Instead, it just logs that the thread is already
  running and skips the resume operation.  This is useful for the case of
  vCont;c handling, where we tell all threads that they should be running.
  At the place we're calling, all we know is "we want this thread running if
  it isn't already," and that's exactly what this command does.

* Formatting change (minor) in NativeThreadLinux logging.

llvm-svn: 227913

9 years agollgs: more work on thread stepping.
Chaoren Lin [Tue, 3 Feb 2015 01:50:49 +0000 (01:50 +0000)]
llgs: more work on thread stepping.

See https://github.com/tfiala/lldb/issues/75.  Not fixed yet but
continuing to push this further.

Fixes:
* Resume() now skips doing deferred notifications if we're doing a
  vCont;{c,C}.  In this case, we're trying to start something up,
  not defer a stop notification.  The default thread action stop
  mode pickup was triggering a stop because it had at least one
  stop, which was wrong in the case of a continue.  (Bug introduced
  by previous change.)

* Added a variant to ThreadStateCoordinator to specify a set of
  thread ids to be skipped when triggering stop notifications to
  non-stopped threads on a deferred signal call.  For the case of
  a stepping thread, it is actually told to step (and is running)
  for a brief moment, but the thread state coordinator would think
  it needed to send the stepping thread a stop, which id doesn't
  need to do.  This facility allows me to get around that cleanly.

With this change, behavior is now reduced to something I think is
essentially a different bug:

* Doing a step into libc code from my code crashes llgs.
* Doing a next out of a function in my own code crashes llgs.

llvm-svn: 227912

9 years agollgs: fix up some handling of stepping.
Chaoren Lin [Tue, 3 Feb 2015 01:50:46 +0000 (01:50 +0000)]
llgs: fix up some handling of stepping.

Tracked down while working on https://github.com/tfiala/lldb/issues/75.
This is not a complete fix for that issue, but moves us farther along.

Fixes:
* When a thread step is requested via vCont:{s,S}, Resume() now marks
  the stepping thread as (1) currently stepping and (2) does trigger
  the deferred signal for the stepped thread.  This fixes a bug where
  we were actually triggering a deferred stop cycle here for the non-stepping
  thread since the single step thread was not part of the Resume()
  deferred signal mechanism.  The stepping thread is also marked in
  the thread state coordinator as running (via a resume callback).

* When we get the SIGTRAP signal for the step completion, we don't
  do a deferred signal call - that happened during the vCont:{s,S}
  processing in Resume() already.  Now we just need to mark that
  the stepping thread is now stopped.  If this is the last thread
  in the set that needs to stop, it will trigger the process/delegate
  stop call that will notify lldb.  Otherwise, that'll happen when
  the final thead we're waiting for stops.

Misc:
* Fixed up thread stop logging to use a leading 0 (0x%PRIx32) so
  we don't get log lines like 0x5 for 0x05 SIGTRAP.

llvm-svn: 227911

9 years agollgs: fixed a bug in deferred signal thread id; added coordinator enqueue logging.
Chaoren Lin [Tue, 3 Feb 2015 01:50:44 +0000 (01:50 +0000)]
llgs: fixed a bug in deferred signal thread id; added coordinator enqueue logging.

The deferred signal thread id was being set with the process id
unintentionally in NativeProcessLinux::CallAfterRunningThreadsStop().

llvm-svn: 227910

9 years agoGet initial thread state coordinator integration working.
Chaoren Lin [Tue, 3 Feb 2015 01:50:42 +0000 (01:50 +0000)]
Get initial thread state coordinator integration working.

* Fixed bug in run loop where run loop return enum was being treated
  erroneously like an int, causing the TSC event loop to terminate
  prematurely.

* Added an explicit scope in NativeProcessLinux::Resume() for the
  threads lock lifetime.  (This was likely unnecessary but is
  more explicit.)

* Fixed a bug in ThreadStateCoordinator where resume execution was
  not updating the internal state about the thread assumed to be
  running now.  I'll add a test and upstream this in a moment.

* Added a verbose logging mechanism to event processing within
  ThreadStateCoordinator.  It is currently enabled when the
  'log enable lldb thread' is true upon inferior launch/attach.

llvm-svn: 227909

9 years agoAdded remote-build.py and wired it into Xcode for Linux and MacOSX+Linux builds.
Chaoren Lin [Tue, 3 Feb 2015 01:50:39 +0000 (01:50 +0000)]
Added remote-build.py and wired it into Xcode for Linux and MacOSX+Linux builds.

llvm-svn: 227908

9 years agoRemove invalid const qualifier for r0, since it is written by svc.
Stephen Hines [Tue, 3 Feb 2015 01:35:39 +0000 (01:35 +0000)]
Remove invalid const qualifier for r0, since it is written by svc.

Summary: This causes an invalid lvalue error when building for Android.

Reviewers: danalbert

Reviewed By: danalbert

Subscribers: llvm-commits

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

llvm-svn: 227907

9 years agoAllow customizing the timeout of the inferior
Enrico Granata [Tue, 3 Feb 2015 01:06:35 +0000 (01:06 +0000)]
Allow customizing the timeout of the inferior

llvm-svn: 227906

9 years agoAnd, do not define arguments twice
Enrico Granata [Tue, 3 Feb 2015 01:00:44 +0000 (01:00 +0000)]
And, do not define arguments twice

llvm-svn: 227905

9 years agoAllow pexpect exact matches
Enrico Granata [Tue, 3 Feb 2015 00:59:28 +0000 (00:59 +0000)]
Allow pexpect exact matches

llvm-svn: 227904

9 years agoUse a non-fatal diag handler in the C API. FIxes PR22368.
Rafael Espindola [Tue, 3 Feb 2015 00:49:57 +0000 (00:49 +0000)]
Use a non-fatal diag handler in the C API. FIxes PR22368.

llvm-svn: 227903

9 years agoELF: Improve linker script unit tests.
Rui Ueyama [Tue, 3 Feb 2015 00:42:36 +0000 (00:42 +0000)]
ELF: Improve linker script unit tests.

This patch is to enable to write unit tests for linker script with
less boilerplate code.

llvm-svn: 227902

9 years agoInstrProf: Update for LLVM API change
Justin Bogner [Tue, 3 Feb 2015 00:20:24 +0000 (00:20 +0000)]
InstrProf: Update for LLVM API change

Update for the change in r227900.

llvm-svn: 227901

9 years agoInstrProf: Simplify RawCoverageMappingReader's API slightly
Justin Bogner [Tue, 3 Feb 2015 00:20:11 +0000 (00:20 +0000)]
InstrProf: Simplify RawCoverageMappingReader's API slightly

This is still kind of a weird API, but dropping the (partial) update
of the passed in CoverageMappingRecord makes it a little easier to
understand and use.

llvm-svn: 227900

9 years agoMake "process attach" command to support attaching to remote process in case if selec...
Oleksiy Vyalov [Tue, 3 Feb 2015 00:04:35 +0000 (00:04 +0000)]
Make "process attach" command to support attaching to remote process in case if selected platform allows this.

http://reviews.llvm.org/D7358

llvm-svn: 227899

9 years agoInstrProf: Simplify some logic by using ArrayRef::slice (NFC)
Justin Bogner [Tue, 3 Feb 2015 00:00:00 +0000 (00:00 +0000)]
InstrProf: Simplify some logic by using ArrayRef::slice (NFC)

llvm-svn: 227898

9 years agoRevert part of r227437 as it was unnecessary. Thanks to echristo for
Alex Rosenberg [Mon, 2 Feb 2015 23:58:54 +0000 (23:58 +0000)]
Revert part of r227437 as it was unnecessary. Thanks to echristo for
pointing this out.

llvm-svn: 227897

9 years agotest: Make encode-test-5.m's output not dependent on its filename
David Majnemer [Mon, 2 Feb 2015 23:38:27 +0000 (23:38 +0000)]
test: Make encode-test-5.m's output not dependent on its filename

Pipe the file into clang instead of passing the file path on the command
line.

llvm-svn: 227896

9 years agoRevert "Add some overloads so that floating point literals can be AST matched properly."
Daniel Jasper [Mon, 2 Feb 2015 23:35:39 +0000 (23:35 +0000)]
Revert "Add some overloads so that floating point literals can be AST matched properly."

Apparently the build bots get angry for some reason. Can't reproduce
that in a local cmake/ninja build. Will look closer. Rolling back for
now.

llvm-svn: 227895

9 years agoclang lit.cfg: Fix a bug pointed by Sean Silva
Filipe Cabecinhas [Mon, 2 Feb 2015 23:17:54 +0000 (23:17 +0000)]
clang lit.cfg: Fix a bug pointed by Sean Silva

llvm-svn: 227894

9 years ago[TSan] Fix remaining bashism in buildgo.sh script.
Alexey Samsonov [Mon, 2 Feb 2015 23:14:46 +0000 (23:14 +0000)]
[TSan] Fix remaining bashism in buildgo.sh script.

llvm-svn: 227893

9 years agoAdd some overloads so that floating point literals can be AST matched properly.
Daniel Jasper [Mon, 2 Feb 2015 23:04:00 +0000 (23:04 +0000)]
Add some overloads so that floating point literals can be AST matched properly.

I am not entirely sure whether the implemented sematics are ideal. In
particular, should floatLiteral(equals(0.5)) match "0.5f" and should
floatLiteral(equals(0.5f)) match "0.5". With the overloads in this
patch, the answer to both questions is yes, but I am happy to change
that.

llvm-svn: 227892

9 years agoMigrate to using the subtarget on the machine function and update
Eric Christopher [Mon, 2 Feb 2015 23:03:45 +0000 (23:03 +0000)]
Migrate to using the subtarget on the machine function and update
all uses.

llvm-svn: 227891

9 years agoUse the function template getSubtarget off of the machine function,
Eric Christopher [Mon, 2 Feb 2015 23:03:43 +0000 (23:03 +0000)]
Use the function template getSubtarget off of the machine function,
and use it in all locations.

llvm-svn: 227890

9 years agoSome cleanup in lldbpexpect
Enrico Granata [Mon, 2 Feb 2015 23:03:37 +0000 (23:03 +0000)]
Some cleanup in lldbpexpect

llvm-svn: 227889

9 years agoNice syntax typo in lldbpexpect
Enrico Granata [Mon, 2 Feb 2015 22:55:46 +0000 (22:55 +0000)]
Nice syntax typo in lldbpexpect

llvm-svn: 227887

9 years agoPR 17421: Implemented -save-temps={obj|cwd} option
Reid Kleckner [Mon, 2 Feb 2015 22:41:48 +0000 (22:41 +0000)]
PR 17421: Implemented -save-temps={obj|cwd} option

-save-temps=cwd is equivalent to -save-temps
-save-temps=obj saves temporary file in the same directory as output

This helps to avoid clobbering of temp files in case of parallel
compilation with -save-temps of the files that have the same name
but located in different directories.

Patch by Artem Belevich

Reviewed By: rnk

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

llvm-svn: 227886

9 years agoUse the cached subtarget on the MachineFunction.
Eric Christopher [Mon, 2 Feb 2015 22:40:56 +0000 (22:40 +0000)]
Use the cached subtarget on the MachineFunction.

llvm-svn: 227885

9 years agoRemove dead header.
Eric Christopher [Mon, 2 Feb 2015 22:40:54 +0000 (22:40 +0000)]
Remove dead header.

llvm-svn: 227884

9 years agoRemove dead code in the HexagonMCInst classes. This also fixes
Eric Christopher [Mon, 2 Feb 2015 22:40:53 +0000 (22:40 +0000)]
Remove dead code in the HexagonMCInst classes. This also fixes
a layering violation in the port and removes calls to getSubtargetImpl.

llvm-svn: 227883

9 years ago80-col fixup.
Eric Christopher [Mon, 2 Feb 2015 22:40:51 +0000 (22:40 +0000)]
80-col fixup.

llvm-svn: 227882

9 years agoInstrProf: Remove an unused header (NFC)
Justin Bogner [Mon, 2 Feb 2015 22:38:39 +0000 (22:38 +0000)]
InstrProf: Remove an unused header (NFC)

llvm-svn: 227881

9 years agoRemove dead code in the HexagonMCInst classes. This also fixes
Eric Christopher [Mon, 2 Feb 2015 22:28:48 +0000 (22:28 +0000)]
Remove dead code in the HexagonMCInst classes. This also fixes
a layering violation in the port and removes calls to getSubtargetImpl.

llvm-svn: 227880

9 years ago80-col fixup.
Eric Christopher [Mon, 2 Feb 2015 22:28:46 +0000 (22:28 +0000)]
80-col fixup.

llvm-svn: 227879

9 years agoRemove unused class variables and update all callers/uses from
Eric Christopher [Mon, 2 Feb 2015 22:28:44 +0000 (22:28 +0000)]
Remove unused class variables and update all callers/uses from
the HexagonSplitTFRCondSet pass. Use the subtarget off the machine
function at the same time.

llvm-svn: 227878

9 years ago[TSan] Update check_analyze.sh expectations to match trunk Clang output.
Alexey Samsonov [Mon, 2 Feb 2015 22:17:23 +0000 (22:17 +0000)]
[TSan] Update check_analyze.sh expectations to match trunk Clang output.

llvm-svn: 227877

9 years agoSEH: Diagnose use of C++ EH and SEH in the same function
Reid Kleckner [Mon, 2 Feb 2015 22:15:31 +0000 (22:15 +0000)]
SEH: Diagnose use of C++ EH and SEH in the same function

This check does not apply when Borland extensions are enabled, as they
have a checked in test case indicating that mixed usage of SEH and C++
is supported.

llvm-svn: 227876

9 years agoAdd an helper class to write pexpect-based test cases
Enrico Granata [Mon, 2 Feb 2015 22:12:39 +0000 (22:12 +0000)]
Add an helper class to write pexpect-based test cases
Over time, we should improve this class and port all pexpect based testing over to using this

llvm-svn: 227875