diff options
| author | Kai Luo <gluokai@gmail.com> | 2023-01-04 18:00:09 +0800 |
|---|---|---|
| committer | Kai Luo <gluokai@gmail.com> | 2023-01-04 18:00:09 +0800 |
| commit | 34534152f5ad64d4d1fbc50ef475bc68cb7ac750 (patch) | |
| tree | 797cffcbaf2625c113c673a01363a1451507d50f /library/std | |
| parent | fbe82928729c29ea953c95defb81b302dd704fae (diff) | |
| download | rust-34534152f5ad64d4d1fbc50ef475bc68cb7ac750.tar.gz rust-34534152f5ad64d4d1fbc50ef475bc68cb7ac750.zip | |
[LSDA] Take ttype_index into account when taking action
If cs_action != 0, we should check the ttype_index field in action record. If ttype_index == 0, a clean up action is taken.
Diffstat (limited to 'library/std')
| -rw-r--r-- | library/std/src/personality/dwarf/eh.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/library/std/src/personality/dwarf/eh.rs b/library/std/src/personality/dwarf/eh.rs index a783e187004..e7bd700b8b8 100644 --- a/library/std/src/personality/dwarf/eh.rs +++ b/library/std/src/personality/dwarf/eh.rs @@ -84,7 +84,7 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>) -> Result let cs_start = read_encoded_pointer(&mut reader, context, call_site_encoding)?; let cs_len = read_encoded_pointer(&mut reader, context, call_site_encoding)?; let cs_lpad = read_encoded_pointer(&mut reader, context, call_site_encoding)?; - let cs_action = reader.read_uleb128(); + let cs_action_entry = reader.read_uleb128(); // Callsite table is sorted by cs_start, so if we've passed the ip, we // may stop searching. if ip < func_start + cs_start { @@ -95,7 +95,15 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>) -> Result return Ok(EHAction::None); } else { let lpad = lpad_base + cs_lpad; - return Ok(interpret_cs_action(cs_action, lpad)); + if cs_action_entry == 0 { + return Ok(interpret_cs_action(0, lpad)); + } else { + let action_record = + (action_table as *mut u8).offset(cs_action_entry as isize - 1); + let mut action_reader = DwarfReader::new(action_record); + let ttype_index = action_reader.read_sleb128(); + return Ok(interpret_cs_action(ttype_index as u64, lpad)); + } } } } |
