void SourceAssembler::eol_comment(const char* fmt, ...) { if (_eol_comment[0] == 0) { va_list ap; va_start(ap, fmt); jvm_vsprintf(_eol_comment, fmt, ap); va_end(ap); } else { // comments from inner macros shouldn't override already created ones. } }
void report_error(bool is_vm_internal_error, const char* file_name, int line_no, const char* title, const char* format, ...) { static int error_level = 1; // Handle the recursive case switch(error_level++) { case 1: // first time, do nothing break; case 2: // second time print recursive problem tty->print_cr("[error occurred during error reporting]"); return; default: // otherwise just say NO. JVM::exit(-1); } // Compute the message char message[2*1024]; va_list ap; va_start(ap, format); jvm_vsprintf(message, format, ap); va_end(ap); if (is_vm_internal_error) { // Print error has happen tty->cr(); tty->print_cr("#"); tty->print_cr("# VM Error, %s", title); tty->print_cr("#"); char loc_buf[256]; if (file_name != NULL) { int len = jvm_strlen(file_name); jvm_strncpy(loc_buf, file_name, 256); if (len + 10 < 256) { jvm_sprintf(loc_buf + len, ", %d", line_no); } } else { jvm_strcpy(loc_buf, "<unknown>"); } tty->print_cr("# Error ID: %s", loc_buf); tty->print_cr("#"); } { char* begin = message; // print line by line for (;;) { char* end = (char *) jvm_strchr(begin, '\n'); if (!end) { break; } *end = '\0'; tty->print_raw("# "); tty->print_raw(begin); *end = '\n'; begin = end + 1; } // print last line if (*begin) { tty->print_raw("# "); tty->print_raw(begin); tty->cr(); } // print end mark tty->print_cr("#"); } error_level--; }