Exemple #1
0
lldb::RegisterContextSP
ThreadMachCore::CreateRegisterContextForFrame (StackFrame *frame)
{
    lldb::RegisterContextSP reg_ctx_sp;
    uint32_t concrete_frame_idx = 0;
    
    if (frame)
        concrete_frame_idx = frame->GetConcreteFrameIndex ();

    if (concrete_frame_idx == 0)
    {
        if (!m_thread_reg_ctx_sp)
        {
            ProcessSP process_sp (GetProcess());
            
            ObjectFile *core_objfile = static_cast<ProcessMachCore *>(process_sp.get())->GetCoreObjectFile ();
            if (core_objfile)
                m_thread_reg_ctx_sp = core_objfile->GetThreadContextAtIndex (GetID(), *this);
        }
        reg_ctx_sp = m_thread_reg_ctx_sp;
    }
    else
    {
        Unwind *unwinder = GetUnwinder ();
        if (unwinder)
            reg_ctx_sp = unwinder->CreateRegisterContextForFrame (frame);
    }
    return reg_ctx_sp;
}
lldb::RegisterContextSP
ThreadGDBRemote::CreateRegisterContextForFrame(StackFrame *frame) {
  lldb::RegisterContextSP reg_ctx_sp;
  uint32_t concrete_frame_idx = 0;

  if (frame)
    concrete_frame_idx = frame->GetConcreteFrameIndex();

  if (concrete_frame_idx == 0) {
    ProcessSP process_sp(GetProcess());
    if (process_sp) {
      ProcessGDBRemote *gdb_process =
          static_cast<ProcessGDBRemote *>(process_sp.get());
      // read_all_registers_at_once will be true if 'p' packet is not
      // supported.
      bool read_all_registers_at_once =
          !gdb_process->GetGDBRemote().GetpPacketSupported(GetID());
      reg_ctx_sp = std::make_shared<GDBRemoteRegisterContext>(
          *this, concrete_frame_idx, gdb_process->m_register_info,
          read_all_registers_at_once);
    }
  } else {
    Unwind *unwinder = GetUnwinder();
    if (unwinder != nullptr)
      reg_ctx_sp = unwinder->CreateRegisterContextForFrame(frame);
  }
  return reg_ctx_sp;
}
lldb::RegisterContextSP
ThreadGDBRemote::CreateRegisterContextForFrame (StackFrame *frame)
{
    lldb::RegisterContextSP reg_ctx_sp;
    const bool read_all_registers_at_once = false;
    uint32_t concrete_frame_idx = 0;
    
    if (frame)
        concrete_frame_idx = frame->GetConcreteFrameIndex ();

    
    if (concrete_frame_idx == 0)
    {
        ProcessSP process_sp (GetProcess());
        if (process_sp)
        {
            ProcessGDBRemote *gdb_process = static_cast<ProcessGDBRemote *>(process_sp.get());
            reg_ctx_sp.reset (new GDBRemoteRegisterContext (*this, concrete_frame_idx, gdb_process->m_register_info, read_all_registers_at_once));
        }
    }
    else
    {
        Unwind *unwinder = GetUnwinder ();
        if (unwinder)
            reg_ctx_sp = unwinder->CreateRegisterContextForFrame (frame);
    }
    return reg_ctx_sp;
}
Exemple #4
0
RegisterContextSP
ThreadMemory::CreateRegisterContextForFrame(StackFrame *frame) {
  RegisterContextSP reg_ctx_sp;
  uint32_t concrete_frame_idx = 0;

  if (frame)
    concrete_frame_idx = frame->GetConcreteFrameIndex();

  if (concrete_frame_idx == 0) {
    reg_ctx_sp = GetRegisterContext();
  } else {
    Unwind *unwinder = GetUnwinder();
    if (unwinder)
      reg_ctx_sp = unwinder->CreateRegisterContextForFrame(frame);
  }
  return reg_ctx_sp;
}
Exemple #5
0
lldb::RegisterContextSP
ThreadKDP::CreateRegisterContextForFrame (StackFrame *frame)
{
    lldb::RegisterContextSP reg_ctx_sp;
    uint32_t concrete_frame_idx = 0;
    
    if (frame)
        concrete_frame_idx = frame->GetConcreteFrameIndex ();

    if (concrete_frame_idx == 0)
    {
        ProcessSP process_sp (CalculateProcess());
        if (process_sp)
        {
            switch (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().GetCPUType())
            {
                case llvm::MachO::CPU_TYPE_ARM:
                    reg_ctx_sp.reset (new RegisterContextKDP_arm (*this, concrete_frame_idx));
                    break;
                case llvm::MachO::CPU_TYPE_ARM64:
                    reg_ctx_sp.reset (new RegisterContextKDP_arm64 (*this, concrete_frame_idx));
                    break;
                case llvm::MachO::CPU_TYPE_I386:
                    reg_ctx_sp.reset (new RegisterContextKDP_i386 (*this, concrete_frame_idx));
                    break;
                case llvm::MachO::CPU_TYPE_X86_64:
                    reg_ctx_sp.reset (new RegisterContextKDP_x86_64 (*this, concrete_frame_idx));
                    break;
                default:
                    assert (!"Add CPU type support in KDP");
                    break;
            }
        }
    }
    else
    {
        Unwind *unwinder = GetUnwinder ();
        if (unwinder)
            reg_ctx_sp = unwinder->CreateRegisterContextForFrame (frame);
    }
    return reg_ctx_sp;
}