Example #1
0
extern "C" void lprint_error(lprint_format_t msg, ...) {
  bool saved = PrintVMMessages; PrintVMMessages = true;
  lprintf("Self VM error: " );
  va_list ap;
  va_start(ap, msg);
  vlprintf(msg, ap);
  va_end(ap);
  lprintf("\n" );
  error_breakpoint();
  PrintVMMessages = saved;
}
Example #2
0
// Handle an OS signal that won't be passed to Self
void SignalInterface::handle_OS_signal(int ossig, char* addr, int32 code) {

  FlagSettingInt fs(errno, 0);  // save errno

  if (eventLog != NULL) // might not exist yet
    LOG_EVENT3("signal %ld pc %#lx npc %#lx",
               ossig, InterruptedContext::the_interrupted_context->pc(), InterruptedContext::the_interrupted_context->next_pc());
            
  # if TARGET_OS_VERSION != MACOSX_VERSION
  assert(!is_off_signal_stack(), "should be on interrupt stack");
  # endif
  // Linux???
  
  if (handle_SIC_OS_signal(ossig, addr, code))
    return;
# if TARGET_OS_VERSION == LINUX_VERSION
  lprintf("\nInternal error: signal %d code %d addr 0x%lx pc 0x%lx.\n",
         (void*)ossig, (void*)code, (void*)(long unsigned)addr,
         (void*)(long unsigned)(InterruptedContext::the_interrupted_context->pc()));
# else
  lprintf("\nInternal error: signal %d (sig%s) code %d addr 0x%lx pc 0x%lx.\n",
         (void*)ossig, (void*)sys_signame[ossig],
         (void*)code, (void*)(long unsigned)addr,
         (void*)(long unsigned)(InterruptedContext::the_interrupted_context->pc()));
# endif
  error_breakpoint();
  if (WizardAbortMode) {
    // for better VM debugging - see regs and stack undisturbed, but
    // printing/traversing Self stack may break
    InterruptedContext::fatal_menu();
  } 
  else {
    // let user print the stack etc; easier to do in user context
    WizardAbortMode = true; // next bit might fail over and over
    InterruptedContext::continue_abort_at(first_inst_addr(InterruptedContext::fatal_menu), true);
    AbortContext.set(InterruptedContext::the_interrupted_context);
  }
}
Example #3
0
volatile void fatal_handler() {
  error_breakpoint();
  SignalInterface::simulate_fatal_signal();
  OS::terminate(-1);
}