Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8266392

ShowMessageBoxOnError debugging is broken on mac

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • tbd
    • 17
    • hotspot

      ShowMessageBoxOnError on mac is just a copy of the Linux version.

      Should call 'lldb -p %p' instead. Mac is able to recognize executables by itself. BTW Mac policy is strict, might ask for some permissions.

      diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp
      index 52b7e1496cc..e895b067799 100644
      --- a/src/hotspot/os/bsd/os_bsd.cpp
      +++ b/src/hotspot/os/bsd/os_bsd.cpp
      @@ -2600,18 +2600,17 @@ bool os::start_debugging(char *buf, int buflen) {
         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 " INTX_FORMAT " (" INTPTR_FORMAT ")\n"
      - "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
      + "To debug, run '`lldb -p %d`'; then switch to thread " INTX_FORMAT " (" INTPTR_FORMAT ")\n"
      + "Enter 'yes' to launch lldb automatically (PATH must include lldb)\n"
                    "Otherwise, press RETURN to abort...",
      - os::current_process_id(), os::current_process_id(),
      - os::current_thread_id(), os::current_thread_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, buflen, "lldb -p %d",
      + os::current_process_id());

           os::fork_and_exec(buf);
           yes = false;

            gziemski Gerard Ziemski
            lmesnik Leonid Mesnik
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: