mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-12 09:41:26 +00:00
ThreadPlanTracer::TracingStarted can't call virtual methods on Thread.
TracingStarted gets called in the Thread constructor, which means you can't call a virtual method of the class. So delay setting up the m_register_values till you need them. NFC as lldb just crashes if you don't do this. The thread tracing is an only occasionally useful feature, and it only sort of works. I'm not adding tests etc. at this point, I'm just poking at it a bit. If I get it working better I'll write tests and so forth.
This commit is contained in:
parent
15bfd2cd54
commit
810c3cfa66
@ -115,10 +115,6 @@ TypeFromUser ThreadPlanAssemblyTracer::GetIntPointerType() {
|
||||
ThreadPlanAssemblyTracer::~ThreadPlanAssemblyTracer() = default;
|
||||
|
||||
void ThreadPlanAssemblyTracer::TracingStarted() {
|
||||
RegisterContext *reg_ctx = m_thread.GetRegisterContext().get();
|
||||
|
||||
if (m_register_values.empty())
|
||||
m_register_values.resize(reg_ctx->GetRegisterCount());
|
||||
}
|
||||
|
||||
void ThreadPlanAssemblyTracer::TracingEnded() { m_register_values.clear(); }
|
||||
@ -208,6 +204,11 @@ void ThreadPlanAssemblyTracer::Log() {
|
||||
}
|
||||
}
|
||||
|
||||
if (m_register_values.empty()) {
|
||||
RegisterContext *reg_ctx = m_thread.GetRegisterContext().get();
|
||||
m_register_values.resize(reg_ctx->GetRegisterCount());
|
||||
}
|
||||
|
||||
RegisterValue reg_value;
|
||||
for (uint32_t reg_num = 0, num_registers = reg_ctx->GetRegisterCount();
|
||||
reg_num < num_registers; ++reg_num) {
|
||||
|
Loading…
Reference in New Issue
Block a user