1 /*
2 * Copyright (c) 2001, 2010, 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 */
24
25 package sun.jvm.hotspot.bugspot;
26
27 import java.awt.*;
28 import java.awt.event.*;
29 import java.io.*;
30 import java.net.*;
31 import java.util.*;
32 import javax.swing.*;
33 import javax.swing.filechooser.*;
34 import sun.jvm.hotspot.debugger.*;
35 import sun.jvm.hotspot.debugger.cdbg.*;
36 import sun.jvm.hotspot.debugger.posix.*;
37 import sun.jvm.hotspot.debugger.win32.*;
38 import sun.jvm.hotspot.livejvm.*;
39 import sun.jvm.hotspot.memory.*;
40 import sun.jvm.hotspot.oops.*;
41 import sun.jvm.hotspot.runtime.*;
42 import sun.jvm.hotspot.ui.*;
43 import sun.jvm.hotspot.utilities.*;
44
45 /** The BugSpot component. This is embeddable in an application by
46 virtue of its being a JComponent. It (currently) requires the use
47 of a menu bar which can be fetched via getMenuBar(). This is
48 intended ultimately to replace HSDB. */
49
50 public class BugSpot extends JPanel {
51 public BugSpot() {
52 super();
53 Runtime.getRuntime().addShutdownHook(new java.lang.Thread() {
54 public void run() {
55 detachDebugger();
56 }
57 });
587 desktop.validate();
588 desktop.repaint();
589 }
590 // FIXME: keep track of all windows and close them even in non-MDI
591 // mode
592 debugEventTimer.stop();
593 }
594
595 // Returns a Debugger for processes on the local machine. This is
596 // only used to fetch the process list.
597 private Debugger getLocalDebugger() {
598 if (localDebugger == null) {
599 String os = PlatformInfo.getOS();
600 String cpu = PlatformInfo.getCPU();
601
602 if (os.equals("win32")) {
603 if (!cpu.equals("x86")) {
604 throw new DebuggerException("Unsupported CPU \"" + cpu + "\" for Windows");
605 }
606
607 localDebugger = new Win32DebuggerLocal(new MachineDescriptionIntelX86(), true);
608 } else if (os.equals("linux")) {
609 if (!cpu.equals("x86")) {
610 throw new DebuggerException("Unsupported CPU \"" + cpu + "\" for Linux");
611 }
612
613 // FIXME: figure out how to specify path to debugger module
614 throw new RuntimeException("FIXME: figure out how to specify path to debugger module");
615 // localDebugger = new PosixDebuggerLocal(new MachineDescriptionIntelX86(), true);
616 } else {
617 // FIXME: port to Solaris
618 throw new DebuggerException("Unsupported OS \"" + os + "\"");
619 }
620
621 // FIXME: we require that the primitive type sizes be configured
622 // in order to use basic functionality in class Address such as
623 // the fetching of floating-point values. There are a lot of
624 // assumptions in the current code that Java floats and doubles
625 // are of equivalent size to C values. The configurability of the
626 // primitive type sizes hasn't seemed necessary and in this kind
627 // of debugging scenario (namely, debugging arbitrary C++
|
1 /*
2 * Copyright (c) 2001, 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 */
24
25 package sun.jvm.hotspot.bugspot;
26
27 import java.awt.*;
28 import java.awt.event.*;
29 import java.io.*;
30 import java.net.*;
31 import java.util.*;
32 import javax.swing.*;
33 import javax.swing.filechooser.*;
34 import sun.jvm.hotspot.debugger.*;
35 import sun.jvm.hotspot.debugger.cdbg.*;
36 import sun.jvm.hotspot.debugger.posix.*;
37 import sun.jvm.hotspot.debugger.windbg.*;
38 import sun.jvm.hotspot.livejvm.*;
39 import sun.jvm.hotspot.memory.*;
40 import sun.jvm.hotspot.oops.*;
41 import sun.jvm.hotspot.runtime.*;
42 import sun.jvm.hotspot.ui.*;
43 import sun.jvm.hotspot.utilities.*;
44
45 /** The BugSpot component. This is embeddable in an application by
46 virtue of its being a JComponent. It (currently) requires the use
47 of a menu bar which can be fetched via getMenuBar(). This is
48 intended ultimately to replace HSDB. */
49
50 public class BugSpot extends JPanel {
51 public BugSpot() {
52 super();
53 Runtime.getRuntime().addShutdownHook(new java.lang.Thread() {
54 public void run() {
55 detachDebugger();
56 }
57 });
587 desktop.validate();
588 desktop.repaint();
589 }
590 // FIXME: keep track of all windows and close them even in non-MDI
591 // mode
592 debugEventTimer.stop();
593 }
594
595 // Returns a Debugger for processes on the local machine. This is
596 // only used to fetch the process list.
597 private Debugger getLocalDebugger() {
598 if (localDebugger == null) {
599 String os = PlatformInfo.getOS();
600 String cpu = PlatformInfo.getCPU();
601
602 if (os.equals("win32")) {
603 if (!cpu.equals("x86")) {
604 throw new DebuggerException("Unsupported CPU \"" + cpu + "\" for Windows");
605 }
606
607 localDebugger = new WindbgDebuggerLocal(new MachineDescriptionIntelX86(), true);
608 } else if (os.equals("linux")) {
609 if (!cpu.equals("x86")) {
610 throw new DebuggerException("Unsupported CPU \"" + cpu + "\" for Linux");
611 }
612
613 // FIXME: figure out how to specify path to debugger module
614 throw new RuntimeException("FIXME: figure out how to specify path to debugger module");
615 // localDebugger = new PosixDebuggerLocal(new MachineDescriptionIntelX86(), true);
616 } else {
617 // FIXME: port to Solaris
618 throw new DebuggerException("Unsupported OS \"" + os + "\"");
619 }
620
621 // FIXME: we require that the primitive type sizes be configured
622 // in order to use basic functionality in class Address such as
623 // the fetching of floating-point values. There are a lot of
624 // assumptions in the current code that Java floats and doubles
625 // are of equivalent size to C values. The configurability of the
626 // primitive type sizes hasn't seemed necessary and in this kind
627 // of debugging scenario (namely, debugging arbitrary C++
|