comparison src/os/posix/vm/os_posix.cpp @ 6200:65906dc96aa1

7129724: MAC: Core file location is wrong in crash report Summary: Updated core path location to reflect macosx default Reviewed-by: dholmes, kamg
author mikael
date Tue, 03 Jul 2012 17:35:00 -0700
parents d2a62e0f25eb
children b9a9ed0f8eeb
comparison
equal deleted inserted replaced
6199:3f1ab0c19c30 6200:65906dc96aa1
32 #include <sys/utsname.h> 32 #include <sys/utsname.h>
33 33
34 34
35 // Check core dump limit and report possible place where core can be found 35 // Check core dump limit and report possible place where core can be found
36 void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) { 36 void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
37 int n;
37 struct rlimit rlim; 38 struct rlimit rlim;
38 static char cwd[O_BUFLEN];
39 bool success; 39 bool success;
40 40
41 get_current_directory(cwd, sizeof(cwd)); 41 n = get_core_path(buffer, bufferSize);
42 42
43 if (getrlimit(RLIMIT_CORE, &rlim) != 0) { 43 if (getrlimit(RLIMIT_CORE, &rlim) != 0) {
44 jio_snprintf(buffer, bufferSize, "%s/core or core.%d (may not exist)", cwd, current_process_id()); 44 jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d (may not exist)", current_process_id());
45 success = true; 45 success = true;
46 } else { 46 } else {
47 switch(rlim.rlim_cur) { 47 switch(rlim.rlim_cur) {
48 case RLIM_INFINITY: 48 case RLIM_INFINITY:
49 jio_snprintf(buffer, bufferSize, "%s/core or core.%d", cwd, current_process_id()); 49 jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d", current_process_id());
50 success = true; 50 success = true;
51 break; 51 break;
52 case 0: 52 case 0:
53 jio_snprintf(buffer, bufferSize, "Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again"); 53 jio_snprintf(buffer, bufferSize, "Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again");
54 success = false; 54 success = false;
55 break; 55 break;
56 default: 56 default:
57 jio_snprintf(buffer, bufferSize, "%s/core or core.%d (max size %lu kB). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", cwd, current_process_id(), (unsigned long)(rlim.rlim_cur >> 10)); 57 jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d (max size %lu kB). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", current_process_id(), (unsigned long)(rlim.rlim_cur >> 10));
58 success = true; 58 success = true;
59 break; 59 break;
60 } 60 }
61 } 61 }
62 VMError::report_coredump_status(buffer, success); 62 VMError::report_coredump_status(buffer, success);