コード例 #1
0
ファイル: throw.c プロジェクト: BillTheBest/k42
void
__rethrow(void *index)
{
    struct eh_context *eh = (*get_eh_context) ();
    void *pc, *handler;
    long offset;

    frame_state my_ustruct, *my_udata = &my_ustruct;

    if (! eh->info) {
	__terminate ();
    }

    eh->table_index = index;
label:
    my_udata = __frame_state_for (&&label, my_udata);
    if (! my_udata) {
	__terminate ();
    }
    my_udata->cfa = __builtin_dwarf_cfa ();
    __builtin_unwind_init ();
    pc = __builtin_extract_return_addr (__builtin_return_address (0)) - 1;
    handler = throw_helper (eh, pc, my_udata, &offset);
    __builtin_eh_return ((void *)eh, offset, handler);
}
コード例 #2
0
void dummy1(void) {
  void* cfa = (void*) __builtin_dwarf_cfa();
  printf("cfa: %p\n", cfa);
  ASSERT(dummy0_cfa == cfa, "ERROR: cfa mismatch");

  next_step(3);
  __builtin_eh_return (STACK_REMAINDER, dummy2);
}
コード例 #3
0
void dummy3(void) {
  void* cfa = (void*) __builtin_dwarf_cfa();
  printf("cfa: %p\n", cfa);
  ASSERT(dummy0_cfa == cfa, "ERROR: cfa mismatch");

  next_step(5);
  exit(55);
}
コード例 #4
0
void dummy0(void) {
  /* NOTE: __builtin_dwarf_cfa() return a pointer to the "current stack frame"
   *  CFA="canonical frame address".
   *  We pick STACK_REMAINDER so that stack is completely cleaned up and
   *  it looks like the function was never called.
   *  Hence all the CFA's should be the same.
   */
  void* cfa = (void*) __builtin_dwarf_cfa();
  printf("cfa: %p\n", cfa);
  dummy0_cfa = cfa;
  next_step(2);
  __builtin_eh_return (STACK_REMAINDER, dummy1);
}