Skip to content

Commit 6223753

Browse files
committed
Parse catch filter in personality function
1 parent 47171e0 commit 6223753

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

library/std/src/personality/dwarf/eh.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ pub enum EHAction {
4747
None,
4848
Cleanup(usize),
4949
Catch(usize),
50+
Filter(usize),
5051
Terminate,
5152
}
5253

@@ -142,9 +143,11 @@ unsafe fn interpret_cs_action(
142143
let ttype_index = action_reader.read_sleb128();
143144
if ttype_index == 0 {
144145
EHAction::Cleanup(lpad)
145-
} else {
146+
} else if ttype_index > 0 {
146147
// Stop unwinding Rust panics at catch_unwind.
147148
EHAction::Catch(lpad)
149+
} else {
150+
EHAction::Filter(lpad)
148151
}
149152
}
150153
}

library/std/src/personality/gcc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ cfg_if::cfg_if! {
135135
EHAction::None | EHAction::Cleanup(_) => {
136136
return continue_unwind(exception_object, context);
137137
}
138-
EHAction::Catch(_) => {
138+
EHAction::Catch(_) | EHAction::Filter(_) => {
139139
// EHABI requires the personality routine to update the
140140
// SP value in the barrier cache of the exception object.
141141
(*exception_object).private[5] =
@@ -147,7 +147,7 @@ cfg_if::cfg_if! {
147147
} else {
148148
match eh_action {
149149
EHAction::None => return continue_unwind(exception_object, context),
150-
EHAction::Cleanup(lpad) | EHAction::Catch(lpad) => {
150+
EHAction::Cleanup(lpad) | EHAction::Catch(lpad) | EHAction::Filter(lpad) => {
151151
uw::_Unwind_SetGR(
152152
context,
153153
UNWIND_DATA_REG.0,
@@ -201,13 +201,13 @@ cfg_if::cfg_if! {
201201
if actions as i32 & uw::_UA_SEARCH_PHASE as i32 != 0 {
202202
match eh_action {
203203
EHAction::None | EHAction::Cleanup(_) => uw::_URC_CONTINUE_UNWIND,
204-
EHAction::Catch(_) => uw::_URC_HANDLER_FOUND,
204+
EHAction::Catch(_) | EHAction::Filter(_) => uw::_URC_HANDLER_FOUND,
205205
EHAction::Terminate => uw::_URC_FATAL_PHASE1_ERROR,
206206
}
207207
} else {
208208
match eh_action {
209209
EHAction::None => uw::_URC_CONTINUE_UNWIND,
210-
EHAction::Cleanup(lpad) | EHAction::Catch(lpad) => {
210+
EHAction::Cleanup(lpad) | EHAction::Catch(lpad) | EHAction::Filter(lpad) => {
211211
uw::_Unwind_SetGR(
212212
context,
213213
UNWIND_DATA_REG.0,

0 commit comments

Comments
 (0)