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 
16 using namespace lldb;
17 using namespace lldb_private;
18 
19 //------------------------------------------------------------------------------
20 // Constructors and destructors.
21 
LinuxThread(Process & process,lldb::tid_t tid)22 LinuxThread::LinuxThread(Process &process, lldb::tid_t tid)
23     : POSIXThread(process, tid)
24 {
25 }
26 
~LinuxThread()27 LinuxThread::~LinuxThread()
28 {
29 }
30 
31 //------------------------------------------------------------------------------
32 // ProcessInterface protocol.
33 
34 void
RefreshStateAfterStop()35 LinuxThread::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 
44 void
TraceNotify(const ProcessMessage & message)45 LinuxThread::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 }