This commit is contained in:
Vladimir Ivanov 2016-05-20 18:05:09 +03:00
commit 36daf60d8f
349 changed files with 7202 additions and 5787 deletions

View file

@ -1925,9 +1925,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);
}
@ -6045,8 +6046,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);
}
@ -6079,20 +6080,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;