Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: libstdc++-v3/libsupc++/eh_pnacl.cc

Issue 97603002: PNaCl SJLJ EH: Fix handling of dependent exceptions (Closed) Base URL: http://git.chromium.org/native_client/pnacl-gcc.git@pnacl
Patch Set: Retry upload Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // -*- C++ -*- Exception handling routines for PNaCl. 1 // -*- C++ -*- Exception handling routines for PNaCl.
2 // Copyright (C) 2013 2 // Copyright (C) 2013
3 // Free Software Foundation, Inc. 3 // Free Software Foundation, Inc.
4 // 4 //
5 // This file is part of GCC. 5 // This file is part of GCC.
6 // 6 //
7 // GCC is free software; you can redistribute it and/or modify 7 // GCC is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by 8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3, or (at your option) 9 // the Free Software Foundation; either version 3, or (at your option)
10 // any later version. 10 // any later version.
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // UE_HEADER to __cxa_exception immediately. 233 // UE_HEADER to __cxa_exception immediately.
234 // 234 //
235 // This function returns if stack unwinding did not find any stack 235 // This function returns if stack unwinding did not find any stack
236 // frames that match the exception being thrown. 236 // frames that match the exception being thrown.
237 static void 237 static void
238 handle_exception (struct _Unwind_Exception *ue_header, bool check_for_catch) 238 handle_exception (struct _Unwind_Exception *ue_header, bool check_for_catch)
239 { 239 {
240 __cxa_exception *xh = __get_exception_header_from_ue (ue_header); 240 __cxa_exception *xh = __get_exception_header_from_ue (ue_header);
241 241
242 void *obj = __get_object_from_ue (ue_header); 242 void *obj = __get_object_from_ue (ue_header);
243 const std::type_info *throw_type =
244 __get_exception_header_from_obj (obj)->exceptionType;
Derek Schuff 2013/12/02 18:24:09 add a comment here mentioning why this has to be d
Mark Seaborn 2013/12/02 18:49:14 Done.
243 struct exception_frame *frame; 245 struct exception_frame *frame;
244 int32_t clause_id; 246 int32_t clause_id;
245 if (find_match (xh->exceptionType, &obj, __pnacl_eh_stack, 247 if (find_match (throw_type, &obj, __pnacl_eh_stack, &frame, &clause_id))
246 &frame, &clause_id))
247 { 248 {
248 // Check that there is a non-cleanup handler for the exception. 249 // Check that there is a non-cleanup handler for the exception.
249 // If not, we should abort before running cleanup handlers 250 // If not, we should abort before running cleanup handlers
250 // (i.e. destructors). 251 // (i.e. destructors).
251 // 252 //
252 // This is mainly a convenience for debugging. It means that if 253 // This is mainly a convenience for debugging. It means that if
253 // the program throws an uncaught exception, the location of the 254 // the program throws an uncaught exception, the location of the
254 // "throw" will be on the stack when the program aborts. If we 255 // "throw" will be on the stack when the program aborts. If we
255 // ran cleanup handlers before aborting, this context would be 256 // ran cleanup handlers before aborting, this context would be
256 // lost. 257 // lost.
257 // 258 //
258 // This is optional in the C++ standard, which says "If no 259 // This is optional in the C++ standard, which says "If no
259 // matching handler is found, the function std::terminate() is 260 // matching handler is found, the function std::terminate() is
260 // called; whether or not the stack is unwound before this call 261 // called; whether or not the stack is unwound before this call
261 // to std::terminate() is implementation-defined". 262 // to std::terminate() is implementation-defined".
262 if (check_for_catch && clause_id == 0 && 263 if (check_for_catch && clause_id == 0 &&
263 !is_exception_caught (xh->exceptionType, obj, frame->next)) 264 !is_exception_caught (throw_type, obj, frame->next))
264 return; 265 return;
265 266
266 __pnacl_eh_stack = frame->next; 267 __pnacl_eh_stack = frame->next;
267 268
268 // Save adjusted exception pointer so that it can be returned by 269 // Save adjusted exception pointer so that it can be returned by
269 // __cxa_begin_catch() when entering a catch() block. 270 // __cxa_begin_catch() when entering a catch() block.
270 xh->adjustedPtr = obj; 271 xh->adjustedPtr = obj;
271 272
272 // Save the clause ID so that if the landingpad block calls 273 // Save the clause ID so that if the landingpad block calls
273 // __cxa_call_unexpected() and the std::set_unexpected() handler 274 // __cxa_call_unexpected() and the std::set_unexpected() handler
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 // If the exception spec allows std::bad_exception, throw that. 419 // If the exception spec allows std::bad_exception, throw that.
419 // We don't have a thrown object to compare against, but since 420 // We don't have a thrown object to compare against, but since
420 // bad_exception doesn't have virtual bases, that's OK; just pass 0. 421 // bad_exception doesn't have virtual bases, that's OK; just pass 0.
421 const std::type_info *bad_exc = &typeid (std::bad_exception); 422 const std::type_info *bad_exc = &typeid (std::bad_exception);
422 if (check_exception_spec (bad_exc, NULL, xh_switch_value)) 423 if (check_exception_spec (bad_exc, NULL, xh_switch_value))
423 throw std::bad_exception (); 424 throw std::bad_exception ();
424 425
425 __terminate (xh_terminate_handler); 426 __terminate (xh_terminate_handler);
426 } 427 }
427 } 428 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698