LinuxThread.cpp revision 4349bcb8ec51f3fd447b511b2ce8292a92d3c771
1//===-- LinuxThread.cpp -----------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// C Includes
11// C++ Includes
12// Other libraries and framework includes
13// Project includes
14#include "LinuxThread.h"
15
16using namespace lldb;
17using namespace lldb_private;
18
19//------------------------------------------------------------------------------
20// Constructors and destructors.
21
22LinuxThread::LinuxThread(Process &process, lldb::tid_t tid)
23    : POSIXThread(process, tid)
24{
25}
26
27LinuxThread::~LinuxThread()
28{
29}
30
31//------------------------------------------------------------------------------
32// ProcessInterface protocol.
33
34void
35LinuxThread::RefreshStateAfterStop()
36{
37    // Invalidate the thread names every time we get a stop event on Linux so we
38    // will re-read the procfs comm virtual file when folks ask for the thread name.
39    m_thread_name_valid = false;
40
41    POSIXThread::RefreshStateAfterStop();
42}
43
44void
45LinuxThread::TraceNotify(const ProcessMessage &message)
46{
47    RegisterContextPOSIX* reg_ctx = GetRegisterContextPOSIX();
48    if (reg_ctx)
49    {
50        uint32_t num_hw_wps = reg_ctx->NumSupportedHardwareWatchpoints();
51        uint32_t wp_idx;
52        for (wp_idx = 0; wp_idx < num_hw_wps; wp_idx++)
53        {
54            if (reg_ctx->IsWatchpointHit(wp_idx))
55            {
56                WatchNotify(message);
57                return;
58            }
59        }
60    }
61
62    POSIXThread::TraceNotify (message);
63}