File: mixtec-sleep-on-bomb.patch

package info (click to toggle)
openjdk-6 6b27-1.12.6-1~deb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-proposed-updates
  • size: 133,540 kB
  • ctags: 37,146
  • sloc: java: 173,188; cpp: 13,710; asm: 6,470; ansic: 4,827; sh: 4,156; makefile: 4,149; perl: 1,005; python: 310
file content (37 lines) | stat: -rw-r--r-- 1,370 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
   }