DecodeHexU8 returns a decoded hex character pair, returns -1 if a
valid hex pair is not available.
GetHexBytesAvail decodes all available hex pairs.
llvm-svn: 223081
Adds a test to verify that a thread resume request marks the thread as running
after doing the resume callback. This test fails without the corresponding
ThreadStateCoordinator.cpp change.
Fixes the code where that state was not maintained.
llvm-svn: 219412
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
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
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
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 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
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
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