void Exception::throw_it (unsigned int line, const char *file, int dbg) { // NOTE: This is the only place we can detect a throw of a pointer // to a stack based object. Exception *temp; PRINTF (("Preparing to throw Exception object at %p:\n", this)); // Only make a temporary if the exception object is on the stack. if (in_stack()) { PRINTF ((" Exception is on the stack - copying it\n")); // Use the special new operator which allocates the exception // in reserved storage if there's no memory available. temp = new (0) Exception (*this); // We created it, so we should delete it. temp->f_temporary = 1; } else { PRINTF ((" Exception is on the heap\n")); temp = this; } temp->do_throw (line, file, dbg); }
static bool in_restart_stack(unsigned long sp, struct stack_info *info) { unsigned long frame_size, top; frame_size = STACK_FRAME_OVERHEAD + sizeof(struct pt_regs); top = S390_lowcore.restart_stack + frame_size; return in_stack(sp, info, STACK_TYPE_RESTART, top - THREAD_SIZE, top); }
static bool in_task_stack(unsigned long sp, struct task_struct *task, struct stack_info *info) { unsigned long stack; stack = (unsigned long) task_stack_page(task); return in_stack(sp, info, STACK_TYPE_TASK, stack, stack + THREAD_SIZE); }
void backtrace_capture(struct backtrace *backtrace) { void **frame; size_t n; n = 0; for (frame = __builtin_frame_address(1); frame != NULL && in_stack(frame) && frame[0] != NULL && n < BACKTRACE_MAX_FRAMES; frame = frame[0]) { backtrace->frames[n++] = (uintptr_t) frame[1]; } backtrace->n_frames = n; }
void get_scc(graph_t * g) { if (!g || !g->vex_count()) { return; } int C = g->vex_count(); list_t * L = g->get_structure(); _processed.assign(C, 0); _visited.assign(C, 0); std::stack<int> stk; std::vector<int> in_stack(C, 0), low(C, 0), dfn(C, 0); for (int i = C - 1; i >= 0; --i) { if (!_visited[i]) { _dfs(g, L, i, low, dfn, stk, in_stack); } } }