/* * Update the values of the erase, interrupt, and kill characters in 'mode'. * * SVr4 tset (e.g., Solaris 2.5) only modifies the intr, quit or erase * characters if they're unset, or if we specify them as options. This differs * from BSD 4.4 tset, which always sets erase. */ static void set_control_chars(void) { #ifdef TERMIOS if (DISABLED(mode.c_cc[VERASE]) || terasechar >= 0) mode.c_cc[VERASE] = (terasechar >= 0) ? terasechar : default_erase(); if (DISABLED(mode.c_cc[VINTR]) || intrchar >= 0) mode.c_cc[VINTR] = (intrchar >= 0) ? intrchar : CINTR; if (DISABLED(mode.c_cc[VKILL]) || tkillchar >= 0) mode.c_cc[VKILL] = (tkillchar >= 0) ? tkillchar : CKILL; #endif }
static void report(const char *name, int which, unsigned def) { unsigned older, newer; char *p; newer = mode.c_cc[which]; older = oldmode.c_cc[which]; if (older == newer && older == def) return; (void) fprintf(stderr, "%s %s ", name, older == newer ? "is" : "set to"); if (DISABLED(newer)) (void) fprintf(stderr, "undef.\n"); /* * Check 'delete' before 'backspace', since the key_backspace value * is ambiguous. */ else if (newer == 0177) (void) fprintf(stderr, "delete.\n"); else if ((p = key_backspace) != 0 && newer == (unsigned char) p[0] && p[1] == '\0') (void) fprintf(stderr, "backspace.\n"); else if (newer < 040) { newer ^= 0100; (void) fprintf(stderr, "control-%c (^%c).\n", UChar(newer), UChar(newer)); } else (void) fprintf(stderr, "%c.\n", UChar(newer)); }
/* * Update the values of the erase, interrupt, and kill characters in the TTY * parameter. * * SVr4 tset (e.g., Solaris 2.5) only modifies the intr, quit or erase * characters if they're unset, or if we specify them as options. This differs * from BSD 4.4 tset, which always sets erase. */ void set_control_chars(TTY * tty_settings, int my_erase, int my_intr, int my_kill) { if (DISABLED(tty_settings->c_cc[VERASE]) || my_erase >= 0) { tty_settings->c_cc[VERASE] = UChar((my_erase >= 0) ? my_erase : default_erase()); } if (DISABLED(tty_settings->c_cc[VINTR]) || my_intr >= 0) { tty_settings->c_cc[VINTR] = UChar((my_intr >= 0) ? my_intr : CINTR); } if (DISABLED(tty_settings->c_cc[VKILL]) || my_kill >= 0) { tty_settings->c_cc[VKILL] = UChar((my_kill >= 0) ? my_kill : CKILL); } }
unsigned int disabled_uint(void) { return DISABLED(); }
static step_state unw_step_bp(hpcrun_unw_cursor_t* cursor) { void *sp, **bp, *pc; void **next_sp, **next_bp, *next_pc; unwind_interval *uw; TMSG(UNW_STRATEGY,"Using BP step"); // current frame bp = cursor->bp; sp = cursor->sp; pc = cursor->pc_unnorm; uw = (unwind_interval *)cursor->intvl; TMSG(UNW,"step_bp: cursor { bp=%p, sp=%p, pc=%p }", bp, sp, pc); if (MYDBG) { dump_ui(uw, 0); } if (!(sp <= (void*) bp)) { TMSG(UNW," step_bp: STEP_ERROR, unwind attempted, but incoming bp(%p) was not" " >= sp(%p)", bp, sp); return STEP_ERROR; } if (DISABLED(OMP_SKIP_MSB)) { if (!((void *)bp < monitor_stack_bottom())) { TMSG(UNW," step_bp: STEP_ERROR, unwind attempted, but incoming bp(%p) was not" " between sp (%p) and monitor stack bottom (%p)", bp, sp, monitor_stack_bottom()); return STEP_ERROR; } } // bp relative next_sp = (void **)((void *)bp + uw->bp_bp_pos); next_bp = *next_sp; next_sp = (void **)((void *)bp + uw->bp_ra_pos); void* ra_loc = (void*) next_sp; next_pc = *next_sp; next_sp += 1; if ((void *)next_sp > sp) { // this condition is a weak correctness check. only // try building an interval for the return address again if it succeeds ip_normalized_t next_pc_norm = ip_normalized_NULL; uw = (unwind_interval *)hpcrun_addr_to_interval(((char *)next_pc) - 1, next_pc, &next_pc_norm); if (! uw){ if (((void *)next_sp) >= monitor_stack_bottom()) { TMSG(UNW," step_bp: STEP_STOP_WEAK, next_sp >= monitor_stack_bottom," " next_sp = %p", next_sp); return STEP_STOP_WEAK; } TMSG(UNW," step_bp: STEP_ERROR, cannot build interval for next_pc(%p)", next_pc); return STEP_ERROR; } else { cursor->pc_unnorm = next_pc; cursor->bp = next_bp; cursor->sp = next_sp; cursor->ra_loc = ra_loc; cursor->pc_norm = next_pc_norm; cursor->intvl = (splay_interval_t *)uw; TMSG(UNW," step_bp: STEP_OK, has_intvl=%d, bp=%p, sp=%p, pc=%p", cursor->intvl != NULL, next_bp, next_sp, next_pc); return STEP_OK; } } else { TMSG(UNW_STRATEGY,"BP unwind fails: bp (%p) < sp (%p)", bp, sp); return STEP_ERROR; } EMSG("FALL Through BP unwind: shouldn't happen"); return STEP_ERROR; }