Added tests and impl to make sure the following errors are reported:
* Notifying a created thread that we are already tracking.
* Notifying a thread death for a thread we don't know about.
llvm-svn: 218900
Now that ThreadStateCoordinator errors out on threads in unexpected states,
it has enough information to know which threads need stop requests fired
when we want to do a deferred callback on a thread's behalf. This change
adds a new method, CallAfterRunningThreadsStop(...), which no longer
takes a set of thread ids that require stop requests. It's much harder
to misuse this method and (with newer error logic) it's harder to
correctly use the original method. Expect the original method that takes
the set of thread ids to stop to disappear in the near future.
Adds several tests for CallAfterRunningThreadsStop().
llvm-svn: 218897
This patch fixes the codesigning of debugserver on OSX when built with
cmake. Without this you get this error when debugging:
error: process launch failed: unable to locate debugserver
Note: you also need to set LLDB_DEBUGSERVER_PATH to point to your built debugserver.
e.g. export LLDB_DEBUGSERVER_PATH=`pwd`/bin/debugserver
Change by dawn@burble.org.
Tested on MacOSX 10.9.5 and Xcode 6.1 Beta using cmake/ninja.
Verified no build break on Linux Ubuntu cmake/ninja and Xcode 6.1 canonical build.
llvm-svn: 218890
Added tests to verify that the coordinator signals an error if
the given thread to resume is unknown, and if the thread is through to
be running already.
Modified resume handling code to match tests.
llvm-svn: 218872
* Checks for any 'clean' arg, setting clean-only mode.
* If clean-only mode, skip the make.
* Adds the equivalent of os.devnull in a way that supports the file-like 'write' operation.
* Uses a null sysout/syserr for the clean step so we don't see noise from cleaning.
* Now always runs the clean step after a real test run so we don't have cruft left over after a test run.
llvm-svn: 218871
updating its ivars. We've had a lot of crash reports and careful
analysis shows that we've got multiple threads operating on the
same StackFrame objects, changing their m_sc and m_flags ivars.
<rdar://problem/18406111>
llvm-svn: 218845
ThreadStateCoordinator changes:
* Most commands that run in the queue now take an error handler that
will be called with an error string if an error occurs during processing.
Errors generally stop the operation in progress. The errors are checked
at time of execution. This is intended to help flush out ptrace/waitpid/state management
issues as quickly as possible.
* Threads now must be known to the coordinator before stops can be reported,
resumes can be requested, thread deaths can be reported, or deferred stop
notifications can be made. Failure to know the thread will cause the coordinator
to call the error callback for the event being processed. Threads are introduced
to the system by the NotifyThreadCreate method.
* The NotifyThreadCreate method now takes the initial state of the thread being
introduces to the system. We no longer just assume the thread is running.
The test cases were cleaned up, too:
* A gtest test fixture is now used, which allows creating less verbose helper
methods that setup common pieces of callback code for some method invocations.
Net result: the tests are simpler to read and shorter to write.
llvm-svn: 218833
CMake build of any part of LLVM with LLDB checked out fails immediately.
=[
We appear to not even have a build bot covering the CMake build of LLDB
which makes this truly terrible. That needs to be fixed immediately.
llvm-svn: 218831
ThreadIDFunc => ThreadIDFunction
LogFunc => LogIDFunction
We try to avoid abbreviations/shortened names. Adjusted function parameter names
as well to replace _func with _function.
llvm-svn: 218773
r218568 added an explicit #include of the Linux ProcessMonitor.h to
POSIXThread.cpp, rather than including just "ProcessMonitor.h" and
relying on the build infrastructure for the appropriate paths.
For now add #ifdefs in the source to use the FreeBSD or Linux header
as appropriate; a cleaner fix (and perhaps some refactoring of the
POSIX classes) should still be done later.
llvm-svn: 218762
There is a state transition that seems potentially buggy that I am capturing and
logging here, and including an explicit test to demonstrate expected behavior. See new test
for detailed description. Added logging around this area since, if we hit it, we
may have a usage bug, or a new state transition we really need to investigate.
This is around this scenario:
Thread C deferred stop notification awaiting thread A and thread B to stop.
Thread A stops.
Thread A requests resume.
Thread B stops.
Here we will explicitly signal the deferred stop notification after thread B
stops even though thread A is now resumed. Copious logging happens here.
llvm-svn: 218683
the user level. It adds the ability to invent new stepping modes implemented by python classes,
and to view the current thread plan stack and to some extent alter it.
I haven't gotten to documentation or tests yet. But this should not cause any behavior changes
if you don't use it, so its safe to check it in now and work on it incrementally.
llvm-svn: 218642
The thread resume block is executed in the normal flow of thread
state queued event processing. The tests verify that it is executed
when we track the thread to be stopped and skipped when we track
it to already be running.
llvm-svn: 218638
Also added a test for the reset handling. The reset/state clearing happens
as a processed queue event. The only diff vs. standard processing is that
the exec clears the queue before queueing the activity to clear internal state.
i.e. once we get an exec, we really stop doing any other queue-based activity.
llvm-svn: 218629
works, as do breakpoints, run and pause, display zeroth frame.
See
http://reviews.llvm.org/D5503
for a fuller description of the changes in this commit.
llvm-svn: 218596
A new thread arriving while a pending signal notification
is outstanding will (1) add the new thread to the list of
stops expected before the deferred signal notification is
fired, (2) send a stop request for the new thread, and
(3) track the new thread as currently running.
llvm-svn: 218578
See http://reviews.llvm.org/D5495 for more details.
These are changes that are part of an effort to support building llgs, within the AOSP source tree, using the Android.mk
build system, when using the llvm/clang/lldb git repos from AOSP replaced with the experimental ones currently in
github.com/tfiala/aosp-{llvm,clang,lldb,compiler-rt}.
llvm-svn: 218568
Tested two pending stops before notification, where one of the pending stop
requirements was already known to be stopped.
Tested pending thread stop before notification, then reporting thread with
pending stop died and verifies pending notification is made.
llvm-svn: 218559
Glad I did - caught a bug where the auto variable was not a reference
to a set and instead was a copy. I need to review rules on that!
llvm-svn: 218558
This change modifies the python test runner to combine lines starting with a
failure report including up to 3 more lines, terminated by the next
"[ FAILED ]" line. These are all emitted on the same line as the file:line
indication, which allows Xcode's failure marker code to pick it up and display
it along with the error badge in the Xcode editor window. Makes for a nice
gtest development experience.
llvm-svn: 218518
This change does the following:
* Removes the gtest/Makefile recursive-make-based calling strategy
for gtest execution.
* Adds the gtest/do-gtest.py call script.
- This handles finding and calling the Makefiles that really
run tests.
- This script also transforms the test output into something
that Xcode can place a failure marker on when a test fails.
* Modifies the Xcode external build command target for gtest.
It now calls the gtest/do-gtest.py script.
There is still room for improvement on Xcode integration of
do-gtest.py. Essentially the next several lines of error reporting
from the gtest output should be coalesced into a single line so that
Xcode can tell more about the error directly in the editor. Right now
it just puts a red mark and says "failure" but doesn't give any
details.
llvm-svn: 218470
This change does the following:
* Remove test/c++/...
* Add gtest.
* Add gtest/unittest directory for unittesting individual classes.
* Add an initial Plugins/Process?linux/ThreadStateCoordinatorTest.cpp.
- currently failing a test (intentional).
- added a bare-bones ThreadStateCoordinator.cpp to Plugins/Process/Linux,
more soon. Just enough to prove out running gtest on Ubuntu and MacOSX.
* Added recursive make machinery so that doing a 'make' in gtest/ is
sufficient to kick off the existing test several directories down.
- Caveat - I currently short circuit from gtest/unittest/Makefile directly to
the one and only gtest/unittest/Plugins/Process/Linux directory. We'll need
to add the intervening layers. I haven't done this yet since to fix the
Xcode test failure correspondence, I may need to add a python layer which
might just handle the directory crawling.
* Added an Xcode project to the lldb workspace for gtest.
- Runs the recursive make system in gtest/Makefile.
- Default target is 'test'. test and clean are supported.
- Currently does not support test failure file/line correspondence.
Requires a bit of text transformation to hook that up.
llvm-svn: 218460
See http://reviews.llvm.org/D5486 for more details.
I was tracking a problem where llgs on linux would not pick up any environment variables. On OSX there is a virtual function PlatformDarwin::GetEnvironment() which correctly sets up the list of environment variables. On linux llgs it defaults to a base class default implementation which clears the list.
I moved the OSX implementation down to PlatformPOSIX. This fixes my problem on linux still works properly on OSX.
Change by Shawn Best.
Slight tweak to convert 'virtual' to 'override' in PlatformDarwin.h virtual method override by Todd.
Tested:
Ubuntu 14.04 x86_64, cmake/ninja build + tests.
MacOSX 10.9.5 x86_64, Xcode 6.1 Beta build + tests.
llvm-svn: 218424
Makes use of LLVM gtest support. This does *not* run as part of
the lldb test suite.
I'm using it to start testing some components that
I'll be adding to the inner guts of NativeThreadLinux to more
maintainably handle thread states and deferred thread state notification.
Runs with default Makefile target "test" using gmake within a given
test directory (currently only test/c++/native_process/thread_state_coordinator).
The Makefile.rules currently assume it is using the LLVM gtest. It works on
a canonical MacOSX dir structture (i.e. lldb, lldb/llvm, lldb/llvm/tools/clang).
It also works on Ubuntu assuming the standard dir layout of llvm, llvm/tools/clang,
llvm/tools/lldb. In this case, it expects a directory called build-debug parallel
to the llvm source dir. All directory assumptions can be overridden with
environment variables. See test/c++/make/Makefile.rules for details.
We'll want to make this smarter in the future, particularly around finding the LLVM build
output dir.
llvm-svn: 218422
See thread started here for motivation:
http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-September/005225.html
This change enables the ability to set breakpoints in ccache-based and executables that
make use of preprocessed source files. This ability existed in lldb before, but was off
by default.
Change by Doug Snyder.
llvm-svn: 218405
This script supports displaying developer-focused backtraces when working
with mixed Java and C/C++ stack frames within lldb. On Android, this represents
just about every app, since all apps start in Java code.
The script currently supports the Art JVM when run on host-side x86_64 and x86,
but does require a patch not yet accepted in AOSP:
AOSP patch: https://android-review.googlesource.com/#/c/106523/
The backtraces will hide Art VM machinery for interpreted and AOT code
and display the Java file/line numbers for Java code, while displaying
native backtrace info for native frames. Effectively the developer will
get an app-centric view of the call stack.
This script is not yet tested on device-side Art nor is it tested on
any architecture other than x86_64 or x86 32-bit. Several changes were
needed on the AOSP side to enable it to work properly for x86_64 and x86,
so it is quite likely we'll need to do something similar for other cpu
architectures as well.
Change by Tong Shen
llvm-svn: 218315
was broken in r214984 by the addition of an unconditional error
return at the start of the code block handling this method. Remove
the errant lines.
<rdar://problem/18416691>
llvm-svn: 218291
If you "command script import" this file, then you will have two new commands:
(lldb) tk-variables
(lldb) tk-process
Not sure how this will work on all other systems, but on MacOSX, you will get a window with a tree view that allows you to inspect your local variables by expanding variables to see the child values.
The "tk-process" allows you to inspect the currently selected process by expanding the process to see the threads, the threads to see the frames, and the frames to see the variables. Very handy if you want to view variables for all frames simultaneously.
llvm-svn: 218279
The test used to trigger an assertion failure "Cannot get layout of
forward declarations!", but it no longer fails when built with
Clang 3.4.1 (system compiler) or 3.5 from SVN on FreeBSD.
llvm.org/pr17231
llvm-svn: 218196
Build break change by Paul Osmialowski.
Minor changes to argument passing (converted unintentional pass-by-value to pass-by-ref) by Todd.
llvm-svn: 218186
requirement for a command instead of the smallest. e.g. if a command
requires a Target, Process, Thread, and Frame, and none of those
are available, report the largest -- Target -- as being missing
instead of the smallest -- Frame.
Patch by Paul Osmialowski.
llvm-svn: 218181
platform locations. We didn't always do an exhaustive search through all the
platform locations, so we would have to read some files out of memory even though
they existed in the exploded shared cache or SDK.
<rdar://problem/18385947>
llvm-svn: 218157
that would clear the module list, and then put it back by hand. But we forgot to
also put its sections back in the target SectionList, so we would jettison it as
unloaded when we finished handling the first real load event. Add its sections.
<rdar://problem/18385947>
llvm-svn: 218156
Changes include:
- fix it so you can select the "host" platform using "platform select host"
- change all callbacks that create platforms to returns shared pointers
- fix TestImageListMultiArchitecture.py to restore the "host" platform by running "platform select host"
- Add a new "PlatformSP Platform::Find(const ConstString &name)" method to get a cached platform
- cache platforms that are created and re-use them instead of always creating a new one
llvm-svn: 218145
For the Objective-C case, we do not have a "function type" notion, so we actually end up wrapping the clang ObjCMethodDecl in the Impl object, and ask function-y questions of it
In general, you can always ask for return type, number of arguments, and type of each argument using the TypeMemberFunction layer - but in the C++ case, you can also acquire a Type object for the function itself, which instead you can't do in the Objective-C case
llvm-svn: 218132
The $A handler was unnecessarily waiting for the launched app to hit a stop
before returning. Removed this code.
Renamed the llgs inferior launching code to LaunchProcessForDebugging ()
to prevent it from possibly being mistaken as code that lldb-platform uses
to launch a debugserver process. We probably want to look at breaking out
llgs-specific and lldb-platform-specific code into separate derived classes,
with common code in a shared base class.
llvm-svn: 218075
The issue was GDBRemoteCommunication::CheckForPacket() already fixes up any prefixed bytes (0x7d followed by value that is XOR'ed with 0x20). If we do this again, we cause binary packets to lose bytes.
This allows lldb-platform to be able to upload binaries and debug them remotely.
llvm-svn: 218002
% lldb ios-executable
(lldb) platform connect connect://localhost:11111
Prior to this fix, the host platform would be selected even though the target was using the ios-remote platform.
llvm-svn: 217963
The problem was the read_func we were supplying to the interactive interpreter wasn't stripping the newline from the end of the string. Now it does and multi-line python scripts can be typed in Xcode.
<rdar://problem/17696438>
llvm-svn: 217843
This allows us to fixup the address of the symbol as soon as we parse it
so that lldb is not confused thinking there are two different symbols in
the binary (one with the thumb bit, one without). Also, differentiating
between THUMB and ARM symbols allows the debugger to place the right
type of breakpoint.
Change by Stephane Sezer.
llvm-svn: 217841
There are several places where multiple threads are accessing the same variables simultaneously without any kind of protection. I propose using std::atomic<> to make it safer. I did a special build of lldb, using the google tool 'thread sanitizer' which identified many cases of multiple threads accessing the same memory. std::atomic is low overhead and does not use any locks for simple types such as int/bool.
See http://reviews.llvm.org/D5302 for more details.
Change by Shawn Best.
llvm-svn: 217818
There are target pointer members in struct jit_code_entry and jit_descriptor.
Data layout of those structures should be decided by target, not host.
This fixes JITLoaderGDB for 64-bit host and 32-bit target.
See http://reviews.llvm.org/D5339 for more details.
Change by Tong Shen.
llvm-svn: 217816
Also, in case they don't define any, change the default from "Run Python function <blah>" into "For more information run help <blah>"
The core issue here is that Python only allows one docstring per function, so we can't really attach both a short and a long help to the same command easily
There are alternatives but this is not a pressing enough concern to go through the motions quite yet
Fixes rdar://18322737
llvm-svn: 217795
ELF objects contain marker symbols to differentiate between ARM and
THUMB functions. Instead of storing them internally and having garbage
show up when symbols are searched for by the user, we can just skip them
and not store them at all, as we never actually need them.
Change by Stephane Sezer.
Tested:
Ubuntu 14.04 x86_64
MacOSX 10.9.4 x86_64
llvm-svn: 217782
Instead of forcing the remote arch type to MachO all the time, we
inspect the OS/vendor that the remote debug server reports and use it to
set the arch type to MachO, ELF or COFF accordingly.
See thread here for more context:
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140915/012968.html
Change by Stephane Sezer.
Tested:
MacOSX 10.9.4 x86_64
Ubuntu 14.04 x86_64
llvm-svn: 217779
This is useful for checking inconsistencies between what the remote debug server thinks we are debugging and we think we are debugging. This follows the check for pointer byte size done just above.
Change by Stephane Sezer.
Tested:
Ubuntu 14.04 x86_64, llvm-3.5-built lldb
MacOSX 10.9.4, Xcode-Beta(2014-09-09)-built lldb.
llvm-svn: 217773
anyway /Vol doesn't complete correctly either. Somehow we're chopping the names
up incorrectly before passing them into the completer.
llvm-svn: 217720
* Fixes the local stack variable return pointer usage in NativeThreadLinux::GetName().
* Changes NativeThreadProtocol::GetName() to return a std::string.
* Adds a unit test to verify thread names don't regress in the future. Currently only run on Linux since I know default thread names there.
llvm-svn: 217717
Apparently, PEEKUSER/POKEUSER is something x86 specific, so I had to rework it for AArch64. This fixes assertion that occurs whenever lldb started on AArch64 device tried to read PC register (or any other register)
See http://reviews.llvm.org/D5232 for more details.
Change by Paul Osmialowski.
llvm-svn: 217691
ProcessStructReader instead of reading the structure out of libdispatch
by hand. I will convert more of the struct readers in SystemRuntimeMacOSX
over to use this class eventually.
llvm-svn: 217649
* Sends a SIGSTOP to the process.
* Fixes busted SIGSTOP handling. Now builds a list of non-stopped
that we wait for the PTRACE group-stop for. When the final must-stop
tid gets its group stop, we propagate the process state change.
Only the signal receiving the notification of the pending SIGSTOP
is marked with the SIGSTOP signal. All the rest, if they weren't
already stopped, are marked as stopped with signal 0.
* Fixes a few broken tests.
* Marks the Linux test I added earlier as expect-pass (no longer XFAIL).
Implements fix for http://llvm.org/bugs/show_bug.cgi?id=20908.
llvm-svn: 217647
The purpose of a ProcessStructReader is to allow intelligent reading of data from the underlying process
Traditionally, the way this has been handled is to have a load_address and shuffle it around, and use Process::ReadMemory()-kind APIs
With a ProcessStructReader one can define a clang type that matches exactly the definition of the thing they are trying to ingest from the inferior process, and then just point LLDB at where the data is
Since this work is done in terms of clang types, one can honor packed/aligned attributes, sizes of types on the inferior architecture, and similar tricky caveats without having to hardcode them
llvm-svn: 217644
1. DW_FORM_strp and DW_FORM_sec_offset are 64bits for DWARF64 / 32bits for DWARF32
They are different from DW_FORM_addr, whose size is specified in .debug_info
2. Bump DWARF version support form [2,3] to [2,4] in DWARFDebugLine.cpp
3. Fix DWARFDebugLine to support DWARF64
See http://reviews.llvm.org/D5307 for more details.
Reviewed by Greg Clayton and Jason Molenda.
Change by Tong Shen.
llvm-svn: 217607
This change implements this ticket:
http://llvm.org/bugs/show_bug.cgi?id=20899
Adds the qThreadStopInfo RSP command for llgs and includes a test that
verifies both debugserver and llgs respond with something reasonable
on a multithreaded app.
llvm-svn: 217549
SetName is only used in LLDB to set a thead's own name. Move it there
to match OS X and Windows and slightly reduce the effort in any future
HostThread/ThisThread name refactoring.
llvm-svn: 217521
More work on the GetName/SetName arguments (thread_t vs tid_t) is needed
but this change should restore the build and basic operation.
llvm-svn: 217502
This patch moves creates a thread abstraction that represents a
thread running inside the LLDB process. This is a replacement for
otherwise using lldb::thread_t, and provides a platform agnostic
interface to managing these threads.
Differential Revision: http://reviews.llvm.org/D5198
Reviewed by: Jim Ingham
llvm-svn: 217460
This makes sure that nothing that requires Python is being built
when the LLDB_DISABLE_PYTHON flag is being passed in.
It also changes a use of CPPFLAGS to CPP.Flags since the former is overridden
when external flags are passed in while the later is not. I'm not sure exactly
why LLDB_DISABLE_PYTHON is in CXXFLAGS rather than CPPFLAGS,
but cleaning that up is for another commit.
Differential Revision: http://reviews.llvm.org/D4918
llvm-svn: 217414
This cleans up a couple of warnings [-Wcovered-switch-default] from the build by
removing the default case from a couple of switches which are fully covered.
This is generally better as it will help identify when a new item is added to
the enumeration but the use sites are not updated.
llvm-svn: 217376
This adds a definition for the TypeValidatorImpl_CXX destructor. Because the
destructor is first virtual method, and declared out-of-line, it also serves as
the key function. Since no definition was present, no virtual table for
TypeValidatorImpl_CXX was emitted, which results in link failures due to
references to undefined symbols.
Also add a definition for a TypeValidatorImpl contructor which was declared
out-of-line and referenced in a constructor for TypeValidatorImpl_CXX.
llvm-svn: 217375
Linking Release+Asserts executable lldb-gdbserver (without symbols)
liblldb.so: undefined reference to `lldb_private::MemoryHistoryASan::Initialize()'
liblldb.so: undefined reference to `lldb_private::MemoryHistoryASan::Terminate()'
liblldb.so: undefined reference to `vtable for lldb_private::TypeValidatorImpl_CXX'
liblldb.so: undefined reference to `lldb_private::TypeValidatorImpl::TypeValidatorImpl(lldb_private::TypeValidatorImpl::Flags const&)'
liblldb.so underlinked to lldbPluginMemoryHistoryASan.a when building with the
make based build system (as opposed to CMake).
llvm-svn: 217360
We would previously simply assume that the write would always succeed. However,
write(2) may return -1 for error as well as fail to perform a complete write (in
which case the returned number of bytes will be less than the requested bytes).
Explicitly check if an error condition is encountered. This would previously
not be caught as we default initialized success to true. Add an assertion that
we always perform a complete write (a continuous retry could be added to ensure
that we finish writing completely).
This was caught by GCC's signed comparison warning and manual inspection.
llvm-svn: 217355
Covers more of the behavior of rendezvous breakpoint handling and other
dynamic loader aspects, all on the 'enable log lldb dyld' log channel.
llvm-svn: 217283
Type Validators have the purpose of looking at a ValueObject, and making sure that there is nothing semantically wrong about the object's contents
For instance, if you have a class that represents a speed, the validator might trigger if the speed value is greater than the speed of light
This first patch hooks up the moving parts in the formatters subsystem, but does not link ValueObjects to TypeValidators, nor lets the SB API be exposed to validators
It also lacks the notion of Python validators
llvm-svn: 217277
lldb's internal memory cache chunks that are read from the remote
system. For a remote connection that is especially slow, a user may
need to reduce it; reading a 512 byte chunk of memory whenever a
4-byte region is requested may not be the right decision in these
kinds of environments.
<rdar://problem/18175117>
llvm-svn: 217083
detct unwind loops but there was a code path through there (using
architecture default unwind plans) that didn't do the check, and
could end up with an infinite loop unwind. Move that code into a
separate method and call it from both places where it is needed.
Also remove the use of ABI::FunctionCallsChangeCFA in that check.
I thought about it a lot and none of the architecutres that we're
supporting today can have a looping CFA.
Since the unwinder isn't using ABI::FunctionCallsChangeCFA() and
ABI::StackUsesFrames(), and the unwinder was the only reason
those methods exists, I removed them from the ABI and all its
plugins.
<rdar://problem/17364005>
llvm-svn: 216992
llgs Linux is no longer doing the translation to some gdb fixed signal
numbers. This change modifies the test method to take in the signo
expected for a segfault. The debugserver test uses the fixed gdb number,
and everything else uses signal.SIGSEGV for the platform.
Sidenote: I somehow did not see this reported in multicore tests.
I will need to verify that we aren't missing test failures in that
script. I need to verify why this wasn't more obvious with
test/dosep.py.
llvm-svn: 216770
See http://reviews.llvm.org/D5108 for details.
This change does the following:
* eliminates the Process::GetUnixSignals() virtual method and replaces with a fixed getter.
* replaces the Process UnixSignals storage with a shared pointer.
* adds a Process constructor variant that can be passed the UnixSignalsSP. When the constructor without the UnixSignalsSP is specified, the Host's default UnixSignals is used.
* adds a host-specific version of GetUnixSignals() that is used when we need the host's appropriate UnixSignals variant.
* replaces GetUnixSignals() overrides in PlatformElfCore, ProcessGDBRemote, ProcessFreeBSD and ProcessLinux with code that appropriately sets the Process::UnixSignals for the process.
This change also enables some future patches that will enable llgs to be used for local Linux debugging.
llvm-svn: 216748
This patch accepts environment variables of the form:
LLDB_DEBUGSERVER_EXTRA_ARG_n
where n starts with 1, and may continue nearly indefinitely (up through std::numeric_limits<uint32_t>::max()).
The code loops around, starting with 1, until it doesn't find one of the environment variables. For each one it does find defined, it appends the environment variable's contents to the end of the debugserver/llgs startup command line issued when the stub is started for local debugging.
I am using this to add arbitrary startup commands to the llgs command line for turning on additional logging. For example:
export LLDB_DEBUGSERVER_EXTRA_ARG_1="-c"
export LLDB_DEBUGSERVER_EXTRA_ARG_2="log enable -f /tmp/llgs_packets.log gdb-remote packets"
export LLDB_DEBUGSERVER_EXTRA_ARG_3="-c"
export LLDB_DEBUGSERVER_EXTRA_ARG_4="log enable -f /tmp/llgs_process.log lldb process"
llvm-svn: 216745
Yet another step toward ARM64 support. With this commit, lldb-gdbserver started on ARM64 target can be accessed by lldb running on desktop PC and it can process simple commands (like 'continue'). Still ARM64 support lacks NativeRegisterContextLinux_arm64.* code which waits to be implemented.
Based on similar files for Linux x86_64 and Darwin ARM64. Due to common code extraction from Darwin related files, lldb should be tested for any unexpected regression on Darwin ARM64 machines too.
See the following for more details:
http://reviews.llvm.org/D4580http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140825/012670.html
Change by Paul Osmialowski.
llvm-svn: 216737
For hosts that cannot support long thread names, shrink the host
wait4 thread name so that it does not truncate the PID in the thread name.
Change by Shawn Best.
llvm-svn: 216686
This change:
* properly captures execs in NativeProcessLinux.
* clears out all non-main-thread thread metadata in NativeProcessLinux on exec.
* adds a DidExec() method to the NativeProcessProtocol delegate.
* clears out the auxv data cache when we exec (on Linux).
This is a small part of the llgs for local Linux debugging work going on here:
https://github.com/tfiala/lldb/tree/dev-llgs-local
I'm breaking it into small patches.
llvm-svn: 216670
This is a lightweight wrapper around a pid. It is intended to be
lightweight enough to serve as a replacement anywhere we currently
store a pid. It provides convenience methods and common process
operations.
This patch does not yet make use of HostProcess anywhere.
llvm-svn: 216607
LLDB had implemented its own DynamicLibrary class for plugin
support. LLVM has an equivalent mechanism, so this patch deletes
the duplicated code in LLDB and updates LLDB to reference the
mechanism provided by LLVM.
llvm-svn: 216606
See thread here:
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140825/012580.html
The original change I made there was due to a segfault. That was
caused by me directly calling PluginManager::Initialize (), with
PluginManager::Initialize() depending on HostInfo::Initialize () to
have been called already (which it wasn't).
The call to PluginManager::Initialize () was erroneous (at least at the
current time) since that method is already called by Debugger::Initialize()'s
implementation.
We will want to revisit initializing a smaller core of the debugger
suitable for lldb-gdbserver and lldb-platform.
llvm-svn: 216581
I copied this originally based on what debugserver was doing. This appears to
be incorrect and unncessary for Linux. The LinuxSignals on the lldb side
don't look for these and therefore they get handled incorrectly.
Leaving the hook in place since I think darwin will continue to need to
translate those signal numbers.
llvm-svn: 216564
Add entries to core_definitions and elf_arch_entries for
those variants. Select the subtype for the variant by parsing
the e_flags field of the elf header.
llvm-svn: 216541
creating the ModuleSpec to load the core file - we won't have a fat
core file and we can end up with cpu subtype mismatches if the core
file header isn't written out completely accurately. We need to
be a little loose in this particular case.
<rdar://problem/17843388>
llvm-svn: 216498
And likewise for qProcessInfo on Linux, but ensures cputype/cpusubtype is not defined. The
Apple case is the more important one, since we take a slightly different path to initialize
ProcessGDBRemote-related remote host/process info if triple is present.
Related to http://llvm.org/bugs/show_bug.cgi?id=20755.
llvm-svn: 216473
This change addresses this bug:
http://llvm.org/bugs/show_bug.cgi?id=20755
This change:
* Modifies llgs to send triple instead of cputype and cpusubtype when not on Apple platforms in qProcessInfo.
* Modifies lldb's GDBRemoteCommunicationClient to handle the triple returned from qProcessInfo if given.
When given, it will prefer to use triple over cputype and cpusubtype.
* Adds gdb-remote protocol tests to verify that cputype and cpusubtype are specified on darwin, and that triple is specified on Linux.
llvm-svn: 216470
I'm about to add some more qProcessInfo tests so I wanted to first pull them out
of the monolithic TestLldbGdbServer test case class.
Related to http://llvm.org/bugs/show_bug.cgi?id=20755
llvm-svn: 216465
I wrote this originally as a part of an unwind library that was using
a different coding convention and some of that old style remained after
its integration into lldb.
llvm-svn: 216419
In practice, 64bit eh_frame is not used even for x86_64 binaries. The main reason is in eh_frame we almost always use pc-relative addressing, so addresses are within 32bits and gcc just sticks to 32bit eh_frame.
I generated 64bit eh_frame for Android Java runtime and unwind successfully in gdb, and in lldb with this patch.
Patch by Tong Shen.
llvm-svn: 216409
We decided to use assmbly profiler instead of eh_frame for frame 0 because for compiler generated code, eh_frame is usually synchronous(a.k.a. only valid at call site); and we have no way to tell if it's asynchronous or not.
But for x86 & x86_64 compiler generated code:
1. clang & GCC describes all prologue instructions in eh_frame;
2. mid-function stack pointer altering instructions can be easily detected.
So we can grab eh_frame, and use assembly profiler to augment it into asynchronous unwind table.
This change also benefits hand-written assembly; eh_frame for hand-written assembly is often asynchronous,so we have a much better chance to successfully unwind through them.
Change by Tong Shen.
llvm-svn: 216406
When building without XCode on sytems where these constants are
not in the system header (or I presume with older versions of XCode),
these are needed to make this file compile, since unlike most other
uses of MachO specific constants, these use the system headers
rather than the LLVM-defined ones.
llvm-svn: 216332
with binaries in the dyld shared cache (esp on iOS) where the file
address for the executable binary (maybe from memory, maybe from
an expanded copy of the dyld shared cache) is different from the
file address in the dSYM. In that case, ObjectFileMachO replaces
the file addresses from the original binary with the dSYM file
addresses (usually 0-based) -- lldb doesn't have a notion of two
file addresses for a given module so they need to agree.
There was a cache of file addresses over in the Symtab so I added
a method to the Module and the objects within to clear any file address
caches if they exist, and added an implementation in the Symtab
module to do that.
<rdar://problem/16929569>
llvm-svn: 216258
This should bring HostInfo up to 99% completion. The remainder
of code in Host will be split into instantiatable classes
representing host processes, threads, dynamic libraries, and
process launching strategies.
llvm-svn: 216230
This continues the effort to get Host code moved over to HostInfo,
and removes many more instances of preprocessor defines along the
way.
llvm-svn: 216195
See this email thread:
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140818/012487.html
This patch handles the case where the inferior process exits but leaves the ReadThread in a continuous loop reading from the communication pipe. On MacOSX, the ReadThread exits when it receives a 0 return value from the read due to EOF. On Linux the read returns -1 and sets errno to EIO error, this does not currently cause the thread to shutdown so it continues to read from the comm. In Communication::ReadThread I added a handler for eConnectionStatusError to disconnect and shutdown the thread.
Change by Alex Pepper.
llvm-svn: 216194