Allow unimplemented registers to appear in DWARF

The presence of such a register — eg. rcx, which is actually used in CFA
on a few lines of libgcc_s.so on my system — will yield an assert(0) in
the produced code, but will at least not fail to compile alltogether.
This commit is contained in:
Théophile Bastian 2018-04-25 17:34:31 +02:00
parent 31f811eca4
commit ff0f8c90df

View file

@ -84,27 +84,32 @@ SimpleDwarf::DwRegister DwarfReader::read_register(
{
SimpleDwarf::DwRegister output;
switch(reg.k) {
case core::FrameSection::register_def::REGISTER:
output.type = SimpleDwarf::DwRegister::REG_REGISTER;
output.offset = reg.register_plus_offset_r().second;
output.reg = from_dwarfpp_reg(
reg.register_plus_offset_r().first);
break;
try {
switch(reg.k) {
case core::FrameSection::register_def::REGISTER:
output.type = SimpleDwarf::DwRegister::REG_REGISTER;
output.offset = reg.register_plus_offset_r().second;
output.reg = from_dwarfpp_reg(
reg.register_plus_offset_r().first);
break;
case core::FrameSection::register_def::SAVED_AT_OFFSET_FROM_CFA:
output.type = SimpleDwarf::DwRegister::REG_CFA_OFFSET;
output.offset = reg.saved_at_offset_from_cfa_r();
break;
case core::FrameSection::register_def::SAVED_AT_OFFSET_FROM_CFA:
output.type = SimpleDwarf::DwRegister::REG_CFA_OFFSET;
output.offset = reg.saved_at_offset_from_cfa_r();
break;
case core::FrameSection::register_def::INDETERMINATE:
case core::FrameSection::register_def::UNDEFINED:
output.type = SimpleDwarf::DwRegister::REG_UNDEFINED;
break;
case core::FrameSection::register_def::INDETERMINATE:
case core::FrameSection::register_def::UNDEFINED:
output.type = SimpleDwarf::DwRegister::REG_UNDEFINED;
break;
default:
output.type = SimpleDwarf::DwRegister::REG_NOT_IMPLEMENTED;
break;
default:
output.type = SimpleDwarf::DwRegister::REG_NOT_IMPLEMENTED;
break;
}
}
catch(const UnsupportedRegister& e) {
output.type = SimpleDwarf::DwRegister::REG_NOT_IMPLEMENTED;
}
return output;