Files
clang-p2996/lldb/tools/debugserver/source/DNBThreadResumeActions.h
Greg Clayton c4e411ffc0 Thread safety changes in debugserver and also in the process GDB remote plugin.
I added support for asking if the GDB remote server supports thread suffixes
for packets that should be thread specific (register read/write packets) because
the way the GDB remote protocol does it right now is to have a notion of a
current thread for register and memory reads/writes (set via the "$Hg%x" packet)
and a current thread for running ("$Hc%x"). Now we ask the remote GDB server
if it supports adding the thread ID to the register packets and we enable
that feature in LLDB if supported. This stops us from having to send a bunch
of packets that update the current thread ID to some value which is prone to
error, or extra packets.

llvm-svn: 123762
2011-01-18 19:36:39 +00:00

103 lines
2.1 KiB
C++

//===-- DNBThreadResumeActions.h --------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Created by Greg Clayton on 03/13/2010
//
//===----------------------------------------------------------------------===//
#ifndef __DNBThreadResumeActions_h__
#define __DNBThreadResumeActions_h__
#include <vector>
#include "DNBDefs.h"
class DNBThreadResumeActions
{
public:
DNBThreadResumeActions ();
DNBThreadResumeActions (nub_state_t default_action, int signal);
DNBThreadResumeActions (const DNBThreadResumeAction *actions, size_t num_actions);
bool
IsEmpty() const
{
return m_actions.empty();
}
void
Append (const DNBThreadResumeAction &action);
void
AppendAction (nub_thread_t tid,
nub_state_t state,
int signal = 0,
nub_addr_t addr = INVALID_NUB_ADDRESS);
void
AppendResumeAll ()
{
AppendAction (INVALID_NUB_THREAD, eStateRunning);
}
void
AppendSuspendAll ()
{
AppendAction (INVALID_NUB_THREAD, eStateStopped);
}
void
AppendStepAll ()
{
AppendAction (INVALID_NUB_THREAD, eStateStepping);
}
const DNBThreadResumeAction *
GetActionForThread (nub_thread_t tid, bool default_ok) const;
size_t
NumActionsWithState (nub_state_t state) const;
bool
SetDefaultThreadActionIfNeeded (nub_state_t action, int signal);
void
SetSignalHandledForThread (nub_thread_t tid) const;
const DNBThreadResumeAction *
GetFirst() const
{
return m_actions.data();
}
size_t
GetSize () const
{
return m_actions.size();
}
void
Clear()
{
m_actions.clear();
m_signal_handled.clear();
}
protected:
std::vector<DNBThreadResumeAction> m_actions;
mutable std::vector<bool> m_signal_handled;
};
#endif // #ifndef __DNBThreadResumeActions_h__