changeset 1306:bc82fc344da8

2009-01-09 Gary Benson <gbenson@redhat.com> * contrib/mixtec-sleep-on-bomb.patch: New file.
author Gary Benson <gbenson@redhat.com>
date Fri, 09 Jan 2009 07:22:45 -0500
parents 972ccbe95125
children 508839ea3465
files ChangeLog contrib/mixtec-sleep-on-bomb.patch
diffstat 2 files changed, 41 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jan 09 07:21:33 2009 -0500
+++ b/ChangeLog	Fri Jan 09 07:22:45 2009 -0500
@@ -1,3 +1,7 @@
+2009-01-09  Gary Benson  <gbenson@redhat.com>
+
+	* contrib/mixtec-sleep-on-bomb.patch: New file.
+
 2009-01-09  Gary Benson  <gbenson@redhat.com>
 
 	* ports/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/mixtec-sleep-on-bomb.patch	Fri Jan 09 07:22:45 2009 -0500
@@ -0,0 +1,37 @@
+This patch causes the VM to drop into an infinite sleep if the fatal
+error handler is invoked.  This is handy for getting gdb attached in
+situations where you couldn't usually, when the VM is invoked by the
+JCK for example.
+
+diff -r b0dd0cbb5c04 openjdk/hotspot/src/os/linux/vm/os_linux.cpp
+--- openjdk/hotspot/src/os/linux/vm/os_linux.cpp	Wed Jan 07 17:45:25 2009
++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp	Thu Jan 08 11:51:14 2009
+@@ -1466,6 +1466,7 @@
+ // called from signal handler. Before adding something to os::abort(), make
+ // sure it is async-safe and can handle partially initialized VM.
+ void os::abort(bool dump_core) {
++  os::infinite_sleep();
+   os::shutdown();
+   if (dump_core) {
+ #ifndef PRODUCT
+@@ -1484,6 +1485,7 @@
+ 
+ // Die immediately, no exit hook, no abort hook, no cleanup.
+ void os::die() {
++  os::infinite_sleep();
+   // _exit() on LinuxThreads only kills current thread
+   ::abort();
+ }
+@@ -2873,6 +2875,12 @@
+ 
+ // Sleep forever; naked call to OS-specific sleep; use with CAUTION
+ void os::infinite_sleep() {
++  fdStream out(defaultStream::output_fd());
++  char buf[16];
++  jio_snprintf(buf, sizeof(buf), UINTX_FORMAT, os::current_thread_id());
++  out.print_raw("thread ");
++  out.print_raw(buf);
++  out.print_raw(" going to sleep...");
+   while (true) {    // sleep forever ...
+     ::sleep(100);   // ... 100 seconds at a time
+   }