Commit Graph

9564 Commits

Author SHA1 Message Date
Todd Fiala e825f44761 thread state coordinator: replaced shortened type name Func suffix with Function.
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
2014-10-01 16:08:20 +00:00
Todd Fiala 241ce99503 Minor tweak to Ed's FreeBSD fix.
Fall back to including the Linux version if not on __FreeBSD__.  Also covers
__ANDROID__ case.

llvm-svn: 218770
2014-10-01 15:10:37 +00:00
Ed Maste 81f59a09f2 Add a bandaid to fix the FreeBSD build
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
2014-10-01 12:56:39 +00:00
Matthew Gardiner 2eb85898b2 Adding a test for k5 binaries
llvm-svn: 218754
2014-10-01 10:41:53 +00:00
Matthew Gardiner 60f9392eb7 Fix the kalimba arch 4 test, broken when I introduced handling
of kalimba architecture variants.

llvm-svn: 218749
2014-10-01 09:12:43 +00:00
Jim Ingham 89fd66813b Not all processes have a Dynamic Loader. Be sure to check that it exists before using it.
<rdar://problem/18491391>

llvm-svn: 218699
2014-09-30 20:33:25 +00:00
Jim Ingham 8d81bdf11f Add SBThreadPlan to this CMakeLists.txt as well.
llvm-svn: 218687
2014-09-30 17:11:53 +00:00
Todd Fiala 1f67ded0b2 thread state coordinator: add additional assert missing from previous test check-in.
llvm-svn: 218686
2014-09-30 17:00:52 +00:00
Zachary Turner 25cbf5aac6 Fix FreeBSD build.
llvm-svn: 218685
2014-09-30 16:56:56 +00:00
Zachary Turner c76a445279 Fixup some minor issues with HostProcess.
llvm-svn: 218684
2014-09-30 16:56:40 +00:00
Todd Fiala f8d929dc82 thread state coordinator: add test to be explicit about resume behavior in presence of deferred stop notification still pending.
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
2014-09-30 16:56:28 +00:00
Todd Fiala 8a3716bfab Fix cmake build for new thread plan files.
llvm-svn: 218679
2014-09-30 15:58:56 +00:00
Jim Ingham 2a057f872d Fix some errors that crept in when I cut & pasted into emacs.
llvm-svn: 218656
2014-09-30 01:37:52 +00:00
Jim Ingham 0fbf3af3dc Add a very trivial example for scripted stepping.
llvm-svn: 218650
2014-09-30 00:24:59 +00:00
Jim Ingham 2bdbfd50d2 This checkin is the first step in making the lldb thread stepping mechanism more accessible from
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
2014-09-29 23:17:18 +00:00
Todd Fiala 8b6fefb3a3 dwarf: add dwarf v4 maximum_operations_per_instruction to DWARFDebugLine.
See http://reviews.llvm.org/D5533 for details.

Change by Tong Shen.

llvm-svn: 218641
2014-09-29 23:11:09 +00:00
Todd Fiala e2109e7323 thread state coordinator: added a thread resume request and related tests.
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
2014-09-29 22:57:05 +00:00
Todd Fiala 424723b281 thread state coordinator: add exec reset support, remove empty virtual destructors.
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
2014-09-29 21:45:21 +00:00
Matthew Gardiner f03e6d84bc Very minimal support 24-bit kalimbas. Vanilla "memory read" for data sections
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
2014-09-29 08:02:24 +00:00
Matthew Gardiner e598d7b01d Included cstdarg for compilation of va_start and va_end.
llvm-svn: 218594
2014-09-29 07:12:47 +00:00
Todd Fiala 55a02a7478 thread state coordinator: added new thread support.
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
2014-09-28 06:50:47 +00:00
Todd Fiala cacde7df6d Enable llgs to build against experimental Android AOSP lldb/llvm/clang/compiler-rt repos.
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
2014-09-27 16:54:22 +00:00
Todd Fiala ef5dbf55c8 thread state coordinator: added thread death support and more tests.
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
2014-09-27 01:58:13 +00:00
Todd Fiala 9dd7334d69 thread state coordinator: added test for notify after two pending thread stops.
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
2014-09-27 01:11:17 +00:00
Todd Fiala e9c9e7070e thread state coordinator: handle when prerequisite pending stop is already stopped.
Change includes new gtest and functionality.

llvm-svn: 218555
2014-09-26 23:42:53 +00:00
Todd Fiala 80bef312b5 gtest: tweaked test runner to fix an extra comma, added more tdd-based thread coordinator behavior.
Starting to flesh out the thread state coordinator class that will be used
by Linux/llgs.

llvm-svn: 218537
2014-09-26 19:08:00 +00:00
Todd Fiala 4dcb6aded2 gtest: modified Xcode integration so gtest assert/expect failure now shows error content in the error marker at the line of failure.
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
2014-09-26 12:58:25 +00:00
Todd Fiala f3a3fc5120 gtest: remove recursive make, add python driver + Xcode error hook-up.
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
2014-09-25 22:12:33 +00:00
Todd Fiala b3185e710e Fixup gtest layout, add Linux ThreadStateCoordinator.cpp.
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
2014-09-25 19:25:07 +00:00
Todd Fiala e15fcaa2e5 Moved PlatformDarwin::GetEnvironment() to PlatformPOSIX to fix Linux/llgs issue.
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
2014-09-24 23:10:30 +00:00
Todd Fiala f502d72d4e The beginnings of a gtest-based test framework.
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
2014-09-24 22:57:33 +00:00
Enrico Granata 5e35cf9dcc Add an explicit cast to silence compiler warning here
llvm-svn: 218410
2014-09-24 20:52:58 +00:00
Todd Fiala ad6eee6399 Change inline-breakpoint-strategy setting to default to eInlineBreakpointsAlways strategy.
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
2014-09-24 19:59:13 +00:00
Enrico Granata a540496e6f These APIs were defined in the .h file, but never actually implemented. Just get rid of them
llvm-svn: 218396
2014-09-24 17:57:11 +00:00
Todd Fiala d5635cdd7f Adjust to LLVM JIT API change
Those wrapper functions seems not used by lldb... Removed

Reference for

replacing JITMemoryManager with SectionMemoryManager
replacing "llvm::JITMemoryManager::CreateDefaultMemManager()" with "new llvm::SectionMemoryManager()"
http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-jitlistener/llvm-jitlistener.cpp?r1=218316&r2=218315&pathrev=218316

Change by Tong Shen.

Tested:
Ubuntu 14.04 x86_64
MacOSX 10.9.5 with Xcode Version 6.1 (6A1030) (Beta)

llvm-svn: 218383
2014-09-24 15:55:47 +00:00
Zachary Turner acee96ae52 Fix up the HostThread interface, making the interface simpler.
Reviewed by: Greg Clayton
Differential Revision: http://reviews.llvm.org/D5417

llvm-svn: 218325
2014-09-23 18:32:09 +00:00
Kuba Brecka 9d28cf5609 Add ASan history threads into process_sp->GetExtendedThreadList, so they don't get freed too early
Reviewed at http://reviews.llvm.org/D5452

llvm-svn: 218323
2014-09-23 18:20:24 +00:00
Todd Fiala 5bc56a4b34 android: add a command script to help display mixed Java/native backtraces.
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
2014-09-23 16:28:01 +00:00
Jason Molenda f6a4258020 ConnectionFileDescriptor::Connect()'s handling of the "fd://" method
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
2014-09-23 02:43:35 +00:00
Greg Clayton 994ba64756 Played around with TK UI a bit this weekend.
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
2014-09-22 22:06:41 +00:00
Ed Maste da7c5b253f Enable libcxx map test on FreeBSD again
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
2014-09-21 02:24:01 +00:00
Todd Fiala 21130fbc04 Fix lldb-gdbserver build.
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
2014-09-20 17:34:48 +00:00
Jason Molenda e59b0d2c48 Have CommandObject::CheckRequirements() report the largest missing
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
2014-09-20 09:14:31 +00:00
Jim Ingham 16ebdd6c1b Fix a thinko in how the RemoteiOS Platform looked up files in the SDK & other
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
2014-09-19 21:58:45 +00:00
Jim Ingham 03d1730aad We had to squirrel away the dyld module before doing ResolveExecutableModule, since
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
2014-09-19 21:56:45 +00:00
Zachary Turner 4171da5cfe Make sure to #include <atomic> when using std::atomic.
llvm-svn: 218148
2014-09-19 20:12:32 +00:00
Carlo Kok b77aba7708 Fix for 218140 for SBTarget.i, the added functions were in the wrong class definition
llvm-svn: 218147
2014-09-19 20:12:24 +00:00
Greg Clayton 615eb7e609 Test suite runs better again after recent fixes that would select a platform if a "file a.out" auto selected a different platform than the selected one.
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
2014-09-19 20:11:50 +00:00
Carlo Kok 0fd6fd4fd4 Adds two new functions to SBTarget FindGlobalVariables and FindGlobalFunctions that lets you search by name, by regular expression and by starts with.
llvm-svn: 218140
2014-09-19 19:38:19 +00:00
Todd Fiala 850f9a25a5 Fix typo in Linux ASLR logging.
llvm-svn: 218133
2014-09-19 18:27:45 +00:00