diff options
| author | Greg Clayton <gclayton@apple.com> | 2011-04-26 23:48:45 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2011-04-26 23:48:45 +0000 |
| commit | 79ea878bf908499b4452e14795af1096cf067995 (patch) | |
| tree | 9a8c40a8350c700023ab01f6572f6ca1576fd651 /lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp | |
| parent | aec25847606fd69e6ef59dd28c5f6d94ab8708d3 (diff) | |
| download | bcm5719-llvm-79ea878bf908499b4452e14795af1096cf067995.tar.gz bcm5719-llvm-79ea878bf908499b4452e14795af1096cf067995.zip | |
Got the EmulateInstruction CFI code a lot closer to producing CFI data.
Switch the EmulateInstruction to use the standard RegisterInfo structure
that is defined in the lldb private types intead of passing the reg kind and
reg num everywhere. EmulateInstruction subclasses also need to provide
RegisterInfo structs given a reg kind and reg num. This eliminates the need
for the GetRegisterName() virtual function and allows more complete information
to be passed around in the read/write register callbacks. Subclasses should
always provide RegiterInfo structs with the generic register info filled in as
well as at least one kind of register number in the RegisterInfo.kinds[] array.
llvm-svn: 130256
Diffstat (limited to 'lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp')
| -rw-r--r-- | lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp b/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp index 72fc484e0d9..296b13ac9ca 100644 --- a/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp +++ b/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp @@ -254,8 +254,7 @@ EmulationStateARM::WritePseudoMemory (EmulateInstruction *instruction, bool EmulationStateARM::ReadPseudoRegister (EmulateInstruction *instruction, void *baton, - uint32_t reg_kind, - uint32_t reg_num, + const RegisterInfo ®_info, uint64_t ®_value) { if (!baton) @@ -264,23 +263,8 @@ EmulationStateARM::ReadPseudoRegister (EmulateInstruction *instruction, bool success = true; EmulationStateARM *pseudo_state = (EmulationStateARM *) baton; - if (reg_kind == eRegisterKindGeneric) - { - switch (reg_num) - { - case LLDB_REGNUM_GENERIC_PC: - reg_num = dwarf_pc; break; - case LLDB_REGNUM_GENERIC_SP: - reg_num = dwarf_sp; break; - case LLDB_REGNUM_GENERIC_FLAGS: - reg_num = dwarf_cpsr; break; - case LLDB_REGNUM_GENERIC_RA: - reg_num = dwarf_lr; break; - default: - break; - } - } - reg_value = pseudo_state->ReadPseudoRegisterValue (reg_num, success); + assert (reg_info.kinds[eRegisterKindDWARF] != LLDB_INVALID_REGNUM); + reg_value = pseudo_state->ReadPseudoRegisterValue (reg_info.kinds[eRegisterKindDWARF], success); return success; @@ -290,32 +274,15 @@ bool EmulationStateARM::WritePseudoRegister (EmulateInstruction *instruction, void *baton, const EmulateInstruction::Context &context, - uint32_t reg_kind, - uint32_t reg_num, + const RegisterInfo ®_info, uint64_t reg_value) { if (!baton) return false; - if (reg_kind == eRegisterKindGeneric) - { - switch (reg_num) - { - case LLDB_REGNUM_GENERIC_PC: - reg_num = dwarf_pc; break; - case LLDB_REGNUM_GENERIC_SP: - reg_num = dwarf_sp; break; - case LLDB_REGNUM_GENERIC_FLAGS: - reg_num = dwarf_cpsr; break; - case LLDB_REGNUM_GENERIC_RA: - reg_num = dwarf_lr; break; - default: - break; - } - } - + assert (reg_info.kinds[eRegisterKindDWARF] != LLDB_INVALID_REGNUM); EmulationStateARM *pseudo_state = (EmulationStateARM *) baton; - return pseudo_state->StorePseudoRegisterValue (reg_num, reg_value); + return pseudo_state->StorePseudoRegisterValue (reg_info.kinds[eRegisterKindDWARF], reg_value); } bool |

