void rtl_check_failed_block_symbol (const char *file, int line, const char *func) { internal_error ("RTL check: attempt to treat non-block symbol as a block symbol " "in %s, at %s:%d", func, trim_filename (file), line); }
void vec_assert_fail (const char *op, const char *struct_name, const char *file, unsigned int line, const char *function) { internal_error ("vector %s %s domain error, in %s at %s:%u", struct_name, op, function, trim_filename (file), line); }
void varray_underflow (varray_type va, const char *file, int line, const char *function) { internal_error ("underflowed virtual array %s in %s, at %s:%d", va->name, function, trim_filename (file), line); }
void rtl_check_failed_flag (const char *name, const_rtx r, const char *file, int line, const char *func) { internal_error ("RTL flag check: %s used with unexpected rtx code '%s' in %s, at %s:%d", name, GET_RTX_NAME (GET_CODE (r)), func, trim_filename (file), line); }
/* XXX Maybe print the vector? */ void rtvec_check_failed_bounds (const_rtvec r, int n, const char *file, int line, const char *func) { internal_error ("RTL check: access of elt %d of vector with last elt %d in %s, at %s:%d", n, GET_NUM_ELEM (r) - 1, func, trim_filename (file), line); }
void rtl_check_failed_code1 (const_rtx r, enum rtx_code code, const char *file, int line, const char *func) { internal_error ("RTL check: expected code '%s', have '%s' in %s, at %s:%d", GET_RTX_NAME (code), GET_RTX_NAME (GET_CODE (r)), func, trim_filename (file), line); }
void rtl_check_failed_type2 (const_rtx r, int n, int c1, int c2, const char *file, int line, const char *func) { internal_error ("RTL check: expected elt %d type '%c' or '%c', have '%c' (rtx %s) in %s, at %s:%d", n, c1, c2, GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE (r)), func, trim_filename (file), line); }
void rtl_check_failed_bounds (const_rtx r, int n, const char *file, int line, const char *func) { internal_error ("RTL check: access of elt %d of '%s' with last elt %d in %s, at %s:%d", n, GET_RTX_NAME (GET_CODE (r)), GET_RTX_LENGTH (GET_CODE (r)) - 1, func, trim_filename (file), line); }
void varray_check_failed (varray_type va, size_t n, const char *file, int line, const char *function) { internal_error ("virtual array %s[%lu]: element %lu out of bounds " "in %s, at %s:%d", va->name, (unsigned long) va->num_elements, (unsigned long) n, function, trim_filename (file), line); }
void rtl_check_failed_code_mode (const_rtx r, enum rtx_code code, enum machine_mode mode, bool not_mode, const char *file, int line, const char *func) { internal_error ((not_mode ? ("RTL check: expected code '%s' and not mode '%s', " "have code '%s' and mode '%s' in %s, at %s:%d") : ("RTL check: expected code '%s' and mode '%s', " "have code '%s' and mode '%s' in %s, at %s:%d")), GET_RTX_NAME (code), GET_MODE_NAME (mode), GET_RTX_NAME (GET_CODE (r)), GET_MODE_NAME (GET_MODE (r)), func, trim_filename (file), line); }
/* Print out the GetLastError() translation. */ static inline void w32_error (const char* function, const char* file, int line, const char* my_msg) { LPSTR w32_msgbuf; FormatMessageA (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR) &w32_msgbuf, 0, NULL); fprintf(stderr, "internal error in %s, at %s:%d: %s: %s\n", function, trim_filename (file), line, my_msg, w32_msgbuf); LocalFree ((HLOCAL)w32_msgbuf); }
/* * Man FIFO routine running in the FIFO * processes requests received * through the FIFO file repeatedly */ int fifo_process(char* msg_buf, int size, int* bytes_needed, void *sh, void** saved_state) { rpc_export_t* exp; char* buf; int line_len; char *file_sep; struct text_chunk* p; struct rpc_struct* s; int r; int req_size; static rpc_ctx_t context; DBG("process_fifo: called with %d bytes, offset %d: %.*s\n", size, (int)(long)*saved_state, size, msg_buf); /* search for the end of the request (\n\r) */ if (size < 6){ /* min fifo request */ *bytes_needed=6-size; return 0; /* we want more bytes, nothing processed */ } for (r=1+(int)(long)*saved_state;r<size;r++){ if ((msg_buf[r]=='\n' || msg_buf[r]=='\r') && (msg_buf[r-1]=='\n'|| msg_buf[r-1]=='\r')){ /* found double cr, or double lf => end of request */ req_size=r; goto process; } } /* no end of request found => ask for more bytes */ *bytes_needed=1; /* save current offset, to optimize search */ *saved_state=(void*)(long)(r-1); return 0; /* we want again the whole buffer */ process: DBG("process_fifo %d bytes request: %.*s\n", req_size, req_size, msg_buf); file_sep = 0; context.method = 0; context.reply_file = 0; context.body = 0; context.code = 200; context.reason = "OK"; context.reply_sent = 0; context.last = 0; context.line_no = 0; context.read_h.s=msg_buf; context.read_h.end=msg_buf+size; context.read_h.crt=msg_buf; context.send_h=(struct send_handle*)sh; /* commands must look this way ':<command>:[filename]' */ if (read_line(&buf, &line_len, &context.read_h) < 0) { /* line breaking must have failed -- consume the rest * and proceed to a new request */ ERR("Command expected\n"); goto consume; } context.line_no++; if (line_len == 0) { DBG("Empty command received\n"); goto consume; } if (line_len < 3) { ERR("Command must have at least 3 chars\n"); goto consume; } if (*buf != CMD_SEPARATOR) { ERR("Command must begin with %c: %.*s\n", CMD_SEPARATOR, line_len, buf); goto consume; } context.method = buf + 1; file_sep = strchr(context.method, CMD_SEPARATOR); if (file_sep == NULL) { ERR("File separator missing\n"); goto consume; } if (file_sep == context.method) { ERR("Empty command\n"); goto consume; } if (*(file_sep + 1) == 0) context.reply_file = NULL; else { context.reply_file = file_sep + 1; context.reply_file = trim_filename(context.reply_file); if (context.reply_file == 0) { ERR("Trimming filename\n"); goto consume; } } /* make command zero-terminated */ *file_sep = 0; exp = find_rpc_export(context.method, 0); if (!exp || !exp->function) { DBG("Command %s not found\n", context.method); rpc_fault(&context, 500, "Command '%s' not found", context.method); goto consume; } exp->function(&func_param, &context); consume: if (!context.reply_sent) { rpc_send(&context); } if (context.reply_file) { ctl_free(context.reply_file); context.reply_file = 0; } /* Collect garbage (unescaped strings and structures) */ while(context.strs) { p = context.strs; context.strs = context.strs->next; free_chunk(p); } while(context.structs) { s = context.structs; context.structs = context.structs->next; free_struct(s); } *bytes_needed=0; DBG("Command consumed\n"); DBG("process_fifo: returning %d, bytes_needed 0\n", req_size+1); return req_size+1; /* all was processed (including terminating \n)*/ }
static void fifo_server(FILE *fifo_stream) { char buf[MAX_FIFO_COMMAND]; int line_len; char *file_sep, *command, *file; struct fifo_command *f; file_sep=command=file=0; while(1) { /* commands must look this way ':<command>:[filename]' */ if (!read_line(buf, MAX_FIFO_COMMAND, fifo_stream, &line_len)) { /* line breaking must have failed -- consume the rest and proceed to a new request */ LOG(L_ERR, "ERROR: fifo_server: command expected\n"); goto consume; } if (line_len==0) { LOG(L_DBG, "INFO: fifo_server: command empty\n"); continue; } if (line_len<3) { LOG(L_ERR, "ERROR: fifo_server: command must have at least 3 chars\n"); goto consume; } if (*buf!=CMD_SEPARATOR) { LOG(L_ERR, "ERROR: fifo_server: command must begin with %c: %.*s\n", CMD_SEPARATOR, line_len, buf ); goto consume; } command=buf+1; file_sep=strchr(command, CMD_SEPARATOR ); if (file_sep==NULL) { LOG(L_ERR, "ERROR: fifo_server: file separator missing\n"); goto consume; } if (file_sep==command) { LOG(L_ERR, "ERROR: fifo_server: empty command\n"); goto consume; } if (*(file_sep+1)==0) file=NULL; else { file=file_sep+1; file=trim_filename(file); if (file==0) { LOG(L_ERR, "ERROR: fifo_server: trimming filename\n"); goto consume; } } /* make command zero-terminated */ *file_sep=0; f=lookup_fifo_cmd( command ); if (f==0) { LOG(L_ERR, "ERROR: fifo_server: command %s is not available\n", command); fifo_reply(file, "500 command '%s' not available\n", command); goto consume; } if (f->f(fifo_stream, file)<0) { LOG(L_ERR, "ERROR: fifo_server: command (%s) " "processing failed\n", command ); goto consume; } consume: if (file) { pkg_free(file); file=0;} consume_request(fifo_stream); } }
/* "Fancy" abort. Reports where in the compiler someone gave up. This file is used only by build programs, so we're not as polite as the version in diagnostic.c. */ void fancy_abort (const char *file, int line, const char *func) { internal_error ("abort in %s, at %s:%d", func, trim_filename (file), line); }