[Lldb-commits] [PATCH] Added remote-build.py and wired it into Xcode for Linux and MacOSX+Linux builds.

Chaoren Lin chaorenl at google.com
Wed Jan 28 16:19:58 PST 2015


Hi clayborg, tfiala, ovyalov, sivachandra, vharron,

Get initial thread state coordinator integration working.

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

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

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

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

llgs: fixed a bug in deferred signal thread id; added coordinator enqueue logging.

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

llgs: fix up some handling of stepping.

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

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

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

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

llgs: more work on thread stepping.

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

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

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

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

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

Fix some bugs in llgs thread state handling.

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

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

* Formatting change (minor) in NativeThreadLinux logging.

Disabled local-llgs hijacking of state on startup; passed along signo to killed process.

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

Fix step commands that mix running threads and stepping threads.

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

Added code to prevent "administrative stop" from overwriting a real stop reason.

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

Fix up NativeProcessLinux::Interrupt() to use thread state coordinator mechanism.

LLGS local - signal stops inferior in debugger

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

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

Added support for writing registers larger than 64 bits

Fixed TestInferiorCrashing failures

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

Fixed TestInferiorChanged

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

added some missing ABIs

Refactor ptrace commands in NativeProcessLinux to use Error as result return type.

Modify ThreadStateCoodrinator in order to resume threads if stop wasn't requested.

Mark several tests as XFAIL with new expectedFailureLLGS decorator since they are failing in Darwin for the same reason.

Share crash information between LLGS and local POSIX debugging with CrashReason class. Deliver crash information from LLGS to lldb via description field of thread stop packet.

Mark TestProcessLaunch.test_set_working_dir_with_dwarf as expected to fail in LLGS mode due llvm.org/pr20265

Make ThreadStateCoordinator to handle properly failed stop/resume operations.

Moving header files from source/Host/common to proper location.

Implement setting and clearing watchpoints.

Add missing switch cases to silence warnings.

Fix compilation error and cleanup in ThreadStateCoordinatorTest

Fix TestThreadStepOut on Linux with LLGS

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

http://reviews.llvm.org/D7238

Files:
  .gitignore
  cmake/platforms/Android.cmake
  gtest/unittest/Plugins/Process/Linux/Makefile
  gtest/unittest/Plugins/Process/Linux/ThreadStateCoordinatorTest.cpp
  gtest/unittest/Plugins/Process/Linux/ThreadStateCoordinatorTestMock.cpp
  include/lldb/Host/common/NativeBreakpoint.h
  include/lldb/Host/common/NativeBreakpointList.h
  include/lldb/Host/common/NativeProcessProtocol.h
  include/lldb/Host/common/NativeRegisterContext.h
  include/lldb/Host/common/NativeRegisterContextRegisterInfo.h
  include/lldb/Host/common/NativeThreadProtocol.h
  include/lldb/Host/common/NativeWatchpointList.h
  include/lldb/Host/common/SoftwareBreakpoint.h
  include/lldb/Target/NativeRegisterContext.h
  include/lldb/Target/NativeRegisterContextRegisterInfo.h
  include/lldb/Target/Platform.h
  lldb.xcodeproj/project.pbxproj
  scripts/Python/remote-build.py
  source/Host/CMakeLists.txt
  source/Host/common/NativeBreakpoint.cpp
  source/Host/common/NativeBreakpoint.h
  source/Host/common/NativeBreakpointList.cpp
  source/Host/common/NativeBreakpointList.h
  source/Host/common/NativeProcessProtocol.cpp
  source/Host/common/NativeProcessProtocol.h
  source/Host/common/NativeRegisterContext.cpp
  source/Host/common/NativeRegisterContextRegisterInfo.cpp
  source/Host/common/NativeThreadProtocol.cpp
  source/Host/common/NativeThreadProtocol.h
  source/Host/common/NativeWatchpointList.cpp
  source/Host/common/SoftwareBreakpoint.cpp
  source/Host/common/SoftwareBreakpoint.h
  source/Plugins/Platform/Linux/PlatformLinux.cpp
  source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
  source/Plugins/Process/FreeBSD/ProcessMonitor.h
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h
  source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
  source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
  source/Plugins/Process/Linux/NativeThreadLinux.cpp
  source/Plugins/Process/Linux/NativeThreadLinux.h
  source/Plugins/Process/Linux/ProcessMonitor.cpp
  source/Plugins/Process/Linux/ProcessMonitor.h
  source/Plugins/Process/Linux/ThreadStateCoordinator.cpp
  source/Plugins/Process/Linux/ThreadStateCoordinator.h
  source/Plugins/Process/POSIX/CMakeLists.txt
  source/Plugins/Process/POSIX/CrashReason.cpp
  source/Plugins/Process/POSIX/CrashReason.h
  source/Plugins/Process/POSIX/POSIXStopInfo.cpp
  source/Plugins/Process/POSIX/POSIXStopInfo.h
  source/Plugins/Process/POSIX/ProcessMessage.cpp
  source/Plugins/Process/POSIX/ProcessMessage.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Target/CMakeLists.txt
  source/Target/NativeRegisterContext.cpp
  source/Target/NativeRegisterContextRegisterInfo.cpp
  test/functionalities/inferior-crashing/TestInferiorCrashing.py
  test/functionalities/process_launch/TestProcessLaunch.py
  test/functionalities/thread/break_after_join/TestBreakAfterJoin.py
  test/functionalities/thread/concurrent_events/TestConcurrentEvents.py
  test/functionalities/thread/create_during_step/TestCreateDuringStep.py
  test/functionalities/thread/exit_during_break/TestExitDuringBreak.py
  test/functionalities/thread/exit_during_step/TestExitDuringStep.py
  test/functionalities/thread/multi_break/TestMultipleBreakpoints.py
  test/functionalities/thread/state/TestThreadStates.py
  test/lldbtest.py

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7238.18927.patch
Type: text/x-patch
Size: 278434 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150129/26a0a940/attachment.bin>


More information about the lldb-commits mailing list