8056930: Output host info under some condition for core dump
authorminqi
Mon, 08 Sep 2014 22:48:09 -0700
changeset 26569 5fcbc13c071c
parent 26567 b8b544832bce
child 26570 8a96177975bc
8056930: Output host info under some condition for core dump Summary: Output host name after java crashed for debug version. Reviewed-by: dholmes, ccheung Contributed-by: yumin.qi@oracle.com
hotspot/src/os/posix/vm/os_posix.cpp
hotspot/src/os/windows/vm/os_windows.cpp
--- a/hotspot/src/os/posix/vm/os_posix.cpp	Mon Sep 08 23:49:39 2014 +0400
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Mon Sep 08 22:48:09 2014 -0700
@@ -215,6 +215,9 @@
   struct utsname name;
   uname(&name);
   st->print("%s ", name.sysname);
+#ifdef ASSERT
+  st->print("%s ", name.nodename);
+#endif
   st->print("%s ", name.release);
   st->print("%s ", name.version);
   st->print("%s", name.machine);
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Mon Sep 08 23:49:39 2014 +0400
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Mon Sep 08 22:48:09 2014 -0700
@@ -1588,8 +1588,17 @@
 }
 
 void os::print_os_info(outputStream* st) {
-  st->print("OS:");
-
+#ifdef ASSERT
+  char buffer[1024];
+  DWORD size = sizeof(buffer);
+  st->print(" HostName: ");
+  if (GetComputerNameEx(ComputerNameDnsHostname, buffer, &size)) {
+    st->print("%s", buffer);
+  } else {
+    st->print("N/A");
+  }
+#endif
+  st->print(" OS:");
   os::win32::print_windows_version(st);
 }