Home | History | Annotate | Download | only in MacOSX-Kernel
      1 //===-- RegisterContextKDP_arm.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 #include "RegisterContextKDP_arm.h"
     11 
     12 // C Includes
     13 // C++ Includes
     14 // Other libraries and framework includes
     15 // Project includes
     16 #include "ProcessKDP.h"
     17 #include "ThreadKDP.h"
     18 
     19 using namespace lldb;
     20 using namespace lldb_private;
     21 
     22 
     23 RegisterContextKDP_arm::RegisterContextKDP_arm (ThreadKDP &thread, uint32_t concrete_frame_idx) :
     24     RegisterContextDarwin_arm (thread, concrete_frame_idx),
     25     m_kdp_thread (thread)
     26 {
     27 }
     28 
     29 RegisterContextKDP_arm::~RegisterContextKDP_arm()
     30 {
     31 }
     32 
     33 int
     34 RegisterContextKDP_arm::DoReadGPR (lldb::tid_t tid, int flavor, GPR &gpr)
     35 {
     36     ProcessSP process_sp (CalculateProcess());
     37     if (process_sp)
     38     {
     39         Error error;
     40         if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestReadRegisters (tid, GPRRegSet, &gpr, sizeof(gpr), error))
     41         {
     42             if (error.Success())
     43                 return 0;
     44         }
     45     }
     46     return -1;
     47 }
     48 
     49 int
     50 RegisterContextKDP_arm::DoReadFPU (lldb::tid_t tid, int flavor, FPU &fpu)
     51 {
     52     ProcessSP process_sp (CalculateProcess());
     53     if (process_sp)
     54     {
     55         Error error;
     56         if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestReadRegisters (tid, FPURegSet, &fpu, sizeof(fpu), error))
     57         {
     58             if (error.Success())
     59                 return 0;
     60         }
     61     }
     62     return -1;
     63 }
     64 
     65 int
     66 RegisterContextKDP_arm::DoReadEXC (lldb::tid_t tid, int flavor, EXC &exc)
     67 {
     68     ProcessSP process_sp (CalculateProcess());
     69     if (process_sp)
     70     {
     71         Error error;
     72         if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestReadRegisters (tid, EXCRegSet, &exc, sizeof(exc), error))
     73         {
     74             if (error.Success())
     75                 return 0;
     76         }
     77     }
     78     return -1;
     79 }
     80 
     81 int
     82 RegisterContextKDP_arm::DoReadDBG (lldb::tid_t tid, int flavor, DBG &dbg)
     83 {
     84     ProcessSP process_sp (CalculateProcess());
     85     if (process_sp)
     86     {
     87         Error error;
     88         if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestReadRegisters (tid, DBGRegSet, &dbg, sizeof(dbg), error))
     89         {
     90             if (error.Success())
     91                 return 0;
     92         }
     93     }
     94     return -1;
     95 }
     96 
     97 int
     98 RegisterContextKDP_arm::DoWriteGPR (lldb::tid_t tid, int flavor, const GPR &gpr)
     99 {
    100     ProcessSP process_sp (CalculateProcess());
    101     if (process_sp)
    102     {
    103         Error error;
    104         if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestWriteRegisters (tid, GPRRegSet, &gpr, sizeof(gpr), error))
    105         {
    106             if (error.Success())
    107                 return 0;
    108         }
    109     }
    110     return -1;
    111 }
    112 
    113 int
    114 RegisterContextKDP_arm::DoWriteFPU (lldb::tid_t tid, int flavor, const FPU &fpu)
    115 {
    116     ProcessSP process_sp (CalculateProcess());
    117     if (process_sp)
    118     {
    119         Error error;
    120         if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestWriteRegisters (tid, FPURegSet, &fpu, sizeof(fpu), error))
    121         {
    122             if (error.Success())
    123                 return 0;
    124         }
    125     }
    126     return -1;
    127 }
    128 
    129 int
    130 RegisterContextKDP_arm::DoWriteEXC (lldb::tid_t tid, int flavor, const EXC &exc)
    131 {
    132     ProcessSP process_sp (CalculateProcess());
    133     if (process_sp)
    134     {
    135         Error error;
    136         if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestWriteRegisters (tid, EXCRegSet, &exc, sizeof(exc), error))
    137         {
    138             if (error.Success())
    139                 return 0;
    140         }
    141     }
    142     return -1;
    143 }
    144 
    145 int
    146 RegisterContextKDP_arm::DoWriteDBG (lldb::tid_t tid, int flavor, const DBG &dbg)
    147 {
    148     ProcessSP process_sp (CalculateProcess());
    149     if (process_sp)
    150     {
    151         Error error;
    152         if (static_cast<ProcessKDP *>(process_sp.get())->GetCommunication().SendRequestWriteRegisters (tid, DBGRegSet, &dbg, sizeof(dbg), error))
    153         {
    154             if (error.Success())
    155                 return 0;
    156         }
    157     }
    158     return -1;
    159 }
    160 
    161 
    162