Commit 81a60e6c by Jason Merrill

add comments

From-SVN: r50805
parent 98ef4163
...@@ -48,7 +48,9 @@ ...@@ -48,7 +48,9 @@
#define PRE_GCC3_DWARF_FRAME_REGISTERS DWARF_FRAME_REGISTERS #define PRE_GCC3_DWARF_FRAME_REGISTERS DWARF_FRAME_REGISTERS
#endif #endif
/* This is the register and unwind state for a particular frame. */ /* This is the register and unwind state for a particular frame. This
provides the information necessary to unwind up past a frame and return
to its caller. */
struct _Unwind_Context struct _Unwind_Context
{ {
void *reg[DWARF_FRAME_REGISTERS+1]; void *reg[DWARF_FRAME_REGISTERS+1];
...@@ -889,6 +891,11 @@ execute_cfa_program (const unsigned char *insn_ptr, ...@@ -889,6 +891,11 @@ execute_cfa_program (const unsigned char *insn_ptr,
} }
} }
/* Given the _Unwind_Context CONTEXT for a stack frame, look up the FDE for
its caller and decode it into FS. This function also sets the
args_size and lsda members of CONTEXT, as they are really information
about the caller's frame. */
static _Unwind_Reason_Code static _Unwind_Reason_Code
uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs) uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
{ {
...@@ -1083,6 +1090,11 @@ uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs) ...@@ -1083,6 +1090,11 @@ uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs)
} }
} }
/* CONTEXT describes the unwind state for a frame, and FS describes the FDE
of its caller. Update CONTEXT to refer to the caller as well. Note
that the args_size and lsda members are not updated here, but later in
uw_frame_state_for. */
static void static void
uw_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs) uw_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs)
{ {
......
...@@ -72,7 +72,6 @@ _Unwind_RaiseException_Phase2(struct _Unwind_Exception *exc, ...@@ -72,7 +72,6 @@ _Unwind_RaiseException_Phase2(struct _Unwind_Exception *exc,
return code; return code;
} }
/* Raise an exception, passing along the given exception object. */ /* Raise an exception, passing along the given exception object. */
_Unwind_Reason_Code _Unwind_Reason_Code
...@@ -81,6 +80,7 @@ _Unwind_RaiseException(struct _Unwind_Exception *exc) ...@@ -81,6 +80,7 @@ _Unwind_RaiseException(struct _Unwind_Exception *exc)
struct _Unwind_Context this_context, cur_context; struct _Unwind_Context this_context, cur_context;
_Unwind_Reason_Code code; _Unwind_Reason_Code code;
/* Set up this_context to describe the current stack frame. */
uw_init_context (&this_context); uw_init_context (&this_context);
cur_context = this_context; cur_context = this_context;
...@@ -90,6 +90,8 @@ _Unwind_RaiseException(struct _Unwind_Exception *exc) ...@@ -90,6 +90,8 @@ _Unwind_RaiseException(struct _Unwind_Exception *exc)
{ {
_Unwind_FrameState fs; _Unwind_FrameState fs;
/* Set up fs to describe the FDE for the caller of cur_context. The
first time through the loop, that means __cxa_throw. */
code = uw_frame_state_for (&cur_context, &fs); code = uw_frame_state_for (&cur_context, &fs);
if (code == _URC_END_OF_STACK) if (code == _URC_END_OF_STACK)
...@@ -112,6 +114,7 @@ _Unwind_RaiseException(struct _Unwind_Exception *exc) ...@@ -112,6 +114,7 @@ _Unwind_RaiseException(struct _Unwind_Exception *exc)
return _URC_FATAL_PHASE1_ERROR; return _URC_FATAL_PHASE1_ERROR;
} }
/* Update cur_context to describe the same frame as fs. */
uw_update_context (&cur_context, &fs); uw_update_context (&cur_context, &fs);
} }
...@@ -144,6 +147,7 @@ _Unwind_ForcedUnwind_Phase2(struct _Unwind_Exception *exc, ...@@ -144,6 +147,7 @@ _Unwind_ForcedUnwind_Phase2(struct _Unwind_Exception *exc,
_Unwind_FrameState fs; _Unwind_FrameState fs;
int action; int action;
/* Set up fs to describe the FDE for the caller of cur_context. */
code = uw_frame_state_for (context, &fs); code = uw_frame_state_for (context, &fs);
if (code != _URC_NO_REASON && code != _URC_END_OF_STACK) if (code != _URC_NO_REASON && code != _URC_END_OF_STACK)
return _URC_FATAL_PHASE2_ERROR; return _URC_FATAL_PHASE2_ERROR;
...@@ -172,6 +176,7 @@ _Unwind_ForcedUnwind_Phase2(struct _Unwind_Exception *exc, ...@@ -172,6 +176,7 @@ _Unwind_ForcedUnwind_Phase2(struct _Unwind_Exception *exc,
return _URC_FATAL_PHASE2_ERROR; return _URC_FATAL_PHASE2_ERROR;
} }
/* Update cur_context to describe the same frame as fs. */
uw_update_context (context, &fs); uw_update_context (context, &fs);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment