summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source/MacOSX/MachThreadList.h
blob: b52a97b547bc8f79fa976050c27449e7060c7ae7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//===-- MachThreadList.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 6/19/07.
//
//===----------------------------------------------------------------------===//

#ifndef __MachThreadList_h__
#define __MachThreadList_h__

#include "MachThread.h"

class DNBThreadResumeActions;

class MachThreadList
{
public:
                    MachThreadList ();
                    ~MachThreadList ();

    void            Clear ();
    void            Dump () const;
    void            GetRegisterState (int flavor, bool force);
    void            SetRegisterState (int flavor);
    bool            GetRegisterValue (nub_thread_t tid, uint32_t reg_set_idx, uint32_t reg_idx, DNBRegisterValue *reg_value) const;
    bool            SetRegisterValue (nub_thread_t tid, uint32_t reg_set_idx, uint32_t reg_idx, const DNBRegisterValue *reg_value) const;
    nub_size_t      GetRegisterContext (nub_thread_t tid, void *buf, size_t buf_len);
    nub_size_t      SetRegisterContext (nub_thread_t tid, const void *buf, size_t buf_len);
    const char *    GetThreadInfo (nub_thread_t tid) const;
    void            ProcessWillResume (MachProcess *process, const DNBThreadResumeActions &thread_actions);
    uint32_t        ProcessDidStop (MachProcess *process);
    bool            NotifyException (MachException::Data& exc);
    bool            ShouldStop (bool &step_more);
    const char *    GetName (thread_t tid);
    nub_state_t     GetState (thread_t tid);
    nub_thread_t    SetCurrentThread (thread_t tid);
    bool            GetThreadStoppedReason (nub_thread_t tid, struct DNBThreadStopInfo *stop_info) const;
    void            DumpThreadStoppedReason (nub_thread_t tid) const;
    bool            GetIdentifierInfo (nub_thread_t tid, thread_identifier_info_data_t *ident_info);
    nub_size_t      NumThreads () const;
    nub_thread_t    ThreadIDAtIndex (nub_size_t idx) const;
    nub_thread_t    CurrentThreadID ();
    uint32_t        GetThreadIndexByID (thread_t tid) const;
    void            CurrentThread (MachThreadSP& threadSP);
    void            NotifyBreakpointChanged (const DNBBreakpoint *bp);
    uint32_t        EnableHardwareBreakpoint (const DNBBreakpoint *bp) const;
    bool            DisableHardwareBreakpoint (const DNBBreakpoint *bp) const;
    uint32_t        EnableHardwareWatchpoint (const DNBBreakpoint *wp) const;
    bool            DisableHardwareWatchpoint (const DNBBreakpoint *wp) const;

protected:
    typedef std::vector<MachThreadSP>   collection;
    typedef collection::iterator        iterator;
    typedef collection::const_iterator  const_iterator;

    uint32_t        UpdateThreadList (MachProcess *process, bool update);
//  const_iterator  FindThreadByID (thread_t tid) const;

    collection      m_threads;
    PThreadMutex    m_threads_mutex;
    MachThreadSP    m_current_thread;
};

#endif // #ifndef __MachThreadList_h__

OpenPOWER on IntegriCloud