src/os/posix/vm/os_posix.cpp

Mon, 28 Feb 2011 14:19:52 +0100

author
sla
date
Mon, 28 Feb 2011 14:19:52 +0100
changeset 2584
da091bb67459
parent 2520
63d374c54045
child 3379
b16494a69d3d
permissions
-rw-r--r--

7022037: Pause when exiting if debugger is attached on windows
Reviewed-by: dsamersoff, kamg, hosterda

     1 /*
     2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 *
     5 * This code is free software; you can redistribute it and/or modify it
     6 * under the terms of the GNU General Public License version 2 only, as
     7 * published by the Free Software Foundation.
     8 *
     9 * This code is distributed in the hope that it will be useful, but WITHOUT
    10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12 * version 2 for more details (a copy is included in the LICENSE file that
    13 * accompanied this code).
    14 *
    15 * You should have received a copy of the GNU General Public License version
    16 * 2 along with this work; if not, write to the Free Software Foundation,
    17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18 *
    19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20 * or visit www.oracle.com if you need additional information or have any
    21 * questions.
    22 *
    23 */
    25 #include "prims/jvm.h"
    26 #include "runtime/os.hpp"
    27 #include "utilities/vmError.hpp"
    29 #include <unistd.h>
    30 #include <sys/resource.h>
    32 // Check core dump limit and report possible place where core can be found
    33 void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
    34   struct rlimit rlim;
    35   static char cwd[O_BUFLEN];
    36   bool success;
    38   get_current_directory(cwd, sizeof(cwd));
    40   if (getrlimit(RLIMIT_CORE, &rlim) != 0) {
    41     jio_snprintf(buffer, bufferSize, "%s/core or core.%d (may not exist)", cwd, current_process_id());
    42     success = true;
    43   } else {
    44     switch(rlim.rlim_cur) {
    45       case RLIM_INFINITY:
    46         jio_snprintf(buffer, bufferSize, "%s/core or core.%d", cwd, current_process_id());
    47         success = true;
    48         break;
    49       case 0:
    50         jio_snprintf(buffer, bufferSize, "Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again");
    51         success = false;
    52         break;
    53       default:
    54         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));
    55         success = true;
    56         break;
    57     }
    58   }
    59   VMError::report_coredump_status(buffer, success);
    60 }
    62 bool os::is_debugger_attached() {
    63   // not implemented
    64   return false;
    65 }
    67 void os::wait_for_keypress_at_exit(void) {
    68   // don't do anything on posix platforms
    69   return;
    70 }

mercurial