Fix bare except:s not catching anything #354

Merged
sb10q merged 1 commits from jcoates/artiq-zynq:dwarf-target2-ttype into master 2025-02-05 15:42:00 +08:00

View File

@ -85,7 +85,7 @@ unsafe fn get_ttype_entry(
encoding | DW_EH_PE_pcrel,
ttype_base,
)
srenblad marked this conversation as resolved Outdated

I am trying to understand what this is doing differently from the read_encoded_pointer_with_base version, assuming the encoding is DW_EH_PE_absptr | DW_EH_PE_pcrel? My assumption is that the pcrel hack is just to add the offset and the original offset, which you also do explicitly here (only difference being the use of add vs +=).

I am trying to understand what this is doing differently from the `read_encoded_pointer_with_base` version, assuming the encoding is `DW_EH_PE_absptr | DW_EH_PE_pcrel`? My assumption is that the pcrel hack is just to add the offset and the original offset, which you also do explicitly here (only difference being the use of `add` vs `+=`).
.map(|v| (v != ttype_base).then(|| v as *const u8))
.map(|v| (v != 0).then(|| v as *const u8))
}
pub unsafe fn find_eh_action(
@ -275,6 +275,11 @@ unsafe fn read_encoded_pointer_with_base(reader: &mut DwarfReader, encoding: u8,
_ => return Err(()),
};
if result == 0 {
// null is just encoded as 0, even if a relative encoding is used for the table.
return Ok(0);
}
result += if (encoding & 0x70) == DW_EH_PE_pcrel {
original_ptr as usize
} else {