Commit Graph

6998 Commits

Author SHA1 Message Date
Zachary Turner 7271bab3bb Have Platform::KillProcess try to use the process plugin first.
llvm-svn: 237280
2015-05-13 19:44:24 +00:00
Ted Woodward bb1e283cc5 Change Linux Platform to support non-host Linux architectures
Summary:
This was originally http://reviews.llvm.org/D8709 , but I didn't commit it correctly. 

Since then GetSupportedArchitectureAtIndex() has been changed. That change, http://reviews.llvm.org/D9511 , breaks non-x86 linux implementations, so this change goes back to the old implementation and adds remote linux support from D8709.

D8709 summary:

The Linux Platform currently will only say the Host architecture is supported. This patch retains that behavior for the Host Platform, but adds a list of architectures for the Remote Platform.


Reviewers: clayborg, flackr

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 237278
2015-05-13 18:52:56 +00:00
Robert Flack 5cbd3bfca1 Enable workaround for finding functions in global namespace on linux binaries on
all hosts.

We require a workaround to be able to locate global and anonymous namespace
functions in the dwarf symbols on linux binaries. This patch enables this code
on all platforms so that we can still find these symbols when debugging from a
different host platform.

Test Plan:
The following tests begin passing when running with a mac host to linux client:
TestCallCPPFunction.py
TestCallStopAndContinue.py
TestExprs.py
TestExprsChar.py
TestNamespace.py
TestOverloadedFunctions.py
TestRvalueReferences.py
TestThreadExit.py

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

llvm-svn: 237270
2015-05-13 18:20:02 +00:00
Tamas Berghammer 4276cb3a50 Fix arm instruction emulation of add (imm) and sub (imm)
Differential revision: http://reviews.llvm.org/D9704

llvm-svn: 237240
2015-05-13 09:25:06 +00:00
Ewan Crawford 78baa19781 Remote Non-Stop Support
Summary:
 
This patch is the beginnings of support for Non-stop mode in the remote protocol. Letting a user examine stopped threads, while other threads execute freely.

Non-stop mode is enabled using the setting target.non-stop-mode, which sends a QNonStop packet when establishing the remote connection.
Changes are also made to treat the '?' stop reply packet differently in non-stop mode, according to spec https://sourceware.org/gdb/current/onlinedocs/gdb/Remote-Non_002dStop.html#Remote-Non_002dStop.
A setting for querying the remote for default thread on setup is also included.

Handling of '%' async notification packets will be added next.

Reviewers: clayborg

Subscribers: lldb-commits, ADodds, ted, deepak2427

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

llvm-svn: 237239
2015-05-13 09:18:18 +00:00
Ilia K acf20fa233 Fix a few compile warnings
llvm-svn: 237238
2015-05-13 09:04:59 +00:00
Robert Flack 8ec55a53a7 Don't change the selected platform when creating the dummy target.
A dummy target is used by TargetList::CreateTargetInternal to prime newly
created targets. the first time this is done it creates the dummy target. The
dummy target is created with the host platform (See
TargetList::CreateDummyTarget) which results in switching the selected platform
back to the host platform even when creating a target for a different platform.
This change avoids changing the selected platform while creating the dummy
target to prevent this side effect.

Test Plan:
./dotest.py $DOTEST_OPTS -t -p TestCreateAfterAttach.py
Tests using process attach (e.g. TestCreateAfterAttach.py, TestHelloWorld.py)
now run successfully mac -> linux.

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

llvm-svn: 237221
2015-05-13 00:39:24 +00:00
Vince Harron d7e6a4f2f0 Fixed a ton of gcc compile warnings
Removed some unused variables, added some consts, changed some casts
to const_cast. I don't think any of these changes are very
controversial.

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

llvm-svn: 237218
2015-05-13 00:25:54 +00:00
Chaoren Lin 042ca39c01 Platform settings doesn't need permission options.
Summary:
Also removes conflict error message for '-w' between
--user-write and --working-dir.

Reviewers: flackr, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 237178
2015-05-12 21:06:48 +00:00
Ted Woodward 4744ec6da9 Windows: fix bug in getcwd() and add chdir().
Summary:
GetCurrentDirectory() returns the number of characters copied; 0 is a failure, not a success.

Add implementation for chdir().

Reviewers: zturner

Reviewed By: zturner

Subscribers: lldb-commits

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

llvm-svn: 237162
2015-05-12 18:47:33 +00:00
Robert Flack e49b8e065e Call remote platform GetSupportedArchitectureAtIndex if connected to remote.
Updated PlatformLinux::GetSupportedArchitectureAtIndex to call the
PlatformRemoteGdbServer::GetSupportedArchitectureAtIndex if connected remotely.
This should return the correct thing for android (to fix those failing tests),
and is also working for mac to linux.

Test Plan:
./dotest.py $DOTEST_OPTS -t -p TestCallStdStringFunction.py
The above still passes when running mac->linux indicating it successfully
identified PlatformLinux as the target platform and converted the mmap options
correctly.

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

llvm-svn: 237128
2015-05-12 13:22:37 +00:00
Tamas Berghammer 1f14920437 Return the correct user register count for arm from NativeRegisterContext
The defult implementation falls back to GetRegisterCount what
includes the debug registers also what shouldn't be displayed to
the user.

llvm-svn: 237111
2015-05-12 10:27:45 +00:00
Pavel Labath 108c325d6e Remove handling of eStateStopped from NativeProcessLinux::Resume
Summary:
NPL::Resume attempted to handle eStateStopped as a resume action. However:
- GDBRemoteCommunicationServerLLGS (the only user of NPL) never sets this action
- it could set this action in response to a vCont:t packet, but LLDB never produces this packet
- gdb-remote protocol documentation says vCont:t packet is used only in non-stop mode, but LLDB
  does not support non-stop mode
- even if LLDB supported non-stop mode, this implementation of eStateStopped does something
  different from what the spec says it should (according to spec, it should stop the specified
  thread, but this seems to want to stop all threads).

Given the facts above, I believe we should remove this unused and untested code, as it probably
doesn't even work and removing it makes the rest of the code noticably simpler.

Reviewers: ovyalov, chaoren

Subscribers: lldb-commits

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

llvm-svn: 237103
2015-05-12 09:03:18 +00:00
Pavel Labath 1dbc6c9cd6 [NativeProcessLinux] Remove event mutex and clean functions using it
Summary:
Since the former-TSC events are now processed synchronously, there is no need for to protect them
with a separate mutex - all the actions are now guarded by the big m_threads_mutex.

With the mutex gone, the following functions, no longer have any purpose and were removed:
NotifyThreadCreate: replaced by direct calls to ThreadWasCreated
NotifyThreadStop: replaced by direct calls to ThreadDidStop
NotifyThreadDeath: folded into StopTrackingThread
ResetForExec: inlined as it consisted of a single line of code
RequestThreadResume(AsNeeded): replaced by direct calls to ResumeThread
StopThreads: removed, as it was never called

Test Plan: tests continue to pass

Reviewers: ovyalov, chaoren

Subscribers: lldb-commits

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

llvm-svn: 237101
2015-05-12 08:35:33 +00:00
Vince Harron 8b33567189 Get lldb-server building on android-9
Build lldb-server with an android-9 sysroot.

llvm-svn: 237078
2015-05-12 01:10:56 +00:00
Ed Maste fefbdb82ae Remove Triple Vendor check when creating FreeBSD Platform
This is equivalent to r237052 in PlatformLinux.cpp.

llvm-svn: 237075
2015-05-12 00:43:45 +00:00
Ted Woodward 869e0c1c59 Fix selecting the Platform in TargetList::CreateTargetInternal()
Summary:
TargetList::CreateTargetInternal() will only select the current Platform. A previous patch always sets platform_sp to the current Platform, so a check later to see if platform_sp was not defined always failed, and the current Platform was used. This patch removes that check, so if the current Platform is not compatible with the target architecture, CreateTargetInternal() will call Platform::GetPlatformForArchitecture() to select a compatible Platform.

Vince, remote linux tests (Ubuntu -> remote Ubuntu) pass the same with and without this patch.

Reviewers: vharron, clayborg

Reviewed By: clayborg

Subscribers: jingham, lldb-commits

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

llvm-svn: 237053
2015-05-11 21:23:31 +00:00
Ted Woodward b1da257ad1 Remove Triple Vendor check when creating Linux Platform
Summary: The Linux Platform shouldn't care about the Vendor field in the Triple. Currently it allows a value of "PC", or "unknown" if LLDB was built on Linux. This patch removes that check, so the Vendor field isn't touched. This will allow the Linux Platform to be created when using a Triple of *-*-Linux.

Reviewers: vharron, clayborg, sas, tberghammer

Reviewed By: clayborg, sas, tberghammer

Subscribers: tberghammer, sas, lldb-commits

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

llvm-svn: 237052
2015-05-11 21:21:21 +00:00
Ted Woodward e76e7e9369 Add Hexagon packet support to ThreadPlanStepRange
Summary:
Hexagon is a VLIW processor. It can execute multiple instructions at once, called a packet. Breakpoints need to be alone in a packet. This patch will make sure that temporary breakpoints used for stepping are set at the start of a packet, which will put the breakpoint in a packet by itself.

Patch by Deepak Panickal of CodePlay and Ted Woodward of Qualcomm.

Reviewers: deepak2427, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 237047
2015-05-11 21:12:33 +00:00
Tamas Berghammer 3c1d572799 Fix thumb condition extraction in ARM instrcution emulator
llvm-svn: 236988
2015-05-11 12:50:56 +00:00
Pavel Labath 8c8ff7af28 [NativeProcessLinux] Remove double thread state accounting
Summary:
Now that all thread events are processed synchronously, there is no need to have separate records
of whether a thread is running. This changes the (ever-dwindling) remains of the TSC to use
NativeThreadLinux as the authoritative source of the state of threads. The rest of the
ThreadContext we need has been moved to a member of NTL.

Test Plan: ninja check-lldb continues to pass

Reviewers: chaoren, ovyalov

Subscribers: lldb-commits

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

llvm-svn: 236983
2015-05-11 10:03:10 +00:00
Vince Harron 9753dd98b3 Add support for ./dotest.py --channel and --log-success
Summary:
New dotest options that allow arbitrary log channels and
categories to be enabled.  Also enables logging for locally run
debug servers.
    
Log messages are separated into separate files per test case.
(this makes it possible to log in dosep runs)
    
These new log files are stored side-by-side with trace files in the
session directory.
    
These files are deleted by default if the test run is successful.
    
If --log-success is specified, even successful logs are retained.
    
--log-success is useful for creating reference log files.
    
Test Plan:
add '--channel "lldb all" --channel "gdb-remote packets" --log-success'
to your dotest options

Tested on OSX and Linux
    
Differential Revision: http://reviews.llvm.org/D9594

llvm-svn: 236956
2015-05-10 15:22:09 +00:00
Vince Harron 4cc8d202d0 Fixed minor compile warnings
llvm-svn: 236945
2015-05-10 08:33:58 +00:00
Robert Flack 96ad3de54b Convert mmap options for target in InferiorCallMmap.
Converts the MAP_PRIVATE and MAP_ANON options to the target platform constants
(on which the call runs) rather than using those of the compiled host.

Test Plan:
Run test suite, the following tests requiring memory allocation / JIT support
begin passing when running mac -> linux:
Test11588.py
TestAnonymous.py
TestBreakpointConditions.py
TestCPPStaticMethods.py
TestCStrings.py
TestCallStdStringFunction.py
TestDataFormatterCpp.py
TestDataFormatterStdList.py
TestExprDoesntBlock.py
TestExprHelpExamples.py
TestFunctionTypes.py
TestPrintfAfterUp.py
TestSBValuePersist.py
TestSetValues.py

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

llvm-svn: 236933
2015-05-09 15:53:31 +00:00
Chaoren Lin f34f410e0a Set path syntax for remote executable FileSpec.
Reviewers: ovyalov, zturner

Subscribers: lldb-commits

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

llvm-svn: 236925
2015-05-09 01:21:32 +00:00
Oleksiy Vyalov a9ea07113c Use hard links to link sysroot files within ModuleCache.
http://reviews.llvm.org/D9587

llvm-svn: 236917
2015-05-08 23:54:34 +00:00
Zachary Turner a49c59145b Enable thread-safe logging.
Thread-safe logging had been disabled because of a deadlock,
possibly due to a lock acquired during a signal handler.

This patch turns thread safe logging back on and also greatly
reduces the scope of the lock, confining it only to the code that
affects the underlying output stream, instead of all the code that
builds up the formatted log message.  this should resolve the
issue surrounding the deadlock.

llvm-svn: 236892
2015-05-08 18:50:54 +00:00
Tamas Berghammer d916dbb726 Remove check for object file type from DynamicLoaderPOSIXDYLD::DidAttach
For PIE executables the type of the main executable is shared object
so we can't force that the main executable should have the type of
executable.

llvm-svn: 236870
2015-05-08 15:45:53 +00:00
Tamas Berghammer f3a243297b Use /data/local/tmp as temp directory on android
If no temp directory specified by the user on android then fall back
to /data/local/tmp what is always present on the device. It removes
the dependency of specifying TMPDIR for executing platform commands
on android.

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

llvm-svn: 236843
2015-05-08 12:46:26 +00:00
Colin Riley 5de4251474 Fix build on windows.
llvm-svn: 236836
2015-05-08 12:17:27 +00:00
Tamas Berghammer 84dc009bef Re-enable compute load address for shared modules
It is required because of systems using PIE code

llvm-svn: 236826
2015-05-08 11:07:05 +00:00
Pavel Labath 014d32b3bb Have lldb_assert accept bool expressions
Summary:
This changes lldb_assert to accept bool expressions as the parameter, this is because some
objects (such as std::shared_ptr) are convertible to bool, but are not convertible to int, which
leads to surprising errors.

Reviewers: granata.enrico, zturner

Subscribers: lldb-commits

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

llvm-svn: 236819
2015-05-08 09:53:31 +00:00
Tamas Berghammer 85fadd9fe8 Fix parsing of the plt section for android-arm
The ELF data contains two different errors in some ELF files on android.
* The link field of the symbol table don't point to the plt section or
  to the dynsym section even when it is present in the ELF files.
* The size of the plt entries aren't specified in the section header of
  the plt section.

This CL adds some workarounds for these two issue with finding the
sections by name if the link field is empty and by using a heuristic to
calculate the size and offset of the plt entries.

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

llvm-svn: 236818
2015-05-08 09:40:05 +00:00
Aidan Dodds c0c838516d This patch allows LLDB to use the $qXfer:Libraries: packet.
Differential Revision: http://reviews.llvm.org/D9471

llvm-svn: 236817
2015-05-08 09:36:31 +00:00
Pavel Labath 337f3eb929 [NativeProcessLinux] Remove the stop callback
Summary:
The stop callback is a remnant of the ThreadStateCoordinator. We don't need it now that TSC is
gone, as we know exactly which function to call when threads stop. This also removes some
stop-related functions, which were just forwarding calls to one another.

Test Plan: ninja check-lldb continues to pass

Reviewers: chaoren, ovyalov

Subscribers: lldb-commits

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

llvm-svn: 236814
2015-05-08 08:57:45 +00:00
Zachary Turner 610e52912d Add logging to ProcessWindows.
llvm-svn: 236776
2015-05-07 21:39:33 +00:00
Enrico Granata 4878c87d5e Make it so that changing formats on a synthetic value object causes children to be invalidated and refetched when needed
This is required for supporting vector types formatting

llvm-svn: 236769
2015-05-07 20:33:31 +00:00
Jim Ingham 841ee9b998 Add a missing check for m_real_stop_reason.
<rdar://problem/20738527>

llvm-svn: 236762
2015-05-07 18:51:04 +00:00
Oleksiy Vyalov 919ef9dc37 Use file locks to synchronize access to ModuleCache.
http://reviews.llvm.org/D9056

llvm-svn: 236736
2015-05-07 15:28:49 +00:00
Mohit K. Bhakkad 5bf047e5c4 A small fix in rL236696
llvm-svn: 236716
2015-05-07 11:43:23 +00:00
Pavel Labath 5eb721edcb [NativeProcessLinux] Remove logging and error callbacks
Summary:
These are remnants of the thread state coordinator, which are now unnecessary. I have basically
inlined the callbacks. No functional change.

Test Plan: Tests continue to pass.

Reviewers: chaoren, vharron

Subscribers: lldb-commits

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

llvm-svn: 236707
2015-05-07 08:30:31 +00:00
Ilia K ece0a3f69c Fix ClangUserExpression::Evaluate return code in case of eExpressionParseError
Summary: This patch fixes retvalue of ClangUserExpression::Evaluate in case of eExpressionParseError error

Reviewers: jingham, spyffe, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, clayborg, spyffe, jingham

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

llvm-svn: 236700
2015-05-07 06:27:43 +00:00
Ilia K 8f0db3e1f0 Don't call the Process::SyncIOHandler in Target::Launch
Summary: This patch moves synchronization of iohandler to CommandObjectProcessLaunch::DoExecute like it was done in CommandObjectProcessContinue::DoExecute.

Reviewers: jingham, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, clayborg, jingham

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

llvm-svn: 236699
2015-05-07 06:26:27 +00:00
Mohit K. Bhakkad cdc22a889e [LLDB][MIPS] Software single stepping
Patch by Jaydeep Patil

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

llvm-svn: 236696
2015-05-07 05:56:27 +00:00
Greg Clayton 28eb7bf406 Don't crash if we load a file with an architecture we don't support and try to parse some DWARF.
The ClangASTContext::getTargetInfo() will return NULL in this case and could cause us to crash if we don't check.

<rdar://problem/20543554> 

llvm-svn: 236681
2015-05-07 00:07:44 +00:00
Enrico Granata 087638b3a6 I forgot to return here, so do it, and appease the compiler
llvm-svn: 236646
2015-05-06 21:54:18 +00:00
Enrico Granata ba4b8b0917 Add a language objc class-table dump command
This command dumps a bunch of interesting facts about all Objective-C classes known to LLDB in the inferior process

llvm-svn: 236640
2015-05-06 21:01:07 +00:00
Sean Callanan ac28c7044f Allow the gdb_objc_realized_classes symbol to be
any type of symbol, which is okay since we are
looking only in the Objective-C module.

<rdar://problem/20828139>

llvm-svn: 236622
2015-05-06 18:33:19 +00:00
Pavel Labath ad5ee04058 Simplify FuncUnwinders::GetEHFrameAugmentedUnwindPlan
Summary:
GetEHFrameAugmentedUnwindPlan duplicated the work of GetEHFrameUnwindPlan in getting the original
plan from DWARF CFI. This changes the function to call GetEHFrameUnwindPlan instead of doing all
the work itself. A copy constructor is added to UnwindPlan to enable plan copying.

Test Plan: No regressions on linux test suite.

Reviewers: jasonmolenda, clayborg

Subscribers: lldb-commits

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

llvm-svn: 236607
2015-05-06 15:54:48 +00:00
Pavel Labath ed89c7fe44 [NativeProcessLinux] Remove the post-stop lambda
Summary:
The lambda was always calling SetState(eStateStopped) with small variations, so I have inlined
the code. Given that we don't have the TSC anymore, I believe we don't need to be so generic.

The only major change here is the way we choose a stop reason thread when we're interrupting a
program on client request. Previously, we were setting a null stop reason for all threads and
then fixing up the reason for one victim thread in the lambda. Now, I make sure the stop reason
is set for the victim thread correctly in the first place.

I also take the opportunity to rename CallAfter* functions into something more appropriate.

Test Plan: All tests continue to pass.

Reviewers: chaoren, vharron

Subscribers: lldb-commits

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

llvm-svn: 236595
2015-05-06 12:22:37 +00:00
Pavel Labath c076559a5b [NativeProcessLinux] fold ThreadStateCoordinator into NPL
Summary:
Since all TSC operations are now executed synchronously, TSC has become a little more than a
messenger between different parts of NativeProcessLinux. Therefore, the reason for its existance
has disappeared.

This commit moves the contents of the TSC into the NPL class. This will enable us to remove all
the boilerplate code in NPL (as it stands now, this is most of the class), which I plan to do in
subsequent commits.

Unfortunately, this also means we will lose the unit tests for the TSC. However, since the size
of the TSC has diminished, the unit tests were not testing much at this point anyway, so it's not
a big loss.

No functional change.

Test Plan: All tests continue to pass.

Reviewers: vharron, chaoren

Subscribers: lldb-commits

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

llvm-svn: 236587
2015-05-06 10:46:34 +00:00
Pavel Labath 9d37c41022 [ThreadStateCoordinator] Remove Event classes
Summary:
This is a cleanup patch for thread state coordinator. After making processing of all events
synchronous, there is no need to have a a separate class for each event. I have moved back
processing of all events back into the TSC class. No functional change.

Test Plan: All tests continue to pass.

Reviewers: chaoren, vharron

Subscribers: lldb-commits

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

llvm-svn: 236576
2015-05-06 08:23:47 +00:00
Greg Clayton 9c284c4d7a Make sure that the following paths say they are equal:
/private/tmp/main.cpp
/private/tmp/..//tmp/main.cpp

We saw paths like this in makefile generate binaries when someone left an extra '/' on the end of a makefile variable.

<rdar://problem/18945972>

llvm-svn: 236541
2015-05-05 20:26:58 +00:00
Chaoren Lin ce36c4cee1 Fix process launch from Windows host to Android target.
Summary:
- Denormalized path on Windows host causes bad `A` packet.
- Executables copied from Windows host doesn't have executable bits.

Reviewers: tberghammer, zturner, ovyalov

Reviewed By: ovyalov

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 236516
2015-05-05 18:43:19 +00:00
Chaoren Lin 26438d26fa Fix Android build.
llvm-svn: 236509
2015-05-05 17:50:53 +00:00
Pavel Labath 45f5cb31dc [NativeProcessLinux] Get rid of the thread state coordinator thread
Summary:
This change removes the thread state coordinator thread by making all the operations it was
performing synchronous. In order to prevent deadlock, NativeProcessLinux must now always call
m_monitor->DoOperation with the m_threads_mutex released. This is needed because HandleWait
callbacks lock the mutex (which means the monitor thread will block waiting on whoever holds the
lock). If the other thread now requests a monitor operation, it will wait for the monitor thread
do process it, creating a deadlock.

To preserve this invariant I have introduced two new Monitor commands: "begin operation block"
and "end operation block". They begin command blocks the monitor from processing waitpid
events until the corresponding end command, thereby assuring the monitor does not attempt to
acquire the mutex.

Test Plan: Run the test suite locally, verify no tests fail.

Reviewers: vharron, chaoren

Subscribers: lldb-commits

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

llvm-svn: 236501
2015-05-05 15:05:50 +00:00
Aidan Dodds df627e73a1 Fix GetModuleInfo() not checking for unsupported RSP response.
http://reviews.llvm.org/D9473

llvm-svn: 236486
2015-05-05 08:31:55 +00:00
Jason Molenda 9060e987a0 Fix an uninitialized memory use error when interpreting
compact unwind encodings for x86_64 / i386 omit-frame-pointer
code.  It was possible for lldb to get the location of saved
registers incorrect for some of these functions.
<rdar://problem/20753264> 

llvm-svn: 236478
2015-05-05 02:05:53 +00:00
Siva Chandra e32f2b57ff [ValueObject::GetPointeeData] Get addr from value for eValueHostAddress values.
Summary:
After r236447, ValueObject::GetAddressOf returns LLDB_INVALID_ADDRESS
when the value type is eValueHostAddress. For such a case, clients of
GetAddressOf should get the address from the scalar part of the value
instead of using the value returned by GetAddressOf directly.

This change also makes ValueObject::GetAddressOf set the address type to
eAddressTypeHost for values of eValueHostAddress so that clients can
recognize that they need to fetch the address from the scalar part
of the value.

Test Plan: ninja check-lldb on linux

Reviewers: clayborg, ovyalov

Reviewed By: ovyalov

Subscribers: lldb-commits

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

llvm-svn: 236473
2015-05-05 00:41:35 +00:00
Siva Chandra a3747a9d31 [ValueObject] Do not return address of eValueTypeHostAddress values.
Summary:
This fixes TestRegisterVariables for clang and hence it is enabled in this commit.


Test Plan: dotest.py -C clang -p TestRegisterVariables

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 236447
2015-05-04 19:43:34 +00:00
Colin Riley c9c55a26bd Add language command and LanguageRuntime plugin changes to allow vending of command objects.
Differential Revision: http://reviews.llvm.org/D9402

llvm-svn: 236443
2015-05-04 18:39:38 +00:00
Jim Ingham 204d0ee01f Fix a typo in the warning.
<rdar://problem/20799707>

llvm-svn: 236429
2015-05-04 17:33:33 +00:00
Mohit K. Bhakkad 1c34f7cf18 [LLDB][MIPS] Emulate instruction using MCDisassembler
Patch by Jaydeep Patil

EmulateInstructionMIPS64 has been modified to use llvm::MCDisassembler instead of duplicating the decoding logic.
Added emulation of few branch instructions for software single stepping

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

llvm-svn: 236411
2015-05-04 06:28:04 +00:00
Jason Molenda 8980e6bc10 Change process kill to call Process::Destroy (force_kill = true);
follow-up to the change in r235158.  Right now if you attach to 
a process and type "kill", lldb doesn't kill it, it detaches.
<rdar://problem/20691198> 

llvm-svn: 236363
2015-05-01 23:39:48 +00:00
Enrico Granata b0e8a55d4d Fix an issue where the UTF dumper was ignoring the direction to generate uncapped dumps
llvm-svn: 236362
2015-05-01 22:57:38 +00:00
Chaoren Lin b2b3ff1860 Fixed some compiler warnings because of bit-width mismatches.
llvm-svn: 236323
2015-05-01 16:58:18 +00:00
Chaoren Lin 3ea689b313 Support remote-android with multiple connected devices.
Summary:
This change introduces a new URL scheme for `platform connect`:
```
adb://device-id:port
```

Reviewers: vharron, tberghammer, clayborg, ovyalov

Reviewed By: ovyalov

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 236321
2015-05-01 16:49:28 +00:00
Chaoren Lin ec53482aef PosixPipes should not be copyable but should be movable.
Summary: This addresses Oleksiy's comment in D9307.

Reviewers: clayborg, ovyalov

Reviewed By: clayborg, ovyalov

Subscribers: lldb-commits

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

llvm-svn: 236320
2015-05-01 16:49:23 +00:00
Sean Callanan 80c9759ef7 Added support for locating and importing functions
(including inline functions) from modules in the
expression parser.  We now have to retain a reference
to the code generator in ClangExpressionDeclMap so
that any imported function bodies can be appropriately
sent to that code generator.

<rdar://problem/19883002>

llvm-svn: 236297
2015-05-01 00:47:29 +00:00
Sean Callanan 09b41c0785 Fixed some compiler warnings because of bit-width
mismatches.

llvm-svn: 236295
2015-05-01 00:44:36 +00:00
Sean Callanan 1376469a61 Updated our use of clang::Preprocessor to reflect
a change in the API used to get macros.

llvm-svn: 236292
2015-05-01 00:19:44 +00:00
Jim Ingham 2c83e336a1 Don't return nullptr when you mean to return an empty llvm::StringRef...
<rdar://problem/20747164>

llvm-svn: 236287
2015-04-30 23:45:07 +00:00
Jason Molenda ebd01b0ae6 Guard against the case where the Write method is called with
an argument pointing into the middle of m_buffer and then
Write() calls GrowBuffer() to resize m_buffer, leaving 
the content argument pointing into deallocated memory.

Patch by Kate Stone.
<rdar://problem/20756722> 

llvm-svn: 236286
2015-04-30 23:42:56 +00:00
Sean Callanan 68f85e7d6a Made macros from modules be injected before our
global convenience expression prefix.  Also ensured
that if macros are defined by the modules we don't
try to redefine them.  Finally cleaned up a bit of
code while I was in there.

<rdar://problem/20756642>

llvm-svn: 236266
2015-04-30 21:49:58 +00:00
Zachary Turner 26c0a5ea0d Remove the NullLog class introduced in r236174.
Based on list discussions, a different approach is desired for
reducing the visual impact of logging statements on the
readability of the code.  Another mechanism will be added in
a followup patch, but for now, since NullLog is unreferenced,
this patch just removes it.

This patch does *not* remove the other half of r236174, which was
to delete some dead code surrounding logging flags.

llvm-svn: 236259
2015-04-30 21:03:37 +00:00
Ilia K d8c1475f46 Fix Process::ResumeSynchronous which waits a process even in case of error
llvm-svn: 236231
2015-04-30 13:10:32 +00:00
Pavel Labath d351bcc858 Fix typo in Core/Log
llvm-svn: 236222
2015-04-30 10:47:56 +00:00
Richard Smith 63a41277fe Fix build after Clang API change in r236176.
llvm-svn: 236182
2015-04-29 23:46:48 +00:00
Zachary Turner b74e279fe1 Fix build broken by r236174.
Apparently va_list is literally a char* on Windows.

llvm-svn: 236177
2015-04-29 23:24:12 +00:00
Zachary Turner c1592658d5 Introduce a NullLog class, which ignores all messages.
The purpose of this class is so that GetLogIfAllCategoriesSet
can always return an instance of some class, whether it be a real
logging class or a "null" class, which ignores messages.  Code
that is littered with if statements that only log if the pointer
is non-null can get very unwieldy very quickly, so this should
help code readability in such circumstances.

Since I'm in this code anyway, I'm also deleting the
PrintfWithFlags methods, as well as all the flags, since they
appear to be dead code that have been superceded by newer
mechanisms and all the flags are simply ignored.

llvm-svn: 236174
2015-04-29 22:55:28 +00:00
Jason Molenda 3114703b5c Don't force a vendor check in ProcessMachCore::CanDebug() -- if this
is a Mach-O file and it is a Mach-O core file, activate the 
ProcessMachCore plugin.
<rdar://problem/20739989> 

llvm-svn: 236170
2015-04-29 22:17:45 +00:00
Chaoren Lin 66f2e12f7a Expose Close{Read/Write}FileDescriptor for pipes.
llvm-svn: 236136
2015-04-29 18:25:18 +00:00
Chaoren Lin a52f48412d Add file descriptor constructor for PipePosix.
llvm-svn: 236133
2015-04-29 17:36:58 +00:00
Chaoren Lin 3eb4b4589e Remove trap code from disassembly.
Summary:
NativeProcessProtocol uses ReadMemory internally for setting/checking
breakpoints but also for generic memory reads (Handle_m), this change adds a
ReadMemoryWithoutTrap for that purpose. Also fixes a bunch of misuses of addr_t
as size/length.

Test Plan: `disassemble` no longer shows the trap code.

Reviewers: jingham, vharron, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 236132
2015-04-29 17:24:48 +00:00
Omair Javaid b78e05fead This patch adds support aarch64-linux-gnu (SysV) abi in lldb.
This code is also an import from MacOSx implementation as SysV abi is
similar to what has been implemented for MacOS but may require a few tweaks.

http://reviews.llvm.org/D8538

llvm-svn: 236098
2015-04-29 11:52:35 +00:00
Omair Javaid 52f825bd1c This patch adds required piece of code for SysV Abi for arm.
Its mostly imported from MacOSx ABI for arm which is similar.

Further tweaking a updates may be required at a later stage.

http://reviews.llvm.org/D8539

llvm-svn: 236097
2015-04-29 10:49:45 +00:00
Aidan Dodds ed9f612639 Fix bug in gdb-remote xml parser which failed to parse xml split over multiple rsp packets.
llvm-svn: 236095
2015-04-29 10:08:17 +00:00
Ilia K 7f83624222 Add language option in -gdb-show command (MI)
Summary:
Add language option in -gdb-show command + test:
```
$ bin/lldb-mi ~/p/hello
[...]
b main
[...]
r
[...]
(gdb)
-gdb-show language
^done,value="c++"
(gdb)
quit
```

Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/

Reviewers: abidh, granata.enrico, jingham, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, jingham, granata.enrico, clayborg, abidh

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

llvm-svn: 235983
2015-04-28 12:51:16 +00:00
Ilia K 6e46512ec3 Don't print a type of variable in Address::Dump if it's unknown (i.e. nullptr)
Summary: This patch fixes dereferencing of nullptr in case when GetType() returns that.

Reviewers: jingham, granata.enrico, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, granata.enrico, clayborg, jingham

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

llvm-svn: 235982
2015-04-28 12:45:57 +00:00
Pavel Labath 426bdf8861 [NativeProcessLinux] Add back synchronisation of thread create events
Summary:
Without the synchronisation between the two thread creation events the following case could
happen:
- threads A and B are running. A hits a breakpoint. We note that we want to stop B.
- before we could stop it, B creates a new thread C, we get the stop notification for B, but we
  don't record C's existence yet.
- we resume B
- before we get the C notification, B stops again (e.g. hits a breakpoint, gets our SIGSTOP,
  etc.)
- we see all known threads have stopped, and we notify LLDB
- C notification comes, we note it's existence and resume it
=> we have an inconsistent state (LLDB thinks we've stopped, but C is running)

I resolve this by doing a blocking wait for for the C notification when we get the creation
notification on the parent (B) thread. This way the two events are synchronised, but we don't
need to introduce the intermediate "launching" state which would complicate handling of thread
states as all code would need to be aware of the third possible state.

Test Plan:
This is an obscure corner case, which I had not observed in practise, so I have no
test for it. I have tested that this commit does not regress in existing tests though.

Reviewers: chaoren, vharron

Subscribers: lldb-commits

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

llvm-svn: 235969
2015-04-28 07:51:52 +00:00
Chaoren Lin 368c9f6e9b Add an unnamed pipe fail-safe to launching lldb-gdbserver.
Summary:
Currently, launching lldb-gdbserver from platform on Android requires root for
mkfifo() and an explicit TMPDIR variable. This should remove both requirements.

Test Plan: Successfully launched lldb-gdbserver on a non-rooted Android device.

Reviewers: tberghammer, vharron, clayborg

Reviewed By: clayborg

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 235940
2015-04-27 23:20:30 +00:00
Zachary Turner 7cc3494dea [Windows] Add a RegisterContextWindows_x64.
With this patch, LLDB can debug x64 executables on Windows with
the same level of functionality as for x86 executables.

llvm-svn: 235935
2015-04-27 22:58:57 +00:00
Greg Clayton 63adb3f5ff Make sure versions are valid before we try to use them. Also check for invalid versions[0] by comparing it to UINT32_MAX instead of 0.
llvm-svn: 235892
2015-04-27 16:49:57 +00:00
Omair Javaid a77ca519ea Fix LLDB ARM build error on ubuntu precise with gcc4.7
Differential revision: http://reviews.llvm.org/D9100

llvm-svn: 235865
2015-04-27 12:01:59 +00:00
Pavel Labath 6648fcc34b Fix register read callback in linux-arm single stepping
The previous read callback always read the value of the register what
caused problems when the emulator wrote some value into a register and
then expected to read the same value back. This CL add a register value
cache into the callbacks to return the correct value after a register
write also.

Test Plan: Stepping over BL/BLX instruction works on android-arm if the instruction set isn't change (other, unrelated patch will come for the case when we move to an other instruction set)

Reviewers: omjavaid, sas, clayborg

Reviewed By: clayborg

Subscribers: labath, tberghammer, rengolin, aemerson, lldb-commits

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

From: Tamas Berghammer <tberghammer@google.com>
llvm-svn: 235852
2015-04-27 09:21:14 +00:00
Robert Flack 31870e15fa Look for both .debug and dsym debugging symbol information for stripped executable.
Currently Symbols::LocateExecutableSymbolFile on MacOSX only looks for external
dsym debugging information, however if running on a stripped dwarf executable it
should also check for a .debug file as well.

Test Plan:
./dotest.py $DOTEST_OPTS -t -p TestSharedLibStrippedSymbols.py
This test now passes when running a remote Mac -> Linux test, and still passes
running locally on Mac or locally on Linux.

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

llvm-svn: 235737
2015-04-24 18:09:54 +00:00
Tamas Berghammer 224dfbf3ae Fix condition detection in EmulateInstructionARM
The condition detection code is calculating the result of the condition
based on the first 3 bit of the condition and then negate it if the LSB
of the condition is set. It works for the normal conditions but 0b1110
and 0b1111 are special as both of them should evaluate to true
independently the value of CPSR. This CL removes the negating logic from
those cases.

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

llvm-svn: 235715
2015-04-24 12:13:44 +00:00
Tamas Berghammer 0da3ee1ef3 Fix order of b and blx instrction in EmulateInstructionARM
In the previous ordering some "blx <label>" instruction was recognised
as "b #imm24" instructions causing a failure in the instruction
emulator.

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

llvm-svn: 235714
2015-04-24 12:13:41 +00:00
Tamas Berghammer 04f7144907 Fix write register context for arm "add<c> <Rd>, sp, #imm"
Differential revision: http://reviews.llvm.org/D9213

llvm-svn: 235713
2015-04-24 12:13:38 +00:00
Bruce Mitchener 17d2730ee0 Start to share SWIG interface files between languages.
Summary:
Move scripts/Python/interface to scripts/interface so that we
can start making iterative improvements towards sharing the
interface files between multiple languages (each of which would
have their own directory as now).

Test Plan: Build and see.

Reviewers: zturner, emaste, clayborg

Reviewed By: clayborg

Subscribers: mjsabby, lldb-commits

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

llvm-svn: 235676
2015-04-24 00:38:53 +00:00