| 126 | } |
| 127 | |
| 128 | PyThread::PyThread(const std::shared_ptr<const AbstractProcessManager>& manager, remote_addr_t addr) |
| 129 | : Thread(0, 0) |
| 130 | { |
| 131 | d_pid = manager->Pid(); |
| 132 | |
| 133 | LOG(DEBUG) << std::hex << std::showbase << "Copying main thread struct from address " << addr; |
| 134 | Structure<py_thread_v> ts(manager, addr); |
| 135 | |
| 136 | remote_addr_t frame_addr = getFrameAddr(manager, ts); |
| 137 | if (frame_addr != (remote_addr_t) nullptr) { |
| 138 | LOG(DEBUG) << std::hex << std::showbase << "Attempting to construct frame from address " |
| 139 | << frame_addr; |
| 140 | d_first_frame = std::make_unique<FrameObject>(manager, frame_addr, 0); |
| 141 | } |
| 142 | |
| 143 | d_addr = addr; |
| 144 | remote_addr_t candidate_next_addr = ts.getField(&py_thread_v::o_next); |
| 145 | d_next_addr = candidate_next_addr == addr ? (remote_addr_t) nullptr : candidate_next_addr; |
| 146 | |
| 147 | d_pthread_id = ts.getField(&py_thread_v::o_thread_id); |
| 148 | d_tid = getThreadTid(manager, ts, d_pthread_id); |
| 149 | d_next = nullptr; |
| 150 | |
| 151 | if (d_next_addr != (remote_addr_t)NULL) { |
| 152 | LOG(DEBUG) << std::hex << std::showbase << "Attempting to construct a new thread address " |
| 153 | << d_next_addr; |
| 154 | d_next = std::make_unique<PyThread>(manager, d_next_addr); |
| 155 | } |
| 156 | |
| 157 | d_gil_status = calculateGilStatus(ts, manager); |
| 158 | d_gc_status = calculateGCStatus(ts, manager); |
| 159 | } |
| 160 | |
| 161 | int |
| 162 | PyThread::getThreadTid( |