8140594: Various minor code improvements (compiler)

Various minor code improvements (compiler)

Reviewed-by: thartmann, kvn
This commit is contained in:
Goetz Lindenmaier 2016-05-03 12:23:06 +02:00
parent 96c4dc3210
commit 1e4b00b1dc
19 changed files with 77 additions and 56 deletions

View file

@ -1913,9 +1913,10 @@ static bool _print_ascii_file(const char* filename, outputStream* st) {
return false;
}
char buf[32];
char buf[33];
int bytes;
while ((bytes = ::read(fd, buf, sizeof(buf))) > 0) {
buf[32] = '\0';
while ((bytes = ::read(fd, buf, sizeof(buf)-1)) > 0) {
st->print_raw(buf, bytes);
}
@ -6033,8 +6034,8 @@ int os::get_core_path(char* buffer, size_t bufferSize) {
if (core_pattern[0] == '|') {
written = jio_snprintf(buffer, bufferSize,
"\"%s\" (or dumping to %s/core.%d)",
&core_pattern[1], p, current_process_id());
"\"%s\" (or dumping to %s/core.%d)",
&core_pattern[1], p, current_process_id());
} else {
written = jio_snprintf(buffer, bufferSize, "%s/%s", p, core_pattern);
}
@ -6067,20 +6068,20 @@ bool os::start_debugging(char *buf, int buflen) {
char *p = &buf[len];
jio_snprintf(p, buflen-len,
"\n\n"
"Do you want to debug the problem?\n\n"
"To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " UINTX_FORMAT " (" INTPTR_FORMAT ")\n"
"Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
"Otherwise, press RETURN to abort...",
os::current_process_id(), os::current_process_id(),
os::current_thread_id(), os::current_thread_id());
"\n\n"
"Do you want to debug the problem?\n\n"
"To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " UINTX_FORMAT " (" INTPTR_FORMAT ")\n"
"Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
"Otherwise, press RETURN to abort...",
os::current_process_id(), os::current_process_id(),
os::current_thread_id(), os::current_thread_id());
bool yes = os::message_box("Unexpected Error", buf);
if (yes) {
// yes, user asked VM to launch debugger
jio_snprintf(buf, sizeof(buf), "gdb /proc/%d/exe %d",
os::current_process_id(), os::current_process_id());
jio_snprintf(buf, sizeof(char)*buflen, "gdb /proc/%d/exe %d",
os::current_process_id(), os::current_process_id());
os::fork_and_exec(buf);
yes = false;