Wed, 27 Feb 2013 12:20:34 -0800
Merge
1.1 --- a/agent/make/Makefile Fri Feb 22 10:12:00 2013 -0800 1.2 +++ b/agent/make/Makefile Wed Feb 27 12:20:34 2013 -0800 1.3 @@ -19,7 +19,7 @@ 1.4 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.5 # or visit www.oracle.com if you need additional information or have any 1.6 # questions. 1.7 -# 1.8 +# 1.9 # 1.10 1.11 # This guards against adding broken .java files to the directory 1.12 @@ -42,8 +42,6 @@ 1.13 sun.jvm.hotspot \ 1.14 sun.jvm.hotspot.asm \ 1.15 sun.jvm.hotspot.asm.sparc \ 1.16 -sun.jvm.hotspot.bugspot \ 1.17 -sun.jvm.hotspot.bugspot.tree \ 1.18 sun.jvm.hotspot.c1 \ 1.19 sun.jvm.hotspot.ci \ 1.20 sun.jvm.hotspot.code \ 1.21 @@ -84,7 +82,6 @@ 1.22 sun.jvm.hotspot.gc_interface \ 1.23 sun.jvm.hotspot.interpreter \ 1.24 sun.jvm.hotspot.jdi \ 1.25 -sun.jvm.hotspot.livejvm \ 1.26 sun.jvm.hotspot.memory \ 1.27 sun.jvm.hotspot.opto \ 1.28 sun.jvm.hotspot.oops \ 1.29 @@ -130,8 +127,6 @@ 1.30 sun/jvm/hotspot/*.java \ 1.31 sun/jvm/hotspot/asm/*.java \ 1.32 sun/jvm/hotspot/asm/sparc/*.java \ 1.33 -sun/jvm/hotspot/bugspot/*.java \ 1.34 -sun/jvm/hotspot/bugspot/tree/*.java \ 1.35 sun/jvm/hotspot/c1/*.java \ 1.36 sun/jvm/hotspot/ci/*.java \ 1.37 sun/jvm/hotspot/code/*.java \ 1.38 @@ -168,7 +163,6 @@ 1.39 sun/jvm/hotspot/gc_implementation/shared/*.java \ 1.40 sun/jvm/hotspot/interpreter/*.java \ 1.41 sun/jvm/hotspot/jdi/*.java \ 1.42 -sun/jvm/hotspot/livejvm/*.java \ 1.43 sun/jvm/hotspot/memory/*.java \ 1.44 sun/jvm/hotspot/oops/*.java \ 1.45 sun/jvm/hotspot/opto/*.java \ 1.46 @@ -205,7 +199,7 @@ 1.47 sun/jvm/hotspot/utilities/memo/*.java \ 1.48 sun/jvm/hotspot/utilities/soql/*.java \ 1.49 com/sun/java/swing/action/*.java \ 1.50 -com/sun/java/swing/ui/*.java 1.51 +com/sun/java/swing/ui/*.java 1.52 #END FILELIST 1.53 1.54 ifneq "x$(ALT_BOOTDIR)" "x" 1.55 @@ -231,7 +225,7 @@ 1.56 OUTPUT_DIR = $(BUILD_DIR)/classes 1.57 DOC_DIR = $(BUILD_DIR)/doc 1.58 1.59 -# gnumake 3.78.1 does not accept the *s, 1.60 +# gnumake 3.78.1 does not accept the *s, 1.61 # so use the shell to expand them 1.62 ALLFILES := $(patsubst %,$(SRC_DIR)/%,$(FILELIST)) 1.63 ALLFILES := $(shell /bin/ls $(ALLFILES)) 1.64 @@ -303,7 +297,7 @@ 1.65 cscope: $(ALLFILES) 1.66 rm -f java.files 1.67 echo $(ALLFILES) > java.files 1.68 - cscope -b -i java.files -f java.out 1.69 + cscope -b -i java.files -f java.out 1.70 rm -f java.files 1.71 1.72 .PHONY: sa.jar
2.1 --- a/agent/make/bugspot.bat Fri Feb 22 10:12:00 2013 -0800 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,25 +0,0 @@ 2.4 -REM 2.5 -REM Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. 2.6 -REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.7 -REM 2.8 -REM This code is free software; you can redistribute it and/or modify it 2.9 -REM under the terms of the GNU General Public License version 2 only, as 2.10 -REM published by the Free Software Foundation. 2.11 -REM 2.12 -REM This code is distributed in the hope that it will be useful, but WITHOUT 2.13 -REM ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2.14 -REM FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2.15 -REM version 2 for more details (a copy is included in the LICENSE file that 2.16 -REM accompanied this code). 2.17 -REM 2.18 -REM You should have received a copy of the GNU General Public License version 2.19 -REM 2 along with this work; if not, write to the Free Software Foundation, 2.20 -REM Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2.21 -REM 2.22 -REM Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2.23 -REM or visit www.oracle.com if you need additional information or have any 2.24 -REM questions. 2.25 -REM 2.26 -REM 2.27 - 2.28 -java -showversion -cp ..\build\classes;..\src\share\lib\js.jar;.\sa.jar;lib\js.jar sun.jvm.hotspot.bugspot.Main
3.1 --- a/agent/make/marks_notes.html Fri Feb 22 10:12:00 2013 -0800 3.2 +++ b/agent/make/marks_notes.html Wed Feb 27 12:20:34 2013 -0800 3.3 @@ -26,14 +26,12 @@ 3.4 3.5 <ul> 3.6 <li><code>java -cp classes sun.jvm.hotspot.HSDB</code> 3.7 - <li><code>java -cp classes sun.jvm.hotspot.bugspot.Main</code> 3.8 </ul> 3.9 3.10 <h2>Feedback</h2> 3.11 <p> 3.12 Refactoring of package hierarchy. All user interface components should be in 3.13 - the ui package. Perhaps: sun.jvm.hotspot.ui.hsdb.Main for the HSDB and 3.14 - sun.jvm.hotspot.ui.bugspot.Main for BugSpot. 3.15 + the ui package. Perhaps: sun.jvm.hotspot.ui.hsdb.Main for the HSDB. 3.16 <p> 3.17 The src\share\vm\agent area seems like a workspace so it should be organized like 3.18 one. In particular, I'd like to suggest the following directory layout:<br> 3.19 @@ -47,7 +45,7 @@ 3.20 </ul> 3.21 3.22 <p> 3.23 - Seems like there is a lot of redundant functionality. Between the HSDB and BugSpot. Perhaps 3.24 + Seems like there is a lot of redundant functionality. Perhaps 3.25 this can be consolidated with a <code>javax.swing.Actions</code> architecture. 3.26 3.27 <h2>Tasklist</h2> 3.28 @@ -55,11 +53,7 @@ 3.29 <p> 3.30 <b>Stack memory pane</b>: 3.31 It's one of the more useful JVM debugging tools in the SA. However, it 3.32 - doesn't support any interaction with the text; the Memory Panel in BugSpot 3.33 - was written afterward (with help from Shannon) and implements proper 3.34 - selection, scrolling, and drag-and-drop, but no annotations. I'm not sure how 3.35 - to integrate the annotations with the JTable that's being used for the memory 3.36 - view; if you have suggestions here please let me know. 3.37 + doesn't support any interaction with the text. 3.38 <p> 3.39 <b>Integrations with the NetBeans architecture (plug in).</b> See the 3.40 <a href="http://openide.netbeans.org">Netbeans Open APIs homepage</a>
4.1 --- a/agent/src/os/win32/windbg/sawindbg.cpp Fri Feb 22 10:12:00 2013 -0800 4.2 +++ b/agent/src/os/win32/windbg/sawindbg.cpp Wed Feb 27 12:20:34 2013 -0800 4.3 @@ -372,8 +372,7 @@ 4.4 4.5 We are attaching to a process in 'read-only' mode. i.e., we do not want to 4.6 put breakpoints, suspend/resume threads etc. For read-only JDI and HSDB kind of 4.7 - usage this should suffice. We are not intending to use this for full-fledged 4.8 - ProcessControl implementation to be used with BugSpotAgent. 4.9 + usage this should suffice. 4.10 4.11 Please refer to DEBUG_ATTACH_NONINVASIVE mode source comments from dbgeng.h. 4.12 In this mode, debug engine does not call DebugActiveProrcess. i.e., we are not
5.1 --- a/agent/src/share/classes/sun/jvm/hotspot/asm/amd64/AMD64FloatRegister.java Fri Feb 22 10:12:00 2013 -0800 5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 5.3 @@ -1,64 +0,0 @@ 5.4 -/* 5.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 5.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.7 - * 5.8 - * This code is free software; you can redistribute it and/or modify it 5.9 - * under the terms of the GNU General Public License version 2 only, as 5.10 - * published by the Free Software Foundation. 5.11 - * 5.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 5.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 5.15 - * version 2 for more details (a copy is included in the LICENSE file that 5.16 - * accompanied this code). 5.17 - * 5.18 - * You should have received a copy of the GNU General Public License version 5.19 - * 2 along with this work; if not, write to the Free Software Foundation, 5.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 5.21 - * 5.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 5.23 - * or visit www.oracle.com if you need additional information or have any 5.24 - * questions. 5.25 - * 5.26 - */ 5.27 - 5.28 -package sun.jvm.hotspot.asm.amd64; 5.29 - 5.30 -import sun.jvm.hotspot.asm.Register; 5.31 -import sun.jvm.hotspot.utilities.Assert; 5.32 - 5.33 -public class AMD64FloatRegister extends Register { 5.34 - 5.35 - public AMD64FloatRegister(int number) { 5.36 - super(number); 5.37 - } 5.38 - 5.39 - public int getNumber() { 5.40 - return number; 5.41 - } 5.42 - 5.43 - public int getNumberOfRegisters() { 5.44 - return AMD64FloatRegisters.getNumRegisters(); 5.45 - } 5.46 - 5.47 - public boolean isFloat() { 5.48 - return true; 5.49 - } 5.50 - 5.51 - public boolean isFramePointer() { 5.52 - return false; 5.53 - } 5.54 - 5.55 - public boolean isStackPointer() { 5.56 - return false; 5.57 - } 5.58 - 5.59 - public boolean isValid() { 5.60 - return number >= 0 && number < AMD64FloatRegisters.getNumRegisters(); 5.61 - } 5.62 - 5.63 - public String toString() { 5.64 - return AMD64FloatRegisters.getRegisterName(number); 5.65 - } 5.66 - 5.67 -}
6.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpot.java Fri Feb 22 10:12:00 2013 -0800 6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 6.3 @@ -1,1536 +0,0 @@ 6.4 -/* 6.5 - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 6.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.7 - * 6.8 - * This code is free software; you can redistribute it and/or modify it 6.9 - * under the terms of the GNU General Public License version 2 only, as 6.10 - * published by the Free Software Foundation. 6.11 - * 6.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 6.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 6.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 6.15 - * version 2 for more details (a copy is included in the LICENSE file that 6.16 - * accompanied this code). 6.17 - * 6.18 - * You should have received a copy of the GNU General Public License version 6.19 - * 2 along with this work; if not, write to the Free Software Foundation, 6.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 6.21 - * 6.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 6.23 - * or visit www.oracle.com if you need additional information or have any 6.24 - * questions. 6.25 - * 6.26 - */ 6.27 - 6.28 -package sun.jvm.hotspot.bugspot; 6.29 - 6.30 -import java.awt.*; 6.31 -import java.awt.event.*; 6.32 -import java.io.*; 6.33 -import java.net.*; 6.34 -import java.util.*; 6.35 -import javax.swing.*; 6.36 -import javax.swing.filechooser.*; 6.37 -import sun.jvm.hotspot.debugger.*; 6.38 -import sun.jvm.hotspot.debugger.cdbg.*; 6.39 -import sun.jvm.hotspot.debugger.posix.*; 6.40 -import sun.jvm.hotspot.debugger.windbg.*; 6.41 -import sun.jvm.hotspot.livejvm.*; 6.42 -import sun.jvm.hotspot.memory.*; 6.43 -import sun.jvm.hotspot.oops.*; 6.44 -import sun.jvm.hotspot.runtime.*; 6.45 -import sun.jvm.hotspot.ui.*; 6.46 -import sun.jvm.hotspot.utilities.*; 6.47 - 6.48 -/** The BugSpot component. This is embeddable in an application by 6.49 - virtue of its being a JComponent. It (currently) requires the use 6.50 - of a menu bar which can be fetched via getMenuBar(). This is 6.51 - intended ultimately to replace HSDB. */ 6.52 - 6.53 -public class BugSpot extends JPanel { 6.54 - public BugSpot() { 6.55 - super(); 6.56 - Runtime.getRuntime().addShutdownHook(new java.lang.Thread() { 6.57 - public void run() { 6.58 - detachDebugger(); 6.59 - } 6.60 - }); 6.61 - } 6.62 - 6.63 - /** Turn on or off MDI (Multiple Document Interface) mode. When MDI 6.64 - is enabled, the BugSpot component contains a JDesktopPane and all 6.65 - windows are JInternalFrames. When disabled, only the menu bar is 6.66 - relevant. */ 6.67 - public void setMDIMode(boolean onOrOff) { 6.68 - mdiMode = onOrOff; 6.69 - } 6.70 - 6.71 - /** Indicates whether MDI mode is enabled. */ 6.72 - public boolean getMDIMode() { 6.73 - return mdiMode; 6.74 - } 6.75 - 6.76 - /** Build user interface widgets. This must be called before adding 6.77 - the BugSpot component to its parent. */ 6.78 - public void build() { 6.79 - setLayout(new BorderLayout()); 6.80 - 6.81 - menuBar = new JMenuBar(); 6.82 - 6.83 - attachMenuItems = new java.util.ArrayList(); 6.84 - detachMenuItems = new java.util.ArrayList(); 6.85 - debugMenuItems = new java.util.ArrayList(); 6.86 - suspendDebugMenuItems = new java.util.ArrayList(); 6.87 - resumeDebugMenuItems = new java.util.ArrayList(); 6.88 - 6.89 - // 6.90 - // File menu 6.91 - // 6.92 - 6.93 - JMenu menu = createMenu("File", 'F', 0); 6.94 - JMenuItem item; 6.95 - item = createMenuItem("Open source file...", 6.96 - new ActionListener() { 6.97 - public void actionPerformed(ActionEvent e) { 6.98 - openSourceFile(); 6.99 - } 6.100 - }, 6.101 - KeyEvent.VK_O, InputEvent.CTRL_MASK, 6.102 - 'O', 0); 6.103 - menu.add(item); 6.104 - detachMenuItems.add(item); 6.105 - 6.106 - menu.addSeparator(); 6.107 - 6.108 - item = createMenuItem("Attach to process...", 6.109 - new ActionListener() { 6.110 - public void actionPerformed(ActionEvent e) { 6.111 - showAttachDialog(); 6.112 - } 6.113 - }, 6.114 - 'A', 0); 6.115 - menu.add(item); 6.116 - attachMenuItems.add(item); 6.117 - 6.118 - item = createMenuItem("Detach", 6.119 - new ActionListener() { 6.120 - public void actionPerformed(ActionEvent e) { 6.121 - detach(); 6.122 - } 6.123 - }, 6.124 - 'D', 0); 6.125 - menu.add(item); 6.126 - detachMenuItems.add(item); 6.127 - 6.128 - // Disable detach menu items at first 6.129 - setMenuItemsEnabled(detachMenuItems, false); 6.130 - 6.131 - menu.addSeparator(); 6.132 - 6.133 - menu.add(createMenuItem("Exit", 6.134 - new ActionListener() { 6.135 - public void actionPerformed(ActionEvent e) { 6.136 - detach(); 6.137 - System.exit(0); 6.138 - } 6.139 - }, 6.140 - 'x', 1)); 6.141 - 6.142 - menuBar.add(menu); 6.143 - 6.144 - // 6.145 - // Debug menu 6.146 - // 6.147 - 6.148 - debugMenu = createMenu("Debug", 'D', 0); 6.149 - item = createMenuItem("Go", 6.150 - new ActionListener() { 6.151 - public void actionPerformed(ActionEvent e) { 6.152 - if (!attached) return; 6.153 - if (!isSuspended()) return; 6.154 - resume(); 6.155 - } 6.156 - }, 6.157 - KeyEvent.VK_F5, 0, 6.158 - 'G', 0); 6.159 - debugMenu.add(item); 6.160 - resumeDebugMenuItems.add(item); 6.161 - 6.162 - item = createMenuItem("Break", 6.163 - new ActionListener() { 6.164 - public void actionPerformed(ActionEvent e) { 6.165 - if (!attached) { 6.166 - System.err.println("Not attached"); 6.167 - return; 6.168 - } 6.169 - if (isSuspended()) { 6.170 - System.err.println("Already suspended"); 6.171 - return; 6.172 - } 6.173 - suspend(); 6.174 - } 6.175 - }, 6.176 - 'B', 0); 6.177 - debugMenu.add(item); 6.178 - suspendDebugMenuItems.add(item); 6.179 - 6.180 - debugMenu.addSeparator(); 6.181 - 6.182 - item = createMenuItem("Threads...", 6.183 - new ActionListener() { 6.184 - public void actionPerformed(ActionEvent e) { 6.185 - showThreadsDialog(); 6.186 - } 6.187 - }, 6.188 - 'T', 0); 6.189 - debugMenu.add(item); 6.190 - debugMenuItems.add(item); 6.191 - // FIXME: belongs under "View -> Debug Windows" 6.192 - item = createMenuItem("Memory", 6.193 - new ActionListener() { 6.194 - public void actionPerformed(ActionEvent e) { 6.195 - showMemoryDialog(); 6.196 - } 6.197 - }, 6.198 - 'M', 0); 6.199 - debugMenu.add(item); 6.200 - debugMenuItems.add(item); 6.201 - 6.202 - debugMenu.setEnabled(false); 6.203 - menuBar.add(debugMenu); 6.204 - 6.205 - if (mdiMode) { 6.206 - desktop = new JDesktopPane(); 6.207 - add(desktop, BorderLayout.CENTER); 6.208 - } 6.209 - 6.210 - fixedWidthFont = GraphicsUtilities.lookupFont("Courier"); 6.211 - 6.212 - debugEventTimer = new javax.swing.Timer(100, new ActionListener() { 6.213 - public void actionPerformed(ActionEvent e) { 6.214 - pollForDebugEvent(); 6.215 - } 6.216 - }); 6.217 - } 6.218 - 6.219 - public JMenuBar getMenuBar() { 6.220 - return menuBar; 6.221 - } 6.222 - 6.223 - public void showAttachDialog() { 6.224 - setMenuItemsEnabled(attachMenuItems, false); 6.225 - final FrameWrapper attachDialog = newFrame("Attach to process"); 6.226 - attachDialog.getContentPane().setLayout(new BorderLayout()); 6.227 - attachDialog.setClosable(true); 6.228 - attachDialog.setResizable(true); 6.229 - 6.230 - JPanel panel = new JPanel(); 6.231 - panel.setLayout(new BorderLayout()); 6.232 - panel.setBorder(GraphicsUtilities.newBorder(5)); 6.233 - attachDialog.setBackground(panel.getBackground()); 6.234 - 6.235 - JPanel listPanel = new JPanel(); 6.236 - listPanel.setLayout(new BorderLayout()); 6.237 - final ProcessListPanel plist = new ProcessListPanel(getLocalDebugger()); 6.238 - panel.add(plist, BorderLayout.CENTER); 6.239 - JCheckBox check = new JCheckBox("Update list continuously"); 6.240 - check.addItemListener(new ItemListener() { 6.241 - public void itemStateChanged(ItemEvent e) { 6.242 - if (e.getStateChange() == ItemEvent.SELECTED) { 6.243 - plist.start(); 6.244 - } else { 6.245 - plist.stop(); 6.246 - } 6.247 - } 6.248 - }); 6.249 - listPanel.add(plist, BorderLayout.CENTER); 6.250 - listPanel.add(check, BorderLayout.SOUTH); 6.251 - panel.add(listPanel, BorderLayout.CENTER); 6.252 - attachDialog.getContentPane().add(panel, BorderLayout.CENTER); 6.253 - attachDialog.setClosingActionListener(new ActionListener() { 6.254 - public void actionPerformed(ActionEvent e) { 6.255 - plist.stop(); 6.256 - setMenuItemsEnabled(attachMenuItems, true); 6.257 - } 6.258 - }); 6.259 - 6.260 - ActionListener attacher = new ActionListener() { 6.261 - public void actionPerformed(ActionEvent e) { 6.262 - plist.stop(); 6.263 - attachDialog.setVisible(false); 6.264 - removeFrame(attachDialog); 6.265 - ProcessInfo info = plist.getSelectedProcess(); 6.266 - if (info != null) { 6.267 - attach(info.getPid()); 6.268 - } 6.269 - } 6.270 - }; 6.271 - 6.272 - Box hbox = Box.createHorizontalBox(); 6.273 - hbox.add(Box.createGlue()); 6.274 - JButton button = new JButton("OK"); 6.275 - button.addActionListener(attacher); 6.276 - hbox.add(button); 6.277 - hbox.add(Box.createHorizontalStrut(20)); 6.278 - button = new JButton("Cancel"); 6.279 - button.addActionListener(new ActionListener() { 6.280 - public void actionPerformed(ActionEvent e) { 6.281 - plist.stop(); 6.282 - attachDialog.setVisible(false); 6.283 - removeFrame(attachDialog); 6.284 - setMenuItemsEnabled(attachMenuItems, true); 6.285 - } 6.286 - }); 6.287 - hbox.add(button); 6.288 - hbox.add(Box.createGlue()); 6.289 - panel = new JPanel(); 6.290 - panel.setBorder(GraphicsUtilities.newBorder(5)); 6.291 - panel.add(hbox); 6.292 - 6.293 - attachDialog.getContentPane().add(panel, BorderLayout.SOUTH); 6.294 - 6.295 - addFrame(attachDialog); 6.296 - attachDialog.pack(); 6.297 - attachDialog.setSize(400, 300); 6.298 - GraphicsUtilities.centerInContainer(attachDialog.getComponent(), 6.299 - getParentDimension(attachDialog.getComponent())); 6.300 - attachDialog.setVisible(true); 6.301 - } 6.302 - 6.303 - public void showThreadsDialog() { 6.304 - final FrameWrapper threadsDialog = newFrame("Threads"); 6.305 - threadsDialog.getContentPane().setLayout(new BorderLayout()); 6.306 - threadsDialog.setClosable(true); 6.307 - threadsDialog.setResizable(true); 6.308 - 6.309 - ThreadListPanel threads = new ThreadListPanel(getCDebugger(), getAgent().isJavaMode()); 6.310 - threads.addListener(new ThreadListPanel.Listener() { 6.311 - public void setFocus(ThreadProxy thread, JavaThread jthread) { 6.312 - setCurrentThread(thread); 6.313 - // FIXME: print this to GUI, bring some windows to foreground 6.314 - System.err.println("Focus changed to thread " + thread); 6.315 - } 6.316 - }); 6.317 - threads.setBorder(GraphicsUtilities.newBorder(5)); 6.318 - threadsDialog.getContentPane().add(threads); 6.319 - addFrame(threadsDialog); 6.320 - threadsDialog.pack(); 6.321 - GraphicsUtilities.reshapeToAspectRatio(threadsDialog.getComponent(), 6.322 - 3.0f, 6.323 - 0.9f, 6.324 - getParentDimension(threadsDialog.getComponent())); 6.325 - GraphicsUtilities.centerInContainer(threadsDialog.getComponent(), 6.326 - getParentDimension(threadsDialog.getComponent())); 6.327 - threadsDialog.setVisible(true); 6.328 - } 6.329 - 6.330 - public void showMemoryDialog() { 6.331 - final FrameWrapper memoryDialog = newFrame("Memory"); 6.332 - memoryDialog.getContentPane().setLayout(new BorderLayout()); 6.333 - memoryDialog.setClosable(true); 6.334 - memoryDialog.setResizable(true); 6.335 - 6.336 - memoryDialog.getContentPane().add(new MemoryViewer(getDebugger(), 6.337 - (getDebugger().getMachineDescription().getAddressSize() == 8)), 6.338 - BorderLayout.CENTER); 6.339 - addFrame(memoryDialog); 6.340 - memoryDialog.pack(); 6.341 - GraphicsUtilities.reshapeToAspectRatio(memoryDialog.getComponent(), 6.342 - 1.0f, 6.343 - 0.7f, 6.344 - getParentDimension(memoryDialog.getComponent())); 6.345 - GraphicsUtilities.centerInContainer(memoryDialog.getComponent(), 6.346 - getParentDimension(memoryDialog.getComponent())); 6.347 - memoryDialog.setVisible(true); 6.348 - } 6.349 - 6.350 - /** Changes the editor factory this debugger uses to display source 6.351 - code. Specified factory may be null, in which case the default 6.352 - factory is used. */ 6.353 - public void setEditorFactory(EditorFactory fact) { 6.354 - if (fact != null) { 6.355 - editorFact = fact; 6.356 - } else { 6.357 - editorFact = new DefaultEditorFactory(); 6.358 - } 6.359 - } 6.360 - 6.361 - //---------------------------------------------------------------------- 6.362 - // Internals only below this point 6.363 - // 6.364 - 6.365 - private WorkerThread workerThread; 6.366 - private boolean mdiMode; 6.367 - private JVMDebugger localDebugger; 6.368 - private BugSpotAgent agent = new BugSpotAgent(); 6.369 - private JMenuBar menuBar; 6.370 - /** List <JMenuItem> */ 6.371 - private java.util.List attachMenuItems; 6.372 - private java.util.List detachMenuItems; 6.373 - private java.util.List debugMenuItems; 6.374 - private java.util.List suspendDebugMenuItems; 6.375 - private java.util.List resumeDebugMenuItems; 6.376 - private FrameWrapper stackFrame; 6.377 - private VariablePanel localsPanel; 6.378 - private StackTracePanel stackTracePanel; 6.379 - private FrameWrapper registerFrame; 6.380 - private RegisterPanel registerPanel; 6.381 - // Used for mixed-language stack traces 6.382 - private Map threadToJavaThreadMap; 6.383 - 6.384 - private JMenu debugMenu; 6.385 - 6.386 - // MDI mode only: desktop pane 6.387 - private JDesktopPane desktop; 6.388 - 6.389 - // Attach/detach state 6.390 - private boolean attached; 6.391 - 6.392 - // Suspension (combined Java/C++) state 6.393 - private boolean suspended; 6.394 - 6.395 - // Fixed-width font 6.396 - private Font fixedWidthFont; 6.397 - 6.398 - // Breakpoint setting 6.399 - // Maps Strings to List/*<LineNumberInfo>*/ 6.400 - private Map sourceFileToLineNumberInfoMap; 6.401 - // Maps Strings (file names) to Sets of Integers (line numbers) 6.402 - private Map fileToBreakpointMap; 6.403 - 6.404 - // Debug events 6.405 - private javax.swing.Timer debugEventTimer; 6.406 - 6.407 - // Java debug events 6.408 - private boolean javaEventPending; 6.409 - 6.410 - static class BreakpointResult { 6.411 - private boolean success; 6.412 - private boolean set; 6.413 - private int lineNo; 6.414 - private String why; 6.415 - 6.416 - /** For positive results */ 6.417 - BreakpointResult(boolean success, boolean set, int lineNo) { 6.418 - this(success, set, lineNo, null); 6.419 - } 6.420 - 6.421 - /** For negative results */ 6.422 - BreakpointResult(boolean success, boolean set, int lineNo, String why) { 6.423 - this.success = success; 6.424 - this.set = set; 6.425 - this.lineNo = lineNo; 6.426 - this.why = why; 6.427 - } 6.428 - 6.429 - public boolean succeeded() { 6.430 - return success; 6.431 - } 6.432 - 6.433 - public boolean set() { 6.434 - return set; 6.435 - } 6.436 - 6.437 - /** Line at which the breakpoint was actually set; only valid if 6.438 - succeeded() returns true */ 6.439 - public int getLine() { 6.440 - return lineNo; 6.441 - } 6.442 - 6.443 - public String getWhy() { 6.444 - return why; 6.445 - } 6.446 - } 6.447 - 6.448 - 6.449 - // Editors for source code. File name-to-Editor mapping. 6.450 - private Map editors; 6.451 - private EditorFactory editorFact = new DefaultEditorFactory(); 6.452 - private EditorCommands editorComm = new EditorCommands() { 6.453 - public void windowClosed(Editor editor) { 6.454 - editors.remove(editor.getSourceFileName()); 6.455 - } 6.456 - 6.457 - public void toggleBreakpointAtLine(Editor editor, int lineNumber) { 6.458 - // FIXME: handle "lazy" breakpoints where the source file has 6.459 - // been opened with some other mechanism (File -> Open) and we 6.460 - // don't have debug information pointing to that file yet 6.461 - // FIXME: NOT FINISHED 6.462 - 6.463 - BreakpointResult res = 6.464 - handleBreakpointToggle(editor, lineNumber); 6.465 - if (res.succeeded()) { 6.466 - if (res.set()) { 6.467 - editor.showBreakpointAtLine(res.getLine()); 6.468 - } else { 6.469 - editor.clearBreakpointAtLine(res.getLine()); 6.470 - } 6.471 - } else { 6.472 - String why = res.getWhy(); 6.473 - if (why == null) { 6.474 - why = ""; 6.475 - } else { 6.476 - why = ": " + why; 6.477 - } 6.478 - showMessageDialog("Unable to toggle breakpoint" + why, 6.479 - "Unable to toggle breakpoint", 6.480 - JOptionPane.WARNING_MESSAGE); 6.481 - } 6.482 - } 6.483 - }; 6.484 - 6.485 - private void attach(final int pid) { 6.486 - try { 6.487 - getAgent().attach(pid); 6.488 - setMenuItemsEnabled(detachMenuItems, true); 6.489 - setMenuItemsEnabled(suspendDebugMenuItems, false); 6.490 - setMenuItemsEnabled(resumeDebugMenuItems, true); 6.491 - debugMenu.setEnabled(true); 6.492 - attached = true; 6.493 - suspended = true; 6.494 - 6.495 - if (getAgent().isJavaMode()) { 6.496 - System.err.println("Java HotSpot(TM) virtual machine detected."); 6.497 - } else { 6.498 - System.err.println("(No Java(TM) virtual machine detected)"); 6.499 - } 6.500 - 6.501 - // Set up editor map 6.502 - editors = new HashMap(); 6.503 - 6.504 - // Initialize breakpoints 6.505 - fileToBreakpointMap = new HashMap(); 6.506 - 6.507 - // Create combined stack trace and local variable panel 6.508 - JPanel framePanel = new JPanel(); 6.509 - framePanel.setLayout(new BorderLayout()); 6.510 - framePanel.setBorder(GraphicsUtilities.newBorder(5)); 6.511 - localsPanel = new VariablePanel(); 6.512 - JTabbedPane tab = new JTabbedPane(); 6.513 - tab.addTab("Locals", localsPanel); 6.514 - tab.setTabPlacement(JTabbedPane.BOTTOM); 6.515 - framePanel.add(tab, BorderLayout.CENTER); 6.516 - JPanel stackPanel = new JPanel(); 6.517 - stackPanel.setLayout(new BoxLayout(stackPanel, BoxLayout.X_AXIS)); 6.518 - stackPanel.add(new JLabel("Context:")); 6.519 - stackPanel.add(Box.createHorizontalStrut(5)); 6.520 - stackTracePanel = new StackTracePanel(); 6.521 - stackTracePanel.addListener(new StackTracePanel.Listener() { 6.522 - public void frameChanged(CFrame fr, JavaVFrame jfr) { 6.523 - setCurrentFrame(fr, jfr); 6.524 - } 6.525 - }); 6.526 - stackPanel.add(stackTracePanel); 6.527 - framePanel.add(stackPanel, BorderLayout.NORTH); 6.528 - stackFrame = newFrame("Stack"); 6.529 - stackFrame.getContentPane().setLayout(new BorderLayout()); 6.530 - stackFrame.getContentPane().add(framePanel, BorderLayout.CENTER); 6.531 - stackFrame.setResizable(true); 6.532 - stackFrame.setClosable(false); 6.533 - addFrame(stackFrame); 6.534 - stackFrame.setSize(400, 200); 6.535 - GraphicsUtilities.moveToInContainer(stackFrame.getComponent(), 0.0f, 1.0f, 0, 20); 6.536 - stackFrame.setVisible(true); 6.537 - 6.538 - // Create register panel 6.539 - registerPanel = new RegisterPanel(); 6.540 - registerPanel.setFont(fixedWidthFont); 6.541 - registerFrame = newFrame("Registers"); 6.542 - registerFrame.getContentPane().setLayout(new BorderLayout()); 6.543 - registerFrame.getContentPane().add(registerPanel, BorderLayout.CENTER); 6.544 - addFrame(registerFrame); 6.545 - registerFrame.setResizable(true); 6.546 - registerFrame.setClosable(false); 6.547 - registerFrame.setSize(225, 200); 6.548 - GraphicsUtilities.moveToInContainer(registerFrame.getComponent(), 6.549 - 1.0f, 0.0f, 0, 0); 6.550 - registerFrame.setVisible(true); 6.551 - 6.552 - resetCurrentThread(); 6.553 - } catch (DebuggerException e) { 6.554 - final String errMsg = formatMessage(e.getMessage(), 80); 6.555 - setMenuItemsEnabled(attachMenuItems, true); 6.556 - showMessageDialog("Unable to connect to process ID " + pid + ":\n\n" + errMsg, 6.557 - "Unable to Connect", 6.558 - JOptionPane.WARNING_MESSAGE); 6.559 - getAgent().detach(); 6.560 - } 6.561 - } 6.562 - 6.563 - private synchronized void detachDebugger() { 6.564 - if (!attached) { 6.565 - return; 6.566 - } 6.567 - if (isSuspended()) { 6.568 - resume(); // Necessary for JVMDI resumption 6.569 - } 6.570 - getAgent().detach(); 6.571 - // FIXME: clear out breakpoints (both Java and C/C++) from target 6.572 - // process 6.573 - sourceFileToLineNumberInfoMap = null; 6.574 - fileToBreakpointMap = null; 6.575 - threadToJavaThreadMap = null; 6.576 - editors = null; 6.577 - attached = false; 6.578 - } 6.579 - 6.580 - private synchronized void detach() { 6.581 - detachDebugger(); 6.582 - setMenuItemsEnabled(attachMenuItems, true); 6.583 - setMenuItemsEnabled(detachMenuItems, false); 6.584 - debugMenu.setEnabled(false); 6.585 - if (mdiMode) { 6.586 - // FIXME: is this sufficient, or will I have to do anything else 6.587 - // to the components to kill them off? What about WorkerThreads? 6.588 - desktop.removeAll(); 6.589 - desktop.invalidate(); 6.590 - desktop.validate(); 6.591 - desktop.repaint(); 6.592 - } 6.593 - // FIXME: keep track of all windows and close them even in non-MDI 6.594 - // mode 6.595 - debugEventTimer.stop(); 6.596 - } 6.597 - 6.598 - // Returns a Debugger for processes on the local machine. This is 6.599 - // only used to fetch the process list. 6.600 - private Debugger getLocalDebugger() { 6.601 - if (localDebugger == null) { 6.602 - String os = PlatformInfo.getOS(); 6.603 - String cpu = PlatformInfo.getCPU(); 6.604 - 6.605 - if (os.equals("win32")) { 6.606 - if (!cpu.equals("x86")) { 6.607 - throw new DebuggerException("Unsupported CPU \"" + cpu + "\" for Windows"); 6.608 - } 6.609 - 6.610 - localDebugger = new WindbgDebuggerLocal(new MachineDescriptionIntelX86(), true); 6.611 - } else if (os.equals("linux")) { 6.612 - if (!cpu.equals("x86")) { 6.613 - throw new DebuggerException("Unsupported CPU \"" + cpu + "\" for Linux"); 6.614 - } 6.615 - 6.616 - // FIXME: figure out how to specify path to debugger module 6.617 - throw new RuntimeException("FIXME: figure out how to specify path to debugger module"); 6.618 - // localDebugger = new PosixDebuggerLocal(new MachineDescriptionIntelX86(), true); 6.619 - } else { 6.620 - // FIXME: port to Solaris 6.621 - throw new DebuggerException("Unsupported OS \"" + os + "\""); 6.622 - } 6.623 - 6.624 - // FIXME: we require that the primitive type sizes be configured 6.625 - // in order to use basic functionality in class Address such as 6.626 - // the fetching of floating-point values. There are a lot of 6.627 - // assumptions in the current code that Java floats and doubles 6.628 - // are of equivalent size to C values. The configurability of the 6.629 - // primitive type sizes hasn't seemed necessary and in this kind 6.630 - // of debugging scenario (namely, debugging arbitrary C++ 6.631 - // processes) it appears difficult to support that kind of 6.632 - // flexibility. 6.633 - localDebugger.configureJavaPrimitiveTypeSizes(1, 1, 2, 8, 4, 4, 8, 2); 6.634 - } 6.635 - 6.636 - return localDebugger; 6.637 - } 6.638 - 6.639 - private BugSpotAgent getAgent() { 6.640 - return agent; 6.641 - } 6.642 - 6.643 - private Debugger getDebugger() { 6.644 - return getAgent().getDebugger(); 6.645 - } 6.646 - 6.647 - private CDebugger getCDebugger() { 6.648 - return getAgent().getCDebugger(); 6.649 - } 6.650 - 6.651 - private void resetCurrentThread() { 6.652 - setCurrentThread((ThreadProxy) getCDebugger().getThreadList().get(0)); 6.653 - } 6.654 - 6.655 - private void setCurrentThread(ThreadProxy t) { 6.656 - // Create stack trace 6.657 - // FIXME: add ability to intermix C/Java frames 6.658 - java.util.List trace = new ArrayList(); 6.659 - CFrame fr = getCDebugger().topFrameForThread(t); 6.660 - while (fr != null) { 6.661 - trace.add(new StackTraceEntry(fr, getCDebugger())); 6.662 - try { 6.663 - fr = fr.sender(t); 6.664 - } catch (AddressException e) { 6.665 - e.printStackTrace(); 6.666 - showMessageDialog("Error while walking stack; stack trace will be truncated\n(see console for details)", 6.667 - "Error walking stack", 6.668 - JOptionPane.WARNING_MESSAGE); 6.669 - fr = null; 6.670 - } 6.671 - } 6.672 - JavaThread jthread = javaThreadForProxy(t); 6.673 - if (jthread != null) { 6.674 - // Java mode, and we have a Java thread. 6.675 - // Find all Java frames on the stack. We currently do this in a 6.676 - // manner which involves minimal interaction between the Java 6.677 - // and C/C++ debugging systems: any C frame which has a PC in an 6.678 - // unknown location (i.e., not in any DSO) is assumed to be a 6.679 - // Java frame. We merge stack segments of unknown frames with 6.680 - // segments of Java frames beginning with native methods. 6.681 - java.util.List javaTrace = new ArrayList(); 6.682 - VFrame vf = jthread.getLastJavaVFrameDbg(); 6.683 - while (vf != null) { 6.684 - if (vf.isJavaFrame()) { 6.685 - javaTrace.add(new StackTraceEntry((JavaVFrame) vf)); 6.686 - vf = vf.sender(); 6.687 - } 6.688 - } 6.689 - // Merge stack traces 6.690 - java.util.List mergedTrace = new ArrayList(); 6.691 - int c = 0; 6.692 - int j = 0; 6.693 - while (c < trace.size()) { 6.694 - StackTraceEntry entry = (StackTraceEntry) trace.get(c); 6.695 - if (entry.isUnknownCFrame()) { 6.696 - boolean gotJavaFrame = false; 6.697 - while (j < javaTrace.size()) { 6.698 - StackTraceEntry javaEntry = (StackTraceEntry) javaTrace.get(j); 6.699 - JavaVFrame jvf = javaEntry.getJavaFrame(); 6.700 - Method m = jvf.getMethod(); 6.701 - if (!m.isNative() || !gotJavaFrame) { 6.702 - gotJavaFrame = true; 6.703 - mergedTrace.add(javaEntry); 6.704 - ++j; 6.705 - } else { 6.706 - break; // Reached native method; have intervening C frames 6.707 - } 6.708 - } 6.709 - if (gotJavaFrame) { 6.710 - // Skip this sequence of unknown frames, as we've 6.711 - // successfully identified it as Java frames 6.712 - while (c < trace.size() && entry.isUnknownCFrame()) { 6.713 - ++c; 6.714 - if (c < trace.size()) { 6.715 - entry = (StackTraceEntry) trace.get(c); 6.716 - } 6.717 - } 6.718 - continue; 6.719 - } 6.720 - } 6.721 - // If we get here, we either have an unknown frame we didn't 6.722 - // know how to categorize or we have a known C frame. Add it 6.723 - // to the trace. 6.724 - mergedTrace.add(entry); 6.725 - ++c; 6.726 - } 6.727 - trace = mergedTrace; 6.728 - } 6.729 - stackTracePanel.setTrace(trace); 6.730 - 6.731 - registerPanel.update(t); 6.732 - } 6.733 - 6.734 - private void setCurrentFrame(CFrame fr, JavaVFrame jfr) { 6.735 - localsPanel.clear(); 6.736 - 6.737 - if (fr != null) { 6.738 - localsPanel.update(fr); 6.739 - 6.740 - // FIXME: load source file if we can find it, otherwise display disassembly 6.741 - LoadObject lo = getCDebugger().loadObjectContainingPC(fr.pc()); 6.742 - if (lo != null) { 6.743 - CDebugInfoDataBase db = lo.getDebugInfoDataBase(); 6.744 - if (db != null) { 6.745 - LineNumberInfo info = db.lineNumberForPC(fr.pc()); 6.746 - if (info != null) { 6.747 - System.err.println("PC " + fr.pc() + ": Source file \"" + 6.748 - info.getSourceFileName() + 6.749 - "\", line number " + 6.750 - info.getLineNumber() + 6.751 - ", PC range [" + 6.752 - info.getStartPC() + 6.753 - ", " + 6.754 - info.getEndPC() + 6.755 - ")"); 6.756 - // OK, here we go... 6.757 - showLineNumber(null, info.getSourceFileName(), info.getLineNumber()); 6.758 - } else { 6.759 - System.err.println("(No line number information for PC " + fr.pc() + ")"); 6.760 - // Dump line number information for database 6.761 - db.iterate(new LineNumberVisitor() { 6.762 - public void doLineNumber(LineNumberInfo info) { 6.763 - System.err.println(" Source file \"" + 6.764 - info.getSourceFileName() + 6.765 - "\", line number " + 6.766 - info.getLineNumber() + 6.767 - ", PC range [" + 6.768 - info.getStartPC() + 6.769 - ", " + 6.770 - info.getEndPC() + 6.771 - ")"); 6.772 - } 6.773 - }); 6.774 - } 6.775 - } 6.776 - } 6.777 - } else { 6.778 - if (Assert.ASSERTS_ENABLED) { 6.779 - Assert.that(jfr != null, "Must have either C or Java frame"); 6.780 - } 6.781 - localsPanel.update(jfr); 6.782 - // See whether we can locate source file and line number 6.783 - // FIXME: infer pathmap entries from user's locating of this 6.784 - // source file 6.785 - // FIXME: figure out what to do for native methods. Possible to 6.786 - // go to line number for the native method declaration? 6.787 - Method m = jfr.getMethod(); 6.788 - Symbol sfn = ((InstanceKlass) m.getMethodHolder()).getSourceFileName(); 6.789 - if (sfn != null) { 6.790 - int bci = jfr.getBCI(); 6.791 - int lineNo = m.getLineNumberFromBCI(bci); 6.792 - if (lineNo >= 0) { 6.793 - // FIXME: show disassembly otherwise 6.794 - showLineNumber(packageName(m.getMethodHolder().getName().asString()), 6.795 - sfn.asString(), lineNo); 6.796 - } 6.797 - } 6.798 - } 6.799 - } 6.800 - 6.801 - private String packageName(String str) { 6.802 - int idx = str.lastIndexOf('/'); 6.803 - if (idx < 0) { 6.804 - return ""; 6.805 - } 6.806 - return str.substring(0, idx).replace('/', '.'); 6.807 - } 6.808 - 6.809 - private JavaThread javaThreadForProxy(ThreadProxy t) { 6.810 - if (!getAgent().isJavaMode()) { 6.811 - return null; 6.812 - } 6.813 - if (threadToJavaThreadMap == null) { 6.814 - threadToJavaThreadMap = new HashMap(); 6.815 - Threads threads = VM.getVM().getThreads(); 6.816 - for (JavaThread thr = threads.first(); thr != null; thr = thr.next()) { 6.817 - threadToJavaThreadMap.put(thr.getThreadProxy(), thr); 6.818 - } 6.819 - } 6.820 - return (JavaThread) threadToJavaThreadMap.get(t); 6.821 - } 6.822 - 6.823 - private static JMenu createMenu(String name, char mnemonic, int mnemonicPos) { 6.824 - JMenu menu = new JMenu(name); 6.825 - menu.setMnemonic(mnemonic); 6.826 - menu.setDisplayedMnemonicIndex(mnemonicPos); 6.827 - return menu; 6.828 - } 6.829 - 6.830 - private static JMenuItem createMenuItem(String name, ActionListener l) { 6.831 - JMenuItem item = new JMenuItem(name); 6.832 - item.addActionListener(l); 6.833 - return item; 6.834 - } 6.835 - 6.836 - private static JMenuItem createMenuItemInternal(String name, ActionListener l, int accelerator, int modifiers) { 6.837 - JMenuItem item = createMenuItem(name, l); 6.838 - item.setAccelerator(KeyStroke.getKeyStroke(accelerator, modifiers)); 6.839 - return item; 6.840 - } 6.841 - 6.842 - private static JMenuItem createMenuItem(String name, ActionListener l, int accelerator) { 6.843 - return createMenuItemInternal(name, l, accelerator, 0); 6.844 - } 6.845 - 6.846 - private static JMenuItem createMenuItem(String name, ActionListener l, char mnemonic, int mnemonicPos) { 6.847 - JMenuItem item = createMenuItem(name, l); 6.848 - item.setMnemonic(mnemonic); 6.849 - item.setDisplayedMnemonicIndex(mnemonicPos); 6.850 - return item; 6.851 - } 6.852 - 6.853 - private static JMenuItem createMenuItem(String name, 6.854 - ActionListener l, 6.855 - int accelerator, 6.856 - int acceleratorMods, 6.857 - char mnemonic, 6.858 - int mnemonicPos) { 6.859 - JMenuItem item = createMenuItemInternal(name, l, accelerator, acceleratorMods); 6.860 - item.setMnemonic(mnemonic); 6.861 - item.setDisplayedMnemonicIndex(mnemonicPos); 6.862 - return item; 6.863 - } 6.864 - 6.865 - /** Punctuates the given string with \n's where necessary to not 6.866 - exceed the given number of characters per line. Strips 6.867 - extraneous whitespace. */ 6.868 - private static String formatMessage(String message, int charsPerLine) { 6.869 - StringBuffer buf = new StringBuffer(message.length()); 6.870 - StringTokenizer tokenizer = new StringTokenizer(message); 6.871 - int curLineLength = 0; 6.872 - while (tokenizer.hasMoreTokens()) { 6.873 - String tok = tokenizer.nextToken(); 6.874 - if (curLineLength + tok.length() > charsPerLine) { 6.875 - buf.append('\n'); 6.876 - curLineLength = 0; 6.877 - } else { 6.878 - if (curLineLength != 0) { 6.879 - buf.append(' '); 6.880 - ++curLineLength; 6.881 - } 6.882 - } 6.883 - buf.append(tok); 6.884 - curLineLength += tok.length(); 6.885 - } 6.886 - return buf.toString(); 6.887 - } 6.888 - 6.889 - private void setMenuItemsEnabled(java.util.List items, boolean enabled) { 6.890 - for (Iterator iter = items.iterator(); iter.hasNext(); ) { 6.891 - ((JMenuItem) iter.next()).setEnabled(enabled); 6.892 - } 6.893 - } 6.894 - 6.895 - private void showMessageDialog(final String message, final String title, final int jOptionPaneKind) { 6.896 - SwingUtilities.invokeLater(new Runnable() { 6.897 - public void run() { 6.898 - if (mdiMode) { 6.899 - JOptionPane.showInternalMessageDialog(desktop, message, title, jOptionPaneKind); 6.900 - } else { 6.901 - JOptionPane.showMessageDialog(null, message, title, jOptionPaneKind); 6.902 - } 6.903 - } 6.904 - }); 6.905 - } 6.906 - 6.907 - private FrameWrapper newFrame(String title) { 6.908 - if (mdiMode) { 6.909 - return new JInternalFrameWrapper(new JInternalFrame(title)); 6.910 - } else { 6.911 - return new JFrameWrapper(new JFrame(title)); 6.912 - } 6.913 - } 6.914 - 6.915 - private void addFrame(FrameWrapper frame) { 6.916 - if (mdiMode) { 6.917 - desktop.add(frame.getComponent()); 6.918 - } 6.919 - } 6.920 - 6.921 - private void removeFrame(FrameWrapper frame) { 6.922 - if (mdiMode) { 6.923 - desktop.remove(frame.getComponent()); 6.924 - desktop.invalidate(); 6.925 - desktop.validate(); 6.926 - desktop.repaint(); 6.927 - } 6.928 - // FIXME: do something when not in MDI mode 6.929 - } 6.930 - 6.931 - private Dimension getParentDimension(Component c) { 6.932 - if (mdiMode) { 6.933 - return desktop.getSize(); 6.934 - } else { 6.935 - return Toolkit.getDefaultToolkit().getScreenSize(); 6.936 - } 6.937 - } 6.938 - 6.939 - // Default editor implementation 6.940 - class DefaultEditor implements Editor { 6.941 - private DefaultEditorFactory factory; 6.942 - private FrameWrapper editorFrame; 6.943 - private String filename; 6.944 - private SourceCodePanel code; 6.945 - private boolean shown; 6.946 - private Object userData; 6.947 - 6.948 - public DefaultEditor(DefaultEditorFactory fact, String filename, final EditorCommands comm) { 6.949 - this.filename = filename; 6.950 - this.factory = fact; 6.951 - editorFrame = newFrame(filename); 6.952 - code = new SourceCodePanel(); 6.953 - // FIXME: when font changes, change font in editors as well 6.954 - code.setFont(fixedWidthFont); 6.955 - editorFrame.getContentPane().add(code); 6.956 - editorFrame.setClosable(true); 6.957 - editorFrame.setResizable(true); 6.958 - editorFrame.setClosingActionListener(new ActionListener() { 6.959 - public void actionPerformed(ActionEvent e) { 6.960 - comm.windowClosed(DefaultEditor.this); 6.961 - removeFrame(editorFrame); 6.962 - editorFrame.dispose(); 6.963 - factory.editorClosed(DefaultEditor.this); 6.964 - } 6.965 - }); 6.966 - editorFrame.setActivatedActionListener(new ActionListener() { 6.967 - public void actionPerformed(ActionEvent e) { 6.968 - factory.makeEditorCurrent(DefaultEditor.this); 6.969 - code.requestFocus(); 6.970 - } 6.971 - }); 6.972 - code.setEditorCommands(comm, this); 6.973 - } 6.974 - 6.975 - public boolean openFile() { return code.openFile(filename); } 6.976 - public String getSourceFileName() { return filename; } 6.977 - public int getCurrentLineNumber() { return code.getCurrentLineNumber(); } 6.978 - public void showLineNumber(int lineNo) { 6.979 - if (!shown) { 6.980 - addFrame(editorFrame); 6.981 - GraphicsUtilities.reshapeToAspectRatio(editorFrame.getComponent(), 6.982 - 1.0f, 6.983 - 0.85f, 6.984 - getParentDimension(editorFrame.getComponent())); 6.985 - editorFrame.setVisible(true); 6.986 - shown = true; 6.987 - } 6.988 - code.showLineNumber(lineNo); 6.989 - editorFrame.toFront(); 6.990 - } 6.991 - public void highlightLineNumber(int lineNo) { code.highlightLineNumber(lineNo); } 6.992 - public void showBreakpointAtLine(int lineNo) { code.showBreakpointAtLine(lineNo); } 6.993 - public boolean hasBreakpointAtLine(int lineNo) { return code.hasBreakpointAtLine(lineNo); } 6.994 - public void clearBreakpointAtLine(int lineNo) { code.clearBreakpointAtLine(lineNo); } 6.995 - public void clearBreakpoints() { code.clearBreakpoints(); } 6.996 - public void setUserData(Object o) { userData = o; } 6.997 - public Object getUserData() { return userData; } 6.998 - public void toFront() { editorFrame.toFront(); 6.999 - factory.makeEditorCurrent(this); } 6.1000 - } 6.1001 - 6.1002 - class DefaultEditorFactory implements EditorFactory { 6.1003 - private LinkedList/*<Editor>*/ editors = new LinkedList(); 6.1004 - 6.1005 - public Editor openFile(String filename, EditorCommands commands) { 6.1006 - DefaultEditor editor = new DefaultEditor(this, filename, editorComm); 6.1007 - if (!editor.openFile()) { 6.1008 - return null; 6.1009 - } 6.1010 - return editor; 6.1011 - } 6.1012 - 6.1013 - public Editor getCurrentEditor() { 6.1014 - if (editors.isEmpty()) { 6.1015 - return null; 6.1016 - } 6.1017 - return (Editor) editors.getFirst(); 6.1018 - } 6.1019 - 6.1020 - void editorClosed(Editor editor) { 6.1021 - editors.remove(editor); 6.1022 - } 6.1023 - 6.1024 - void makeEditorCurrent(Editor editor) { 6.1025 - editors.remove(editor); 6.1026 - editors.addFirst(editor); 6.1027 - } 6.1028 - } 6.1029 - 6.1030 - // Helper class for loading .java files; show only those with 6.1031 - // correct file name which are also in the correct package 6.1032 - static class JavaFileFilter extends javax.swing.filechooser.FileFilter { 6.1033 - private String packageName; 6.1034 - private String fileName; 6.1035 - 6.1036 - JavaFileFilter(String packageName, String fileName) { 6.1037 - this.packageName = packageName; 6.1038 - this.fileName = fileName; 6.1039 - } 6.1040 - 6.1041 - public boolean accept(File f) { 6.1042 - if (f.isDirectory()) { 6.1043 - return true; 6.1044 - } 6.1045 - // This rejects most files 6.1046 - if (!f.getName().equals(fileName)) { 6.1047 - return false; 6.1048 - } 6.1049 - // Ensure selected file is in the correct package 6.1050 - PackageScanner scanner = new PackageScanner(); 6.1051 - String pkg = scanner.scan(f); 6.1052 - if (!pkg.equals(packageName)) { 6.1053 - return false; 6.1054 - } 6.1055 - return true; 6.1056 - } 6.1057 - 6.1058 - public String getDescription() { return "Java source files"; } 6.1059 - } 6.1060 - 6.1061 - // Auxiliary information used only for Java source files 6.1062 - static class JavaUserData { 6.1063 - private String packageName; // External format 6.1064 - private String sourceFileName; 6.1065 - 6.1066 - /** Source file name is equivalent to that found in the .java 6.1067 - file; i.e., not a full path */ 6.1068 - JavaUserData(String packageName, String sourceFileName) { 6.1069 - this.packageName = packageName; 6.1070 - this.sourceFileName = sourceFileName; 6.1071 - } 6.1072 - 6.1073 - String packageName() { return packageName; } 6.1074 - String sourceFileName() { return sourceFileName; } 6.1075 - } 6.1076 - 6.1077 - // Opens a source file. This makes it available for the setting of 6.1078 - // lazy breakpoints. 6.1079 - private void openSourceFile() { 6.1080 - JFileChooser chooser = new JFileChooser(); 6.1081 - chooser.setDialogTitle("Open source code file"); 6.1082 - chooser.setMultiSelectionEnabled(false); 6.1083 - if (chooser.showOpenDialog(null) != JFileChooser.APPROVE_OPTION) { 6.1084 - return; 6.1085 - } 6.1086 - File chosen = chooser.getSelectedFile(); 6.1087 - if (chosen == null) { 6.1088 - return; 6.1089 - } 6.1090 - 6.1091 - // See whether we have a Java source file. If so, derive a package 6.1092 - // name for it. 6.1093 - String path = chosen.getPath(); 6.1094 - String name = null; 6.1095 - JavaUserData data = null; 6.1096 - if (path.endsWith(".java")) { 6.1097 - PackageScanner scanner = new PackageScanner(); 6.1098 - String pkg = scanner.scan(chosen); 6.1099 - // Now knowing both the package name and file name, we can put 6.1100 - // this in the editor map and use it for setting breakpoints 6.1101 - // later 6.1102 - String fileName = chosen.getName(); 6.1103 - name = pkg + "." + fileName; 6.1104 - data = new JavaUserData(pkg, fileName); 6.1105 - } else { 6.1106 - // FIXME: need pathmap mechanism 6.1107 - name = path; 6.1108 - } 6.1109 - Editor editor = (Editor) editors.get(name); 6.1110 - if (editor == null) { 6.1111 - editor = editorFact.openFile(path, editorComm); 6.1112 - if (editor == null) { 6.1113 - showMessageDialog("Unable to open file \"" + path + "\" -- unexpected error.", 6.1114 - "Unable to open file", 6.1115 - JOptionPane.WARNING_MESSAGE); 6.1116 - return; 6.1117 - } 6.1118 - editors.put(name, editor); 6.1119 - if (data != null) { 6.1120 - editor.setUserData(data); 6.1121 - } 6.1122 - } else { 6.1123 - editor.toFront(); 6.1124 - } 6.1125 - editor.showLineNumber(1); 6.1126 - // Show breakpoints as well if we have any for this file 6.1127 - Set set = (Set) fileToBreakpointMap.get(editor.getSourceFileName()); 6.1128 - if (set != null) { 6.1129 - for (Iterator iter = set.iterator(); iter.hasNext(); ) { 6.1130 - editor.showBreakpointAtLine(((Integer) iter.next()).intValue()); 6.1131 - } 6.1132 - } 6.1133 - } 6.1134 - 6.1135 - // Package name may be null, in which case the file is assumed to be 6.1136 - // a C source file. Otherwise it is assumed to be a Java source file 6.1137 - // and certain filtering rules will be applied. 6.1138 - private void showLineNumber(String packageName, String fileName, int lineNumber) { 6.1139 - String name; 6.1140 - if (packageName == null) { 6.1141 - name = fileName; 6.1142 - } else { 6.1143 - name = packageName + "." + fileName; 6.1144 - } 6.1145 - Editor editor = (Editor) editors.get(name); 6.1146 - if (editor == null) { 6.1147 - // See whether file exists 6.1148 - File file = new File(fileName); 6.1149 - String realFileName = fileName; 6.1150 - if (!file.exists()) { 6.1151 - // User must specify path to file 6.1152 - JFileChooser chooser = new JFileChooser(); 6.1153 - chooser.setDialogTitle("Please locate " + fileName); 6.1154 - chooser.setMultiSelectionEnabled(false); 6.1155 - if (packageName != null) { 6.1156 - chooser.setFileFilter(new JavaFileFilter(packageName, fileName)); 6.1157 - } 6.1158 - int res = chooser.showOpenDialog(null); 6.1159 - if (res != JFileChooser.APPROVE_OPTION) { 6.1160 - // FIXME: show disassembly instead 6.1161 - return; 6.1162 - } 6.1163 - // FIXME: would like to infer more from the selection; i.e., 6.1164 - // a pathmap leading up to this file 6.1165 - File chosen = chooser.getSelectedFile(); 6.1166 - if (chosen == null) { 6.1167 - return; 6.1168 - } 6.1169 - realFileName = chosen.getPath(); 6.1170 - } 6.1171 - // Now instruct editor factory to open file 6.1172 - editor = editorFact.openFile(realFileName, editorComm); 6.1173 - if (editor == null) { 6.1174 - showMessageDialog("Unable to open file \"" + realFileName + "\" -- unexpected error.", 6.1175 - "Unable to open file", 6.1176 - JOptionPane.WARNING_MESSAGE); 6.1177 - return; 6.1178 - } 6.1179 - // Got an editor; put it in map 6.1180 - editors.put(name, editor); 6.1181 - // If Java source file, add additional information for later 6.1182 - if (packageName != null) { 6.1183 - editor.setUserData(new JavaUserData(packageName, fileName)); 6.1184 - } 6.1185 - } 6.1186 - // Got editor; show line 6.1187 - editor.showLineNumber(lineNumber); 6.1188 - editor.highlightLineNumber(lineNumber); 6.1189 - // Show breakpoints as well if we have any for this file 6.1190 - Set set = (Set) fileToBreakpointMap.get(editor.getSourceFileName()); 6.1191 - if (set != null) { 6.1192 - for (Iterator iter = set.iterator(); iter.hasNext(); ) { 6.1193 - editor.showBreakpointAtLine(((Integer) iter.next()).intValue()); 6.1194 - } 6.1195 - } 6.1196 - } 6.1197 - 6.1198 - // 6.1199 - // Suspend/resume 6.1200 - // 6.1201 - 6.1202 - private boolean isSuspended() { 6.1203 - return suspended; 6.1204 - } 6.1205 - 6.1206 - private synchronized void suspend() { 6.1207 - setMenuItemsEnabled(resumeDebugMenuItems, true); 6.1208 - setMenuItemsEnabled(suspendDebugMenuItems, false); 6.1209 - BugSpotAgent agent = getAgent(); 6.1210 - if (agent.canInteractWithJava() && !agent.isJavaSuspended()) { 6.1211 - agent.suspendJava(); 6.1212 - } 6.1213 - agent.suspend(); 6.1214 - // FIXME: call VM.getVM().fireVMSuspended() 6.1215 - resetCurrentThread(); 6.1216 - debugEventTimer.stop(); 6.1217 - suspended = true; 6.1218 - } 6.1219 - 6.1220 - private synchronized void resume() { 6.1221 - // Note: we don't wipe out the cached state like the 6.1222 - // sourceFileToLineNumberInfoMap since it is too expensive to 6.1223 - // recompute. Instead we recompute it if any DLLs are loaded or 6.1224 - // unloaded. 6.1225 - threadToJavaThreadMap = null; 6.1226 - setMenuItemsEnabled(resumeDebugMenuItems, false); 6.1227 - setMenuItemsEnabled(suspendDebugMenuItems, true); 6.1228 - registerPanel.clear(); 6.1229 - // FIXME: call VM.getVM().fireVMResumed() 6.1230 - BugSpotAgent agent = getAgent(); 6.1231 - agent.resume(); 6.1232 - if (agent.canInteractWithJava()) { 6.1233 - if (agent.isJavaSuspended()) { 6.1234 - agent.resumeJava(); 6.1235 - } 6.1236 - if (javaEventPending) { 6.1237 - javaEventPending = false; 6.1238 - // Clear it out before resuming polling for events 6.1239 - agent.javaEventContinue(); 6.1240 - } 6.1241 - } 6.1242 - agent.enableJavaInteraction(); 6.1243 - suspended = false; 6.1244 - debugEventTimer.start(); 6.1245 - } 6.1246 - 6.1247 - // 6.1248 - // Breakpoints 6.1249 - // 6.1250 - 6.1251 - private synchronized BreakpointResult handleBreakpointToggle(Editor editor, int lineNumber) { 6.1252 - // Currently we only use user data in editors to indicate Java 6.1253 - // source files. If this changes then this code will need to 6.1254 - // change. 6.1255 - JavaUserData data = (JavaUserData) editor.getUserData(); 6.1256 - String filename = editor.getSourceFileName(); 6.1257 - if (data == null) { 6.1258 - // C/C++ code 6.1259 - // FIXME: as noted above in EditorCommands.toggleBreakpointAtLine, 6.1260 - // this needs more work to handle "lazy" breakpoints in files 6.1261 - // which we don't know about in the debug information yet 6.1262 - CDebugger dbg = getCDebugger(); 6.1263 - ProcessControl prctl = dbg.getProcessControl(); 6.1264 - if (prctl == null) { 6.1265 - return new BreakpointResult(false, false, 0, "Process control not enabled"); 6.1266 - } 6.1267 - boolean mustSuspendAndResume = (!prctl.isSuspended()); 6.1268 - try { 6.1269 - if (mustSuspendAndResume) { 6.1270 - prctl.suspend(); 6.1271 - } 6.1272 - // Search debug info for all DSOs 6.1273 - LineNumberInfo info = getLineNumberInfo(filename, lineNumber); 6.1274 - if (info != null) { 6.1275 - Set bpset = (Set) fileToBreakpointMap.get(filename); 6.1276 - if (bpset == null) { 6.1277 - bpset = new HashSet(); 6.1278 - fileToBreakpointMap.put(filename, bpset); 6.1279 - } 6.1280 - Integer key = new Integer(info.getLineNumber()); 6.1281 - if (bpset.contains(key)) { 6.1282 - // Clear breakpoint at this line's PC 6.1283 - prctl.clearBreakpoint(info.getStartPC()); 6.1284 - bpset.remove(key); 6.1285 - return new BreakpointResult(true, false, info.getLineNumber()); 6.1286 - } else { 6.1287 - // Set breakpoint at this line's PC 6.1288 - System.err.println("Setting breakpoint at PC " + info.getStartPC()); 6.1289 - prctl.setBreakpoint(info.getStartPC()); 6.1290 - bpset.add(key); 6.1291 - return new BreakpointResult(true, true, info.getLineNumber()); 6.1292 - } 6.1293 - } else { 6.1294 - return new BreakpointResult(false, false, 0, "No debug information for this source file and line"); 6.1295 - } 6.1296 - } finally { 6.1297 - if (mustSuspendAndResume) { 6.1298 - prctl.resume(); 6.1299 - } 6.1300 - } 6.1301 - } else { 6.1302 - BugSpotAgent agent = getAgent(); 6.1303 - if (!agent.canInteractWithJava()) { 6.1304 - String why; 6.1305 - if (agent.isJavaInteractionDisabled()) { 6.1306 - why = "Can not toggle Java breakpoints while stopped because\nof C/C++ debug events (breakpoints, single-stepping)"; 6.1307 - } else { 6.1308 - why = "Could not talk to SA's JVMDI module to enable Java\nprogramming language breakpoints (run with -Xdebug -Xrunsa)"; 6.1309 - } 6.1310 - return new BreakpointResult(false, false, 0, why); 6.1311 - } 6.1312 - Set bpset = (Set) fileToBreakpointMap.get(filename); 6.1313 - if (bpset == null) { 6.1314 - bpset = new HashSet(); 6.1315 - fileToBreakpointMap.put(filename, bpset); 6.1316 - } 6.1317 - boolean mustResumeAndSuspend = isSuspended(); 6.1318 - try { 6.1319 - if (mustResumeAndSuspend) { 6.1320 - agent.resume(); 6.1321 - } 6.1322 - ServiceabilityAgentJVMDIModule.BreakpointToggleResult res = 6.1323 - getAgent().toggleJavaBreakpoint(data.sourceFileName(), 6.1324 - data.packageName(), 6.1325 - lineNumber); 6.1326 - if (res.getSuccess()) { 6.1327 - Integer key = new Integer(res.getLineNumber()); 6.1328 - boolean addRemRes = false; 6.1329 - if (res.getWasSet()) { 6.1330 - addRemRes = bpset.add(key); 6.1331 - System.err.println("Setting breakpoint at " + res.getMethodName() + res.getMethodSignature() + 6.1332 - ", bci " + res.getBCI() + ", line " + res.getLineNumber()); 6.1333 - } else { 6.1334 - addRemRes = bpset.remove(key); 6.1335 - System.err.println("Clearing breakpoint at " + res.getMethodName() + res.getMethodSignature() + 6.1336 - ", bci " + res.getBCI() + ", line " + res.getLineNumber()); 6.1337 - } 6.1338 - if (Assert.ASSERTS_ENABLED) { 6.1339 - Assert.that(addRemRes, "Inconsistent Java breakpoint state with respect to target process"); 6.1340 - } 6.1341 - return new BreakpointResult(true, res.getWasSet(), res.getLineNumber()); 6.1342 - } else { 6.1343 - return new BreakpointResult(false, false, 0, res.getErrMsg()); 6.1344 - } 6.1345 - } finally { 6.1346 - if (mustResumeAndSuspend) { 6.1347 - agent.suspend(); 6.1348 - resetCurrentThread(); 6.1349 - } 6.1350 - } 6.1351 - } 6.1352 - } 6.1353 - 6.1354 - // Must call only when suspended 6.1355 - private LineNumberInfo getLineNumberInfo(String filename, int lineNumber) { 6.1356 - Map map = getSourceFileToLineNumberInfoMap(); 6.1357 - java.util.List infos = (java.util.List) map.get(filename); 6.1358 - if (infos == null) { 6.1359 - return null; 6.1360 - } 6.1361 - // Binary search for line number 6.1362 - return searchLineNumbers(infos, lineNumber, 0, infos.size()); 6.1363 - } 6.1364 - 6.1365 - // Must call only when suspended 6.1366 - private Map getSourceFileToLineNumberInfoMap() { 6.1367 - if (sourceFileToLineNumberInfoMap == null) { 6.1368 - // Build from debug info 6.1369 - java.util.List loadObjects = getCDebugger().getLoadObjectList(); 6.1370 - final Map map = new HashMap(); 6.1371 - for (Iterator iter = loadObjects.iterator(); iter.hasNext(); ) { 6.1372 - LoadObject lo = (LoadObject) iter.next(); 6.1373 - CDebugInfoDataBase db = lo.getDebugInfoDataBase(); 6.1374 - if (db != null) { 6.1375 - db.iterate(new LineNumberVisitor() { 6.1376 - public void doLineNumber(LineNumberInfo info) { 6.1377 - String name = info.getSourceFileName(); 6.1378 - if (name != null) { 6.1379 - java.util.List val = (java.util.List) map.get(name); 6.1380 - if (val == null) { 6.1381 - val = new ArrayList(); 6.1382 - map.put(name, val); 6.1383 - } 6.1384 - val.add(info); 6.1385 - } 6.1386 - } 6.1387 - }); 6.1388 - } 6.1389 - } 6.1390 - // Sort all lists 6.1391 - for (Iterator iter = map.values().iterator(); iter.hasNext(); ) { 6.1392 - java.util.List list = (java.util.List) iter.next(); 6.1393 - Collections.sort(list, new Comparator() { 6.1394 - public int compare(Object o1, Object o2) { 6.1395 - LineNumberInfo l1 = (LineNumberInfo) o1; 6.1396 - LineNumberInfo l2 = (LineNumberInfo) o2; 6.1397 - int n1 = l1.getLineNumber(); 6.1398 - int n2 = l2.getLineNumber(); 6.1399 - if (n1 < n2) return -1; 6.1400 - if (n1 == n2) return 0; 6.1401 - return 1; 6.1402 - } 6.1403 - }); 6.1404 - } 6.1405 - sourceFileToLineNumberInfoMap = map; 6.1406 - } 6.1407 - return sourceFileToLineNumberInfoMap; 6.1408 - } 6.1409 - 6.1410 - private LineNumberInfo searchLineNumbers(java.util.List infoList, int lineNo, int lowIdx, int highIdx) { 6.1411 - if (highIdx < lowIdx) return null; 6.1412 - if (lowIdx == highIdx) { 6.1413 - // Base case: see whether start PC is less than or equal to addr 6.1414 - if (checkLineNumber(infoList, lineNo, lowIdx)) { 6.1415 - return (LineNumberInfo) infoList.get(lowIdx); 6.1416 - } else { 6.1417 - return null; 6.1418 - } 6.1419 - } else if (lowIdx == highIdx - 1) { 6.1420 - if (checkLineNumber(infoList, lineNo, lowIdx)) { 6.1421 - return (LineNumberInfo) infoList.get(lowIdx); 6.1422 - } else if (checkLineNumber(infoList, lineNo, highIdx)) { 6.1423 - return (LineNumberInfo) infoList.get(highIdx); 6.1424 - } else { 6.1425 - return null; 6.1426 - } 6.1427 - } 6.1428 - int midIdx = (lowIdx + highIdx) >> 1; 6.1429 - LineNumberInfo info = (LineNumberInfo) infoList.get(midIdx); 6.1430 - if (lineNo < info.getLineNumber()) { 6.1431 - // Always move search down 6.1432 - return searchLineNumbers(infoList, lineNo, lowIdx, midIdx); 6.1433 - } else if (lineNo == info.getLineNumber()) { 6.1434 - return info; 6.1435 - } else { 6.1436 - // Move search up 6.1437 - return searchLineNumbers(infoList, lineNo, midIdx, highIdx); 6.1438 - } 6.1439 - } 6.1440 - 6.1441 - private boolean checkLineNumber(java.util.List infoList, int lineNo, int idx) { 6.1442 - LineNumberInfo info = (LineNumberInfo) infoList.get(idx); 6.1443 - return (info.getLineNumber() >= lineNo); 6.1444 - } 6.1445 - 6.1446 - // 6.1447 - // Debug events 6.1448 - // 6.1449 - 6.1450 - private synchronized void pollForDebugEvent() { 6.1451 - ProcessControl prctl = getCDebugger().getProcessControl(); 6.1452 - if (prctl == null) { 6.1453 - return; 6.1454 - } 6.1455 - DebugEvent ev = prctl.debugEventPoll(); 6.1456 - if (ev != null) { 6.1457 - DebugEvent.Type t = ev.getType(); 6.1458 - if (t == DebugEvent.Type.LOADOBJECT_LOAD || 6.1459 - t == DebugEvent.Type.LOADOBJECT_UNLOAD) { 6.1460 - // Conservatively clear cached debug info state 6.1461 - sourceFileToLineNumberInfoMap = null; 6.1462 - // FIXME: would be very useful to have "stop on load/unload" 6.1463 - // events 6.1464 - // FIXME: must do work at these events to implement lazy 6.1465 - // breakpoints 6.1466 - prctl.debugEventContinue(); 6.1467 - } else if (t == DebugEvent.Type.BREAKPOINT) { 6.1468 - // Note: Visual C++ only notifies on breakpoints it doesn't 6.1469 - // know about 6.1470 - 6.1471 - // FIXME: put back test 6.1472 - // if (!prctl.isBreakpointSet(ev.getPC())) { 6.1473 - showMessageDialog("Breakpoint reached at PC " + ev.getPC(), 6.1474 - "Breakpoint reached", 6.1475 - JOptionPane.INFORMATION_MESSAGE); 6.1476 - // } 6.1477 - agent.disableJavaInteraction(); 6.1478 - suspend(); 6.1479 - prctl.debugEventContinue(); 6.1480 - } else if (t == DebugEvent.Type.SINGLE_STEP) { 6.1481 - agent.disableJavaInteraction(); 6.1482 - suspend(); 6.1483 - prctl.debugEventContinue(); 6.1484 - } else if (t == DebugEvent.Type.ACCESS_VIOLATION) { 6.1485 - showMessageDialog("Access violation attempting to " + 6.1486 - (ev.getWasWrite() ? "write" : "read") + 6.1487 - " address " + ev.getAddress() + 6.1488 - " at PC " + ev.getPC(), 6.1489 - "Access Violation", 6.1490 - JOptionPane.WARNING_MESSAGE); 6.1491 - agent.disableJavaInteraction(); 6.1492 - suspend(); 6.1493 - prctl.debugEventContinue(); 6.1494 - } else { 6.1495 - String info = "Unknown debug event encountered"; 6.1496 - if (ev.getUnknownEventDetail() != null) { 6.1497 - info = info + ": " + ev.getUnknownEventDetail(); 6.1498 - } 6.1499 - showMessageDialog(info, "Unknown debug event", JOptionPane.INFORMATION_MESSAGE); 6.1500 - suspend(); 6.1501 - prctl.debugEventContinue(); 6.1502 - } 6.1503 - return; 6.1504 - } 6.1505 - 6.1506 - // No C++ debug event; poll for Java debug event 6.1507 - if (getAgent().canInteractWithJava()) { 6.1508 - if (!javaEventPending) { 6.1509 - if (getAgent().javaEventPending()) { 6.1510 - suspend(); 6.1511 - // This does a lot of work and we want to have the page 6.1512 - // cache available to us as it runs 6.1513 - sun.jvm.hotspot.livejvm.Event jev = getAgent().javaEventPoll(); 6.1514 - if (jev != null) { 6.1515 - javaEventPending = true; 6.1516 - if (jev.getType() == sun.jvm.hotspot.livejvm.Event.Type.BREAKPOINT) { 6.1517 - BreakpointEvent bpev = (BreakpointEvent) jev; 6.1518 - showMessageDialog("Breakpoint reached in method\n" + 6.1519 - bpev.methodID().method().externalNameAndSignature() + 6.1520 - ",\nbci " + bpev.location(), 6.1521 - "Breakpoint reached", 6.1522 - JOptionPane.INFORMATION_MESSAGE); 6.1523 - } else if (jev.getType() == sun.jvm.hotspot.livejvm.Event.Type.EXCEPTION) { 6.1524 - ExceptionEvent exev = (ExceptionEvent) jev; 6.1525 - showMessageDialog(exev.exception().getKlass().getName().asString() + 6.1526 - "\nthrown in method\n" + 6.1527 - exev.methodID().method().externalNameAndSignature() + 6.1528 - "\nat BCI " + exev.location(), 6.1529 - "Exception thrown", 6.1530 - JOptionPane.INFORMATION_MESSAGE); 6.1531 - } else { 6.1532 - Assert.that(false, "Should not reach here"); 6.1533 - } 6.1534 - } 6.1535 - } 6.1536 - } 6.1537 - } 6.1538 - } 6.1539 -}
7.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java Fri Feb 22 10:12:00 2013 -0800 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,799 +0,0 @@ 7.4 -/* 7.5 - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 7.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.7 - * 7.8 - * This code is free software; you can redistribute it and/or modify it 7.9 - * under the terms of the GNU General Public License version 2 only, as 7.10 - * published by the Free Software Foundation. 7.11 - * 7.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 7.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 7.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 7.15 - * version 2 for more details (a copy is included in the LICENSE file that 7.16 - * accompanied this code). 7.17 - * 7.18 - * You should have received a copy of the GNU General Public License version 7.19 - * 2 along with this work; if not, write to the Free Software Foundation, 7.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 7.21 - * 7.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 7.23 - * or visit www.oracle.com if you need additional information or have any 7.24 - * questions. 7.25 - * 7.26 - */ 7.27 - 7.28 -package sun.jvm.hotspot.bugspot; 7.29 - 7.30 -import java.io.PrintStream; 7.31 -import java.net.*; 7.32 -import java.rmi.*; 7.33 -import sun.jvm.hotspot.*; 7.34 -import sun.jvm.hotspot.debugger.*; 7.35 -import sun.jvm.hotspot.debugger.bsd.*; 7.36 -import sun.jvm.hotspot.debugger.proc.*; 7.37 -import sun.jvm.hotspot.debugger.cdbg.*; 7.38 -import sun.jvm.hotspot.debugger.windbg.*; 7.39 -import sun.jvm.hotspot.debugger.linux.*; 7.40 -import sun.jvm.hotspot.debugger.sparc.*; 7.41 -import sun.jvm.hotspot.debugger.remote.*; 7.42 -import sun.jvm.hotspot.livejvm.*; 7.43 -import sun.jvm.hotspot.memory.*; 7.44 -import sun.jvm.hotspot.oops.*; 7.45 -import sun.jvm.hotspot.runtime.*; 7.46 -import sun.jvm.hotspot.types.*; 7.47 -import sun.jvm.hotspot.utilities.*; 7.48 - 7.49 -/** <P> This class wraps the basic functionality for connecting to the 7.50 - * target process or debug server. It makes it simple to start up the 7.51 - * debugging system. </P> 7.52 - * 7.53 - * <P> This agent (as compared to the HotSpotAgent) can connect to 7.54 - * and interact with arbitrary processes. If the target process 7.55 - * happens to be a HotSpot JVM, the Java debugging features of the 7.56 - * Serviceability Agent are enabled. Further, if the Serviceability 7.57 - * Agent's JVMDI module is loaded into the target VM, interaction 7.58 - * with the live Java program is possible, specifically the catching 7.59 - * of exceptions and setting of breakpoints. </P> 7.60 - * 7.61 - * <P> The BugSpot debugger requires that the underlying Debugger 7.62 - * support C/C++ debugging via the CDebugger interface. </P> 7.63 - * 7.64 - * <P> FIXME: especially with the addition of remote debugging, this 7.65 - * has turned into a mess; needs rethinking. </P> */ 7.66 - 7.67 -public class BugSpotAgent { 7.68 - 7.69 - private JVMDebugger debugger; 7.70 - private MachineDescription machDesc; 7.71 - private TypeDataBase db; 7.72 - 7.73 - private String os; 7.74 - private String cpu; 7.75 - private String fileSep; 7.76 - 7.77 - // The system can work in several ways: 7.78 - // - Attaching to local process 7.79 - // - Attaching to local core file 7.80 - // - Connecting to remote debug server 7.81 - // - Starting debug server for process 7.82 - // - Starting debug server for core file 7.83 - 7.84 - // These are options for the "client" side of things 7.85 - private static final int PROCESS_MODE = 0; 7.86 - private static final int CORE_FILE_MODE = 1; 7.87 - private static final int REMOTE_MODE = 2; 7.88 - private int startupMode; 7.89 - 7.90 - // This indicates whether we are really starting a server or not 7.91 - private boolean isServer; 7.92 - 7.93 - // All possible required information for connecting 7.94 - private int pid; 7.95 - private String executableName; 7.96 - private String coreFileName; 7.97 - private String debugServerID; 7.98 - 7.99 - // All needed information for server side 7.100 - private String serverID; 7.101 - 7.102 - // Indicates whether we are attached to a HotSpot JVM or not 7.103 - private boolean javaMode; 7.104 - 7.105 - // Indicates whether we have process control over a live HotSpot JVM 7.106 - // or not; non-null if so. 7.107 - private ServiceabilityAgentJVMDIModule jvmdi; 7.108 - // While handling C breakpoints interactivity with the Java program 7.109 - // is forbidden. Too many invariants are broken while the target is 7.110 - // stopped at a C breakpoint to risk making JVMDI calls. 7.111 - private boolean javaInteractionDisabled; 7.112 - 7.113 - private String[] jvmLibNames; 7.114 - private String[] saLibNames; 7.115 - 7.116 - // FIXME: make these configurable, i.e., via a dotfile; also 7.117 - // consider searching within the JDK from which this Java executable 7.118 - // comes to find them 7.119 - private static final String defaultDbxPathPrefix = "/net/jano.eng/export/disk05/hotspot/sa"; 7.120 - private static final String defaultDbxSvcAgentDSOPathPrefix = "/net/jano.eng/export/disk05/hotspot/sa"; 7.121 - 7.122 - private static final boolean DEBUG; 7.123 - static { 7.124 - DEBUG = System.getProperty("sun.jvm.hotspot.bugspot.BugSpotAgent.DEBUG") 7.125 - != null; 7.126 - } 7.127 - 7.128 - static void debugPrintln(String str) { 7.129 - if (DEBUG) { 7.130 - System.err.println(str); 7.131 - } 7.132 - } 7.133 - 7.134 - static void showUsage() { 7.135 - System.out.println(" You can also pass these -D options to java to specify where to find dbx and the \n" + 7.136 - " Serviceability Agent plugin for dbx:"); 7.137 - System.out.println(" -DdbxPathName=<path-to-dbx-executable>\n" + 7.138 - " Default is derived from dbxPathPrefix"); 7.139 - System.out.println(" or"); 7.140 - System.out.println(" -DdbxPathPrefix=<xxx>\n" + 7.141 - " where xxx is the path name of a dir structure that contains:\n" + 7.142 - " <os>/<arch>/bin/dbx\n" + 7.143 - " The default is " + defaultDbxPathPrefix); 7.144 - System.out.println(" and"); 7.145 - System.out.println(" -DdbxSvcAgentDSOPathName=<path-to-dbx-serviceability-agent-module>\n" + 7.146 - " Default is determined from dbxSvcAgentDSOPathPrefix"); 7.147 - System.out.println(" or"); 7.148 - System.out.println(" -DdbxSvcAgentDSOPathPrefix=<xxx>\n" + 7.149 - " where xxx is the pathname of a dir structure that contains:\n" + 7.150 - " <os>/<arch>/bin/lib/libsvc_agent_dbx.so\n" + 7.151 - " The default is " + defaultDbxSvcAgentDSOPathPrefix); 7.152 - } 7.153 - 7.154 - public BugSpotAgent() { 7.155 - // for non-server add shutdown hook to clean-up debugger in case 7.156 - // of forced exit. For remote server, shutdown hook is added by 7.157 - // DebugServer. 7.158 - Runtime.getRuntime().addShutdownHook(new java.lang.Thread( 7.159 - new Runnable() { 7.160 - public void run() { 7.161 - synchronized (BugSpotAgent.this) { 7.162 - if (!isServer) { 7.163 - detach(); 7.164 - } 7.165 - } 7.166 - } 7.167 - })); 7.168 - } 7.169 - 7.170 - //-------------------------------------------------------------------------------- 7.171 - // Accessors (once the system is set up) 7.172 - // 7.173 - 7.174 - public synchronized Debugger getDebugger() { 7.175 - return debugger; 7.176 - } 7.177 - 7.178 - public synchronized CDebugger getCDebugger() { 7.179 - return getDebugger().getCDebugger(); 7.180 - } 7.181 - 7.182 - public synchronized ProcessControl getProcessControl() { 7.183 - return getCDebugger().getProcessControl(); 7.184 - } 7.185 - 7.186 - public synchronized TypeDataBase getTypeDataBase() { 7.187 - return db; 7.188 - } 7.189 - 7.190 - /** Indicates whether the target process is suspended 7.191 - completely. Equivalent to getProcessControl().isSuspended(). */ 7.192 - public synchronized boolean isSuspended() throws DebuggerException { 7.193 - return getProcessControl().isSuspended(); 7.194 - } 7.195 - 7.196 - /** Suspends the target process completely. Equivalent to 7.197 - getProcessControl().suspend(). */ 7.198 - public synchronized void suspend() throws DebuggerException { 7.199 - getProcessControl().suspend(); 7.200 - } 7.201 - 7.202 - /** Resumes the target process completely. Equivalent to 7.203 - getProcessControl().suspend(). */ 7.204 - public synchronized void resume() throws DebuggerException { 7.205 - getProcessControl().resume(); 7.206 - } 7.207 - 7.208 - /** Indicates whether we are attached to a Java HotSpot virtual 7.209 - machine */ 7.210 - public synchronized boolean isJavaMode() { 7.211 - return javaMode; 7.212 - } 7.213 - 7.214 - /** Temporarily disables interaction with the target process via 7.215 - JVMDI. This is done while the target process is stopped at a C 7.216 - breakpoint. Can be called even if the JVMDI agent has not been 7.217 - initialized. */ 7.218 - public synchronized void disableJavaInteraction() { 7.219 - javaInteractionDisabled = true; 7.220 - } 7.221 - 7.222 - /** Re-enables interaction with the target process via JVMDI. This 7.223 - is done while the target process is continued past a C 7.224 - braekpoint. Can be called even if the JVMDI agent has not been 7.225 - initialized. */ 7.226 - public synchronized void enableJavaInteraction() { 7.227 - javaInteractionDisabled = false; 7.228 - } 7.229 - 7.230 - /** Indicates whether Java interaction has been disabled */ 7.231 - public synchronized boolean isJavaInteractionDisabled() { 7.232 - return javaInteractionDisabled; 7.233 - } 7.234 - 7.235 - /** Indicates whether we can talk to the Serviceability Agent's 7.236 - JVMDI module to be able to set breakpoints */ 7.237 - public synchronized boolean canInteractWithJava() { 7.238 - return (jvmdi != null) && !javaInteractionDisabled; 7.239 - } 7.240 - 7.241 - /** Suspends all Java threads in the target process. Can only be 7.242 - called if we are attached to a HotSpot JVM and can connect to 7.243 - the SA's JVMDI module. Must not be called when the target 7.244 - process has been suspended with suspend(). */ 7.245 - public synchronized void suspendJava() throws DebuggerException { 7.246 - if (!canInteractWithJava()) { 7.247 - throw new DebuggerException("Could not connect to SA's JVMDI module"); 7.248 - } 7.249 - if (jvmdi.isSuspended()) { 7.250 - throw new DebuggerException("Target process already suspended via JVMDI"); 7.251 - } 7.252 - jvmdi.suspend(); 7.253 - } 7.254 - 7.255 - /** Resumes all Java threads in the target process. Can only be 7.256 - called if we are attached to a HotSpot JVM and can connect to 7.257 - the SA's JVMDI module. Must not be called when the target 7.258 - process has been suspended with suspend(). */ 7.259 - public synchronized void resumeJava() throws DebuggerException { 7.260 - if (!canInteractWithJava()) { 7.261 - throw new DebuggerException("Could not connect to SA's JVMDI module"); 7.262 - } 7.263 - if (!jvmdi.isSuspended()) { 7.264 - throw new DebuggerException("Target process already resumed via JVMDI"); 7.265 - } 7.266 - jvmdi.resume(); 7.267 - } 7.268 - 7.269 - /** Indicates whether the target process has been suspended at the 7.270 - Java language level via the SA's JVMDI module */ 7.271 - public synchronized boolean isJavaSuspended() throws DebuggerException { 7.272 - return jvmdi.isSuspended(); 7.273 - } 7.274 - 7.275 - /** Toggle a Java breakpoint at the given location. */ 7.276 - public synchronized ServiceabilityAgentJVMDIModule.BreakpointToggleResult 7.277 - toggleJavaBreakpoint(String srcFileName, 7.278 - String pkgName, 7.279 - int lineNo) { 7.280 - if (!canInteractWithJava()) { 7.281 - throw new DebuggerException("Could not connect to SA's JVMDI module; can not toggle Java breakpoints"); 7.282 - } 7.283 - return jvmdi.toggleBreakpoint(srcFileName, pkgName, lineNo); 7.284 - } 7.285 - 7.286 - /** Access to JVMDI module's eventPending */ 7.287 - public synchronized boolean javaEventPending() throws DebuggerException { 7.288 - if (!canInteractWithJava()) { 7.289 - throw new DebuggerException("Could not connect to SA's JVMDI module; can not poll for Java debug events"); 7.290 - } 7.291 - return jvmdi.eventPending(); 7.292 - } 7.293 - 7.294 - /** Access to JVMDI module's eventPoll */ 7.295 - public synchronized Event javaEventPoll() throws DebuggerException { 7.296 - if (!canInteractWithJava()) { 7.297 - throw new DebuggerException("Could not connect to SA's JVMDI module; can not poll for Java debug events"); 7.298 - } 7.299 - return jvmdi.eventPoll(); 7.300 - } 7.301 - 7.302 - /** Access to JVMDI module's eventContinue */ 7.303 - public synchronized void javaEventContinue() throws DebuggerException { 7.304 - if (!canInteractWithJava()) { 7.305 - throw new DebuggerException("Could not connect to SA's JVMDI module; can not continue past Java debug events"); 7.306 - } 7.307 - jvmdi.eventContinue(); 7.308 - } 7.309 - 7.310 - 7.311 - // FIXME: add other accessors. For example, suspension and 7.312 - // resumption should be done through this interface, as well as 7.313 - // interaction with the live Java process such as breakpoint setting. 7.314 - // Probably should not expose the ServiceabilityAgentJVMDIModule 7.315 - // from this interface. 7.316 - 7.317 - //-------------------------------------------------------------------------------- 7.318 - // Client-side operations 7.319 - // 7.320 - 7.321 - /** This attaches to a process running on the local machine. */ 7.322 - public synchronized void attach(int processID) 7.323 - throws DebuggerException { 7.324 - if (debugger != null) { 7.325 - throw new DebuggerException("Already attached"); 7.326 - } 7.327 - pid = processID; 7.328 - startupMode = PROCESS_MODE; 7.329 - isServer = false; 7.330 - go(); 7.331 - } 7.332 - 7.333 - /** This opens a core file on the local machine */ 7.334 - public synchronized void attach(String executableName, String coreFileName) 7.335 - throws DebuggerException { 7.336 - if (debugger != null) { 7.337 - throw new DebuggerException("Already attached"); 7.338 - } 7.339 - if ((executableName == null) || (coreFileName == null)) { 7.340 - throw new DebuggerException("Both the core file name and executable name must be specified"); 7.341 - } 7.342 - this.executableName = executableName; 7.343 - this.coreFileName = coreFileName; 7.344 - startupMode = CORE_FILE_MODE; 7.345 - isServer = false; 7.346 - go(); 7.347 - } 7.348 - 7.349 - /** This attaches to a "debug server" on a remote machine; this 7.350 - remote server has already attached to a process or opened a 7.351 - core file and is waiting for RMI calls on the Debugger object to 7.352 - come in. */ 7.353 - public synchronized void attach(String remoteServerID) 7.354 - throws DebuggerException { 7.355 - if (debugger != null) { 7.356 - throw new DebuggerException("Already attached to a process"); 7.357 - } 7.358 - if (remoteServerID == null) { 7.359 - throw new DebuggerException("Debug server id must be specified"); 7.360 - } 7.361 - 7.362 - debugServerID = remoteServerID; 7.363 - startupMode = REMOTE_MODE; 7.364 - isServer = false; 7.365 - go(); 7.366 - } 7.367 - 7.368 - /** This should only be called by the user on the client machine, 7.369 - not the server machine */ 7.370 - public synchronized boolean detach() throws DebuggerException { 7.371 - if (isServer) { 7.372 - throw new DebuggerException("Should not call detach() for server configuration"); 7.373 - } 7.374 - return detachInternal(); 7.375 - } 7.376 - 7.377 - //-------------------------------------------------------------------------------- 7.378 - // Server-side operations 7.379 - // 7.380 - 7.381 - /** This attaches to a process running on the local machine and 7.382 - starts a debug server, allowing remote machines to connect and 7.383 - examine this process. uniqueID is used to uniquely identify the 7.384 - debuggee */ 7.385 - public synchronized void startServer(int processID, String uniqueID) 7.386 - throws DebuggerException { 7.387 - if (debugger != null) { 7.388 - throw new DebuggerException("Already attached"); 7.389 - } 7.390 - pid = processID; 7.391 - startupMode = PROCESS_MODE; 7.392 - isServer = true; 7.393 - serverID = uniqueID; 7.394 - go(); 7.395 - } 7.396 - 7.397 - /** This attaches to a process running on the local machine and 7.398 - starts a debug server, allowing remote machines to connect and 7.399 - examine this process. */ 7.400 - public synchronized void startServer(int processID) 7.401 - throws DebuggerException { 7.402 - startServer(processID, null); 7.403 - } 7.404 - 7.405 - /** This opens a core file on the local machine and starts a debug 7.406 - server, allowing remote machines to connect and examine this 7.407 - core file. uniqueID is used to uniquely identify the 7.408 - debuggee */ 7.409 - public synchronized void startServer(String executableName, String coreFileName, 7.410 - String uniqueID) 7.411 - throws DebuggerException { 7.412 - if (debugger != null) { 7.413 - throw new DebuggerException("Already attached"); 7.414 - } 7.415 - if ((executableName == null) || (coreFileName == null)) { 7.416 - throw new DebuggerException("Both the core file name and Java executable name must be specified"); 7.417 - } 7.418 - this.executableName = executableName; 7.419 - this.coreFileName = coreFileName; 7.420 - startupMode = CORE_FILE_MODE; 7.421 - isServer = true; 7.422 - serverID = uniqueID; 7.423 - go(); 7.424 - } 7.425 - 7.426 - /** This opens a core file on the local machine and starts a debug 7.427 - server, allowing remote machines to connect and examine this 7.428 - core file.*/ 7.429 - public synchronized void startServer(String executableName, String coreFileName) 7.430 - throws DebuggerException { 7.431 - startServer(executableName, coreFileName, null); 7.432 - } 7.433 - 7.434 - /** This may only be called on the server side after startServer() 7.435 - has been called */ 7.436 - public synchronized boolean shutdownServer() throws DebuggerException { 7.437 - if (!isServer) { 7.438 - throw new DebuggerException("Should not call shutdownServer() for client configuration"); 7.439 - } 7.440 - return detachInternal(); 7.441 - } 7.442 - 7.443 - 7.444 - //-------------------------------------------------------------------------------- 7.445 - // Internals only below this point 7.446 - // 7.447 - 7.448 - private boolean detachInternal() { 7.449 - if (debugger == null) { 7.450 - return false; 7.451 - } 7.452 - if (canInteractWithJava()) { 7.453 - jvmdi.detach(); 7.454 - jvmdi = null; 7.455 - } 7.456 - boolean retval = true; 7.457 - if (!isServer) { 7.458 - VM.shutdown(); 7.459 - } 7.460 - // We must not call detach() if we are a client and are connected 7.461 - // to a remote debugger 7.462 - Debugger dbg = null; 7.463 - DebuggerException ex = null; 7.464 - if (isServer) { 7.465 - try { 7.466 - RMIHelper.unbind(serverID); 7.467 - } 7.468 - catch (DebuggerException de) { 7.469 - ex = de; 7.470 - } 7.471 - dbg = debugger; 7.472 - } else { 7.473 - if (startupMode != REMOTE_MODE) { 7.474 - dbg = debugger; 7.475 - } 7.476 - } 7.477 - if (dbg != null) { 7.478 - retval = dbg.detach(); 7.479 - } 7.480 - 7.481 - debugger = null; 7.482 - machDesc = null; 7.483 - db = null; 7.484 - if (ex != null) { 7.485 - throw(ex); 7.486 - } 7.487 - return retval; 7.488 - } 7.489 - 7.490 - private void go() { 7.491 - setupDebugger(); 7.492 - javaMode = setupVM(); 7.493 - } 7.494 - 7.495 - private void setupDebugger() { 7.496 - if (startupMode != REMOTE_MODE) { 7.497 - // 7.498 - // Local mode (client attaching to local process or setting up 7.499 - // server, but not client attaching to server) 7.500 - // 7.501 - 7.502 - try { 7.503 - os = PlatformInfo.getOS(); 7.504 - cpu = PlatformInfo.getCPU(); 7.505 - } 7.506 - catch (UnsupportedPlatformException e) { 7.507 - throw new DebuggerException(e); 7.508 - } 7.509 - fileSep = System.getProperty("file.separator"); 7.510 - 7.511 - if (os.equals("solaris")) { 7.512 - setupDebuggerSolaris(); 7.513 - } else if (os.equals("win32")) { 7.514 - setupDebuggerWin32(); 7.515 - } else if (os.equals("linux")) { 7.516 - setupDebuggerLinux(); 7.517 - } else if (os.equals("bsd")) { 7.518 - setupDebuggerBsd(); 7.519 - } else { 7.520 - // Add support for more operating systems here 7.521 - throw new DebuggerException("Operating system " + os + " not yet supported"); 7.522 - } 7.523 - if (isServer) { 7.524 - RemoteDebuggerServer remote = null; 7.525 - try { 7.526 - remote = new RemoteDebuggerServer(debugger); 7.527 - } 7.528 - catch (RemoteException rem) { 7.529 - throw new DebuggerException(rem); 7.530 - } 7.531 - RMIHelper.rebind(serverID, remote); 7.532 - } 7.533 - } else { 7.534 - // 7.535 - // Remote mode (client attaching to server) 7.536 - // 7.537 - 7.538 - // Create and install a security manager 7.539 - 7.540 - // FIXME: currently commented out because we were having 7.541 - // security problems since we're "in the sun.* hierarchy" here. 7.542 - // Perhaps a permissive policy file would work around this. In 7.543 - // the long run, will probably have to move into com.sun.*. 7.544 - 7.545 - // if (System.getSecurityManager() == null) { 7.546 - // System.setSecurityManager(new RMISecurityManager()); 7.547 - // } 7.548 - 7.549 - connectRemoteDebugger(); 7.550 - } 7.551 - } 7.552 - 7.553 - private boolean setupVM() { 7.554 - // We need to instantiate a HotSpotTypeDataBase on both the client 7.555 - // and server machine. On the server it is only currently used to 7.556 - // configure the Java primitive type sizes (which we should 7.557 - // consider making constant). On the client it is used to 7.558 - // configure the VM. 7.559 - 7.560 - try { 7.561 - if (os.equals("solaris")) { 7.562 - db = new HotSpotTypeDataBase(machDesc, new HotSpotSolarisVtblAccess(debugger, jvmLibNames), 7.563 - debugger, jvmLibNames); 7.564 - } else if (os.equals("win32")) { 7.565 - db = new HotSpotTypeDataBase(machDesc, new Win32VtblAccess(debugger, jvmLibNames), 7.566 - debugger, jvmLibNames); 7.567 - } else if (os.equals("linux")) { 7.568 - db = new HotSpotTypeDataBase(machDesc, new LinuxVtblAccess(debugger, jvmLibNames), 7.569 - debugger, jvmLibNames); 7.570 - } else if (os.equals("bsd")) { 7.571 - db = new HotSpotTypeDataBase(machDesc, new BsdVtblAccess(debugger, jvmLibNames), 7.572 - debugger, jvmLibNames); 7.573 - } else { 7.574 - throw new DebuggerException("OS \"" + os + "\" not yet supported (no VtblAccess implemented yet)"); 7.575 - } 7.576 - } 7.577 - catch (NoSuchSymbolException e) { 7.578 - e.printStackTrace(); 7.579 - return false; 7.580 - } 7.581 - 7.582 - if (startupMode != REMOTE_MODE) { 7.583 - // Configure the debugger with the primitive type sizes just obtained from the VM 7.584 - debugger.configureJavaPrimitiveTypeSizes(db.getJBooleanType().getSize(), 7.585 - db.getJByteType().getSize(), 7.586 - db.getJCharType().getSize(), 7.587 - db.getJDoubleType().getSize(), 7.588 - db.getJFloatType().getSize(), 7.589 - db.getJIntType().getSize(), 7.590 - db.getJLongType().getSize(), 7.591 - db.getJShortType().getSize()); 7.592 - } 7.593 - 7.594 - if (!isServer) { 7.595 - // Do not initialize the VM on the server (unnecessary, since it's 7.596 - // instantiated on the client) 7.597 - VM.initialize(db, debugger); 7.598 - } 7.599 - 7.600 - try { 7.601 - jvmdi = new ServiceabilityAgentJVMDIModule(debugger, saLibNames); 7.602 - if (jvmdi.canAttach()) { 7.603 - jvmdi.attach(); 7.604 - jvmdi.setCommandTimeout(6000); 7.605 - debugPrintln("Attached to Serviceability Agent's JVMDI module."); 7.606 - // Jog VM to suspended point with JVMDI module 7.607 - resume(); 7.608 - suspendJava(); 7.609 - suspend(); 7.610 - debugPrintln("Suspended all Java threads."); 7.611 - } else { 7.612 - debugPrintln("Could not locate SA's JVMDI module; skipping attachment"); 7.613 - jvmdi = null; 7.614 - } 7.615 - } catch (Exception e) { 7.616 - e.printStackTrace(); 7.617 - jvmdi = null; 7.618 - } 7.619 - 7.620 - return true; 7.621 - } 7.622 - 7.623 - //-------------------------------------------------------------------------------- 7.624 - // OS-specific debugger setup/connect routines 7.625 - // 7.626 - 7.627 - // 7.628 - // Solaris 7.629 - // 7.630 - 7.631 - private void setupDebuggerSolaris() { 7.632 - setupJVMLibNamesSolaris(); 7.633 - ProcDebuggerLocal dbg = new ProcDebuggerLocal(null, true); 7.634 - debugger = dbg; 7.635 - attachDebugger(); 7.636 - 7.637 - // Set up CPU-dependent stuff 7.638 - if (cpu.equals("x86")) { 7.639 - machDesc = new MachineDescriptionIntelX86(); 7.640 - } else if (cpu.equals("sparc")) { 7.641 - int addressSize = dbg.getRemoteProcessAddressSize(); 7.642 - if (addressSize == -1) { 7.643 - throw new DebuggerException("Error occurred while trying to determine the remote process's address size"); 7.644 - } 7.645 - 7.646 - if (addressSize == 32) { 7.647 - machDesc = new MachineDescriptionSPARC32Bit(); 7.648 - } else if (addressSize == 64) { 7.649 - machDesc = new MachineDescriptionSPARC64Bit(); 7.650 - } else { 7.651 - throw new DebuggerException("Address size " + addressSize + " is not supported on SPARC"); 7.652 - } 7.653 - } else if (cpu.equals("amd64")) { 7.654 - machDesc = new MachineDescriptionAMD64(); 7.655 - } else { 7.656 - throw new DebuggerException("Solaris only supported on sparc/sparcv9/x86/amd64"); 7.657 - } 7.658 - 7.659 - dbg.setMachineDescription(machDesc); 7.660 - } 7.661 - 7.662 - private void connectRemoteDebugger() throws DebuggerException { 7.663 - RemoteDebugger remote = 7.664 - (RemoteDebugger) RMIHelper.lookup(debugServerID); 7.665 - debugger = new RemoteDebuggerClient(remote); 7.666 - machDesc = ((RemoteDebuggerClient) debugger).getMachineDescription(); 7.667 - os = debugger.getOS(); 7.668 - if (os.equals("solaris")) { 7.669 - setupJVMLibNamesSolaris(); 7.670 - } else if (os.equals("win32")) { 7.671 - setupJVMLibNamesWin32(); 7.672 - } else if (os.equals("linux")) { 7.673 - setupJVMLibNamesLinux(); 7.674 - } else if (os.equals("bsd")) { 7.675 - setupJVMLibNamesBsd(); 7.676 - } else { 7.677 - throw new RuntimeException("Unknown OS type"); 7.678 - } 7.679 - 7.680 - cpu = debugger.getCPU(); 7.681 - } 7.682 - 7.683 - private void setupJVMLibNamesSolaris() { 7.684 - jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so", "gamma_g" }; 7.685 - saLibNames = new String[] { "libsa.so", "libsa_g.so" }; 7.686 - } 7.687 - 7.688 - // 7.689 - // Win32 7.690 - // 7.691 - 7.692 - private void setupDebuggerWin32() { 7.693 - setupJVMLibNamesWin32(); 7.694 - 7.695 - if (cpu.equals("x86")) { 7.696 - machDesc = new MachineDescriptionIntelX86(); 7.697 - } else if (cpu.equals("amd64")) { 7.698 - machDesc = new MachineDescriptionAMD64(); 7.699 - } else if (cpu.equals("ia64")) { 7.700 - machDesc = new MachineDescriptionIA64(); 7.701 - } else { 7.702 - throw new DebuggerException("Win32 supported under x86, amd64 and ia64 only"); 7.703 - } 7.704 - 7.705 - // Note we do not use a cache for the local debugger in server 7.706 - // mode; it will be taken care of on the client side (once remote 7.707 - // debugging is implemented). 7.708 - 7.709 - debugger = new WindbgDebuggerLocal(machDesc, !isServer); 7.710 - 7.711 - attachDebugger(); 7.712 - } 7.713 - 7.714 - private void setupJVMLibNamesWin32() { 7.715 - jvmLibNames = new String[] { "jvm.dll", "jvm_g.dll" }; 7.716 - saLibNames = new String[] { "sa.dll", "sa_g.dll" }; 7.717 - } 7.718 - 7.719 - // 7.720 - // Linux 7.721 - // 7.722 - 7.723 - private void setupDebuggerLinux() { 7.724 - setupJVMLibNamesLinux(); 7.725 - 7.726 - if (cpu.equals("x86")) { 7.727 - machDesc = new MachineDescriptionIntelX86(); 7.728 - } else if (cpu.equals("ia64")) { 7.729 - machDesc = new MachineDescriptionIA64(); 7.730 - } else if (cpu.equals("amd64")) { 7.731 - machDesc = new MachineDescriptionAMD64(); 7.732 - } else if (cpu.equals("sparc")) { 7.733 - if (LinuxDebuggerLocal.getAddressSize()==8) { 7.734 - machDesc = new MachineDescriptionSPARC64Bit(); 7.735 - } else { 7.736 - machDesc = new MachineDescriptionSPARC32Bit(); 7.737 - } 7.738 - } else { 7.739 - try { 7.740 - machDesc = (MachineDescription) 7.741 - Class.forName("sun.jvm.hotspot.debugger.MachineDescription" + 7.742 - cpu.toUpperCase()).newInstance(); 7.743 - } catch (Exception e) { 7.744 - throw new DebuggerException("unsupported machine type"); 7.745 - } 7.746 - } 7.747 - 7.748 - 7.749 - // Note we do not use a cache for the local debugger in server 7.750 - // mode; it will be taken care of on the client side (once remote 7.751 - // debugging is implemented). 7.752 - 7.753 - debugger = new LinuxDebuggerLocal(machDesc, !isServer); 7.754 - attachDebugger(); 7.755 - } 7.756 - 7.757 - private void setupJVMLibNamesLinux() { 7.758 - // same as solaris 7.759 - setupJVMLibNamesSolaris(); 7.760 - } 7.761 - 7.762 - // 7.763 - // BSD 7.764 - // 7.765 - 7.766 - private void setupDebuggerBsd() { 7.767 - setupJVMLibNamesBsd(); 7.768 - 7.769 - if (cpu.equals("x86")) { 7.770 - machDesc = new MachineDescriptionIntelX86(); 7.771 - } else if (cpu.equals("amd64") || (cpu.equals("x86_64"))) { 7.772 - machDesc = new MachineDescriptionAMD64(); 7.773 - } else { 7.774 - throw new DebuggerException("Bsd only supported on x86/x86_64. Current arch: " + cpu); 7.775 - } 7.776 - 7.777 - // Note we do not use a cache for the local debugger in server 7.778 - // mode; it will be taken care of on the client side (once remote 7.779 - // debugging is implemented). 7.780 - 7.781 - debugger = new BsdDebuggerLocal(machDesc, !isServer); 7.782 - attachDebugger(); 7.783 - } 7.784 - 7.785 - private void setupJVMLibNamesBsd() { 7.786 - // same as solaris 7.787 - setupJVMLibNamesSolaris(); 7.788 - } 7.789 - 7.790 - /** Convenience routine which should be called by per-platform 7.791 - debugger setup. Should not be called when startupMode is 7.792 - REMOTE_MODE. */ 7.793 - private void attachDebugger() { 7.794 - if (startupMode == PROCESS_MODE) { 7.795 - debugger.attach(pid); 7.796 - } else if (startupMode == CORE_FILE_MODE) { 7.797 - debugger.attach(executableName, coreFileName); 7.798 - } else { 7.799 - throw new DebuggerException("Should not call attach() for startupMode == " + startupMode); 7.800 - } 7.801 - } 7.802 -}
8.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/JavaLineNumberInfo.java Fri Feb 22 10:12:00 2013 -0800 8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 8.3 @@ -1,55 +0,0 @@ 8.4 -/* 8.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. 8.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.7 - * 8.8 - * This code is free software; you can redistribute it and/or modify it 8.9 - * under the terms of the GNU General Public License version 2 only, as 8.10 - * published by the Free Software Foundation. 8.11 - * 8.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 8.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 8.15 - * version 2 for more details (a copy is included in the LICENSE file that 8.16 - * accompanied this code). 8.17 - * 8.18 - * You should have received a copy of the GNU General Public License version 8.19 - * 2 along with this work; if not, write to the Free Software Foundation, 8.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 8.21 - * 8.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 8.23 - * or visit www.oracle.com if you need additional information or have any 8.24 - * questions. 8.25 - * 8.26 - */ 8.27 - 8.28 -package sun.jvm.hotspot.bugspot; 8.29 - 8.30 -import sun.jvm.hotspot.oops.*; 8.31 - 8.32 -/** Wrapper class which describes line number information for Java 8.33 - class files. The line number table is converted into this 8.34 - representation on demand. These objects are then sorted by line 8.35 - number for fast lookup when setting breakpoints in a particular 8.36 - source file. */ 8.37 - 8.38 -public class JavaLineNumberInfo { 8.39 - private InstanceKlass klass; 8.40 - private Method method; 8.41 - private int startBCI; 8.42 - private int lineNumber; 8.43 - 8.44 - public JavaLineNumberInfo(InstanceKlass klass, 8.45 - Method method, 8.46 - int startBCI, 8.47 - int lineNumber) { 8.48 - this.klass = klass; 8.49 - this.method = method; 8.50 - this.startBCI = startBCI; 8.51 - this.lineNumber = lineNumber; 8.52 - } 8.53 - 8.54 - public InstanceKlass getKlass() { return klass; } 8.55 - public Method getMethod() { return method; } 8.56 - public int getStartBCI() { return startBCI; } 8.57 - public int getLineNumber() { return lineNumber; } 8.58 -}
9.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/Main.java Fri Feb 22 10:12:00 2013 -0800 9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 9.3 @@ -1,52 +0,0 @@ 9.4 -/* 9.5 - * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved. 9.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.7 - * 9.8 - * This code is free software; you can redistribute it and/or modify it 9.9 - * under the terms of the GNU General Public License version 2 only, as 9.10 - * published by the Free Software Foundation. 9.11 - * 9.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 9.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 9.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 9.15 - * version 2 for more details (a copy is included in the LICENSE file that 9.16 - * accompanied this code). 9.17 - * 9.18 - * You should have received a copy of the GNU General Public License version 9.19 - * 2 along with this work; if not, write to the Free Software Foundation, 9.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 9.21 - * 9.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 9.23 - * or visit www.oracle.com if you need additional information or have any 9.24 - * questions. 9.25 - * 9.26 - */ 9.27 - 9.28 -package sun.jvm.hotspot.bugspot; 9.29 - 9.30 -import java.awt.*; 9.31 -import java.awt.event.*; 9.32 -import javax.swing.*; 9.33 - 9.34 -import sun.jvm.hotspot.ui.*; 9.35 - 9.36 -/** The main class for the BugSpot debugger. */ 9.37 - 9.38 -public class Main { 9.39 - public static void main(String[] args) { 9.40 - JFrame frame = new JFrame("BugSpot"); 9.41 - frame.setSize(800, 600); 9.42 - BugSpot db = new BugSpot(); 9.43 - db.setMDIMode(true); 9.44 - db.build(); 9.45 - frame.setJMenuBar(db.getMenuBar()); 9.46 - frame.getContentPane().add(db); 9.47 - frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); 9.48 - 9.49 - GraphicsUtilities.reshapeToAspectRatio(frame, 9.50 - 4.0f/3.0f, 0.85f, Toolkit.getDefaultToolkit().getScreenSize()); 9.51 - GraphicsUtilities.centerInContainer(frame, 9.52 - Toolkit.getDefaultToolkit().getScreenSize()); 9.53 - frame.setVisible(true); 9.54 - } 9.55 -}
10.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/PCFinder.java Fri Feb 22 10:12:00 2013 -0800 10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 10.3 @@ -1,96 +0,0 @@ 10.4 -/* 10.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. 10.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.7 - * 10.8 - * This code is free software; you can redistribute it and/or modify it 10.9 - * under the terms of the GNU General Public License version 2 only, as 10.10 - * published by the Free Software Foundation. 10.11 - * 10.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 10.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.15 - * version 2 for more details (a copy is included in the LICENSE file that 10.16 - * accompanied this code). 10.17 - * 10.18 - * You should have received a copy of the GNU General Public License version 10.19 - * 2 along with this work; if not, write to the Free Software Foundation, 10.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.21 - * 10.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 10.23 - * or visit www.oracle.com if you need additional information or have any 10.24 - * questions. 10.25 - * 10.26 - */ 10.27 - 10.28 -package sun.jvm.hotspot.bugspot; 10.29 - 10.30 -import sun.jvm.hotspot.debugger.*; 10.31 -import sun.jvm.hotspot.debugger.cdbg.*; 10.32 - 10.33 -/** Helper class for locating a program counter. Indicates the 10.34 - confidence of the find. */ 10.35 - 10.36 -public class PCFinder { 10.37 - public static final int LOW_CONFIDENCE = 1; 10.38 - public static final int HIGH_CONFIDENCE = 2; 10.39 - 10.40 - public static class Info { 10.41 - private String name; 10.42 - private long offset; 10.43 - private int confidence; 10.44 - 10.45 - public Info(String name, long offset, int confidence) { 10.46 - this.name = name; 10.47 - this.offset = offset; 10.48 - this.confidence = confidence; 10.49 - } 10.50 - 10.51 - /** May be null */ 10.52 - public String getName() { return name; } 10.53 - 10.54 - /** If this is -1, a symbol could not be found, and the offset 10.55 - should not be shown */ 10.56 - public long getOffset() { return offset; } 10.57 - 10.58 - /** PCFinder.LOW_CONFIDENCE or PCFinder.HIGH_CONFIDENCE */ 10.59 - public int getConfidence() { return confidence; } 10.60 - } 10.61 - 10.62 - /** Passed loadobject may be null in which case the returned Info 10.63 - object has low confidence */ 10.64 - public static Info findPC(Address pc, LoadObject lo, CDebugger dbg) { 10.65 - if (lo == null) { 10.66 - return new Info(null, -1, LOW_CONFIDENCE); 10.67 - } 10.68 - 10.69 - // First try debug info 10.70 - BlockSym sym = lo.debugInfoForPC(pc); 10.71 - while (sym != null) { 10.72 - if (sym.isFunction()) { 10.73 - // Highest confidence 10.74 - return new Info(sym.toString(), pc.minus(sym.getAddress()), HIGH_CONFIDENCE); 10.75 - } 10.76 - } 10.77 - 10.78 - // Now try looking up symbol in loadobject 10.79 - 10.80 - // FIXME: must add support for mapfiles on Win32 and try looking 10.81 - // up there first if possible. Should we hide that behind 10.82 - // LoadObject.closestSymbolToPC and have the ClosestSymbol return 10.83 - // confidence? I think so. On Solaris there is no notion of a 10.84 - // mapfile, and the confidence for closestSymbolToPC will be high 10.85 - // instead of low. 10.86 - 10.87 - int confidence = HIGH_CONFIDENCE; 10.88 - 10.89 - ClosestSymbol cs = lo.closestSymbolToPC(pc); 10.90 - if (cs != null) { 10.91 - // FIXME: currently low confidence (only on Win32) 10.92 - return new Info(cs.getName() + "()", cs.getOffset(), LOW_CONFIDENCE); 10.93 - } 10.94 - 10.95 - // Unknown location 10.96 - return new Info(dbg.getNameOfFile(lo.getName()).toUpperCase() + 10.97 - "! " + pc + "()", -1, HIGH_CONFIDENCE); 10.98 - } 10.99 -}
11.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/PackageScanner.java Fri Feb 22 10:12:00 2013 -0800 11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 11.3 @@ -1,89 +0,0 @@ 11.4 -/* 11.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. 11.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.7 - * 11.8 - * This code is free software; you can redistribute it and/or modify it 11.9 - * under the terms of the GNU General Public License version 2 only, as 11.10 - * published by the Free Software Foundation. 11.11 - * 11.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 11.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11.15 - * version 2 for more details (a copy is included in the LICENSE file that 11.16 - * accompanied this code). 11.17 - * 11.18 - * You should have received a copy of the GNU General Public License version 11.19 - * 2 along with this work; if not, write to the Free Software Foundation, 11.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 11.21 - * 11.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 11.23 - * or visit www.oracle.com if you need additional information or have any 11.24 - * questions. 11.25 - * 11.26 - */ 11.27 - 11.28 -package sun.jvm.hotspot.bugspot; 11.29 - 11.30 -import java.io.*; 11.31 - 11.32 -/** Scans a .java file for the package that it is in. */ 11.33 - 11.34 -public class PackageScanner { 11.35 - 11.36 - public PackageScanner() { 11.37 - } 11.38 - 11.39 - public String scan(String filename) { 11.40 - return scan(new File(filename)); 11.41 - } 11.42 - 11.43 - /** Returns the String comprising the package name of the classes in 11.44 - this .java file. Returns the (non-null) empty string if any 11.45 - error occurs or if the classes are in the unnamed package. */ 11.46 - public String scan(File file) { 11.47 - BufferedReader buf = null; 11.48 - String res = ""; 11.49 - try { 11.50 - buf = new BufferedReader(new FileReader(file)); 11.51 - StreamTokenizer tok = new StreamTokenizer(buf); 11.52 - tok.slashStarComments(true); 11.53 - tok.slashSlashComments(true); 11.54 - if (tok.nextToken() != StreamTokenizer.TT_WORD) { 11.55 - return res; 11.56 - } 11.57 - if (!tok.sval.equals("package")) { 11.58 - return res; 11.59 - } 11.60 - if (tok.nextToken() != StreamTokenizer.TT_WORD) { 11.61 - return res; 11.62 - } 11.63 - res = tok.sval; 11.64 - return res; 11.65 - } catch (FileNotFoundException e) { 11.66 - return res; 11.67 - } catch (IOException e) { 11.68 - return res; 11.69 - } finally { 11.70 - try { 11.71 - if (buf != null) { 11.72 - buf.close(); 11.73 - } 11.74 - } catch (IOException e) { 11.75 - } 11.76 - } 11.77 - } 11.78 - 11.79 - public static void main(String[] args) { 11.80 - if (args.length != 1) { 11.81 - usage(); 11.82 - } 11.83 - 11.84 - System.out.println(new PackageScanner().scan(args[0])); 11.85 - } 11.86 - 11.87 - private static void usage() { 11.88 - System.err.println("Usage: java PackageScanner <.java file name>"); 11.89 - System.err.println("Prints package the .java file is in to stdout."); 11.90 - System.exit(1); 11.91 - } 11.92 -}
12.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/RegisterPanel.java Fri Feb 22 10:12:00 2013 -0800 12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 12.3 @@ -1,173 +0,0 @@ 12.4 -/* 12.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. 12.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.7 - * 12.8 - * This code is free software; you can redistribute it and/or modify it 12.9 - * under the terms of the GNU General Public License version 2 only, as 12.10 - * published by the Free Software Foundation. 12.11 - * 12.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 12.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12.15 - * version 2 for more details (a copy is included in the LICENSE file that 12.16 - * accompanied this code). 12.17 - * 12.18 - * You should have received a copy of the GNU General Public License version 12.19 - * 2 along with this work; if not, write to the Free Software Foundation, 12.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 12.21 - * 12.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 12.23 - * or visit www.oracle.com if you need additional information or have any 12.24 - * questions. 12.25 - * 12.26 - */ 12.27 - 12.28 -package sun.jvm.hotspot.bugspot; 12.29 - 12.30 -import java.awt.*; 12.31 -import java.util.*; 12.32 -import javax.swing.*; 12.33 -import javax.swing.table.*; 12.34 - 12.35 -import sun.jvm.hotspot.debugger.*; 12.36 - 12.37 -/** Displays registers in a window. FIXME: this will need more work to 12.38 - understand and handle register windows. */ 12.39 - 12.40 -public class RegisterPanel extends JPanel { 12.41 - private java.util.List/*<RegisterInfo>*/ registers; 12.42 - private AbstractTableModel dataModel; 12.43 - private boolean valid; 12.44 - private boolean editable; 12.45 - private String nullAddressString; 12.46 - private ThreadProxy curThread; 12.47 - private JTable table; 12.48 - 12.49 - static class RegisterInfo { 12.50 - private String name; 12.51 - private Address value; 12.52 - 12.53 - RegisterInfo(String name, Address value) { 12.54 - this.name = name; 12.55 - this.value = value; 12.56 - } 12.57 - 12.58 - String getName() { return name; } 12.59 - Address getValue() { return value; } 12.60 - } 12.61 - 12.62 - public RegisterPanel() { 12.63 - super(); 12.64 - 12.65 - registers = new ArrayList(); 12.66 - 12.67 - dataModel = new AbstractTableModel() { 12.68 - public int getColumnCount() { return 2; } 12.69 - public int getRowCount() { return registers.size(); } 12.70 - public String getColumnName(int col) { 12.71 - switch (col) { 12.72 - case 0: 12.73 - return "Register Name"; 12.74 - case 1: 12.75 - return "Register Value"; 12.76 - default: 12.77 - throw new RuntimeException("Index " + col + " out of bounds"); 12.78 - } 12.79 - } 12.80 - public Object getValueAt(int row, int col) { 12.81 - RegisterInfo info = (RegisterInfo) registers.get(row); 12.82 - 12.83 - switch (col) { 12.84 - case 0: 12.85 - return info.getName(); 12.86 - case 1: 12.87 - if (valid) { 12.88 - Address val = info.getValue(); 12.89 - if (val != null) { 12.90 - return val; 12.91 - } else { 12.92 - return nullAddressString; 12.93 - } 12.94 - } else { 12.95 - return "-"; 12.96 - } 12.97 - default: 12.98 - throw new RuntimeException("Index (" + col + ", " + row + ") out of bounds"); 12.99 - } 12.100 - } 12.101 - public boolean isCellEditable(int row, int col) { 12.102 - if (col == 0) return false; 12.103 - if (!valid) return false; 12.104 - if (curThread == null) return false; 12.105 - if (!curThread.canSetContext()) return false; 12.106 - 12.107 - // FIXME: add listener to watch for register changes 12.108 - // return true; 12.109 - return false; 12.110 - } 12.111 - }; 12.112 - 12.113 - // Build user interface 12.114 - setLayout(new BorderLayout()); 12.115 - table = new JTable(dataModel); 12.116 - table.setCellSelectionEnabled(true); 12.117 - table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); 12.118 - table.setDragEnabled(true); 12.119 - JTableHeader header = table.getTableHeader(); 12.120 - header.setReorderingAllowed(false); 12.121 - JScrollPane scrollPane = new JScrollPane(table); 12.122 - add(scrollPane, BorderLayout.CENTER); 12.123 - } 12.124 - 12.125 - 12.126 - /** Updates the register panel with the register set from the 12.127 - specified thread. Call this when the process has been suspended 12.128 - and the current thread has been set. FIXME: this interface will 12.129 - need to change to support register windows. */ 12.130 - public void update(ThreadProxy curThread) { 12.131 - this.curThread = curThread; 12.132 - ThreadContext context = curThread.getContext(); 12.133 - editable = curThread.canSetContext(); 12.134 - registers.clear(); 12.135 - for (int i = 0; i < context.getNumRegisters(); i++) { 12.136 - String name = context.getRegisterName(i); 12.137 - Address addr = context.getRegisterAsAddress(i); 12.138 - if ((nullAddressString == null) && (addr != null)) { 12.139 - String addrStr = addr.toString(); 12.140 - StringBuffer buf = new StringBuffer(); 12.141 - buf.append("0x"); 12.142 - int len = addrStr.length() - 2; 12.143 - for (int j = 0; j < len; j++) { 12.144 - buf.append("0"); 12.145 - } 12.146 - nullAddressString = buf.toString(); 12.147 - } 12.148 - registers.add(new RegisterInfo(name, addr)); 12.149 - } 12.150 - valid = true; 12.151 - SwingUtilities.invokeLater(new Runnable() { 12.152 - public void run() { 12.153 - dataModel.fireTableDataChanged(); 12.154 - } 12.155 - }); 12.156 - } 12.157 - 12.158 - /** Clears the registers' values. Call this when the processs has 12.159 - been resumed. */ 12.160 - public void clear() { 12.161 - valid = false; 12.162 - nullAddressString = null; 12.163 - SwingUtilities.invokeLater(new Runnable() { 12.164 - public void run() { 12.165 - dataModel.fireTableDataChanged(); 12.166 - } 12.167 - }); 12.168 - } 12.169 - 12.170 - public void setFont(Font font) { 12.171 - super.setFont(font); 12.172 - if (table != null) { 12.173 - table.setFont(font); 12.174 - } 12.175 - } 12.176 -}
13.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/StackTraceEntry.java Fri Feb 22 10:12:00 2013 -0800 13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 13.3 @@ -1,87 +0,0 @@ 13.4 -/* 13.5 - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. 13.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.7 - * 13.8 - * This code is free software; you can redistribute it and/or modify it 13.9 - * under the terms of the GNU General Public License version 2 only, as 13.10 - * published by the Free Software Foundation. 13.11 - * 13.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 13.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13.15 - * version 2 for more details (a copy is included in the LICENSE file that 13.16 - * accompanied this code). 13.17 - * 13.18 - * You should have received a copy of the GNU General Public License version 13.19 - * 2 along with this work; if not, write to the Free Software Foundation, 13.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 13.21 - * 13.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 13.23 - * or visit www.oracle.com if you need additional information or have any 13.24 - * questions. 13.25 - * 13.26 - */ 13.27 - 13.28 -package sun.jvm.hotspot.bugspot; 13.29 - 13.30 -import sun.jvm.hotspot.debugger.cdbg.*; 13.31 -import sun.jvm.hotspot.oops.*; 13.32 -import sun.jvm.hotspot.runtime.*; 13.33 - 13.34 -/** This class describes a frame in a stack trace. It abstracts over 13.35 - C/C++ and Java frames. */ 13.36 - 13.37 -public class StackTraceEntry { 13.38 - private CFrame cFrame; 13.39 - private CDebugger dbg; 13.40 - private JavaVFrame javaFrame; 13.41 - private String value; // What is displayed in a stack trace 13.42 - // For merging C and Java stack traces. 13.43 - // For more precise stack traces, should probably have a way to 13.44 - // convert a CFrame to a sun.jvm.hotspot.runtime.Frame. For now, 13.45 - // doing similar algorithm to jdbx (which does not have intimate 13.46 - // knowledge of the VM). 13.47 - private boolean isUnknownCFrame; 13.48 - 13.49 - public StackTraceEntry(CFrame cFrame, CDebugger dbg) { 13.50 - this.cFrame = cFrame; 13.51 - this.dbg = dbg; 13.52 - computeValue(); 13.53 - } 13.54 - 13.55 - public StackTraceEntry(JavaVFrame javaFrame) { 13.56 - this.javaFrame = javaFrame; 13.57 - computeValue(); 13.58 - } 13.59 - 13.60 - public boolean isCFrame() { return (cFrame != null); } 13.61 - public boolean isJavaFrame() { return (javaFrame != null); } 13.62 - public CFrame getCFrame() { return cFrame; } 13.63 - public JavaVFrame getJavaFrame() { return javaFrame; } 13.64 - public boolean isUnknownCFrame() { return isUnknownCFrame; } 13.65 - public String toString() { 13.66 - return value; 13.67 - } 13.68 - 13.69 - private void computeValue() { 13.70 - isUnknownCFrame = true; 13.71 - value = "<unknown>"; 13.72 - if (cFrame != null) { 13.73 - PCFinder.Info info = PCFinder.findPC(cFrame.pc(), cFrame.loadObjectForPC(), dbg); 13.74 - if (info.getName() != null) { 13.75 - value = "(C) " + info.getName(); 13.76 - isUnknownCFrame = false; 13.77 - if (info.getConfidence() == PCFinder.LOW_CONFIDENCE) { 13.78 - value = value + " (?)"; 13.79 - } 13.80 - if (info.getOffset() >= 0) { 13.81 - value = value + " + 0x" + Long.toHexString(info.getOffset()); 13.82 - } 13.83 - } 13.84 - } else if (javaFrame != null) { 13.85 - isUnknownCFrame = false; 13.86 - Method m = javaFrame.getMethod(); 13.87 - value = "(J) " + m.externalNameAndSignature(); 13.88 - } 13.89 - } 13.90 -}
14.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/StackTracePanel.java Fri Feb 22 10:12:00 2013 -0800 14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 14.3 @@ -1,115 +0,0 @@ 14.4 -/* 14.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. 14.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.7 - * 14.8 - * This code is free software; you can redistribute it and/or modify it 14.9 - * under the terms of the GNU General Public License version 2 only, as 14.10 - * published by the Free Software Foundation. 14.11 - * 14.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 14.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14.15 - * version 2 for more details (a copy is included in the LICENSE file that 14.16 - * accompanied this code). 14.17 - * 14.18 - * You should have received a copy of the GNU General Public License version 14.19 - * 2 along with this work; if not, write to the Free Software Foundation, 14.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 14.21 - * 14.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 14.23 - * or visit www.oracle.com if you need additional information or have any 14.24 - * questions. 14.25 - * 14.26 - */ 14.27 - 14.28 -package sun.jvm.hotspot.bugspot; 14.29 - 14.30 -import java.awt.*; 14.31 -import java.awt.event.*; 14.32 -import java.util.*; 14.33 -import javax.swing.*; 14.34 -import sun.jvm.hotspot.debugger.cdbg.*; 14.35 -import sun.jvm.hotspot.runtime.*; 14.36 -import sun.jvm.hotspot.ui.*; 14.37 - 14.38 -/** This panel contains a ListBox with all of the stack frames in a 14.39 - given thread. When a given entry is selected, an event is 14.40 - fired. */ 14.41 - 14.42 -public class StackTracePanel extends JPanel { 14.43 - public interface Listener { 14.44 - public void frameChanged(CFrame fr, JavaVFrame jfr); 14.45 - } 14.46 - 14.47 - class Model extends AbstractListModel implements ComboBoxModel { 14.48 - private Object selectedItem; 14.49 - public Object getElementAt(int index) { 14.50 - if (trace == null) return null; 14.51 - return trace.get(index); 14.52 - } 14.53 - public int getSize() { 14.54 - if (trace == null) return 0; 14.55 - return trace.size(); 14.56 - } 14.57 - public Object getSelectedItem() { 14.58 - return selectedItem; 14.59 - } 14.60 - public void setSelectedItem(Object item) { 14.61 - selectedItem = item; 14.62 - } 14.63 - public void dataChanged() { 14.64 - fireContentsChanged(this, 0, trace.size()); 14.65 - } 14.66 - } 14.67 - 14.68 - private java.util.List trace; 14.69 - private Model model; 14.70 - private JComboBox list; 14.71 - private java.util.List listeners; 14.72 - 14.73 - public StackTracePanel() { 14.74 - super(); 14.75 - 14.76 - model = new Model(); 14.77 - 14.78 - // Build user interface 14.79 - setLayout(new BorderLayout()); 14.80 - setBorder(GraphicsUtilities.newBorder(5)); 14.81 - list = new JComboBox(model); 14.82 - list.setPrototypeDisplayValue("ZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"); 14.83 - add(list, BorderLayout.CENTER); 14.84 - 14.85 - // Add selection listener 14.86 - list.addItemListener(new ItemListener() { 14.87 - public void itemStateChanged(ItemEvent e) { 14.88 - if (e.getStateChange() == ItemEvent.SELECTED) { 14.89 - fireFrameChanged(); 14.90 - } 14.91 - } 14.92 - }); 14.93 - } 14.94 - 14.95 - /** Takes a List of StackTraceEntry objects */ 14.96 - public void setTrace(java.util.List trace) { 14.97 - this.trace = trace; 14.98 - model.dataChanged(); 14.99 - list.setSelectedIndex(0); 14.100 - fireFrameChanged(); 14.101 - } 14.102 - 14.103 - public void addListener(Listener listener) { 14.104 - if (listeners == null) { 14.105 - listeners = new ArrayList(); 14.106 - } 14.107 - listeners.add(listener); 14.108 - } 14.109 - 14.110 - protected void fireFrameChanged() { 14.111 - if (listeners != null) { 14.112 - StackTraceEntry entry = (StackTraceEntry) trace.get(list.getSelectedIndex()); 14.113 - for (Iterator iter = listeners.iterator(); iter.hasNext(); ) { 14.114 - ((Listener) iter.next()).frameChanged(entry.getCFrame(), entry.getJavaFrame()); 14.115 - } 14.116 - } 14.117 - } 14.118 -}
15.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/ThreadListPanel.java Fri Feb 22 10:12:00 2013 -0800 15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 15.3 @@ -1,237 +0,0 @@ 15.4 -/* 15.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. 15.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.7 - * 15.8 - * This code is free software; you can redistribute it and/or modify it 15.9 - * under the terms of the GNU General Public License version 2 only, as 15.10 - * published by the Free Software Foundation. 15.11 - * 15.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 15.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15.15 - * version 2 for more details (a copy is included in the LICENSE file that 15.16 - * accompanied this code). 15.17 - * 15.18 - * You should have received a copy of the GNU General Public License version 15.19 - * 2 along with this work; if not, write to the Free Software Foundation, 15.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 15.21 - * 15.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 15.23 - * or visit www.oracle.com if you need additional information or have any 15.24 - * questions. 15.25 - * 15.26 - */ 15.27 - 15.28 -package sun.jvm.hotspot.bugspot; 15.29 - 15.30 -import java.awt.*; 15.31 -import java.awt.event.*; 15.32 -import java.util.*; 15.33 -import javax.swing.*; 15.34 -import javax.swing.table.*; 15.35 - 15.36 -import sun.jvm.hotspot.debugger.*; 15.37 -import sun.jvm.hotspot.debugger.cdbg.*; 15.38 -import sun.jvm.hotspot.runtime.*; 15.39 -import sun.jvm.hotspot.ui.*; 15.40 - 15.41 -// NOTE: this class was not placed in sun.jvm.hotspot.ui to prevent 15.42 -// mixing components designed for C and C++ debugging with the ones 15.43 -// that work with the core serviceability agent functionality (which 15.44 -// does not require that the CDebugger interface be implemented). 15.45 - 15.46 -/** The ThreadListPanel is used for C and C++ debugging and can 15.47 - visualize all threads in the target process. The caller passes in 15.48 - a CDebugger attached to the target process and can request that 15.49 - JavaThreads' associations with these underlying threads be 15.50 - displayed; this option is only valid when attached to a HotSpot 15.51 - JVM and when the {@link sun.jvm.hotspot.runtime.VM} has been 15.52 - initialized. */ 15.53 - 15.54 -public class ThreadListPanel extends JPanel { 15.55 - /** Listener which can be added to receive "Set Focus" events */ 15.56 - public static interface Listener { 15.57 - /** ThreadProxy will always be provided; JavaThread will only be 15.58 - present if displayJavaThreads was specified in the constructor 15.59 - for the panel and the thread was a JavaThread. */ 15.60 - public void setFocus(ThreadProxy thread, JavaThread jthread); 15.61 - } 15.62 - 15.63 - static class ThreadInfo { 15.64 - private ThreadProxy thread; 15.65 - // Distinguish between PC == null and no top frame 15.66 - private boolean gotPC; 15.67 - private Address pc; 15.68 - private String location; 15.69 - private JavaThread javaThread; 15.70 - private String javaThreadName; 15.71 - 15.72 - public ThreadInfo(ThreadProxy thread, CDebugger dbg, JavaThread jthread) { 15.73 - this.thread = thread; 15.74 - this.location = "<unknown>"; 15.75 - CFrame fr = dbg.topFrameForThread(thread); 15.76 - if (fr != null) { 15.77 - gotPC = true; 15.78 - pc = fr.pc(); 15.79 - PCFinder.Info info = PCFinder.findPC(pc, fr.loadObjectForPC(), dbg); 15.80 - if (info.getName() != null) { 15.81 - location = info.getName(); 15.82 - if (info.getConfidence() == PCFinder.LOW_CONFIDENCE) { 15.83 - location = location + " (?)"; 15.84 - } 15.85 - if (info.getOffset() < 0) { 15.86 - location = location + " + 0x" + Long.toHexString(info.getOffset()); 15.87 - } 15.88 - } 15.89 - } 15.90 - if (jthread != null) { 15.91 - javaThread = jthread; 15.92 - javaThreadName = jthread.getThreadName(); 15.93 - } 15.94 - } 15.95 - 15.96 - public ThreadProxy getThread() { return thread; } 15.97 - public boolean hasPC() { return gotPC; } 15.98 - public Address getPC() { return pc; } 15.99 - public String getLocation() { return location; } 15.100 - public boolean isJavaThread() { return (javaThread != null); } 15.101 - public JavaThread getJavaThread() { return javaThread; } 15.102 - public String getJavaThreadName() { return javaThreadName; } 15.103 - } 15.104 - 15.105 - // List<ThreadInfo> 15.106 - private java.util.List threadList; 15.107 - private JTable table; 15.108 - private AbstractTableModel dataModel; 15.109 - // List<Listener> 15.110 - private java.util.List listeners; 15.111 - 15.112 - /** Takes a CDebugger from which the thread list is queried. 15.113 - displayJavaThreads must only be set to true if the debugger is 15.114 - attached to a HotSpot JVM and if the VM has already been 15.115 - initialized. */ 15.116 - public ThreadListPanel(CDebugger dbg, final boolean displayJavaThreads) { 15.117 - super(); 15.118 - 15.119 - Map threadToJavaThreadMap = null; 15.120 - if (displayJavaThreads) { 15.121 - // Collect Java threads from virtual machine and insert them in 15.122 - // table for later querying 15.123 - threadToJavaThreadMap = new HashMap(); 15.124 - Threads threads = VM.getVM().getThreads(); 15.125 - for (JavaThread thr = threads.first(); thr != null; thr = thr.next()) { 15.126 - threadToJavaThreadMap.put(thr.getThreadProxy(), thr); 15.127 - } 15.128 - } 15.129 - 15.130 - java.util.List/*<ThreadProxy>*/ threads = dbg.getThreadList(); 15.131 - threadList = new ArrayList(threads.size()); 15.132 - for (Iterator iter = threads.iterator(); iter.hasNext(); ) { 15.133 - ThreadProxy thr = (ThreadProxy) iter.next(); 15.134 - JavaThread jthr = null; 15.135 - if (displayJavaThreads) { 15.136 - jthr = (JavaThread) threadToJavaThreadMap.get(thr); 15.137 - } 15.138 - threadList.add(new ThreadInfo(thr, dbg, jthr)); 15.139 - } 15.140 - 15.141 - // Thread ID, current PC, current symbol, Java Thread, [Java thread name] 15.142 - dataModel = new AbstractTableModel() { 15.143 - public int getColumnCount() { return (displayJavaThreads ? 5 : 3); } 15.144 - public int getRowCount() { return threadList.size(); } 15.145 - public String getColumnName(int col) { 15.146 - switch (col) { 15.147 - case 0: 15.148 - return "Thread ID"; 15.149 - case 1: 15.150 - return "PC"; 15.151 - case 2: 15.152 - return "Location"; 15.153 - case 3: 15.154 - return "Java?"; 15.155 - case 4: 15.156 - return "Java Thread Name"; 15.157 - default: 15.158 - throw new RuntimeException("Index " + col + " out of bounds"); 15.159 - } 15.160 - } 15.161 - public Object getValueAt(int row, int col) { 15.162 - ThreadInfo info = (ThreadInfo) threadList.get(row); 15.163 - 15.164 - switch (col) { 15.165 - case 0: 15.166 - return info.getThread(); 15.167 - case 1: 15.168 - { 15.169 - if (info.hasPC()) { 15.170 - return info.getPC(); 15.171 - } 15.172 - return "<no frames on stack>"; 15.173 - } 15.174 - case 2: 15.175 - return info.getLocation(); 15.176 - case 3: 15.177 - if (info.isJavaThread()) { 15.178 - return "Yes"; 15.179 - } else { 15.180 - return ""; 15.181 - } 15.182 - case 4: 15.183 - if (info.isJavaThread()) { 15.184 - return info.getJavaThreadName(); 15.185 - } else { 15.186 - return ""; 15.187 - } 15.188 - default: 15.189 - throw new RuntimeException("Index (" + col + ", " + row + ") out of bounds"); 15.190 - } 15.191 - } 15.192 - }; 15.193 - 15.194 - // Build user interface 15.195 - setLayout(new BorderLayout()); 15.196 - table = new JTable(dataModel); 15.197 - table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 15.198 - JTableHeader header = table.getTableHeader(); 15.199 - header.setReorderingAllowed(false); 15.200 - table.setRowSelectionAllowed(true); 15.201 - table.setColumnSelectionAllowed(false); 15.202 - JScrollPane scrollPane = new JScrollPane(table); 15.203 - add(scrollPane, BorderLayout.CENTER); 15.204 - if (threadList.size() > 0) { 15.205 - table.setRowSelectionInterval(0, 0); 15.206 - } 15.207 - 15.208 - JButton button = new JButton("Set Focus"); 15.209 - button.addActionListener(new ActionListener() { 15.210 - public void actionPerformed(ActionEvent e) { 15.211 - int i = table.getSelectedRow(); 15.212 - if (i < 0) { 15.213 - return; 15.214 - } 15.215 - ThreadInfo info = (ThreadInfo) threadList.get(i); 15.216 - for (Iterator iter = listeners.iterator(); iter.hasNext(); ) { 15.217 - ((Listener) iter.next()).setFocus(info.getThread(), info.getJavaThread()); 15.218 - } 15.219 - } 15.220 - }); 15.221 - JPanel focusPanel = new JPanel(); 15.222 - focusPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); 15.223 - focusPanel.setLayout(new BoxLayout(focusPanel, BoxLayout.Y_AXIS)); 15.224 - focusPanel.add(Box.createGlue()); 15.225 - focusPanel.add(button); 15.226 - focusPanel.add(Box.createGlue()); 15.227 - add(focusPanel, BorderLayout.EAST); 15.228 - 15.229 - // FIXME: make listener model for the debugger so if the user 15.230 - // specifies a mapfile for or path to a given DSO later we can 15.231 - // update our state 15.232 - } 15.233 - 15.234 - public void addListener(Listener l) { 15.235 - if (listeners == null) { 15.236 - listeners = new ArrayList(); 15.237 - } 15.238 - listeners.add(l); 15.239 - } 15.240 -}
16.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/VariablePanel.java Fri Feb 22 10:12:00 2013 -0800 16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 16.3 @@ -1,252 +0,0 @@ 16.4 -/* 16.5 - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. 16.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.7 - * 16.8 - * This code is free software; you can redistribute it and/or modify it 16.9 - * under the terms of the GNU General Public License version 2 only, as 16.10 - * published by the Free Software Foundation. 16.11 - * 16.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 16.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16.15 - * version 2 for more details (a copy is included in the LICENSE file that 16.16 - * accompanied this code). 16.17 - * 16.18 - * You should have received a copy of the GNU General Public License version 16.19 - * 2 along with this work; if not, write to the Free Software Foundation, 16.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 16.21 - * 16.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 16.23 - * or visit www.oracle.com if you need additional information or have any 16.24 - * questions. 16.25 - * 16.26 - */ 16.27 - 16.28 -package sun.jvm.hotspot.bugspot; 16.29 - 16.30 -import java.awt.*; 16.31 -import javax.swing.*; 16.32 -import java.util.*; 16.33 -import sun.jvm.hotspot.debugger.*; 16.34 -import sun.jvm.hotspot.debugger.cdbg.*; 16.35 -import sun.jvm.hotspot.bugspot.tree.*; 16.36 -import sun.jvm.hotspot.oops.*; 16.37 -import sun.jvm.hotspot.runtime.*; 16.38 -import sun.jvm.hotspot.ui.tree.*; 16.39 -import sun.jvm.hotspot.ui.treetable.*; 16.40 - 16.41 -/** Manages display of a set of local variables in a frame, or the 16.42 - contents of the "this" pointer */ 16.43 - 16.44 -public class VariablePanel extends JPanel { 16.45 - private JTreeTable treeTable; 16.46 - private SimpleTreeTableModel model; 16.47 - private SimpleTreeGroupNode root; 16.48 - 16.49 - public VariablePanel() { 16.50 - super(); 16.51 - 16.52 - model = new SimpleTreeTableModel(); 16.53 - model.setValuesEditable(false); 16.54 - root = new SimpleTreeGroupNode(); 16.55 - model.setRoot(root); 16.56 - treeTable = new JTreeTable(model); 16.57 - treeTable.setRootVisible(false); 16.58 - treeTable.setShowsRootHandles(true); 16.59 - treeTable.setShowsIcons(false); 16.60 - treeTable.setTreeEditable(false); 16.61 - treeTable.getTableHeader().setReorderingAllowed(false); 16.62 - treeTable.setCellSelectionEnabled(true); 16.63 - treeTable.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); 16.64 - treeTable.setDragEnabled(true); 16.65 - JScrollPane sp = new JScrollPane(treeTable); 16.66 - sp.getViewport().setBackground(Color.white); 16.67 - 16.68 - setLayout(new BorderLayout()); 16.69 - add(sp, BorderLayout.CENTER); 16.70 - } 16.71 - 16.72 - /** Clear the contents of this VariablePanel */ 16.73 - public void clear() { 16.74 - root.removeAllChildren(); 16.75 - model.fireTreeStructureChanged(); 16.76 - } 16.77 - 16.78 - /** Update the contents of this VariablePanel from the given CFrame */ 16.79 - public void update(CFrame fr) { 16.80 - // Collect locals 16.81 - CCollector coll = new CCollector(); 16.82 - fr.iterateLocals(coll); 16.83 - update(coll); 16.84 - } 16.85 - 16.86 - /** Update the contents of this VariablePanel from the given JavaVFrame */ 16.87 - public void update(JavaVFrame jfr) { 16.88 - Method m = jfr.getMethod(); 16.89 - if (!m.hasLocalVariableTable()) { 16.90 - return; 16.91 - } 16.92 - int bci = jfr.getBCI(); 16.93 - // Get local variable table 16.94 - LocalVariableTableElement[] locals = m.getLocalVariableTable(); 16.95 - // Get locals as StackValueCollection 16.96 - StackValueCollection coll = jfr.getLocals(); 16.97 - root.removeAllChildren(); 16.98 - // See which locals are live 16.99 - for (int i = 0; i < locals.length; i++) { 16.100 - LocalVariableTableElement local = locals[i]; 16.101 - if (local.getStartBCI() <= bci && bci < local.getStartBCI() + local.getLength()) { 16.102 - // Valid; add it 16.103 - SimpleTreeNode node = null; 16.104 - Symbol name = null; 16.105 - try { 16.106 - name = m.getConstants().getSymbolAt(local.getNameCPIndex()); 16.107 - if (name == null) { 16.108 - System.err.println("Null name at slot " + 16.109 - local.getNameCPIndex() + 16.110 - " for local variable at slot " + 16.111 - local.getSlot()); 16.112 - continue; 16.113 - } 16.114 - } catch (Exception e) { 16.115 - System.err.println("Unable to fetch name at slot " + 16.116 - local.getNameCPIndex() + 16.117 - " for local variable at slot " + 16.118 - local.getSlot()); 16.119 - e.printStackTrace(); 16.120 - continue; 16.121 - } 16.122 - sun.jvm.hotspot.oops.NamedFieldIdentifier f = 16.123 - new sun.jvm.hotspot.oops.NamedFieldIdentifier(name.asString()); 16.124 - Symbol descriptor = null; 16.125 - try { 16.126 - descriptor = m.getConstants().getSymbolAt(local.getDescriptorCPIndex()); 16.127 - } catch (Exception e) { 16.128 - System.err.println("Unable to fetch descriptor at slot " + 16.129 - local.getDescriptorCPIndex() + 16.130 - " for local variable " + f.getName() + 16.131 - " at slot " + local.getSlot()); 16.132 - e.printStackTrace(); 16.133 - continue; 16.134 - } 16.135 - 16.136 - if (descriptor != null) { 16.137 - switch (descriptor.getByteAt(0)) { 16.138 - case 'F': { 16.139 - node = new sun.jvm.hotspot.ui.tree.FloatTreeNodeAdapter(coll.floatAt(local.getSlot()), f, true); 16.140 - break; 16.141 - } 16.142 - case 'D': { 16.143 - node = new sun.jvm.hotspot.ui.tree.DoubleTreeNodeAdapter(coll.doubleAt(local.getSlot()), f, true); 16.144 - break; 16.145 - } 16.146 - case 'C': { 16.147 - node = new sun.jvm.hotspot.ui.tree.CharTreeNodeAdapter((char) coll.intAt(local.getSlot()), f, true); 16.148 - break; 16.149 - } 16.150 - case 'B': 16.151 - case 'S': 16.152 - case 'I': { 16.153 - node = new sun.jvm.hotspot.ui.tree.LongTreeNodeAdapter(coll.intAt(local.getSlot()), f, true); 16.154 - break; 16.155 - } 16.156 - case 'Z': { 16.157 - node = new sun.jvm.hotspot.ui.tree.BooleanTreeNodeAdapter( 16.158 - ((coll.intAt(local.getSlot()) != 0) ? true : false), f, true 16.159 - ); 16.160 - break; 16.161 - } 16.162 - case 'J': { 16.163 - node = new sun.jvm.hotspot.ui.tree.LongTreeNodeAdapter(coll.longAt(local.getSlot()), f, true); 16.164 - break; 16.165 - } 16.166 - default: { 16.167 - try { 16.168 - node = new sun.jvm.hotspot.ui.tree.OopTreeNodeAdapter( 16.169 - VM.getVM().getObjectHeap().newOop(coll.oopHandleAt(local.getSlot())), f, true 16.170 - ); 16.171 - } catch (AddressException e) { 16.172 - node = new sun.jvm.hotspot.ui.tree.FieldTreeNodeAdapter(f, true) { 16.173 - public int getChildCount() { return 0; } 16.174 - public SimpleTreeNode getChild(int i) { return null; } 16.175 - public boolean isLeaf() { return false; } 16.176 - public int getIndexOfChild(SimpleTreeNode child) { return 0; } 16.177 - public String getValue() { 16.178 - return "<Bad oop>"; 16.179 - } 16.180 - }; 16.181 - } 16.182 - break; 16.183 - } 16.184 - } 16.185 - if (node != null) { 16.186 - root.addChild(node); 16.187 - } 16.188 - } 16.189 - } 16.190 - } 16.191 - 16.192 - model.fireTreeStructureChanged(); 16.193 - } 16.194 - 16.195 - /** Update the contents of this VariablePanel from the given "this" 16.196 - pointer of the given type */ 16.197 - public void update(Address thisAddr, Type type) { 16.198 - // Collect fields 16.199 - CCollector coll = new CCollector(); 16.200 - type.iterateObject(thisAddr, coll); 16.201 - update(coll); 16.202 - } 16.203 - 16.204 - private void update(CCollector coll) { 16.205 - root.removeAllChildren(); 16.206 - for (int i = 0; i < coll.getNumChildren(); i++) { 16.207 - root.addChild(coll.getChild(i)); 16.208 - } 16.209 - model.fireTreeStructureChanged(); 16.210 - } 16.211 - 16.212 - static class CCollector extends DefaultObjectVisitor { 16.213 - private java.util.List children; 16.214 - 16.215 - public CCollector() { 16.216 - children = new ArrayList(); 16.217 - } 16.218 - 16.219 - public int getNumChildren() { 16.220 - return children.size(); 16.221 - } 16.222 - 16.223 - public SimpleTreeNode getChild(int i) { 16.224 - return (SimpleTreeNode) children.get(i); 16.225 - } 16.226 - 16.227 - public void doBit(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, long val) { 16.228 - children.add(new sun.jvm.hotspot.bugspot.tree.LongTreeNodeAdapter(val, f, true)); 16.229 - } 16.230 - public void doInt(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, long val) { 16.231 - children.add(new sun.jvm.hotspot.bugspot.tree.LongTreeNodeAdapter(val, f, true)); 16.232 - } 16.233 - public void doEnum(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, long val, String enumName) { 16.234 - children.add(new sun.jvm.hotspot.bugspot.tree.EnumTreeNodeAdapter(enumName, val, f, true)); 16.235 - } 16.236 - public void doFloat(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, float val) { 16.237 - children.add(new sun.jvm.hotspot.bugspot.tree.FloatTreeNodeAdapter(val, f, true)); 16.238 - } 16.239 - public void doDouble(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, double val) { 16.240 - children.add(new sun.jvm.hotspot.bugspot.tree.DoubleTreeNodeAdapter(val, f, true)); 16.241 - } 16.242 - public void doPointer(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, Address val) { 16.243 - children.add(new sun.jvm.hotspot.bugspot.tree.AddressTreeNodeAdapter(val, f, true)); 16.244 - } 16.245 - public void doArray(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, Address val) { 16.246 - children.add(new sun.jvm.hotspot.bugspot.tree.AddressTreeNodeAdapter(val, f, true)); 16.247 - } 16.248 - public void doRef(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, Address val) { 16.249 - children.add(new sun.jvm.hotspot.bugspot.tree.AddressTreeNodeAdapter(val, f, true)); 16.250 - } 16.251 - public void doCompound(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, Address val) { 16.252 - children.add(new sun.jvm.hotspot.bugspot.tree.ObjectTreeNodeAdapter(val, f, true)); 16.253 - } 16.254 - } 16.255 -}
17.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/tree/AddressTreeNodeAdapter.java Fri Feb 22 10:12:00 2013 -0800 17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 17.3 @@ -1,67 +0,0 @@ 17.4 -/* 17.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. 17.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.7 - * 17.8 - * This code is free software; you can redistribute it and/or modify it 17.9 - * under the terms of the GNU General Public License version 2 only, as 17.10 - * published by the Free Software Foundation. 17.11 - * 17.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 17.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 17.15 - * version 2 for more details (a copy is included in the LICENSE file that 17.16 - * accompanied this code). 17.17 - * 17.18 - * You should have received a copy of the GNU General Public License version 17.19 - * 2 along with this work; if not, write to the Free Software Foundation, 17.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17.21 - * 17.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 17.23 - * or visit www.oracle.com if you need additional information or have any 17.24 - * questions. 17.25 - * 17.26 - */ 17.27 - 17.28 -package sun.jvm.hotspot.bugspot.tree; 17.29 - 17.30 -import sun.jvm.hotspot.debugger.*; 17.31 -import sun.jvm.hotspot.debugger.cdbg.*; 17.32 -import sun.jvm.hotspot.ui.tree.SimpleTreeNode; 17.33 - 17.34 -/** Encapsulates a float value in a tree handled by SimpleTreeModel */ 17.35 - 17.36 -public class AddressTreeNodeAdapter extends FieldTreeNodeAdapter { 17.37 - private Address val; 17.38 - 17.39 - public AddressTreeNodeAdapter(Address val, FieldIdentifier id) { 17.40 - this(val, id, false); 17.41 - } 17.42 - 17.43 - public AddressTreeNodeAdapter(Address val, FieldIdentifier id, boolean treeTableMode) { 17.44 - super(id, treeTableMode); 17.45 - this.val = val; 17.46 - } 17.47 - 17.48 - public int getChildCount() { 17.49 - return 0; 17.50 - } 17.51 - 17.52 - public SimpleTreeNode getChild(int index) { 17.53 - return null; 17.54 - } 17.55 - 17.56 - public boolean isLeaf() { 17.57 - return true; 17.58 - } 17.59 - 17.60 - public int getIndexOfChild(SimpleTreeNode child) { 17.61 - return 0; 17.62 - } 17.63 - 17.64 - public String getValue() { 17.65 - if (val != null) { 17.66 - return val.toString(); 17.67 - } 17.68 - return "NULL"; 17.69 - } 17.70 -}
18.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/tree/DoubleTreeNodeAdapter.java Fri Feb 22 10:12:00 2013 -0800 18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 18.3 @@ -1,63 +0,0 @@ 18.4 -/* 18.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. 18.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.7 - * 18.8 - * This code is free software; you can redistribute it and/or modify it 18.9 - * under the terms of the GNU General Public License version 2 only, as 18.10 - * published by the Free Software Foundation. 18.11 - * 18.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 18.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 18.15 - * version 2 for more details (a copy is included in the LICENSE file that 18.16 - * accompanied this code). 18.17 - * 18.18 - * You should have received a copy of the GNU General Public License version 18.19 - * 2 along with this work; if not, write to the Free Software Foundation, 18.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18.21 - * 18.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 18.23 - * or visit www.oracle.com if you need additional information or have any 18.24 - * questions. 18.25 - * 18.26 - */ 18.27 - 18.28 -package sun.jvm.hotspot.bugspot.tree; 18.29 - 18.30 -import sun.jvm.hotspot.debugger.cdbg.*; 18.31 -import sun.jvm.hotspot.ui.tree.SimpleTreeNode; 18.32 - 18.33 -/** Encapsulates a double value in a tree handled by SimpleTreeModel */ 18.34 - 18.35 -public class DoubleTreeNodeAdapter extends FieldTreeNodeAdapter { 18.36 - private double val; 18.37 - 18.38 - public DoubleTreeNodeAdapter(double val, FieldIdentifier id) { 18.39 - this(val, id, false); 18.40 - } 18.41 - 18.42 - public DoubleTreeNodeAdapter(double val, FieldIdentifier id, boolean treeTableMode) { 18.43 - super(id, treeTableMode); 18.44 - this.val = val; 18.45 - } 18.46 - 18.47 - public int getChildCount() { 18.48 - return 0; 18.49 - } 18.50 - 18.51 - public SimpleTreeNode getChild(int index) { 18.52 - return null; 18.53 - } 18.54 - 18.55 - public boolean isLeaf() { 18.56 - return true; 18.57 - } 18.58 - 18.59 - public int getIndexOfChild(SimpleTreeNode child) { 18.60 - return 0; 18.61 - } 18.62 - 18.63 - public String getValue() { 18.64 - return Double.toString(val); 18.65 - } 18.66 -}
19.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/tree/EnumTreeNodeAdapter.java Fri Feb 22 10:12:00 2013 -0800 19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 19.3 @@ -1,69 +0,0 @@ 19.4 -/* 19.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. 19.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.7 - * 19.8 - * This code is free software; you can redistribute it and/or modify it 19.9 - * under the terms of the GNU General Public License version 2 only, as 19.10 - * published by the Free Software Foundation. 19.11 - * 19.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 19.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19.15 - * version 2 for more details (a copy is included in the LICENSE file that 19.16 - * accompanied this code). 19.17 - * 19.18 - * You should have received a copy of the GNU General Public License version 19.19 - * 2 along with this work; if not, write to the Free Software Foundation, 19.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19.21 - * 19.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19.23 - * or visit www.oracle.com if you need additional information or have any 19.24 - * questions. 19.25 - * 19.26 - */ 19.27 - 19.28 -package sun.jvm.hotspot.bugspot.tree; 19.29 - 19.30 -import sun.jvm.hotspot.debugger.cdbg.*; 19.31 -import sun.jvm.hotspot.ui.tree.SimpleTreeNode; 19.32 - 19.33 -/** Encapsulates an enumerated value in a tree handled by SimpleTreeModel */ 19.34 - 19.35 -public class EnumTreeNodeAdapter extends FieldTreeNodeAdapter { 19.36 - private long val; 19.37 - private String enumName; 19.38 - 19.39 - public EnumTreeNodeAdapter(String enumName, long val, FieldIdentifier id) { 19.40 - this(enumName, val, id, false); 19.41 - } 19.42 - 19.43 - public EnumTreeNodeAdapter(String enumName, long val, FieldIdentifier id, boolean treeTableMode) { 19.44 - super(id, treeTableMode); 19.45 - this.enumName = enumName; 19.46 - this.val = val; 19.47 - } 19.48 - 19.49 - public int getChildCount() { 19.50 - return 0; 19.51 - } 19.52 - 19.53 - public SimpleTreeNode getChild(int index) { 19.54 - return null; 19.55 - } 19.56 - 19.57 - public boolean isLeaf() { 19.58 - return true; 19.59 - } 19.60 - 19.61 - public int getIndexOfChild(SimpleTreeNode child) { 19.62 - return 0; 19.63 - } 19.64 - 19.65 - public String getValue() { 19.66 - if (enumName != null) { 19.67 - return enumName; 19.68 - } else { 19.69 - return Long.toString(val); 19.70 - } 19.71 - } 19.72 -}
20.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/tree/FieldTreeNodeAdapter.java Fri Feb 22 10:12:00 2013 -0800 20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 20.3 @@ -1,73 +0,0 @@ 20.4 -/* 20.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. 20.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.7 - * 20.8 - * This code is free software; you can redistribute it and/or modify it 20.9 - * under the terms of the GNU General Public License version 2 only, as 20.10 - * published by the Free Software Foundation. 20.11 - * 20.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 20.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 20.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20.15 - * version 2 for more details (a copy is included in the LICENSE file that 20.16 - * accompanied this code). 20.17 - * 20.18 - * You should have received a copy of the GNU General Public License version 20.19 - * 2 along with this work; if not, write to the Free Software Foundation, 20.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20.21 - * 20.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20.23 - * or visit www.oracle.com if you need additional information or have any 20.24 - * questions. 20.25 - * 20.26 - */ 20.27 - 20.28 -package sun.jvm.hotspot.bugspot.tree; 20.29 - 20.30 -import sun.jvm.hotspot.debugger.cdbg.*; 20.31 -import sun.jvm.hotspot.ui.tree.SimpleTreeNode; 20.32 - 20.33 -/** Abstract base class for all adapters for fields of C/C++ objects */ 20.34 - 20.35 -public abstract class FieldTreeNodeAdapter implements SimpleTreeNode { 20.36 - private FieldIdentifier id; 20.37 - private boolean treeTableMode; 20.38 - 20.39 - /** The identifier may be null, i.e., for the root of the tree */ 20.40 - public FieldTreeNodeAdapter(FieldIdentifier id, boolean treeTableMode) { 20.41 - this.id = id; 20.42 - this.treeTableMode = treeTableMode; 20.43 - } 20.44 - 20.45 - public FieldIdentifier getID() { 20.46 - return id; 20.47 - } 20.48 - 20.49 - /** Defaults to false in subclasses */ 20.50 - public boolean getTreeTableMode() { 20.51 - return treeTableMode; 20.52 - } 20.53 - 20.54 - public Type getType() { 20.55 - return getID().getType(); 20.56 - } 20.57 - 20.58 - public String getName() { 20.59 - if (getID() != null) { 20.60 - return getID().toString(); 20.61 - } 20.62 - return ""; 20.63 - } 20.64 - 20.65 - public String toString() { 20.66 - if (treeTableMode) { 20.67 - return getName(); 20.68 - } else { 20.69 - if (getID() != null) { 20.70 - return getName() + ": " + getValue(); 20.71 - } else { 20.72 - return getValue(); 20.73 - } 20.74 - } 20.75 - } 20.76 -}
21.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/tree/FloatTreeNodeAdapter.java Fri Feb 22 10:12:00 2013 -0800 21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 21.3 @@ -1,63 +0,0 @@ 21.4 -/* 21.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. 21.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.7 - * 21.8 - * This code is free software; you can redistribute it and/or modify it 21.9 - * under the terms of the GNU General Public License version 2 only, as 21.10 - * published by the Free Software Foundation. 21.11 - * 21.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 21.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 21.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 21.15 - * version 2 for more details (a copy is included in the LICENSE file that 21.16 - * accompanied this code). 21.17 - * 21.18 - * You should have received a copy of the GNU General Public License version 21.19 - * 2 along with this work; if not, write to the Free Software Foundation, 21.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21.21 - * 21.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21.23 - * or visit www.oracle.com if you need additional information or have any 21.24 - * questions. 21.25 - * 21.26 - */ 21.27 - 21.28 -package sun.jvm.hotspot.bugspot.tree; 21.29 - 21.30 -import sun.jvm.hotspot.debugger.cdbg.*; 21.31 -import sun.jvm.hotspot.ui.tree.SimpleTreeNode; 21.32 - 21.33 -/** Encapsulates a float value in a tree handled by SimpleTreeModel */ 21.34 - 21.35 -public class FloatTreeNodeAdapter extends FieldTreeNodeAdapter { 21.36 - private float val; 21.37 - 21.38 - public FloatTreeNodeAdapter(float val, FieldIdentifier id) { 21.39 - this(val, id, false); 21.40 - } 21.41 - 21.42 - public FloatTreeNodeAdapter(float val, FieldIdentifier id, boolean treeTableMode) { 21.43 - super(id, treeTableMode); 21.44 - this.val = val; 21.45 - } 21.46 - 21.47 - public int getChildCount() { 21.48 - return 0; 21.49 - } 21.50 - 21.51 - public SimpleTreeNode getChild(int index) { 21.52 - return null; 21.53 - } 21.54 - 21.55 - public boolean isLeaf() { 21.56 - return true; 21.57 - } 21.58 - 21.59 - public int getIndexOfChild(SimpleTreeNode child) { 21.60 - return 0; 21.61 - } 21.62 - 21.63 - public String getValue() { 21.64 - return Float.toString(val); 21.65 - } 21.66 -}
22.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/tree/LongTreeNodeAdapter.java Fri Feb 22 10:12:00 2013 -0800 22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 22.3 @@ -1,63 +0,0 @@ 22.4 -/* 22.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. 22.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.7 - * 22.8 - * This code is free software; you can redistribute it and/or modify it 22.9 - * under the terms of the GNU General Public License version 2 only, as 22.10 - * published by the Free Software Foundation. 22.11 - * 22.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 22.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 22.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22.15 - * version 2 for more details (a copy is included in the LICENSE file that 22.16 - * accompanied this code). 22.17 - * 22.18 - * You should have received a copy of the GNU General Public License version 22.19 - * 2 along with this work; if not, write to the Free Software Foundation, 22.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 22.21 - * 22.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22.23 - * or visit www.oracle.com if you need additional information or have any 22.24 - * questions. 22.25 - * 22.26 - */ 22.27 - 22.28 -package sun.jvm.hotspot.bugspot.tree; 22.29 - 22.30 -import sun.jvm.hotspot.debugger.cdbg.*; 22.31 -import sun.jvm.hotspot.ui.tree.SimpleTreeNode; 22.32 - 22.33 -/** Encapsulates a long value in a tree handled by SimpleTreeModel */ 22.34 - 22.35 -public class LongTreeNodeAdapter extends FieldTreeNodeAdapter { 22.36 - private long val; 22.37 - 22.38 - public LongTreeNodeAdapter(long val, FieldIdentifier id) { 22.39 - this(val, id, false); 22.40 - } 22.41 - 22.42 - public LongTreeNodeAdapter(long val, FieldIdentifier id, boolean treeTableMode) { 22.43 - super(id, treeTableMode); 22.44 - this.val = val; 22.45 - } 22.46 - 22.47 - public int getChildCount() { 22.48 - return 0; 22.49 - } 22.50 - 22.51 - public SimpleTreeNode getChild(int index) { 22.52 - return null; 22.53 - } 22.54 - 22.55 - public boolean isLeaf() { 22.56 - return true; 22.57 - } 22.58 - 22.59 - public int getIndexOfChild(SimpleTreeNode child) { 22.60 - return 0; 22.61 - } 22.62 - 22.63 - public String getValue() { 22.64 - return Long.toString(val); 22.65 - } 22.66 -}
23.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/tree/ObjectTreeNodeAdapter.java Fri Feb 22 10:12:00 2013 -0800 23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 23.3 @@ -1,216 +0,0 @@ 23.4 -/* 23.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. 23.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.7 - * 23.8 - * This code is free software; you can redistribute it and/or modify it 23.9 - * under the terms of the GNU General Public License version 2 only, as 23.10 - * published by the Free Software Foundation. 23.11 - * 23.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 23.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 23.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23.15 - * version 2 for more details (a copy is included in the LICENSE file that 23.16 - * accompanied this code). 23.17 - * 23.18 - * You should have received a copy of the GNU General Public License version 23.19 - * 2 along with this work; if not, write to the Free Software Foundation, 23.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 23.21 - * 23.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23.23 - * or visit www.oracle.com if you need additional information or have any 23.24 - * questions. 23.25 - * 23.26 - */ 23.27 - 23.28 -package sun.jvm.hotspot.bugspot.tree; 23.29 - 23.30 -import java.io.*; 23.31 -import sun.jvm.hotspot.debugger.*; 23.32 -import sun.jvm.hotspot.debugger.cdbg.*; 23.33 -import sun.jvm.hotspot.ui.tree.SimpleTreeNode; 23.34 - 23.35 -/** An adapter class which allows C/C++ objects to be displayed in a 23.36 - tree via the SimpleTreeNode interface. */ 23.37 - 23.38 -public class ObjectTreeNodeAdapter extends FieldTreeNodeAdapter { 23.39 - // Address of object 23.40 - private Address addr; 23.41 - 23.42 - /** The address may be null (for object fields of objcets which are 23.43 - null). The FieldIdentifier should not be null. treeTableMode 23.44 - defaults to false. */ 23.45 - public ObjectTreeNodeAdapter(Address addr, FieldIdentifier id) { 23.46 - this(addr, id, false); 23.47 - } 23.48 - 23.49 - /** The address may be null (for object fields of objcets which are 23.50 - null). The FieldIdentifier should not be null. */ 23.51 - public ObjectTreeNodeAdapter(Address addr, FieldIdentifier id, boolean treeTableMode) { 23.52 - super(id, treeTableMode); 23.53 - this.addr = addr; 23.54 - } 23.55 - 23.56 - public int getChildCount() { 23.57 - if (addr == null) { 23.58 - return 0; 23.59 - } 23.60 - 23.61 - Counter c = new Counter(); 23.62 - getType().iterateObject(addr, c); 23.63 - return c.getNumFields(); 23.64 - } 23.65 - 23.66 - public SimpleTreeNode getChild(int index) { 23.67 - if (addr == null) { 23.68 - return null; 23.69 - } 23.70 - 23.71 - Fetcher f = new Fetcher(index); 23.72 - getType().iterateObject(addr, f); 23.73 - return f.getChild(); 23.74 - } 23.75 - 23.76 - public boolean isLeaf() { 23.77 - return (addr == null); 23.78 - } 23.79 - 23.80 - public int getIndexOfChild(SimpleTreeNode child) { 23.81 - FieldIdentifier id = ((FieldTreeNodeAdapter) child).getID(); 23.82 - Finder f = new Finder(id); 23.83 - getType().iterateObject(addr, f); 23.84 - return f.getIndex(); 23.85 - } 23.86 - 23.87 - public String getValue() { 23.88 - if (addr != null) { 23.89 - return addr.toString(); 23.90 - } 23.91 - return "NULL"; 23.92 - } 23.93 - 23.94 - /** Should be used only once, then have the number of fields 23.95 - fetched. */ 23.96 - static class Counter extends DefaultObjectVisitor { 23.97 - private int numFields; 23.98 - 23.99 - public int getNumFields() { 23.100 - return numFields; 23.101 - } 23.102 - 23.103 - public void doBit(FieldIdentifier f, long val) { ++numFields; } 23.104 - public void doInt(FieldIdentifier f, long val) { ++numFields; } 23.105 - public void doEnum(FieldIdentifier f, long val, String enumName) { ++numFields; } 23.106 - public void doFloat(FieldIdentifier f, float val) { ++numFields; } 23.107 - public void doDouble(FieldIdentifier f, double val) { ++numFields; } 23.108 - public void doPointer(FieldIdentifier f, Address val) { ++numFields; } 23.109 - public void doArray(FieldIdentifier f, Address val) { ++numFields; } 23.110 - public void doRef(FieldIdentifier f, Address val) { ++numFields; } 23.111 - public void doCompound(FieldIdentifier f, Address addr) { ++numFields; } 23.112 - } 23.113 - 23.114 - /** Creates a new SimpleTreeNode for the given field. */ 23.115 - class Fetcher extends DefaultObjectVisitor { 23.116 - private int index; 23.117 - private int curField; 23.118 - private SimpleTreeNode child; 23.119 - 23.120 - public Fetcher(int index) { 23.121 - this.index = index; 23.122 - } 23.123 - 23.124 - public SimpleTreeNode getChild() { 23.125 - return child; 23.126 - } 23.127 - 23.128 - public void doBit(FieldIdentifier f, long val) { 23.129 - if (curField == index) { 23.130 - child = new LongTreeNodeAdapter(val, f, getTreeTableMode()); 23.131 - } 23.132 - ++curField; 23.133 - } 23.134 - 23.135 - public void doInt(FieldIdentifier f, long val) { 23.136 - if (curField == index) { 23.137 - child = new LongTreeNodeAdapter(val, f, getTreeTableMode()); 23.138 - } 23.139 - ++curField; 23.140 - } 23.141 - 23.142 - public void doEnum(FieldIdentifier f, long val, String enumName) { 23.143 - if (curField == index) { 23.144 - child = new EnumTreeNodeAdapter(enumName, val, f, getTreeTableMode()); 23.145 - } 23.146 - ++curField; 23.147 - } 23.148 - 23.149 - public void doFloat(FieldIdentifier f, float val) { 23.150 - if (curField == index) { 23.151 - child = new FloatTreeNodeAdapter(val, f, getTreeTableMode()); 23.152 - } 23.153 - ++curField; 23.154 - } 23.155 - 23.156 - public void doDouble(FieldIdentifier f, double val) { 23.157 - if (curField == index) { 23.158 - child = new DoubleTreeNodeAdapter(val, f, getTreeTableMode()); 23.159 - } 23.160 - ++curField; 23.161 - } 23.162 - 23.163 - public void doPointer(FieldIdentifier f, Address val) { 23.164 - if (curField == index) { 23.165 - child = new AddressTreeNodeAdapter(val, f, getTreeTableMode()); 23.166 - } 23.167 - ++curField; 23.168 - } 23.169 - 23.170 - public void doArray(FieldIdentifier f, Address val) { 23.171 - if (curField == index) { 23.172 - child = new AddressTreeNodeAdapter(val, f, getTreeTableMode()); 23.173 - } 23.174 - ++curField; 23.175 - } 23.176 - 23.177 - public void doRef(FieldIdentifier f, Address val) { 23.178 - if (curField == index) { 23.179 - child = new AddressTreeNodeAdapter(val, f, getTreeTableMode()); 23.180 - } 23.181 - ++curField; 23.182 - } 23.183 - 23.184 - public void doCompound(FieldIdentifier f, Address val) { 23.185 - if (curField == index) { 23.186 - child = new ObjectTreeNodeAdapter(val, f, getTreeTableMode()); 23.187 - } 23.188 - ++curField; 23.189 - } 23.190 - } 23.191 - 23.192 - /** Finds the index of the given FieldIdentifier. */ 23.193 - static class Finder extends DefaultObjectVisitor { 23.194 - private FieldIdentifier id; 23.195 - private int curField; 23.196 - private int index = -1; 23.197 - 23.198 - public Finder(FieldIdentifier id) { 23.199 - this.id = id; 23.200 - } 23.201 - 23.202 - /** Returns -1 if not found */ 23.203 - public int getIndex() { 23.204 - return index; 23.205 - } 23.206 - 23.207 - public void doBit(FieldIdentifier f, long val) { if (f.equals(id)) { index = curField; } ++curField; } 23.208 - public void doInt(FieldIdentifier f, long val) { if (f.equals(id)) { index = curField; } ++curField; } 23.209 - public void doEnum(FieldIdentifier f, long val, 23.210 - String enumName) { if (f.equals(id)) { index = curField; } ++curField; } 23.211 - public void doFloat(FieldIdentifier f, float val) { if (f.equals(id)) { index = curField; } ++curField; } 23.212 - public void doDouble(FieldIdentifier f, double val) { if (f.equals(id)) { index = curField; } ++curField; } 23.213 - public void doPointer(FieldIdentifier f, Address val) { if (f.equals(id)) { index = curField; } ++curField; } 23.214 - public void doArray(FieldIdentifier f, Address val) { if (f.equals(id)) { index = curField; } ++curField; } 23.215 - public void doRef(FieldIdentifier f, Address val) { if (f.equals(id)) { index = curField; } ++curField; } 23.216 - public void doCompound(FieldIdentifier f, 23.217 - Address val) { if (f.equals(id)) { index = curField; } ++curField; } 23.218 - } 23.219 -}
24.1 --- a/agent/src/share/classes/sun/jvm/hotspot/livejvm/BreakpointEvent.java Fri Feb 22 10:12:00 2013 -0800 24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 24.3 @@ -1,51 +0,0 @@ 24.4 -/* 24.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. 24.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.7 - * 24.8 - * This code is free software; you can redistribute it and/or modify it 24.9 - * under the terms of the GNU General Public License version 2 only, as 24.10 - * published by the Free Software Foundation. 24.11 - * 24.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 24.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 24.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 24.15 - * version 2 for more details (a copy is included in the LICENSE file that 24.16 - * accompanied this code). 24.17 - * 24.18 - * You should have received a copy of the GNU General Public License version 24.19 - * 2 along with this work; if not, write to the Free Software Foundation, 24.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 24.21 - * 24.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 24.23 - * or visit www.oracle.com if you need additional information or have any 24.24 - * questions. 24.25 - * 24.26 - */ 24.27 - 24.28 -package sun.jvm.hotspot.livejvm; 24.29 - 24.30 -import sun.jvm.hotspot.oops.*; 24.31 -import sun.jvm.hotspot.runtime.*; 24.32 - 24.33 -public class BreakpointEvent extends Event { 24.34 - private Oop thread; 24.35 - private Oop clazz; 24.36 - private JNIid method; 24.37 - private int location; 24.38 - 24.39 - public BreakpointEvent(Oop thread, 24.40 - Oop clazz, 24.41 - JNIid method, 24.42 - int location) { 24.43 - super(Event.Type.BREAKPOINT); 24.44 - this.thread = thread; 24.45 - this.clazz = clazz; 24.46 - this.method = method; 24.47 - this.location = location; 24.48 - } 24.49 - 24.50 - public Oop thread() { return thread; } 24.51 - public Oop clazz() { return clazz; } 24.52 - public JNIid methodID() { return method; } 24.53 - public int location() { return location; } 24.54 -}
25.1 --- a/agent/src/share/classes/sun/jvm/hotspot/livejvm/CIntegerAccessor.java Fri Feb 22 10:12:00 2013 -0800 25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 25.3 @@ -1,47 +0,0 @@ 25.4 -/* 25.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. 25.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.7 - * 25.8 - * This code is free software; you can redistribute it and/or modify it 25.9 - * under the terms of the GNU General Public License version 2 only, as 25.10 - * published by the Free Software Foundation. 25.11 - * 25.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 25.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 25.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25.15 - * version 2 for more details (a copy is included in the LICENSE file that 25.16 - * accompanied this code). 25.17 - * 25.18 - * You should have received a copy of the GNU General Public License version 25.19 - * 2 along with this work; if not, write to the Free Software Foundation, 25.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25.21 - * 25.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 25.23 - * or visit www.oracle.com if you need additional information or have any 25.24 - * questions. 25.25 - * 25.26 - */ 25.27 - 25.28 -package sun.jvm.hotspot.livejvm; 25.29 - 25.30 -import sun.jvm.hotspot.debugger.*; 25.31 - 25.32 -class CIntegerAccessor { 25.33 - private Address addr; 25.34 - private long numBytes; 25.35 - private boolean isUnsigned; 25.36 - 25.37 - CIntegerAccessor(Address addr, long numBytes, boolean isUnsigned) { 25.38 - this.addr = addr; 25.39 - this.numBytes = numBytes; 25.40 - this.isUnsigned = isUnsigned; 25.41 - } 25.42 - 25.43 - long getValue() { 25.44 - return addr.getCIntegerAt(0, numBytes, isUnsigned); 25.45 - } 25.46 - 25.47 - void setValue(long value) { 25.48 - addr.setCIntegerAt(0, numBytes, value); 25.49 - } 25.50 -}
26.1 --- a/agent/src/share/classes/sun/jvm/hotspot/livejvm/CStringAccessor.java Fri Feb 22 10:12:00 2013 -0800 26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 26.3 @@ -1,69 +0,0 @@ 26.4 -/* 26.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. 26.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.7 - * 26.8 - * This code is free software; you can redistribute it and/or modify it 26.9 - * under the terms of the GNU General Public License version 2 only, as 26.10 - * published by the Free Software Foundation. 26.11 - * 26.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 26.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 26.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26.15 - * version 2 for more details (a copy is included in the LICENSE file that 26.16 - * accompanied this code). 26.17 - * 26.18 - * You should have received a copy of the GNU General Public License version 26.19 - * 2 along with this work; if not, write to the Free Software Foundation, 26.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 26.21 - * 26.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 26.23 - * or visit www.oracle.com if you need additional information or have any 26.24 - * questions. 26.25 - * 26.26 - */ 26.27 - 26.28 -package sun.jvm.hotspot.livejvm; 26.29 - 26.30 -import java.io.UnsupportedEncodingException; 26.31 -import sun.jvm.hotspot.debugger.*; 26.32 - 26.33 -class CStringAccessor { 26.34 - private Address addr; 26.35 - private int bufLen; 26.36 - 26.37 - CStringAccessor(Address addr, int bufLen) { 26.38 - this.addr = addr; 26.39 - this.bufLen = bufLen; 26.40 - } 26.41 - 26.42 - String getValue() throws DebuggerException { 26.43 - int len = 0; 26.44 - while ((addr.getCIntegerAt(len, 1, true) != 0) && (len < bufLen)) { 26.45 - ++len; 26.46 - } 26.47 - byte[] res = new byte[len]; 26.48 - for (int i = 0; i < len; i++) { 26.49 - res[i] = (byte) addr.getCIntegerAt(i, 1, true); 26.50 - } 26.51 - try { 26.52 - return new String(res, "US-ASCII"); 26.53 - } catch (UnsupportedEncodingException e) { 26.54 - throw new DebuggerException("Unable to use US-ASCII encoding"); 26.55 - } 26.56 - } 26.57 - 26.58 - void setValue(String value) throws DebuggerException { 26.59 - try { 26.60 - byte[] data = value.getBytes("US-ASCII"); 26.61 - if (data.length >= bufLen) { 26.62 - throw new DebuggerException("String too long"); 26.63 - } 26.64 - for (int i = 0; i < data.length; i++) { 26.65 - addr.setCIntegerAt(i, 1, data[i]); 26.66 - } 26.67 - addr.setCIntegerAt(data.length, 1, 0); 26.68 - } catch (UnsupportedEncodingException e) { 26.69 - throw new DebuggerException("Unable to use US-ASCII encoding"); 26.70 - } 26.71 - } 26.72 -}
27.1 --- a/agent/src/share/classes/sun/jvm/hotspot/livejvm/Event.java Fri Feb 22 10:12:00 2013 -0800 27.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 27.3 @@ -1,41 +0,0 @@ 27.4 -/* 27.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. 27.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 27.7 - * 27.8 - * This code is free software; you can redistribute it and/or modify it 27.9 - * under the terms of the GNU General Public License version 2 only, as 27.10 - * published by the Free Software Foundation. 27.11 - * 27.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 27.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 27.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 27.15 - * version 2 for more details (a copy is included in the LICENSE file that 27.16 - * accompanied this code). 27.17 - * 27.18 - * You should have received a copy of the GNU General Public License version 27.19 - * 2 along with this work; if not, write to the Free Software Foundation, 27.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27.21 - * 27.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 27.23 - * or visit www.oracle.com if you need additional information or have any 27.24 - * questions. 27.25 - * 27.26 - */ 27.27 - 27.28 -package sun.jvm.hotspot.livejvm; 27.29 - 27.30 -public class Event { 27.31 - public static class Type { 27.32 - private Type() {} 27.33 - public static final Type BREAKPOINT = new Type(); 27.34 - public static final Type EXCEPTION = new Type(); 27.35 - } 27.36 - 27.37 - private Type type; 27.38 - 27.39 - public Event(Type type) { 27.40 - this.type = type; 27.41 - } 27.42 - 27.43 - public Type getType() { return type; } 27.44 -}
28.1 --- a/agent/src/share/classes/sun/jvm/hotspot/livejvm/ExceptionEvent.java Fri Feb 22 10:12:00 2013 -0800 28.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 28.3 @@ -1,67 +0,0 @@ 28.4 -/* 28.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. 28.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 28.7 - * 28.8 - * This code is free software; you can redistribute it and/or modify it 28.9 - * under the terms of the GNU General Public License version 2 only, as 28.10 - * published by the Free Software Foundation. 28.11 - * 28.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 28.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 28.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 28.15 - * version 2 for more details (a copy is included in the LICENSE file that 28.16 - * accompanied this code). 28.17 - * 28.18 - * You should have received a copy of the GNU General Public License version 28.19 - * 2 along with this work; if not, write to the Free Software Foundation, 28.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 28.21 - * 28.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 28.23 - * or visit www.oracle.com if you need additional information or have any 28.24 - * questions. 28.25 - * 28.26 - */ 28.27 - 28.28 -package sun.jvm.hotspot.livejvm; 28.29 - 28.30 -import sun.jvm.hotspot.oops.*; 28.31 -import sun.jvm.hotspot.runtime.*; 28.32 - 28.33 -public class ExceptionEvent extends Event { 28.34 - private Oop thread; 28.35 - private Oop clazz; 28.36 - private JNIid method; 28.37 - private int location; 28.38 - private Oop exception; 28.39 - private Oop catchClass; 28.40 - private JNIid catchMethod; 28.41 - private int catchLocation; 28.42 - 28.43 - public ExceptionEvent(Oop thread, 28.44 - Oop clazz, 28.45 - JNIid method, 28.46 - int location, 28.47 - Oop exception, 28.48 - Oop catchClass, 28.49 - JNIid catchMethod, 28.50 - int catchLocation) { 28.51 - super(Event.Type.EXCEPTION); 28.52 - this.thread = thread; 28.53 - this.clazz = clazz; 28.54 - this.method = method; 28.55 - this.location = location; 28.56 - this.exception = exception; 28.57 - this.catchClass = catchClass; 28.58 - this.catchMethod = catchMethod; 28.59 - this.catchLocation = catchLocation; 28.60 - } 28.61 - 28.62 - public Oop thread() { return thread; } 28.63 - public Oop clazz() { return clazz; } 28.64 - public JNIid methodID() { return method; } 28.65 - public int location() { return location; } 28.66 - public Oop exception() { return exception; } 28.67 - public Oop catchClass() { return catchClass; } 28.68 - public JNIid catchMethodID() { return catchMethod; } 28.69 - public int catchLocation() { return catchLocation; } 28.70 -}
29.1 --- a/agent/src/share/classes/sun/jvm/hotspot/livejvm/JNIHandleAccessor.java Fri Feb 22 10:12:00 2013 -0800 29.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 29.3 @@ -1,54 +0,0 @@ 29.4 -/* 29.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. 29.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 29.7 - * 29.8 - * This code is free software; you can redistribute it and/or modify it 29.9 - * under the terms of the GNU General Public License version 2 only, as 29.10 - * published by the Free Software Foundation. 29.11 - * 29.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 29.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 29.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 29.15 - * version 2 for more details (a copy is included in the LICENSE file that 29.16 - * accompanied this code). 29.17 - * 29.18 - * You should have received a copy of the GNU General Public License version 29.19 - * 2 along with this work; if not, write to the Free Software Foundation, 29.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 29.21 - * 29.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 29.23 - * or visit www.oracle.com if you need additional information or have any 29.24 - * questions. 29.25 - * 29.26 - */ 29.27 - 29.28 -package sun.jvm.hotspot.livejvm; 29.29 - 29.30 -import sun.jvm.hotspot.debugger.*; 29.31 -import sun.jvm.hotspot.oops.*; 29.32 -import sun.jvm.hotspot.utilities.*; 29.33 - 29.34 -class JNIHandleAccessor { 29.35 - private Address addr; 29.36 - private ObjectHeap heap; 29.37 - 29.38 - JNIHandleAccessor(Address addr, ObjectHeap heap) { 29.39 - this.addr = addr; 29.40 - this.heap = heap; 29.41 - } 29.42 - 29.43 - Oop getValue() { 29.44 - // Accessing the contents of the JNIHandle is a double dereference 29.45 - Address handle = addr.getAddressAt(0); 29.46 - if (handle == null) return null; 29.47 - return heap.newOop(handle.getOopHandleAt(0)); 29.48 - } 29.49 - 29.50 - void setValue(Oop value) { 29.51 - Address handle = addr.getAddressAt(0); 29.52 - if (Assert.ASSERTS_ENABLED) { 29.53 - Assert.that(handle != null, "Must have valid global JNI handle for setting"); 29.54 - } 29.55 - handle.setOopHandleAt(0, value.getHandle()); 29.56 - } 29.57 -}
30.1 --- a/agent/src/share/classes/sun/jvm/hotspot/livejvm/ServiceabilityAgentJVMDIModule.java Fri Feb 22 10:12:00 2013 -0800 30.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 30.3 @@ -1,415 +0,0 @@ 30.4 -/* 30.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. 30.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 30.7 - * 30.8 - * This code is free software; you can redistribute it and/or modify it 30.9 - * under the terms of the GNU General Public License version 2 only, as 30.10 - * published by the Free Software Foundation. 30.11 - * 30.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 30.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 30.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 30.15 - * version 2 for more details (a copy is included in the LICENSE file that 30.16 - * accompanied this code). 30.17 - * 30.18 - * You should have received a copy of the GNU General Public License version 30.19 - * 2 along with this work; if not, write to the Free Software Foundation, 30.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 30.21 - * 30.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 30.23 - * or visit www.oracle.com if you need additional information or have any 30.24 - * questions. 30.25 - * 30.26 - */ 30.27 - 30.28 -package sun.jvm.hotspot.livejvm; 30.29 - 30.30 -import sun.jvm.hotspot.debugger.*; 30.31 -import sun.jvm.hotspot.oops.*; 30.32 -import sun.jvm.hotspot.runtime.*; 30.33 - 30.34 -/** Provides Java programming language-level interaction with a live 30.35 - Java HotSpot VM via the use of the SA's JVMDI module. This is an 30.36 - experimental mechanism. The BugSpot debugger should be converted 30.37 - to use the JVMDI/JDWP-based JDI implementation for live process 30.38 - interaction once the JDI binding for the SA is complete. */ 30.39 - 30.40 -public class ServiceabilityAgentJVMDIModule { 30.41 - private Debugger dbg; 30.42 - private String[] saLibNames; 30.43 - private String saLibName; 30.44 - private boolean attached; 30.45 - 30.46 - private boolean suspended; 30.47 - 30.48 - private static final int JVMDI_EVENT_BREAKPOINT = 2; 30.49 - private static final int JVMDI_EVENT_EXCEPTION = 4; 30.50 - 30.51 - private static long timeoutMillis = 3000; 30.52 - 30.53 - // Values in target process 30.54 - // Events sent from VM to SA 30.55 - private CIntegerAccessor saAttached; 30.56 - private CIntegerAccessor saEventPending; 30.57 - private CIntegerAccessor saEventKind; 30.58 - // Exception events 30.59 - private JNIHandleAccessor saExceptionThread; 30.60 - private JNIHandleAccessor saExceptionClass; 30.61 - private JNIid saExceptionMethod; 30.62 - private CIntegerAccessor saExceptionLocation; 30.63 - private JNIHandleAccessor saExceptionException; 30.64 - private JNIHandleAccessor saExceptionCatchClass; 30.65 - private JNIid saExceptionCatchMethod; 30.66 - private CIntegerAccessor saExceptionCatchLocation; 30.67 - // Breakpoint events 30.68 - private JNIHandleAccessor saBreakpointThread; 30.69 - private JNIHandleAccessor saBreakpointClass; 30.70 - private JNIid saBreakpointMethod; 30.71 - private CIntegerAccessor saBreakpointLocation; 30.72 - // Commands sent by the SA to the VM 30.73 - private int SA_CMD_SUSPEND_ALL; 30.74 - private int SA_CMD_RESUME_ALL; 30.75 - private int SA_CMD_TOGGLE_BREAKPOINT; 30.76 - private int SA_CMD_BUF_SIZE; 30.77 - private CIntegerAccessor saCmdPending; 30.78 - private CIntegerAccessor saCmdType; 30.79 - private CIntegerAccessor saCmdResult; 30.80 - private CStringAccessor saCmdResultErrMsg; 30.81 - // Toggle breakpoint command arguments 30.82 - private CStringAccessor saCmdBkptSrcFileName; 30.83 - private CStringAccessor saCmdBkptPkgName; 30.84 - private CIntegerAccessor saCmdBkptLineNumber; 30.85 - private CIntegerAccessor saCmdBkptResWasError; 30.86 - private CIntegerAccessor saCmdBkptResLineNumber; 30.87 - private CIntegerAccessor saCmdBkptResBCI; 30.88 - private CIntegerAccessor saCmdBkptResWasSet; 30.89 - private CStringAccessor saCmdBkptResMethodName; 30.90 - private CStringAccessor saCmdBkptResMethodSig; 30.91 - 30.92 - public ServiceabilityAgentJVMDIModule(Debugger dbg, String[] saLibNames) { 30.93 - this.dbg = dbg; 30.94 - this.saLibNames = saLibNames; 30.95 - } 30.96 - 30.97 - /** Indicates whether a call to attach() should complete without an 30.98 - exception. */ 30.99 - public boolean canAttach() { 30.100 - return setupLookup("SA_CMD_SUSPEND_ALL"); 30.101 - } 30.102 - 30.103 - /** Attempt to initiate a connection with the JVMDI module in the 30.104 - target VM. */ 30.105 - public void attach() throws DebuggerException { 30.106 - if (!canAttach()) { 30.107 - throw new DebuggerException("Unable to initiate symbol lookup in SA's JVMDI module"); 30.108 - } 30.109 - 30.110 - if (attached) { 30.111 - throw new DebuggerException("Already attached"); 30.112 - } 30.113 - 30.114 - // Attempt to look up well-known symbols in the target VM. 30.115 - SA_CMD_SUSPEND_ALL = lookupConstInt("SA_CMD_SUSPEND_ALL"); 30.116 - SA_CMD_RESUME_ALL = lookupConstInt("SA_CMD_RESUME_ALL"); 30.117 - SA_CMD_TOGGLE_BREAKPOINT = lookupConstInt("SA_CMD_TOGGLE_BREAKPOINT"); 30.118 - SA_CMD_BUF_SIZE = lookupConstInt("SA_CMD_BUF_SIZE"); 30.119 - 30.120 - saAttached = lookupCInt("saAttached"); 30.121 - saEventPending = lookupCInt("saEventPending"); 30.122 - saEventKind = lookupCInt("saEventKind"); 30.123 - saCmdPending = lookupCInt("saCmdPending"); 30.124 - saCmdType = lookupCInt("saCmdType"); 30.125 - saCmdResult = lookupCInt("saCmdResult"); 30.126 - saCmdResultErrMsg = lookupCString("saCmdResultErrMsg", SA_CMD_BUF_SIZE); 30.127 - // Toggling of breakpoints 30.128 - saCmdBkptSrcFileName = lookupCString("saCmdBkptSrcFileName", SA_CMD_BUF_SIZE); 30.129 - saCmdBkptPkgName = lookupCString("saCmdBkptPkgName", SA_CMD_BUF_SIZE); 30.130 - saCmdBkptLineNumber = lookupCInt("saCmdBkptLineNumber"); 30.131 - saCmdBkptResWasError = lookupCInt("saCmdBkptResWasError"); 30.132 - saCmdBkptResLineNumber = lookupCInt("saCmdBkptResLineNumber"); 30.133 - saCmdBkptResBCI = lookupCInt("saCmdBkptResBCI"); 30.134 - saCmdBkptResWasSet = lookupCInt("saCmdBkptResWasSet"); 30.135 - saCmdBkptResMethodName = lookupCString("saCmdBkptResMethodName", SA_CMD_BUF_SIZE); 30.136 - saCmdBkptResMethodSig = lookupCString("saCmdBkptResMethodSig", SA_CMD_BUF_SIZE); 30.137 - 30.138 - // Check for existence of symbols needed later 30.139 - // FIXME: should probably cache these since we can't support the 30.140 - // -Xrun module or the VM getting unloaded anyway 30.141 - lookup("saExceptionThread"); 30.142 - lookup("saExceptionClass"); 30.143 - lookup("saExceptionMethod"); 30.144 - lookup("saExceptionLocation"); 30.145 - lookup("saExceptionException"); 30.146 - lookup("saExceptionCatchClass"); 30.147 - lookup("saExceptionCatchMethod"); 30.148 - lookup("saExceptionCatchLocation"); 30.149 - lookup("saBreakpointThread"); 30.150 - lookup("saBreakpointClass"); 30.151 - lookup("saBreakpointMethod"); 30.152 - lookup("saBreakpointLocation"); 30.153 - 30.154 - saAttached.setValue(1); 30.155 - attached = true; 30.156 - } 30.157 - 30.158 - public void detach() { 30.159 - saAttached.setValue(0); 30.160 - attached = false; 30.161 - saLibName = null; 30.162 - } 30.163 - 30.164 - /** Set the timeout value (in milliseconds) for the VM to reply to 30.165 - commands. Once this timeout has elapsed, the VM is assumed to 30.166 - have disconnected. Defaults to 3000 milliseconds (3 seconds). */ 30.167 - public void setCommandTimeout(long millis) { 30.168 - timeoutMillis = millis; 30.169 - } 30.170 - 30.171 - /** Get the timeout value (in milliseconds) for the VM to reply to 30.172 - commands. Once this timeout has elapsed, the VM is assumed to 30.173 - have disconnected. Defaults to 3000 milliseconds (3 seconds). */ 30.174 - public long getCommandTimeout() { 30.175 - return timeoutMillis; 30.176 - } 30.177 - 30.178 - /** Indicates whether a Java debug event is pending */ 30.179 - public boolean eventPending() { 30.180 - return (saEventPending.getValue() != 0); 30.181 - } 30.182 - 30.183 - /** Poll for event; returns null if none pending. */ 30.184 - public Event eventPoll() { 30.185 - if (saEventPending.getValue() == 0) { 30.186 - return null; 30.187 - } 30.188 - 30.189 - int kind = (int) saEventKind.getValue(); 30.190 - switch (kind) { 30.191 - case JVMDI_EVENT_EXCEPTION: { 30.192 - JNIHandleAccessor thread = lookupJNIHandle("saExceptionThread"); 30.193 - JNIHandleAccessor clazz = lookupJNIHandle("saExceptionClass"); 30.194 - JNIid method = lookupJNIid("saExceptionMethod"); 30.195 - CIntegerAccessor location = lookupCInt("saExceptionLocation"); 30.196 - JNIHandleAccessor exception = lookupJNIHandle("saExceptionException"); 30.197 - JNIHandleAccessor catchClass = lookupJNIHandle("saExceptionCatchClass"); 30.198 - JNIid catchMethod = lookupJNIid("saExceptionCatchMethod"); 30.199 - CIntegerAccessor catchLocation = lookupCInt("saExceptionCatchLocation"); 30.200 - return new ExceptionEvent(thread.getValue(), clazz.getValue(), method, 30.201 - (int) location.getValue(), exception.getValue(), 30.202 - catchClass.getValue(), catchMethod, (int) catchLocation.getValue()); 30.203 - } 30.204 - 30.205 - case JVMDI_EVENT_BREAKPOINT: { 30.206 - JNIHandleAccessor thread = lookupJNIHandle("saBreakpointThread"); 30.207 - JNIHandleAccessor clazz = lookupJNIHandle("saBreakpointClass"); 30.208 - JNIid method = lookupJNIid("saBreakpointMethod"); 30.209 - CIntegerAccessor location = lookupCInt("saBreakpointLocation"); 30.210 - return new BreakpointEvent(thread.getValue(), clazz.getValue(), 30.211 - method, (int) location.getValue()); 30.212 - } 30.213 - 30.214 - default: 30.215 - throw new DebuggerException("Unsupported event type " + kind); 30.216 - } 30.217 - } 30.218 - 30.219 - /** Continue past current event */ 30.220 - public void eventContinue() { 30.221 - saEventPending.setValue(0); 30.222 - } 30.223 - 30.224 - /** Suspend all Java threads in the target VM. Throws 30.225 - DebuggerException if the VM disconnected. */ 30.226 - public void suspend() { 30.227 - saCmdType.setValue(SA_CMD_SUSPEND_ALL); 30.228 - saCmdPending.setValue(1); 30.229 - waitForCommandCompletion(); 30.230 - suspended = true; 30.231 - } 30.232 - 30.233 - /** Resume all Java threads in the target VM. Throws 30.234 - DebuggerException if the VM disconnected. */ 30.235 - public void resume() { 30.236 - saCmdType.setValue(SA_CMD_RESUME_ALL); 30.237 - saCmdPending.setValue(1); 30.238 - waitForCommandCompletion(); 30.239 - suspended = false; 30.240 - } 30.241 - 30.242 - /** Indicates whether all Java threads have been suspended via this 30.243 - interface. */ 30.244 - public boolean isSuspended() { 30.245 - return suspended; 30.246 - } 30.247 - 30.248 - /** Information about toggling of breakpoints */ 30.249 - public static class BreakpointToggleResult { 30.250 - private boolean success; 30.251 - private String errMsg; 30.252 - private int lineNumber; 30.253 - private int bci; 30.254 - private boolean wasSet; 30.255 - private String methodName; 30.256 - private String methodSig; 30.257 - 30.258 - /** Success constructor */ 30.259 - public BreakpointToggleResult(int lineNumber, int bci, boolean wasSet, 30.260 - String methodName, String methodSig) { 30.261 - this.lineNumber = lineNumber; 30.262 - this.bci = bci; 30.263 - this.wasSet = wasSet; 30.264 - this.methodName = methodName; 30.265 - this.methodSig = methodSig; 30.266 - success = true; 30.267 - } 30.268 - 30.269 - /** Failure constructor */ 30.270 - public BreakpointToggleResult(String errMsg) { 30.271 - this.errMsg = errMsg; 30.272 - success = false; 30.273 - } 30.274 - 30.275 - /** Indicates whether this represents a successful return or not */ 30.276 - public boolean getSuccess() { return success; } 30.277 - 30.278 - /** Valid only if getSuccess() returns false */ 30.279 - public String getErrMsg() { return errMsg; } 30.280 - 30.281 - /** Line number at which breakpoint toggle occurred; valid only if 30.282 - getSuccess() returns true. */ 30.283 - public int getLineNumber() { return lineNumber; } 30.284 - 30.285 - /** BCI at which breakpoint toggle occurred; valid only if 30.286 - getSuccess() returns true. */ 30.287 - public int getBCI() { return bci; } 30.288 - 30.289 - /** Indicates whether the breakpoint toggle was the set of a 30.290 - breakpoint or not; valid only if getSuccess() returns true. */ 30.291 - public boolean getWasSet() { return wasSet; } 30.292 - 30.293 - /** Method name in which the breakpoint toggle occurred; valid 30.294 - only if getSuccess() returns true. */ 30.295 - public String getMethodName() { return methodName; } 30.296 - 30.297 - /** Method signature in which the breakpoint toggle occurred; 30.298 - valid only if getSuccess() returns true. */ 30.299 - public String getMethodSignature() { return methodSig; } 30.300 - } 30.301 - 30.302 - /** Toggle a breakpoint. Throws DebuggerException if a real error 30.303 - occurred; otherwise returns non-null BreakpointToggleResult. The 30.304 - work of scanning the loaded classes is done in the target VM 30.305 - because it turns out to be significantly faster than scanning 30.306 - through the system dictionary from the SA, and interactivity 30.307 - when setting breakpoints is important. */ 30.308 - public BreakpointToggleResult toggleBreakpoint(String srcFileName, 30.309 - String pkgName, 30.310 - int lineNo) { 30.311 - saCmdBkptSrcFileName.setValue(srcFileName); 30.312 - saCmdBkptPkgName.setValue(pkgName); 30.313 - saCmdBkptLineNumber.setValue(lineNo); 30.314 - saCmdType.setValue(SA_CMD_TOGGLE_BREAKPOINT); 30.315 - saCmdPending.setValue(1); 30.316 - if (waitForCommandCompletion(true)) { 30.317 - return new BreakpointToggleResult((int) saCmdBkptResLineNumber.getValue(), 30.318 - (int) saCmdBkptResBCI.getValue(), 30.319 - (saCmdBkptResWasSet.getValue() != 0), 30.320 - saCmdBkptResMethodName.getValue(), 30.321 - saCmdBkptResMethodSig.getValue()); 30.322 - } else { 30.323 - return new BreakpointToggleResult(saCmdResultErrMsg.getValue()); 30.324 - } 30.325 - } 30.326 - 30.327 - 30.328 - //---------------------------------------------------------------------- 30.329 - // Internals only below this point 30.330 - // 30.331 - 30.332 - private CIntegerAccessor lookupCInt(String symbolName) { 30.333 - return new CIntegerAccessor(lookup(symbolName), 4, false); 30.334 - } 30.335 - 30.336 - private CStringAccessor lookupCString(String symbolName, int bufLen) { 30.337 - return new CStringAccessor(lookup(symbolName), bufLen); 30.338 - } 30.339 - 30.340 - private JNIHandleAccessor lookupJNIHandle(String symbolName) { 30.341 - return new JNIHandleAccessor(lookup(symbolName), VM.getVM().getObjectHeap()); 30.342 - } 30.343 - 30.344 - private JNIid lookupJNIid(String symbolName) { 30.345 - Address idAddr = lookup(symbolName).getAddressAt(0); 30.346 - if (idAddr == null) { 30.347 - return null; 30.348 - } 30.349 - return new JNIid(idAddr, VM.getVM().getObjectHeap()); 30.350 - } 30.351 - 30.352 - private int lookupConstInt(String symbolName) { 30.353 - Address addr = lookup(symbolName); 30.354 - return (int) addr.getCIntegerAt(0, 4, false); 30.355 - } 30.356 - 30.357 - private boolean setupLookup(String symbolName) { 30.358 - if (saLibName == null) { 30.359 - for (int i = 0; i < saLibNames.length; i++) { 30.360 - Address addr = dbg.lookup(saLibNames[i], symbolName); 30.361 - if (addr != null) { 30.362 - saLibName = saLibNames[i]; 30.363 - return true; 30.364 - } 30.365 - } 30.366 - return false; 30.367 - } 30.368 - return true; 30.369 - } 30.370 - 30.371 - private Address lookup(String symbolName) { 30.372 - if (saLibName == null) { 30.373 - for (int i = 0; i < saLibNames.length; i++) { 30.374 - Address addr = dbg.lookup(saLibNames[i], symbolName); 30.375 - if (addr != null) { 30.376 - saLibName = saLibNames[i]; 30.377 - return addr; 30.378 - } 30.379 - } 30.380 - throw new DebuggerException("Unable to find symbol " + symbolName + " in any of the known names for the SA"); 30.381 - } 30.382 - 30.383 - Address addr = dbg.lookup(saLibName, symbolName); 30.384 - if (addr == null) { 30.385 - throw new DebuggerException("Unable to find symbol " + symbolName + " in " + saLibName); 30.386 - } 30.387 - return addr; 30.388 - } 30.389 - 30.390 - private void waitForCommandCompletion() { 30.391 - waitForCommandCompletion(false); 30.392 - } 30.393 - 30.394 - /** Returns true if command succeeded, false if not */ 30.395 - private boolean waitForCommandCompletion(boolean forBreakpoint) { 30.396 - long start = System.currentTimeMillis(); 30.397 - long cur = start; 30.398 - while ((saCmdPending.getValue() != 0) && 30.399 - (cur - start < timeoutMillis)) { 30.400 - try { 30.401 - java.lang.Thread.currentThread().sleep(10); 30.402 - } catch (InterruptedException e) { 30.403 - } 30.404 - cur = System.currentTimeMillis(); 30.405 - } 30.406 - if (saCmdPending.getValue() != 0) { 30.407 - detach(); 30.408 - throw new DebuggerException("VM appears to have died"); 30.409 - } 30.410 - boolean succeeded = saCmdResult.getValue() == 0; 30.411 - if (!succeeded && 30.412 - (!forBreakpoint || saCmdBkptResWasError.getValue() != 0)) { 30.413 - String err = saCmdResultErrMsg.getValue(); 30.414 - throw new DebuggerException("Error executing JVMDI command: " + err); 30.415 - } 30.416 - return succeeded; 30.417 - } 30.418 -}
31.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Fri Feb 22 10:12:00 2013 -0800 31.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Wed Feb 27 12:20:34 2013 -0800 31.3 @@ -1,5 +1,5 @@ 31.4 /* 31.5 - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 31.6 + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 31.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 31.8 * 31.9 * This code is free software; you can redistribute it and/or modify it 31.10 @@ -469,7 +469,6 @@ 31.11 case JVM_CONSTANT_UnresolvedClassInError: return "JVM_CONSTANT_UnresolvedClassInError"; 31.12 case JVM_CONSTANT_MethodHandleInError:return "JVM_CONSTANT_MethodHandleInError"; 31.13 case JVM_CONSTANT_MethodTypeInError: return "JVM_CONSTANT_MethodTypeInError"; 31.14 - case JVM_CONSTANT_Object: return "JVM_CONSTANT_Object"; 31.15 } 31.16 throw new InternalError("Unknown tag: " + tag); 31.17 }
32.1 --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java Fri Feb 22 10:12:00 2013 -0800 32.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java Wed Feb 27 12:20:34 2013 -0800 32.3 @@ -1,5 +1,5 @@ 32.4 /* 32.5 - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 32.6 + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. 32.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 32.8 * 32.9 * This code is free software; you can redistribute it and/or modify it 32.10 @@ -67,7 +67,6 @@ 32.11 public static final int JVM_CONSTANT_UnresolvedClassInError = 103; // Error tag due to resolution error 32.12 public static final int JVM_CONSTANT_MethodHandleInError = 104; // Error tag due to resolution error 32.13 public static final int JVM_CONSTANT_MethodTypeInError = 105; // Error tag due to resolution error 32.14 - public static final int JVM_CONSTANT_Object = 106; // Required for BoundMethodHandle arguments. 32.15 32.16 // 1.5 major/minor version numbers from JVM spec. 3rd edition 32.17 public static final short MAJOR_VERSION = 49;
33.1 --- a/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java Fri Feb 22 10:12:00 2013 -0800 33.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java Wed Feb 27 12:20:34 2013 -0800 33.3 @@ -58,10 +58,6 @@ 33.4 } 33.5 } 33.6 33.7 - protected boolean requiresVM() { 33.8 - return false; 33.9 - } 33.10 - 33.11 public static void main(String[] args) throws Exception { 33.12 PMap t = new PMap(); 33.13 t.start(args);
34.1 --- a/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java Fri Feb 22 10:12:00 2013 -0800 34.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java Wed Feb 27 12:20:34 2013 -0800 34.3 @@ -50,29 +50,23 @@ 34.4 34.5 public void run(PrintStream out) { 34.6 Debugger dbg = getAgent().getDebugger(); 34.7 - run(out, dbg, getAgent().isJavaMode()); 34.8 + run(out, dbg); 34.9 } 34.10 34.11 public void run(PrintStream out, Debugger dbg) { 34.12 - run(out, dbg, true); 34.13 - } 34.14 - 34.15 - private void run(PrintStream out, Debugger dbg, final boolean isJava) { 34.16 CDebugger cdbg = dbg.getCDebugger(); 34.17 if (cdbg != null) { 34.18 ConcurrentLocksPrinter concLocksPrinter = null; 34.19 - if (isJava) { 34.20 - // compute and cache java Vframes. 34.21 - initJFrameCache(); 34.22 - if (concurrentLocks) { 34.23 - concLocksPrinter = new ConcurrentLocksPrinter(); 34.24 - } 34.25 - // print Java level deadlocks 34.26 - try { 34.27 - DeadlockDetector.print(out); 34.28 - } catch (Exception exp) { 34.29 - out.println("can't print deadlock information: " + exp.getMessage()); 34.30 - } 34.31 + // compute and cache java Vframes. 34.32 + initJFrameCache(); 34.33 + if (concurrentLocks) { 34.34 + concLocksPrinter = new ConcurrentLocksPrinter(); 34.35 + } 34.36 + // print Java level deadlocks 34.37 + try { 34.38 + DeadlockDetector.print(out); 34.39 + } catch (Exception exp) { 34.40 + out.println("can't print deadlock information: " + exp.getMessage()); 34.41 } 34.42 34.43 List l = cdbg.getThreadList(); 34.44 @@ -100,63 +94,59 @@ 34.45 } 34.46 out.println(); 34.47 } else { 34.48 - if (isJava) { 34.49 - // look for one or more java frames 34.50 - String[] names = null; 34.51 - // check interpreter frame 34.52 - Interpreter interp = VM.getVM().getInterpreter(); 34.53 - if (interp.contains(pc)) { 34.54 - names = getJavaNames(th, f.localVariableBase()); 34.55 - // print codelet name if we can't determine method 34.56 - if (names == null || names.length == 0) { 34.57 - out.print("<interpreter> "); 34.58 - InterpreterCodelet ic = interp.getCodeletContaining(pc); 34.59 - if (ic != null) { 34.60 - String desc = ic.getDescription(); 34.61 - if (desc != null) out.print(desc); 34.62 - } 34.63 - out.println(); 34.64 - } 34.65 - } else { 34.66 - // look for known code blobs 34.67 - CodeCache c = VM.getVM().getCodeCache(); 34.68 - if (c.contains(pc)) { 34.69 - CodeBlob cb = c.findBlobUnsafe(pc); 34.70 - if (cb.isNMethod()) { 34.71 - names = getJavaNames(th, f.localVariableBase()); 34.72 - // just print compiled code, if can't determine method 34.73 - if (names == null || names.length == 0) { 34.74 - out.println("<Unknown compiled code>"); 34.75 - } 34.76 - } else if (cb.isBufferBlob()) { 34.77 - out.println("<StubRoutines>"); 34.78 - } else if (cb.isRuntimeStub()) { 34.79 - out.println("<RuntimeStub>"); 34.80 - } else if (cb.isDeoptimizationStub()) { 34.81 - out.println("<DeoptimizationStub>"); 34.82 - } else if (cb.isUncommonTrapStub()) { 34.83 - out.println("<UncommonTrap>"); 34.84 - } else if (cb.isExceptionStub()) { 34.85 - out.println("<ExceptionStub>"); 34.86 - } else if (cb.isSafepointStub()) { 34.87 - out.println("<SafepointStub>"); 34.88 - } else { 34.89 - out.println("<Unknown code blob>"); 34.90 - } 34.91 - } else { 34.92 - printUnknown(out); 34.93 - } 34.94 - } 34.95 - // print java frames, if any 34.96 - if (names != null && names.length != 0) { 34.97 - // print java frame(s) 34.98 - for (int i = 0; i < names.length; i++) { 34.99 - out.println(names[i]); 34.100 - } 34.101 - } 34.102 - } else { 34.103 - printUnknown(out); 34.104 - } 34.105 + // look for one or more java frames 34.106 + String[] names = null; 34.107 + // check interpreter frame 34.108 + Interpreter interp = VM.getVM().getInterpreter(); 34.109 + if (interp.contains(pc)) { 34.110 + names = getJavaNames(th, f.localVariableBase()); 34.111 + // print codelet name if we can't determine method 34.112 + if (names == null || names.length == 0) { 34.113 + out.print("<interpreter> "); 34.114 + InterpreterCodelet ic = interp.getCodeletContaining(pc); 34.115 + if (ic != null) { 34.116 + String desc = ic.getDescription(); 34.117 + if (desc != null) out.print(desc); 34.118 + } 34.119 + out.println(); 34.120 + } 34.121 + } else { 34.122 + // look for known code blobs 34.123 + CodeCache c = VM.getVM().getCodeCache(); 34.124 + if (c.contains(pc)) { 34.125 + CodeBlob cb = c.findBlobUnsafe(pc); 34.126 + if (cb.isNMethod()) { 34.127 + names = getJavaNames(th, f.localVariableBase()); 34.128 + // just print compiled code, if can't determine method 34.129 + if (names == null || names.length == 0) { 34.130 + out.println("<Unknown compiled code>"); 34.131 + } 34.132 + } else if (cb.isBufferBlob()) { 34.133 + out.println("<StubRoutines>"); 34.134 + } else if (cb.isRuntimeStub()) { 34.135 + out.println("<RuntimeStub>"); 34.136 + } else if (cb.isDeoptimizationStub()) { 34.137 + out.println("<DeoptimizationStub>"); 34.138 + } else if (cb.isUncommonTrapStub()) { 34.139 + out.println("<UncommonTrap>"); 34.140 + } else if (cb.isExceptionStub()) { 34.141 + out.println("<ExceptionStub>"); 34.142 + } else if (cb.isSafepointStub()) { 34.143 + out.println("<SafepointStub>"); 34.144 + } else { 34.145 + out.println("<Unknown code blob>"); 34.146 + } 34.147 + } else { 34.148 + printUnknown(out); 34.149 + } 34.150 + } 34.151 + // print java frames, if any 34.152 + if (names != null && names.length != 0) { 34.153 + // print java frame(s) 34.154 + for (int i = 0; i < names.length; i++) { 34.155 + out.println(names[i]); 34.156 + } 34.157 + } 34.158 } 34.159 f = f.sender(th); 34.160 } 34.161 @@ -164,7 +154,7 @@ 34.162 exp.printStackTrace(); 34.163 // continue, may be we can do a better job for other threads 34.164 } 34.165 - if (isJava && concurrentLocks) { 34.166 + if (concurrentLocks) { 34.167 JavaThread jthread = (JavaThread) proxyToThread.get(th); 34.168 if (jthread != null) { 34.169 concLocksPrinter.print(jthread, out); 34.170 @@ -180,10 +170,6 @@ 34.171 } 34.172 } 34.173 34.174 - protected boolean requiresVM() { 34.175 - return false; 34.176 - } 34.177 - 34.178 public static void main(String[] args) throws Exception { 34.179 PStack t = new PStack(); 34.180 t.start(args);
35.1 --- a/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java Fri Feb 22 10:12:00 2013 -0800 35.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java Wed Feb 27 12:20:34 2013 -0800 35.3 @@ -27,7 +27,6 @@ 35.4 import java.io.PrintStream; 35.5 import java.util.Hashtable; 35.6 import sun.jvm.hotspot.*; 35.7 -import sun.jvm.hotspot.bugspot.*; 35.8 import sun.jvm.hotspot.runtime.*; 35.9 import sun.jvm.hotspot.debugger.*; 35.10 35.11 @@ -35,7 +34,7 @@ 35.12 // override run & code main as shown below. 35.13 35.14 public abstract class Tool implements Runnable { 35.15 - private BugSpotAgent agent; 35.16 + private HotSpotAgent agent; 35.17 private int debugeeType; 35.18 35.19 // debugeeType is one of constants below 35.20 @@ -51,12 +50,7 @@ 35.21 return true; 35.22 } 35.23 35.24 - // whether this tool requires debuggee to be java process or core? 35.25 - protected boolean requiresVM() { 35.26 - return true; 35.27 - } 35.28 - 35.29 - protected void setAgent(BugSpotAgent a) { 35.30 + protected void setAgent(HotSpotAgent a) { 35.31 agent = a; 35.32 } 35.33 35.34 @@ -64,7 +58,7 @@ 35.35 debugeeType = dt; 35.36 } 35.37 35.38 - protected BugSpotAgent getAgent() { 35.39 + protected HotSpotAgent getAgent() { 35.40 return agent; 35.41 } 35.42 35.43 @@ -155,7 +149,7 @@ 35.44 usage(); 35.45 } 35.46 35.47 - agent = new BugSpotAgent(); 35.48 + agent = new HotSpotAgent(); 35.49 try { 35.50 switch (debugeeType) { 35.51 case DEBUGEE_PID: 35.52 @@ -198,33 +192,24 @@ 35.53 35.54 err.println("Debugger attached successfully."); 35.55 35.56 - boolean isJava = agent.isJavaMode(); 35.57 - if (isJava) { 35.58 - VM vm = VM.getVM(); 35.59 - if (vm.isCore()) { 35.60 - err.println("Core build detected."); 35.61 - } else if (vm.isClientCompiler()) { 35.62 - err.println("Client compiler detected."); 35.63 - } else if (vm.isServerCompiler()) { 35.64 - err.println("Server compiler detected."); 35.65 - } else { 35.66 - throw new RuntimeException("Fatal error: " + 35.67 - "should have been able to detect core/C1/C2 build"); 35.68 - } 35.69 + VM vm = VM.getVM(); 35.70 + if (vm.isCore()) { 35.71 + err.println("Core build detected."); 35.72 + } else if (vm.isClientCompiler()) { 35.73 + err.println("Client compiler detected."); 35.74 + } else if (vm.isServerCompiler()) { 35.75 + err.println("Server compiler detected."); 35.76 + } else { 35.77 + throw new RuntimeException("Fatal error: " 35.78 + + "should have been able to detect core/C1/C2 build"); 35.79 + } 35.80 35.81 - String version = vm.getVMRelease(); 35.82 - if (version != null) { 35.83 - err.print("JVM version is "); 35.84 - err.println(version); 35.85 - } 35.86 + String version = vm.getVMRelease(); 35.87 + if (version != null) { 35.88 + err.print("JVM version is "); 35.89 + err.println(version); 35.90 + } 35.91 35.92 - run(); 35.93 - } else { // not a java process or core 35.94 - if (requiresVM()) { 35.95 - err.println(getName() + " requires a java VM process/core!"); 35.96 - } else { 35.97 - run(); 35.98 - } 35.99 - } 35.100 + run(); 35.101 } 35.102 }
36.1 --- a/agent/src/share/classes/sun/jvm/hotspot/ui/SAPanel.java Fri Feb 22 10:12:00 2013 -0800 36.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/ui/SAPanel.java Wed Feb 27 12:20:34 2013 -0800 36.3 @@ -50,7 +50,7 @@ 36.4 /** 36.5 * This base class encapsulates many of the events that are fired from 36.6 * the various panels in this directory so they can easily be plugged 36.7 - * in to different containing frameworks (HSDB, BugSpot). 36.8 + * in to different containing frameworks (HSDB). 36.9 */ 36.10 public class SAPanel extends JPanel { 36.11 protected List listeners = new ArrayList();
37.1 --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java Fri Feb 22 10:12:00 2013 -0800 37.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java Wed Feb 27 12:20:34 2013 -0800 37.3 @@ -1,5 +1,5 @@ 37.4 /* 37.5 - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 37.6 + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 37.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 37.8 * 37.9 * This code is free software; you can redistribute it and/or modify it 37.10 @@ -51,7 +51,6 @@ 37.11 private static final int JVM_CONSTANT_UnresolvedClassInError = 103; // Resolution failed 37.12 private static final int JVM_CONSTANT_MethodHandleInError = 104; // Error tag due to resolution error 37.13 private static final int JVM_CONSTANT_MethodTypeInError = 105; // Error tag due to resolution error 37.14 - private static final int JVM_CONSTANT_Object = 106; // Required for BoundMethodHandle arguments. 37.15 37.16 // JVM_CONSTANT_MethodHandle subtypes //FIXME: connect these to data structure 37.17 private static int JVM_REF_getField = 1; 37.18 @@ -96,8 +95,6 @@ 37.19 public boolean isKlassIndex() { return tag == JVM_CONSTANT_ClassIndex; } 37.20 public boolean isStringIndex() { return tag == JVM_CONSTANT_StringIndex; } 37.21 37.22 - public boolean isObject() { return tag == JVM_CONSTANT_Object; } 37.23 - 37.24 public boolean isKlassReference() { return isKlassIndex() || isUnresolvedKlass(); } 37.25 public boolean isFieldOrMethod() { return isField() || isMethod() || isInterfaceMethod(); } 37.26 public boolean isSymbol() { return isUtf8(); } 37.27 @@ -123,7 +120,6 @@ 37.28 case JVM_CONSTANT_StringIndex : 37.29 case JVM_CONSTANT_MethodHandle : 37.30 case JVM_CONSTANT_MethodType : 37.31 - case JVM_CONSTANT_Object : 37.32 return BasicType.T_OBJECT; 37.33 default: 37.34 throw new InternalError("unexpected tag: " + tag);
38.1 --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js Fri Feb 22 10:12:00 2013 -0800 38.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js Wed Feb 27 12:20:34 2013 -0800 38.3 @@ -31,7 +31,6 @@ 38.4 38.5 sapkg.hotspot = Packages.sun.jvm.hotspot; 38.6 sapkg.asm = sapkg.hotspot.asm; 38.7 -sapkg.bugspot = sapkg.hotspot.bugspot; 38.8 sapkg.c1 = sapkg.hotspot.c1; 38.9 sapkg.code = sapkg.hotspot.code; 38.10 sapkg.compiler = sapkg.hotspot.compiler; 38.11 @@ -40,7 +39,6 @@ 38.12 // sapkg.debugger = sapkg.hotspot.debugger; 38.13 38.14 sapkg.interpreter = sapkg.hotspot.interpreter; 38.15 -sapkg.livejvm = sapkg.hotspot.livejvm; 38.16 sapkg.jdi = sapkg.hotspot.jdi; 38.17 sapkg.memory = sapkg.hotspot.memory; 38.18 sapkg.oops = sapkg.hotspot.oops;
39.1 --- a/agent/src/share/native/jvmdi/sa.cpp Fri Feb 22 10:12:00 2013 -0800 39.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 39.3 @@ -1,601 +0,0 @@ 39.4 -/* 39.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. 39.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 39.7 - * 39.8 - * This code is free software; you can redistribute it and/or modify it 39.9 - * under the terms of the GNU General Public License version 2 only, as 39.10 - * published by the Free Software Foundation. 39.11 - * 39.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 39.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 39.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 39.15 - * version 2 for more details (a copy is included in the LICENSE file that 39.16 - * accompanied this code). 39.17 - * 39.18 - * You should have received a copy of the GNU General Public License version 39.19 - * 2 along with this work; if not, write to the Free Software Foundation, 39.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 39.21 - * 39.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 39.23 - * or visit www.oracle.com if you need additional information or have any 39.24 - * questions. 39.25 - * 39.26 - */ 39.27 - 39.28 -#include <stdio.h> 39.29 -#include <stdarg.h> 39.30 -#include <stdlib.h> 39.31 -#include <vector> 39.32 -#include "sa.hpp" 39.33 -#include "jni.h" 39.34 -#include "jvmdi.h" 39.35 - 39.36 -#ifndef WIN32 39.37 - #include <inttypes.h> 39.38 -#else 39.39 - typedef int int32_t; 39.40 -#endif 39.41 - 39.42 -#ifdef WIN32 39.43 - #include <windows.h> 39.44 - #define YIELD() Sleep(0) 39.45 - #define SLEEP() Sleep(10) 39.46 - #define vsnprintf _vsnprintf 39.47 -#else 39.48 - Error: please port YIELD() and SLEEP() macros to your platform 39.49 -#endif 39.50 - 39.51 -using namespace std; 39.52 - 39.53 -////////////////////////////////////////////////////////////////////// 39.54 -// // 39.55 -// Exported "interface" for Java language-level interaction between // 39.56 -// the SA and the VM. Note that the SA knows about the layout of // 39.57 -// certain VM data structures and that knowledge is taken advantage // 39.58 -// of in this code, although this interfaces with the VM via JVMDI. // 39.59 -// // 39.60 -////////////////////////////////////////////////////////////////////// 39.61 - 39.62 -extern "C" { 39.63 - ///////////////////////////////////// 39.64 - // // 39.65 - // Events sent by the VM to the SA // 39.66 - // // 39.67 - ///////////////////////////////////// 39.68 - 39.69 - // Set by the SA when it attaches. Indicates that events should be 39.70 - // posted via these exported variables, and that the VM should wait 39.71 - // for those events to be acknowledged by the SA (via its setting 39.72 - // saEventPending to 0). 39.73 - JNIEXPORT volatile int32_t saAttached = 0; 39.74 - 39.75 - // Set to nonzero value by the VM when an event has been posted; set 39.76 - // back to 0 by the SA when it has processed that event. 39.77 - JNIEXPORT volatile int32_t saEventPending = 0; 39.78 - 39.79 - // Kind of the event (from jvmdi.h) 39.80 - JNIEXPORT volatile int32_t saEventKind = 0; 39.81 - 39.82 - // 39.83 - // Exception events 39.84 - // 39.85 - JNIEXPORT jthread saExceptionThread; 39.86 - JNIEXPORT jclass saExceptionClass; 39.87 - JNIEXPORT jmethodID saExceptionMethod; 39.88 - JNIEXPORT int32_t saExceptionLocation; 39.89 - JNIEXPORT jobject saExceptionException; 39.90 - JNIEXPORT jclass saExceptionCatchClass; 39.91 - JNIEXPORT jmethodID saExceptionCatchMethod; 39.92 - JNIEXPORT int32_t saExceptionCatchLocation; 39.93 - 39.94 - // 39.95 - // Breakpoint events 39.96 - // 39.97 - JNIEXPORT jthread saBreakpointThread; 39.98 - JNIEXPORT jclass saBreakpointClass; 39.99 - JNIEXPORT jmethodID saBreakpointMethod; 39.100 - JNIEXPORT jlocation saBreakpointLocation; 39.101 - 39.102 - /////////////////////////////////////// 39.103 - // // 39.104 - // Commands sent by the SA to the VM // 39.105 - // // 39.106 - /////////////////////////////////////// 39.107 - 39.108 - extern JNIEXPORT const int32_t SA_CMD_SUSPEND_ALL = 0; 39.109 - extern JNIEXPORT const int32_t SA_CMD_RESUME_ALL = 1; 39.110 - extern JNIEXPORT const int32_t SA_CMD_TOGGLE_BREAKPOINT = 2; 39.111 - extern JNIEXPORT const int32_t SA_CMD_BUF_SIZE = 1024; 39.112 - 39.113 - // SA sets this to a nonzero value when it is requesting a command 39.114 - // to be processed; VM sets it back to 0 when the command has been 39.115 - // executed 39.116 - JNIEXPORT volatile int32_t saCmdPending = 0; 39.117 - 39.118 - // SA sets this to one of the manifest constants above to indicate 39.119 - // the kind of command to be executed 39.120 - JNIEXPORT volatile int32_t saCmdType = 0; 39.121 - 39.122 - // VM sets this to 0 if the last command succeeded or a nonzero 39.123 - // value if it failed 39.124 - JNIEXPORT volatile int32_t saCmdResult = 0; 39.125 - 39.126 - // If last command failed, this buffer will contain a descriptive 39.127 - // error message 39.128 - JNIEXPORT char saCmdResultErrMsg[SA_CMD_BUF_SIZE]; 39.129 - 39.130 - // 39.131 - // Toggling of breakpoint command arguments. 39.132 - // 39.133 - // Originally there were separate set/clear breakpoint commands 39.134 - // taking a class name, method name and signature, and the iteration 39.135 - // through the debug information was done in the SA. It turns out 39.136 - // that doing this work in the target VM is significantly faster, 39.137 - // and since interactivity when setting and clearing breakpoints is 39.138 - // important, the solution which resulted in more C/C++ code was used. 39.139 - // 39.140 - 39.141 - // Source file name 39.142 - JNIEXPORT char saCmdBkptSrcFileName[SA_CMD_BUF_SIZE]; 39.143 - 39.144 - // Package name ('/' as separator instead of '.') 39.145 - JNIEXPORT char saCmdBkptPkgName[SA_CMD_BUF_SIZE]; 39.146 - 39.147 - // Line number 39.148 - JNIEXPORT int32_t saCmdBkptLineNumber; 39.149 - 39.150 - // Output back to SA: indicator whether the last failure of a 39.151 - // breakpoint toggle command was really an error or just a lack of 39.152 - // debug information covering the requested line. 0 if not error. 39.153 - // Valid only if saCmdResult != 0. 39.154 - JNIEXPORT int32_t saCmdBkptResWasError; 39.155 - 39.156 - // Output back to SA: resulting line number at which the breakpoint 39.157 - // was set or cleared (valid only if saCmdResult == 0) 39.158 - JNIEXPORT int32_t saCmdBkptResLineNumber; 39.159 - 39.160 - // Output back to SA: resulting byte code index at which the 39.161 - // breakpoint was set or cleared (valid only if saCmdResult == 0) 39.162 - JNIEXPORT int32_t saCmdBkptResBCI; 39.163 - 39.164 - // Output back to SA: indicator whether the breakpoint operation 39.165 - // resulted in a set or cleared breakpoint; nonzero if set, zero if 39.166 - // cleared (valid only if saCmdResult == 0) 39.167 - JNIEXPORT int32_t saCmdBkptResWasSet; 39.168 - 39.169 - // Output back to SA: method name the breakpoint was set in (valid 39.170 - // only if saCmdResult == 0) 39.171 - JNIEXPORT char saCmdBkptResMethodName[SA_CMD_BUF_SIZE]; 39.172 - 39.173 - // Output back to SA: method signature (JNI style) the breakpoint 39.174 - // was set in (valid only if saCmdResult == 0) 39.175 - JNIEXPORT char saCmdBkptResMethodSig[SA_CMD_BUF_SIZE]; 39.176 -} 39.177 - 39.178 -// Internal state 39.179 -static JavaVM* jvm = NULL; 39.180 -static JVMDI_Interface_1* jvmdi = NULL; 39.181 -static jthread debugThreadObj = NULL; 39.182 -static bool suspended = false; 39.183 -static vector<jthread> suspendedThreads; 39.184 -static JVMDI_RawMonitor eventLock = NULL; 39.185 - 39.186 -class MonitorLocker { 39.187 -private: 39.188 - JVMDI_RawMonitor lock; 39.189 -public: 39.190 - MonitorLocker(JVMDI_RawMonitor lock) { 39.191 - this->lock = lock; 39.192 - if (lock != NULL) { 39.193 - jvmdi->RawMonitorEnter(lock); 39.194 - } 39.195 - } 39.196 - ~MonitorLocker() { 39.197 - if (lock != NULL) { 39.198 - jvmdi->RawMonitorExit(lock); 39.199 - } 39.200 - } 39.201 -}; 39.202 - 39.203 -class JvmdiDeallocator { 39.204 -private: 39.205 - void* ptr; 39.206 -public: 39.207 - JvmdiDeallocator(void* ptr) { 39.208 - this->ptr = ptr; 39.209 - } 39.210 - ~JvmdiDeallocator() { 39.211 - jvmdi->Deallocate((jbyte*) ptr); 39.212 - } 39.213 -}; 39.214 - 39.215 -class JvmdiRefListDeallocator { 39.216 -private: 39.217 - JNIEnv* env; 39.218 - jobject* refList; 39.219 - jint refCount; 39.220 -public: 39.221 - JvmdiRefListDeallocator(JNIEnv* env, jobject* refList, jint refCount) { 39.222 - this->env = env; 39.223 - this->refList = refList; 39.224 - this->refCount = refCount; 39.225 - } 39.226 - ~JvmdiRefListDeallocator() { 39.227 - for (int i = 0; i < refCount; i++) { 39.228 - env->DeleteGlobalRef(refList[i]); 39.229 - } 39.230 - jvmdi->Deallocate((jbyte*) refList); 39.231 - } 39.232 -}; 39.233 - 39.234 -static void 39.235 -stop(char* msg) { 39.236 - fprintf(stderr, "%s", msg); 39.237 - fprintf(stderr, "\n"); 39.238 - exit(1); 39.239 -} 39.240 - 39.241 -// This fills in the command result error message, sets the command 39.242 -// result to -1, and clears the pending command flag 39.243 -static void 39.244 -reportErrorToSA(const char* str, ...) { 39.245 - va_list varargs; 39.246 - va_start(varargs, str); 39.247 - vsnprintf(saCmdResultErrMsg, sizeof(saCmdResultErrMsg), str, varargs); 39.248 - va_end(varargs); 39.249 - saCmdResult = -1; 39.250 - saCmdPending = 0; 39.251 -} 39.252 - 39.253 -static bool 39.254 -packageNameMatches(char* clazzName, char* pkg) { 39.255 - int pkgLen = strlen(pkg); 39.256 - int clazzNameLen = strlen(clazzName); 39.257 - 39.258 - if (pkgLen >= clazzNameLen + 1) { 39.259 - return false; 39.260 - } 39.261 - 39.262 - if (strncmp(clazzName, pkg, pkgLen)) { 39.263 - return false; 39.264 - } 39.265 - 39.266 - // Ensure that '/' is the next character if non-empty package name 39.267 - int l = pkgLen; 39.268 - if (l > 0) { 39.269 - if (clazzName[l] != '/') { 39.270 - return false; 39.271 - } 39.272 - l++; 39.273 - } 39.274 - // Ensure that there are no more trailing slashes 39.275 - while (l < clazzNameLen) { 39.276 - if (clazzName[l++] == '/') { 39.277 - return false; 39.278 - } 39.279 - } 39.280 - return true; 39.281 -} 39.282 - 39.283 -static void 39.284 -executeOneCommand(JNIEnv* env) { 39.285 - switch (saCmdType) { 39.286 - case SA_CMD_SUSPEND_ALL: { 39.287 - if (suspended) { 39.288 - reportErrorToSA("Target process already suspended"); 39.289 - return; 39.290 - } 39.291 - 39.292 - // We implement this by getting all of the threads and calling 39.293 - // SuspendThread on each one, except for the thread object 39.294 - // corresponding to this thread. Each thread for which the call 39.295 - // succeeded (i.e., did not return JVMDI_ERROR_INVALID_THREAD) 39.296 - // is added to a list which is remembered for later resumption. 39.297 - // Note that this currently has race conditions since a thread 39.298 - // might be started after we call GetAllThreads and since a 39.299 - // thread for which we got an error earlier might be resumed by 39.300 - // the VM while we are busy suspending other threads. We could 39.301 - // solve this by looping until there are no more threads we can 39.302 - // suspend, but a more robust and scalable solution is to add 39.303 - // this functionality to the JVMDI interface (i.e., 39.304 - // "suspendAll"). Probably need to provide an exclude list for 39.305 - // such a routine. 39.306 - jint threadCount; 39.307 - jthread* threads; 39.308 - if (jvmdi->GetAllThreads(&threadCount, &threads) != JVMDI_ERROR_NONE) { 39.309 - reportErrorToSA("Error while getting thread list"); 39.310 - return; 39.311 - } 39.312 - 39.313 - 39.314 - for (int i = 0; i < threadCount; i++) { 39.315 - jthread thr = threads[i]; 39.316 - if (!env->IsSameObject(thr, debugThreadObj)) { 39.317 - jvmdiError err = jvmdi->SuspendThread(thr); 39.318 - if (err == JVMDI_ERROR_NONE) { 39.319 - // Remember this thread and do not free it 39.320 - suspendedThreads.push_back(thr); 39.321 - continue; 39.322 - } else { 39.323 - fprintf(stderr, " SA: Error %d while suspending thread\n", err); 39.324 - // FIXME: stop, resume all threads, report error 39.325 - } 39.326 - } 39.327 - env->DeleteGlobalRef(thr); 39.328 - } 39.329 - 39.330 - // Free up threads 39.331 - jvmdi->Deallocate((jbyte*) threads); 39.332 - 39.333 - // Suspension is complete 39.334 - suspended = true; 39.335 - break; 39.336 - } 39.337 - 39.338 - case SA_CMD_RESUME_ALL: { 39.339 - if (!suspended) { 39.340 - reportErrorToSA("Target process already suspended"); 39.341 - return; 39.342 - } 39.343 - 39.344 - saCmdResult = 0; 39.345 - bool errorOccurred = false; 39.346 - jvmdiError firstError; 39.347 - for (int i = 0; i < suspendedThreads.size(); i++) { 39.348 - jthread thr = suspendedThreads[i]; 39.349 - jvmdiError err = jvmdi->ResumeThread(thr); 39.350 - env->DeleteGlobalRef(thr); 39.351 - if (err != JVMDI_ERROR_NONE) { 39.352 - if (!errorOccurred) { 39.353 - errorOccurred = true; 39.354 - firstError = err; 39.355 - } 39.356 - } 39.357 - } 39.358 - suspendedThreads.clear(); 39.359 - suspended = false; 39.360 - if (errorOccurred) { 39.361 - reportErrorToSA("Error %d while resuming threads", firstError); 39.362 - return; 39.363 - } 39.364 - break; 39.365 - } 39.366 - 39.367 - case SA_CMD_TOGGLE_BREAKPOINT: { 39.368 - saCmdBkptResWasError = 1; 39.369 - 39.370 - // Search line number info for all loaded classes 39.371 - jint classCount; 39.372 - jclass* classes; 39.373 - 39.374 - jvmdiError glcRes = jvmdi->GetLoadedClasses(&classCount, &classes); 39.375 - if (glcRes != JVMDI_ERROR_NONE) { 39.376 - reportErrorToSA("Error %d while getting loaded classes", glcRes); 39.377 - return; 39.378 - } 39.379 - JvmdiRefListDeallocator rld(env, (jobject*) classes, classCount); 39.380 - 39.381 - bool done = false; 39.382 - bool gotOne = false; 39.383 - jclass targetClass; 39.384 - jmethodID targetMethod; 39.385 - jlocation targetLocation; 39.386 - jint targetLineNumber; 39.387 - 39.388 - for (int i = 0; i < classCount && !done; i++) { 39.389 - fflush(stderr); 39.390 - jclass clazz = classes[i]; 39.391 - char* srcName; 39.392 - jvmdiError sfnRes = jvmdi->GetSourceFileName(clazz, &srcName); 39.393 - if (sfnRes == JVMDI_ERROR_NONE) { 39.394 - JvmdiDeallocator de1(srcName); 39.395 - if (!strcmp(srcName, saCmdBkptSrcFileName)) { 39.396 - // Got a match. Now see whether the package name of the class also matches 39.397 - char* clazzName; 39.398 - jvmdiError sigRes = jvmdi->GetClassSignature(clazz, &clazzName); 39.399 - if (sigRes != JVMDI_ERROR_NONE) { 39.400 - reportErrorToSA("Error %d while getting a class's signature", sigRes); 39.401 - return; 39.402 - } 39.403 - JvmdiDeallocator de2(clazzName); 39.404 - if (packageNameMatches(clazzName + 1, saCmdBkptPkgName)) { 39.405 - // Iterate through all methods 39.406 - jint methodCount; 39.407 - jmethodID* methods; 39.408 - if (jvmdi->GetClassMethods(clazz, &methodCount, &methods) != JVMDI_ERROR_NONE) { 39.409 - reportErrorToSA("Error while getting methods of class %s", clazzName); 39.410 - return; 39.411 - } 39.412 - JvmdiDeallocator de3(methods); 39.413 - for (int j = 0; j < methodCount && !done; j++) { 39.414 - jmethodID m = methods[j]; 39.415 - jint entryCount; 39.416 - JVMDI_line_number_entry* table; 39.417 - jvmdiError lnRes = jvmdi->GetLineNumberTable(clazz, m, &entryCount, &table); 39.418 - if (lnRes == JVMDI_ERROR_NONE) { 39.419 - JvmdiDeallocator de4(table); 39.420 - // Look for line number greater than or equal to requested line 39.421 - for (int k = 0; k < entryCount && !done; k++) { 39.422 - JVMDI_line_number_entry& entry = table[k]; 39.423 - if (entry.line_number >= saCmdBkptLineNumber && 39.424 - (!gotOne || entry.line_number < targetLineNumber)) { 39.425 - gotOne = true; 39.426 - targetClass = clazz; 39.427 - targetMethod = m; 39.428 - targetLocation = entry.start_location; 39.429 - targetLineNumber = entry.line_number; 39.430 - done = (targetLineNumber == saCmdBkptLineNumber); 39.431 - } 39.432 - } 39.433 - } else if (lnRes != JVMDI_ERROR_ABSENT_INFORMATION) { 39.434 - reportErrorToSA("Unexpected error %d while fetching line number table", lnRes); 39.435 - return; 39.436 - } 39.437 - } 39.438 - } 39.439 - } 39.440 - } else if (sfnRes != JVMDI_ERROR_ABSENT_INFORMATION) { 39.441 - reportErrorToSA("Unexpected error %d while fetching source file name", sfnRes); 39.442 - return; 39.443 - } 39.444 - } 39.445 - 39.446 - bool wasSet = true; 39.447 - if (gotOne) { 39.448 - // Really toggle this breakpoint 39.449 - jvmdiError bpRes; 39.450 - bpRes = jvmdi->SetBreakpoint(targetClass, targetMethod, targetLocation); 39.451 - if (bpRes == JVMDI_ERROR_DUPLICATE) { 39.452 - bpRes = jvmdi->ClearBreakpoint(targetClass, targetMethod, targetLocation); 39.453 - wasSet = false; 39.454 - } 39.455 - if (bpRes != JVMDI_ERROR_NONE) { 39.456 - reportErrorToSA("Unexpected error %d while setting or clearing breakpoint at bci %d, line %d", 39.457 - bpRes, targetLocation, targetLineNumber); 39.458 - return; 39.459 - } 39.460 - } else { 39.461 - saCmdBkptResWasError = 0; 39.462 - reportErrorToSA("No debug information found covering this line"); 39.463 - return; 39.464 - } 39.465 - 39.466 - // Provide result 39.467 - saCmdBkptResLineNumber = targetLineNumber; 39.468 - saCmdBkptResBCI = targetLocation; 39.469 - saCmdBkptResWasSet = (wasSet ? 1 : 0); 39.470 - { 39.471 - char* methodName; 39.472 - char* methodSig; 39.473 - if (jvmdi->GetMethodName(targetClass, targetMethod, &methodName, &methodSig) 39.474 - == JVMDI_ERROR_NONE) { 39.475 - JvmdiDeallocator mnd(methodName); 39.476 - JvmdiDeallocator msd(methodSig); 39.477 - strncpy(saCmdBkptResMethodName, methodName, SA_CMD_BUF_SIZE); 39.478 - strncpy(saCmdBkptResMethodSig, methodSig, SA_CMD_BUF_SIZE); 39.479 - } else { 39.480 - strncpy(saCmdBkptResMethodName, "<error>", SA_CMD_BUF_SIZE); 39.481 - strncpy(saCmdBkptResMethodSig, "<error>", SA_CMD_BUF_SIZE); 39.482 - } 39.483 - } 39.484 - break; 39.485 - } 39.486 - 39.487 - default: 39.488 - reportErrorToSA("Command %d not yet supported", saCmdType); 39.489 - return; 39.490 - } 39.491 - 39.492 - // Successful command execution 39.493 - saCmdResult = 0; 39.494 - saCmdPending = 0; 39.495 -} 39.496 - 39.497 -static void 39.498 -saCommandThread(void *arg) { 39.499 - JNIEnv* env = NULL; 39.500 - if (jvm->GetEnv((void **) &env, JNI_VERSION_1_2) != JNI_OK) { 39.501 - stop("Error while starting Serviceability Agent " 39.502 - "command thread: could not get JNI environment"); 39.503 - } 39.504 - 39.505 - while (1) { 39.506 - // Wait for command 39.507 - while (!saCmdPending) { 39.508 - SLEEP(); 39.509 - } 39.510 - 39.511 - executeOneCommand(env); 39.512 - } 39.513 -} 39.514 - 39.515 -static void 39.516 -saEventHook(JNIEnv *env, JVMDI_Event *event) 39.517 -{ 39.518 - MonitorLocker ml(eventLock); 39.519 - 39.520 - saEventKind = event->kind; 39.521 - 39.522 - if (event->kind == JVMDI_EVENT_VM_INIT) { 39.523 - // Create event lock 39.524 - if (jvmdi->CreateRawMonitor("Serviceability Agent Event Lock", &eventLock) 39.525 - != JVMDI_ERROR_NONE) { 39.526 - stop("Unable to create Serviceability Agent's event lock"); 39.527 - } 39.528 - // Start thread which receives commands from the SA. 39.529 - jclass threadClass = env->FindClass("java/lang/Thread"); 39.530 - if (threadClass == NULL) stop("Unable to find class java/lang/Thread"); 39.531 - jstring threadName = env->NewStringUTF("Serviceability Agent Command Thread"); 39.532 - if (threadName == NULL) stop("Unable to allocate debug thread name"); 39.533 - jmethodID ctor = env->GetMethodID(threadClass, "<init>", "(Ljava/lang/String;)V"); 39.534 - if (ctor == NULL) stop("Unable to find appropriate constructor for java/lang/Thread"); 39.535 - // Allocate thread object 39.536 - jthread thr = (jthread) env->NewObject(threadClass, ctor, threadName); 39.537 - if (thr == NULL) stop("Unable to allocate debug thread's java/lang/Thread instance"); 39.538 - // Remember which thread this is 39.539 - debugThreadObj = env->NewGlobalRef(thr); 39.540 - if (debugThreadObj == NULL) stop("Unable to allocate global ref for debug thread object"); 39.541 - // Start thread 39.542 - jvmdiError err; 39.543 - if ((err = jvmdi->RunDebugThread(thr, &saCommandThread, NULL, JVMDI_THREAD_NORM_PRIORITY)) 39.544 - != JVMDI_ERROR_NONE) { 39.545 - char buf[256]; 39.546 - sprintf(buf, "Error %d while starting debug thread", err); 39.547 - stop(buf); 39.548 - } 39.549 - // OK, initialization is done 39.550 - return; 39.551 - } 39.552 - 39.553 - if (!saAttached) { 39.554 - return; 39.555 - } 39.556 - 39.557 - switch (event->kind) { 39.558 - case JVMDI_EVENT_EXCEPTION: { 39.559 - fprintf(stderr, "SA: Exception thrown -- ignoring\n"); 39.560 - saExceptionThread = event->u.exception.thread; 39.561 - saExceptionClass = event->u.exception.clazz; 39.562 - saExceptionMethod = event->u.exception.method; 39.563 - saExceptionLocation = event->u.exception.location; 39.564 - saExceptionException = event->u.exception.exception; 39.565 - saExceptionCatchClass = event->u.exception.catch_clazz; 39.566 - saExceptionCatchClass = event->u.exception.catch_clazz; 39.567 - saExceptionCatchMethod = event->u.exception.catch_method; 39.568 - saExceptionCatchLocation = event->u.exception.catch_location; 39.569 - // saEventPending = 1; 39.570 - break; 39.571 - } 39.572 - 39.573 - case JVMDI_EVENT_BREAKPOINT: { 39.574 - saBreakpointThread = event->u.breakpoint.thread; 39.575 - saBreakpointClass = event->u.breakpoint.clazz; 39.576 - saBreakpointMethod = event->u.breakpoint.method; 39.577 - saBreakpointLocation = event->u.breakpoint.location; 39.578 - saEventPending = 1; 39.579 - break; 39.580 - } 39.581 - 39.582 - default: 39.583 - break; 39.584 - } 39.585 - 39.586 - while (saAttached && saEventPending) { 39.587 - SLEEP(); 39.588 - } 39.589 -} 39.590 - 39.591 -extern "C" { 39.592 -JNIEXPORT jint JNICALL 39.593 -JVM_OnLoad(JavaVM *vm, char *options, void *reserved) 39.594 -{ 39.595 - jvm = vm; 39.596 - if (jvm->GetEnv((void**) &jvmdi, JVMDI_VERSION_1) != JNI_OK) { 39.597 - return -1; 39.598 - } 39.599 - if (jvmdi->SetEventHook(&saEventHook) != JVMDI_ERROR_NONE) { 39.600 - return -1; 39.601 - } 39.602 - return 0; 39.603 -} 39.604 -};
40.1 --- a/agent/src/share/native/jvmdi/sa.dsp Fri Feb 22 10:12:00 2013 -0800 40.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 40.3 @@ -1,105 +0,0 @@ 40.4 -# Microsoft Developer Studio Project File - Name="sa" - Package Owner=<4> 40.5 -# Microsoft Developer Studio Generated Build File, Format Version 6.00 40.6 -# ** DO NOT EDIT ** 40.7 - 40.8 -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 40.9 - 40.10 -CFG=sa - Win32 Debug 40.11 -!MESSAGE This is not a valid makefile. To build this project using NMAKE, 40.12 -!MESSAGE use the Export Makefile command and run 40.13 -!MESSAGE 40.14 -!MESSAGE NMAKE /f "sa.mak". 40.15 -!MESSAGE 40.16 -!MESSAGE You can specify a configuration when running NMAKE 40.17 -!MESSAGE by defining the macro CFG on the command line. For example: 40.18 -!MESSAGE 40.19 -!MESSAGE NMAKE /f "sa.mak" CFG="sa - Win32 Debug" 40.20 -!MESSAGE 40.21 -!MESSAGE Possible choices for configuration are: 40.22 -!MESSAGE 40.23 -!MESSAGE "sa - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") 40.24 -!MESSAGE "sa - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") 40.25 -!MESSAGE 40.26 - 40.27 -# Begin Project 40.28 -# PROP AllowPerConfigDependencies 0 40.29 -# PROP Scc_ProjName "" 40.30 -# PROP Scc_LocalPath "" 40.31 -CPP=cl.exe 40.32 -MTL=midl.exe 40.33 -RSC=rc.exe 40.34 - 40.35 -!IF "$(CFG)" == "sa - Win32 Release" 40.36 - 40.37 -# PROP BASE Use_MFC 0 40.38 -# PROP BASE Use_Debug_Libraries 0 40.39 -# PROP BASE Output_Dir "Release" 40.40 -# PROP BASE Intermediate_Dir "Release" 40.41 -# PROP BASE Target_Dir "" 40.42 -# PROP Use_MFC 0 40.43 -# PROP Use_Debug_Libraries 0 40.44 -# PROP Output_Dir "Release" 40.45 -# PROP Intermediate_Dir "Release" 40.46 -# PROP Target_Dir "" 40.47 -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SA_EXPORTS" /YX /FD /c 40.48 -# ADD CPP /nologo /MT /W3 /GX /O2 /I "D:\jdk1.4\include" /I "D:\jdk1.4\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SA_EXPORTS" /YX /FD /c 40.49 -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 40.50 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 40.51 -# ADD BASE RSC /l 0x409 /d "NDEBUG" 40.52 -# ADD RSC /l 0x409 /d "NDEBUG" 40.53 -BSC32=bscmake.exe 40.54 -# ADD BASE BSC32 /nologo 40.55 -# ADD BSC32 /nologo 40.56 -LINK32=link.exe 40.57 -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 40.58 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 40.59 - 40.60 -!ELSEIF "$(CFG)" == "sa - Win32 Debug" 40.61 - 40.62 -# PROP BASE Use_MFC 0 40.63 -# PROP BASE Use_Debug_Libraries 1 40.64 -# PROP BASE Output_Dir "Debug" 40.65 -# PROP BASE Intermediate_Dir "Debug" 40.66 -# PROP BASE Target_Dir "" 40.67 -# PROP Use_MFC 0 40.68 -# PROP Use_Debug_Libraries 1 40.69 -# PROP Output_Dir "Debug" 40.70 -# PROP Intermediate_Dir "Debug" 40.71 -# PROP Target_Dir "" 40.72 -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SA_EXPORTS" /YX /FD /GZ /c 40.73 -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "D:\jdk1.4\include" /I "D:\jdk1.4\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SA_EXPORTS" /YX /FD /GZ /c 40.74 -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 40.75 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 40.76 -# ADD BASE RSC /l 0x409 /d "_DEBUG" 40.77 -# ADD RSC /l 0x409 /d "_DEBUG" 40.78 -BSC32=bscmake.exe 40.79 -# ADD BASE BSC32 /nologo 40.80 -# ADD BSC32 /nologo 40.81 -LINK32=link.exe 40.82 -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept 40.83 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept 40.84 - 40.85 -!ENDIF 40.86 - 40.87 -# Begin Target 40.88 - 40.89 -# Name "sa - Win32 Release" 40.90 -# Name "sa - Win32 Debug" 40.91 -# Begin Group "Source Files" 40.92 - 40.93 -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 40.94 -# Begin Source File 40.95 - 40.96 -SOURCE=.\sa.cpp 40.97 -# End Source File 40.98 -# End Group 40.99 -# Begin Group "Header Files" 40.100 - 40.101 -# PROP Default_Filter "h;hpp;hxx;hm;inl" 40.102 -# End Group 40.103 -# Begin Group "Resource Files" 40.104 - 40.105 -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 40.106 -# End Group 40.107 -# End Target 40.108 -# End Project
41.1 --- a/agent/src/share/native/jvmdi/sa.dsw Fri Feb 22 10:12:00 2013 -0800 41.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 41.3 @@ -1,29 +0,0 @@ 41.4 -Microsoft Developer Studio Workspace File, Format Version 6.00 41.5 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 41.6 - 41.7 -############################################################################### 41.8 - 41.9 -Project: "sa"=.\sa.dsp - Package Owner=<4> 41.10 - 41.11 -Package=<5> 41.12 -{{{ 41.13 -}}} 41.14 - 41.15 -Package=<4> 41.16 -{{{ 41.17 -}}} 41.18 - 41.19 -############################################################################### 41.20 - 41.21 -Global: 41.22 - 41.23 -Package=<5> 41.24 -{{{ 41.25 -}}} 41.26 - 41.27 -Package=<3> 41.28 -{{{ 41.29 -}}} 41.30 - 41.31 -############################################################################### 41.32 -
42.1 --- a/agent/src/share/native/jvmdi/sa.hpp Fri Feb 22 10:12:00 2013 -0800 42.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 42.3 @@ -1,30 +0,0 @@ 42.4 -/* 42.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. 42.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 42.7 - * 42.8 - * This code is free software; you can redistribute it and/or modify it 42.9 - * under the terms of the GNU General Public License version 2 only, as 42.10 - * published by the Free Software Foundation. 42.11 - * 42.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 42.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 42.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 42.15 - * version 2 for more details (a copy is included in the LICENSE file that 42.16 - * accompanied this code). 42.17 - * 42.18 - * You should have received a copy of the GNU General Public License version 42.19 - * 2 along with this work; if not, write to the Free Software Foundation, 42.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 42.21 - * 42.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 42.23 - * or visit www.oracle.com if you need additional information or have any 42.24 - * questions. 42.25 - * 42.26 - */ 42.27 - 42.28 -#include "jni.h" 42.29 - 42.30 -extern "C" { 42.31 -JNIEXPORT jint JNICALL 42.32 -JVM_OnLoad(JavaVM *vm, char *options, void *reserved); 42.33 -}
43.1 --- a/make/Makefile Fri Feb 22 10:12:00 2013 -0800 43.2 +++ b/make/Makefile Wed Feb 27 12:20:34 2013 -0800 43.3 @@ -464,9 +464,6 @@ 43.4 $(EXPORT_LIB_DIR)/%.jar: $(GEN_DIR)/%.jar 43.5 $(install-file) 43.6 43.7 -$(EXPORT_JRE_LIB_DIR)/%.jar: $(GEN_DIR)/%.jar 43.8 - $(install-file) 43.9 - 43.10 # Include files (jvmti.h, jvmticmlr.h, jni.h, $(JDK_INCLUDE_SUBDIR)/jni_md.h, jmm.h, jfr.h) 43.11 $(EXPORT_INCLUDE_DIR)/%: $(GEN_DIR)/jvmtifiles/% 43.12 $(install-file)
44.1 --- a/make/bsd/makefiles/defs.make Fri Feb 22 10:12:00 2013 -0800 44.2 +++ b/make/bsd/makefiles/defs.make Wed Feb 27 12:20:34 2013 -0800 44.3 @@ -157,8 +157,6 @@ 44.4 EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client 44.5 EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal 44.6 44.7 -EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar 44.8 - 44.9 ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) 44.10 EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt 44.11 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
45.1 --- a/make/bsd/makefiles/vm.make Fri Feb 22 10:12:00 2013 -0800 45.2 +++ b/make/bsd/makefiles/vm.make Wed Feb 27 12:20:34 2013 -0800 45.3 @@ -337,9 +337,6 @@ 45.4 # Serviceability agent 45.5 include $(MAKEFILES_DIR)/saproc.make 45.6 45.7 -# Whitebox testing API 45.8 -include $(MAKEFILES_DIR)/wb.make 45.9 - 45.10 #---------------------------------------------------------------------- 45.11 45.12 ifeq ($(OS_VENDOR), Darwin) 45.13 @@ -347,10 +344,10 @@ 45.14 dsymutil $(LIBJVM) 45.15 45.16 # no libjvm_db for macosx 45.17 -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(BUILDLIBSAPROC) dtraceCheck $(LIBJVM).dSYM $(WB_JAR) 45.18 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(BUILDLIBSAPROC) dtraceCheck $(LIBJVM).dSYM 45.19 echo "Doing vm.make build:" 45.20 else 45.21 -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) $(WB_JAR) 45.22 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) 45.23 endif 45.24 45.25 install: install_jvm install_jsig install_saproc
46.1 --- a/make/bsd/makefiles/wb.make Fri Feb 22 10:12:00 2013 -0800 46.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 46.3 @@ -1,46 +0,0 @@ 46.4 -# 46.5 -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 46.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 46.7 -# 46.8 -# This code is free software; you can redistribute it and/or modify it 46.9 -# under the terms of the GNU General Public License version 2 only, as 46.10 -# published by the Free Software Foundation. 46.11 -# 46.12 -# This code is distributed in the hope that it will be useful, but WITHOUT 46.13 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 46.14 -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 46.15 -# version 2 for more details (a copy is included in the LICENSE file that 46.16 -# accompanied this code). 46.17 -# 46.18 -# You should have received a copy of the GNU General Public License version 46.19 -# 2 along with this work; if not, write to the Free Software Foundation, 46.20 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 46.21 -# 46.22 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 46.23 -# or visit www.oracle.com if you need additional information or have any 46.24 -# questions. 46.25 -# 46.26 -# 46.27 - 46.28 -# Rules to build whitebox testing library, used by vm.make 46.29 -WB = wb 46.30 - 46.31 -WBSRCDIR = $(GAMMADIR)/src/share/tools/whitebox 46.32 - 46.33 -WB_JAR = $(GENERATED)/$(WB).jar 46.34 - 46.35 -WB_JAVA_SRCS = $(shell find $(WBSRCDIR) -name '*.java') 46.36 -WB_JAVA_CLASSDIR = $(GENERATED)/wb/classes 46.37 - 46.38 -WB_JAVA_CLASSES = $(patsubst $(WBSRCDIR)/%,$(WB_JAVA_CLASSDIR)/%, \ 46.39 - $(patsubst %.java,%.class,$(WB_JAVA_SRCS))) 46.40 - 46.41 -$(WB_JAVA_CLASSDIR)/%.class: $(WBSRCDIR)/%.java $(WB_JAVA_CLASSDIR) 46.42 - $(REMOTE) $(COMPILE.JAVAC) -sourcepath $(WBSRCDIR) -nowarn -d $(WB_JAVA_CLASSDIR) $< 46.43 - 46.44 -$(WB_JAR): $(WB_JAVA_CLASSES) 46.45 - $(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(WB_JAVA_CLASSDIR)/ . 46.46 - 46.47 -$(WB_JAVA_CLASSDIR): 46.48 - $(QUIETLY) mkdir -p $@ 46.49 -
47.1 --- a/make/linux/makefiles/defs.make Fri Feb 22 10:12:00 2013 -0800 47.2 +++ b/make/linux/makefiles/defs.make Wed Feb 27 12:20:34 2013 -0800 47.3 @@ -258,8 +258,6 @@ 47.4 EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client 47.5 EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal 47.6 47.7 -EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar 47.8 - 47.9 ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) 47.10 EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt 47.11 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
48.1 --- a/make/linux/makefiles/vm.make Fri Feb 22 10:12:00 2013 -0800 48.2 +++ b/make/linux/makefiles/vm.make Wed Feb 27 12:20:34 2013 -0800 48.3 @@ -381,12 +381,9 @@ 48.4 # Serviceability agent 48.5 include $(MAKEFILES_DIR)/saproc.make 48.6 48.7 -# Whitebox testing API 48.8 -include $(MAKEFILES_DIR)/wb.make 48.9 - 48.10 #---------------------------------------------------------------------- 48.11 48.12 -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceCheck $(WB_JAR) 48.13 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceCheck 48.14 48.15 install: install_jvm install_jsig install_saproc 48.16
49.1 --- a/make/linux/makefiles/wb.make Fri Feb 22 10:12:00 2013 -0800 49.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 49.3 @@ -1,46 +0,0 @@ 49.4 -# 49.5 -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 49.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 49.7 -# 49.8 -# This code is free software; you can redistribute it and/or modify it 49.9 -# under the terms of the GNU General Public License version 2 only, as 49.10 -# published by the Free Software Foundation. 49.11 -# 49.12 -# This code is distributed in the hope that it will be useful, but WITHOUT 49.13 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 49.14 -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 49.15 -# version 2 for more details (a copy is included in the LICENSE file that 49.16 -# accompanied this code). 49.17 -# 49.18 -# You should have received a copy of the GNU General Public License version 49.19 -# 2 along with this work; if not, write to the Free Software Foundation, 49.20 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 49.21 -# 49.22 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 49.23 -# or visit www.oracle.com if you need additional information or have any 49.24 -# questions. 49.25 -# 49.26 -# 49.27 - 49.28 -# Rules to build whitebox testing library, used by vm.make 49.29 -WB = wb 49.30 - 49.31 -WBSRCDIR = $(GAMMADIR)/src/share/tools/whitebox 49.32 - 49.33 -WB_JAR = $(GENERATED)/$(WB).jar 49.34 - 49.35 -WB_JAVA_SRCS = $(shell find $(WBSRCDIR) -name '*.java') 49.36 -WB_JAVA_CLASSDIR = $(GENERATED)/wb/classes 49.37 - 49.38 -WB_JAVA_CLASSES = $(patsubst $(WBSRCDIR)/%,$(WB_JAVA_CLASSDIR)/%, \ 49.39 - $(patsubst %.java,%.class,$(WB_JAVA_SRCS))) 49.40 - 49.41 -$(WB_JAVA_CLASSDIR)/%.class: $(WBSRCDIR)/%.java $(WB_JAVA_CLASSDIR) 49.42 - $(REMOTE) $(COMPILE.JAVAC) -sourcepath $(WBSRCDIR) -nowarn -d $(WB_JAVA_CLASSDIR) $< 49.43 - 49.44 -$(WB_JAR): $(WB_JAVA_CLASSES) 49.45 - $(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(WB_JAVA_CLASSDIR)/ . 49.46 - 49.47 -$(WB_JAVA_CLASSDIR): 49.48 - $(QUIETLY) mkdir -p $@ 49.49 -
50.1 --- a/make/sa.files Fri Feb 22 10:12:00 2013 -0800 50.2 +++ b/make/sa.files Wed Feb 27 12:20:34 2013 -0800 50.3 @@ -24,10 +24,7 @@ 50.4 50.5 # This filelist macro is included in platform specific sa.make 50.6 # included all packages/*.java. package list can be generated by 50.7 -# $(GAMMADIR)/agent/make/build-pkglist. Then manually removed all 50.8 -# classes in sun.jvm.hotspot.ui (and subpackages), all ui classes 50.9 -# in sun.jvm.hotspot.bugspot/hotspot and SPARC and x86 disassembler 50.10 -# classes and sun.jvm.hotspot.utilities.soql. 50.11 +# $(GAMMADIR)/agent/make/build-pkglist. 50.12 50.13 # define AGENT_DIR before including this file in sa.make 50.14 50.15 @@ -40,8 +37,6 @@ 50.16 $(AGENT_SRC_DIR)/sun/jvm/hotspot/*.java \ 50.17 $(AGENT_SRC_DIR)/sun/jvm/hotspot/asm/*.java \ 50.18 $(AGENT_SRC_DIR)/sun/jvm/hotspot/asm/sparc/*.java \ 50.19 -$(AGENT_SRC_DIR)/sun/jvm/hotspot/bugspot/*.java \ 50.20 -$(AGENT_SRC_DIR)/sun/jvm/hotspot/bugspot/tree/*.java \ 50.21 $(AGENT_SRC_DIR)/sun/jvm/hotspot/c1/*.java \ 50.22 $(AGENT_SRC_DIR)/sun/jvm/hotspot/ci/*.java \ 50.23 $(AGENT_SRC_DIR)/sun/jvm/hotspot/code/*.java \ 50.24 @@ -82,7 +77,6 @@ 50.25 $(AGENT_SRC_DIR)/sun/jvm/hotspot/gc_interface/*.java \ 50.26 $(AGENT_SRC_DIR)/sun/jvm/hotspot/interpreter/*.java \ 50.27 $(AGENT_SRC_DIR)/sun/jvm/hotspot/jdi/*.java \ 50.28 -$(AGENT_SRC_DIR)/sun/jvm/hotspot/livejvm/*.java \ 50.29 $(AGENT_SRC_DIR)/sun/jvm/hotspot/memory/*.java \ 50.30 $(AGENT_SRC_DIR)/sun/jvm/hotspot/oops/*.java \ 50.31 $(AGENT_SRC_DIR)/sun/jvm/hotspot/opto/*.java \
51.1 --- a/make/solaris/makefiles/defs.make Fri Feb 22 10:12:00 2013 -0800 51.2 +++ b/make/solaris/makefiles/defs.make Wed Feb 27 12:20:34 2013 -0800 51.3 @@ -187,8 +187,6 @@ 51.4 endif 51.5 endif 51.6 51.7 -EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar 51.8 - 51.9 EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server 51.10 EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client 51.11
52.1 --- a/make/solaris/makefiles/vm.make Fri Feb 22 10:12:00 2013 -0800 52.2 +++ b/make/solaris/makefiles/vm.make Wed Feb 27 12:20:34 2013 -0800 52.3 @@ -347,12 +347,9 @@ 52.4 # Serviceability agent 52.5 include $(MAKEFILES_DIR)/saproc.make 52.6 52.7 -# Whitebox testing API 52.8 -include $(MAKEFILES_DIR)/wb.make 52.9 - 52.10 #---------------------------------------------------------------------- 52.11 52.12 -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) $(BUILDLIBSAPROC) dtraceCheck $(WB_JAR) 52.13 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) $(BUILDLIBSAPROC) dtraceCheck 52.14 52.15 install: install_jvm install_jsig install_saproc 52.16
53.1 --- a/make/solaris/makefiles/wb.make Fri Feb 22 10:12:00 2013 -0800 53.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 53.3 @@ -1,46 +0,0 @@ 53.4 -# 53.5 -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 53.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 53.7 -# 53.8 -# This code is free software; you can redistribute it and/or modify it 53.9 -# under the terms of the GNU General Public License version 2 only, as 53.10 -# published by the Free Software Foundation. 53.11 -# 53.12 -# This code is distributed in the hope that it will be useful, but WITHOUT 53.13 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 53.14 -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 53.15 -# version 2 for more details (a copy is included in the LICENSE file that 53.16 -# accompanied this code). 53.17 -# 53.18 -# You should have received a copy of the GNU General Public License version 53.19 -# 2 along with this work; if not, write to the Free Software Foundation, 53.20 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 53.21 -# 53.22 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 53.23 -# or visit www.oracle.com if you need additional information or have any 53.24 -# questions. 53.25 -# 53.26 - 53.27 -# Rules to build whitebox testing library, used by vm.make 53.28 - 53.29 -WB = wb 53.30 - 53.31 -WBSRCDIR = $(GAMMADIR)/src/share/tools/whitebox 53.32 - 53.33 -WB_JAR = $(GENERATED)/$(WB).jar 53.34 - 53.35 -WB_JAVA_SRCS = $(shell find $(WBSRCDIR) -name '*.java') 53.36 -WB_JAVA_CLASSDIR = $(GENERATED)/wb/classes 53.37 - 53.38 -WB_JAVA_CLASSES = $(patsubst $(WBSRCDIR)/%,$(WB_JAVA_CLASSDIR)/%, \ 53.39 - $(patsubst %.java,%.class,$(WB_JAVA_SRCS))) 53.40 - 53.41 -$(WB_JAVA_CLASSDIR)/%.class: $(WBSRCDIR)/%.java $(WB_JAVA_CLASSDIR) 53.42 - $(REMOTE) $(COMPILE.JAVAC) -sourcepath $(WBSRCDIR) -nowarn -d $(WB_JAVA_CLASSDIR) $< 53.43 - 53.44 -$(WB_JAR): $(WB_JAVA_CLASSES) 53.45 - $(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(WB_JAVA_CLASSDIR)/ . 53.46 - 53.47 -$(WB_JAVA_CLASSDIR): 53.48 - $(QUIETLY) mkdir -p $@ 53.49 -
54.1 --- a/make/windows/makefiles/debug.make Fri Feb 22 10:12:00 2013 -0800 54.2 +++ b/make/windows/makefiles/debug.make Wed Feb 27 12:20:34 2013 -0800 54.3 @@ -33,7 +33,7 @@ 54.4 BUILD_PCH_FILE=_build_pch_file.obj 54.5 !endif 54.6 54.7 -default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb 54.8 +default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA 54.9 54.10 !include ../local.make 54.11 !include compile.make 54.12 @@ -72,4 +72,3 @@ 54.13 !include $(WorkSpace)/make/windows/makefiles/shared.make 54.14 !include $(WorkSpace)/make/windows/makefiles/sa.make 54.15 !include $(WorkSpace)/make/windows/makefiles/launcher.make 54.16 -!include $(WorkSpace)/make/windows/makefiles/wb.make
55.1 --- a/make/windows/makefiles/defs.make Fri Feb 22 10:12:00 2013 -0800 55.2 +++ b/make/windows/makefiles/defs.make Wed Feb 27 12:20:34 2013 -0800 55.3 @@ -277,8 +277,6 @@ 55.4 endif 55.5 endif 55.6 55.7 -EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar 55.8 - 55.9 ifeq ($(BUILD_WIN_SA), 1) 55.10 EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.$(LIBRARY_SUFFIX) 55.11 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
56.1 --- a/make/windows/makefiles/fastdebug.make Fri Feb 22 10:12:00 2013 -0800 56.2 +++ b/make/windows/makefiles/fastdebug.make Wed Feb 27 12:20:34 2013 -0800 56.3 @@ -33,7 +33,7 @@ 56.4 BUILD_PCH_FILE=_build_pch_file.obj 56.5 !endif 56.6 56.7 -default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb 56.8 +default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA 56.9 56.10 !include ../local.make 56.11 !include compile.make 56.12 @@ -71,4 +71,3 @@ 56.13 !include $(WorkSpace)/make/windows/makefiles/shared.make 56.14 !include $(WorkSpace)/make/windows/makefiles/sa.make 56.15 !include $(WorkSpace)/make/windows/makefiles/launcher.make 56.16 -!include $(WorkSpace)/make/windows/makefiles/wb.make
57.1 --- a/make/windows/makefiles/product.make Fri Feb 22 10:12:00 2013 -0800 57.2 +++ b/make/windows/makefiles/product.make Wed Feb 27 12:20:34 2013 -0800 57.3 @@ -32,7 +32,7 @@ 57.4 BUILD_PCH_FILE=_build_pch_file.obj 57.5 !endif 57.6 57.7 -default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb 57.8 +default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA 57.9 57.10 !include ../local.make 57.11 !include compile.make 57.12 @@ -82,4 +82,3 @@ 57.13 !include $(WorkSpace)/make/windows/makefiles/shared.make 57.14 !include $(WorkSpace)/make/windows/makefiles/sa.make 57.15 !include $(WorkSpace)/make/windows/makefiles/launcher.make 57.16 -!include $(WorkSpace)/make/windows/makefiles/wb.make
58.1 --- a/make/windows/makefiles/wb.make Fri Feb 22 10:12:00 2013 -0800 58.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 58.3 @@ -1,54 +0,0 @@ 58.4 -# 58.5 -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 58.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 58.7 -# 58.8 -# This code is free software; you can redistribute it and/or modify it 58.9 -# under the terms of the GNU General Public License version 2 only, as 58.10 -# published by the Free Software Foundation. 58.11 -# 58.12 -# This code is distributed in the hope that it will be useful, but WITHOUT 58.13 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 58.14 -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 58.15 -# version 2 for more details (a copy is included in the LICENSE file that 58.16 -# accompanied this code). 58.17 -# 58.18 -# You should have received a copy of the GNU General Public License version 58.19 -# 2 along with this work; if not, write to the Free Software Foundation, 58.20 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 58.21 -# 58.22 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 58.23 -# or visit www.oracle.com if you need additional information or have any 58.24 -# questions. 58.25 -# 58.26 -# 58.27 - 58.28 -# This makefile is used to build the whitebox testing lib 58.29 -# and compile the tests which use it 58.30 - 58.31 -!include $(WorkSpace)/make/windows/makefiles/rules.make 58.32 - 58.33 -WBSRCDIR = $(WorkSpace)/src/share/tools/whitebox 58.34 - 58.35 -# turn GENERATED into a windows path to get sane dependencies 58.36 -WB_CLASSES=$(GENERATED:/=\)\wb\classes 58.37 -WB_JAR=$(GENERATED:/=\)\wb.jar 58.38 - 58.39 -# call recursive make to do wildcard expansion 58.40 -.SUFFIXES : .java .class 58.41 -wb_java_srcs: $(WorkSpace)\src\share\tools\whitebox\sun\hotspot\*.java $(WB_CLASSES) 58.42 - $(MAKE) -f $(WorkSpace)\make\windows\makefiles\$(BUILD_FLAVOR).make $(**:.java=.class) 58.43 - 58.44 - 58.45 -{$(WorkSpace)\src\share\tools\whitebox\sun\hotspot}.java.class:: 58.46 - $(COMPILE_JAVAC) -sourcepath $(WBSRCDIR) -d $(WB_CLASSES) $< 58.47 - 58.48 -$(WB_JAR): wb_java_srcs 58.49 - $(RUN_JAR) cf $@ -C $(WB_CLASSES) . 58.50 - 58.51 -# turn $@ to a unix path because mkdir in PATH is cygwin/mks mkdir 58.52 -$(WB_CLASSES): 58.53 - mkdir -p $(@:\=/) 58.54 - 58.55 -# main target to build wb 58.56 -wb: $(WB_JAR) 58.57 -
59.1 --- a/src/cpu/sparc/vm/frame_sparc.cpp Fri Feb 22 10:12:00 2013 -0800 59.2 +++ b/src/cpu/sparc/vm/frame_sparc.cpp Wed Feb 27 12:20:34 2013 -0800 59.3 @@ -216,6 +216,11 @@ 59.4 } 59.5 } 59.6 59.7 + // Could just be some random pointer within the codeBlob 59.8 + if (!_cb->code_contains(_pc)) { 59.9 + return false; 59.10 + } 59.11 + 59.12 // Entry frame checks 59.13 if (is_entry_frame()) { 59.14 // an entry frame must have a valid fp.
60.1 --- a/src/cpu/sparc/vm/templateTable_sparc.cpp Fri Feb 22 10:12:00 2013 -0800 60.2 +++ b/src/cpu/sparc/vm/templateTable_sparc.cpp Wed Feb 27 12:20:34 2013 -0800 60.3 @@ -1,5 +1,5 @@ 60.4 /* 60.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 60.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 60.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 60.8 * 60.9 * This code is free software; you can redistribute it and/or modify it 60.10 @@ -340,8 +340,6 @@ 60.11 60.12 __ bind(notInt); 60.13 // __ cmp(O2, JVM_CONSTANT_String); 60.14 - __ brx(Assembler::equal, true, Assembler::pt, isString); 60.15 - __ delayed()->cmp(O2, JVM_CONSTANT_Object); 60.16 __ brx(Assembler::notEqual, true, Assembler::pt, notString); 60.17 __ delayed()->ldf(FloatRegisterImpl::S, O0, O1, Ftos_f); 60.18 __ bind(isString);
61.1 --- a/src/cpu/x86/vm/frame_x86.cpp Fri Feb 22 10:12:00 2013 -0800 61.2 +++ b/src/cpu/x86/vm/frame_x86.cpp Wed Feb 27 12:20:34 2013 -0800 61.3 @@ -91,6 +91,12 @@ 61.4 return false; 61.5 } 61.6 } 61.7 + 61.8 + // Could just be some random pointer within the codeBlob 61.9 + if (!_cb->code_contains(_pc)) { 61.10 + return false; 61.11 + } 61.12 + 61.13 // Entry frame checks 61.14 if (is_entry_frame()) { 61.15 // an entry frame must have a valid fp.
62.1 --- a/src/os/linux/vm/os_linux.cpp Fri Feb 22 10:12:00 2013 -0800 62.2 +++ b/src/os/linux/vm/os_linux.cpp Wed Feb 27 12:20:34 2013 -0800 62.3 @@ -4743,49 +4743,26 @@ 62.4 // 62.5 62.6 static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { 62.7 - static bool proc_pid_cpu_avail = true; 62.8 static bool proc_task_unchecked = true; 62.9 static const char *proc_stat_path = "/proc/%d/stat"; 62.10 pid_t tid = thread->osthread()->thread_id(); 62.11 - int i; 62.12 char *s; 62.13 char stat[2048]; 62.14 int statlen; 62.15 char proc_name[64]; 62.16 int count; 62.17 long sys_time, user_time; 62.18 - char string[64]; 62.19 char cdummy; 62.20 int idummy; 62.21 long ldummy; 62.22 FILE *fp; 62.23 62.24 - // We first try accessing /proc/<pid>/cpu since this is faster to 62.25 - // process. If this file is not present (linux kernels 2.5 and above) 62.26 - // then we open /proc/<pid>/stat. 62.27 - if ( proc_pid_cpu_avail ) { 62.28 - sprintf(proc_name, "/proc/%d/cpu", tid); 62.29 - fp = fopen(proc_name, "r"); 62.30 - if ( fp != NULL ) { 62.31 - count = fscanf( fp, "%s %lu %lu\n", string, &user_time, &sys_time); 62.32 - fclose(fp); 62.33 - if ( count != 3 ) return -1; 62.34 - 62.35 - if (user_sys_cpu_time) { 62.36 - return ((jlong)sys_time + (jlong)user_time) * (1000000000 / clock_tics_per_sec); 62.37 - } else { 62.38 - return (jlong)user_time * (1000000000 / clock_tics_per_sec); 62.39 - } 62.40 - } 62.41 - else proc_pid_cpu_avail = false; 62.42 - } 62.43 - 62.44 // The /proc/<tid>/stat aggregates per-process usage on 62.45 // new Linux kernels 2.6+ where NPTL is supported. 62.46 // The /proc/self/task/<tid>/stat still has the per-thread usage. 62.47 // See bug 6328462. 62.48 - // There can be no directory /proc/self/task on kernels 2.4 with NPTL 62.49 - // and possibly in some other cases, so we check its availability. 62.50 + // There possibly can be cases where there is no directory 62.51 + // /proc/self/task, so we check its availability. 62.52 if (proc_task_unchecked && os::Linux::is_NPTL()) { 62.53 // This is executed only once 62.54 proc_task_unchecked = false; 62.55 @@ -4810,7 +4787,6 @@ 62.56 // We don't really need to know the command string, just find the last 62.57 // occurrence of ")" and then start parsing from there. See bug 4726580. 62.58 s = strrchr(stat, ')'); 62.59 - i = 0; 62.60 if (s == NULL ) return -1; 62.61 62.62 // Skip blank chars
63.1 --- a/src/share/tools/whitebox/sun/hotspot/WhiteBox.java Fri Feb 22 10:12:00 2013 -0800 63.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 63.3 @@ -1,97 +0,0 @@ 63.4 -/* 63.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 63.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 63.7 - * 63.8 - * This code is free software; you can redistribute it and/or modify it 63.9 - * under the terms of the GNU General Public License version 2 only, as 63.10 - * published by the Free Software Foundation. 63.11 - * 63.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 63.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 63.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 63.15 - * version 2 for more details (a copy is included in the LICENSE file that 63.16 - * accompanied this code). 63.17 - * 63.18 - * You should have received a copy of the GNU General Public License version 63.19 - * 2 along with this work; if not, write to the Free Software Foundation, 63.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 63.21 - * 63.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 63.23 - * or visit www.oracle.com if you need additional information or have any 63.24 - * questions. 63.25 - * 63.26 - */ 63.27 - 63.28 -package sun.hotspot; 63.29 - 63.30 -import java.lang.reflect.Method; 63.31 -import java.security.BasicPermission; 63.32 -import sun.hotspot.parser.DiagnosticCommand; 63.33 - 63.34 -public class WhiteBox { 63.35 - 63.36 - @SuppressWarnings("serial") 63.37 - public static class WhiteBoxPermission extends BasicPermission { 63.38 - public WhiteBoxPermission(String s) { 63.39 - super(s); 63.40 - } 63.41 - } 63.42 - 63.43 - private WhiteBox() {} 63.44 - private static final WhiteBox instance = new WhiteBox(); 63.45 - private static native void registerNatives(); 63.46 - 63.47 - /** 63.48 - * Returns the singleton WhiteBox instance. 63.49 - * 63.50 - * The returned WhiteBox object should be carefully guarded 63.51 - * by the caller, since it can be used to read and write data 63.52 - * at arbitrary memory addresses. It must never be passed to 63.53 - * untrusted code. 63.54 - */ 63.55 - public synchronized static WhiteBox getWhiteBox() { 63.56 - SecurityManager sm = System.getSecurityManager(); 63.57 - if (sm != null) { 63.58 - sm.checkPermission(new WhiteBoxPermission("getInstance")); 63.59 - } 63.60 - return instance; 63.61 - } 63.62 - 63.63 - static { 63.64 - registerNatives(); 63.65 - } 63.66 - 63.67 - // Memory 63.68 - public native long getObjectAddress(Object o); 63.69 - public native int getHeapOopSize(); 63.70 - 63.71 - // Runtime 63.72 - // Make sure class name is in the correct format 63.73 - public boolean isClassAlive(String name) { 63.74 - return isClassAlive0(name.replace('.', '/')); 63.75 - } 63.76 - private native boolean isClassAlive0(String name); 63.77 - 63.78 - // G1 63.79 - public native boolean g1InConcurrentMark(); 63.80 - public native boolean g1IsHumongous(Object o); 63.81 - public native long g1NumFreeRegions(); 63.82 - public native int g1RegionSize(); 63.83 - public native Object[] parseCommandLine(String commandline, DiagnosticCommand[] args); 63.84 - 63.85 - // NMT 63.86 - public native boolean NMTAllocTest(); 63.87 - public native boolean NMTFreeTestMemory(); 63.88 - public native boolean NMTWaitForDataMerge(); 63.89 - 63.90 - // Compiler 63.91 - public native void deoptimizeAll(); 63.92 - public native boolean isMethodCompiled(Method method); 63.93 - public native boolean isMethodCompilable(Method method); 63.94 - public native boolean isMethodQueuedForCompilation(Method method); 63.95 - public native int deoptimizeMethod(Method method); 63.96 - public native void makeMethodNotCompilable(Method method); 63.97 - public native int getMethodCompilationLevel(Method method); 63.98 - public native boolean setDontInlineMethod(Method method, boolean value); 63.99 - public native int getCompileQueuesSize(); 63.100 -}
64.1 --- a/src/share/tools/whitebox/sun/hotspot/parser/DiagnosticCommand.java Fri Feb 22 10:12:00 2013 -0800 64.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 64.3 @@ -1,43 +0,0 @@ 64.4 -package sun.hotspot.parser; 64.5 - 64.6 -public class DiagnosticCommand { 64.7 - 64.8 - public enum DiagnosticArgumentType { 64.9 - JLONG, BOOLEAN, STRING, NANOTIME, STRINGARRAY, MEMORYSIZE 64.10 - } 64.11 - 64.12 - private String name; 64.13 - private String desc; 64.14 - private DiagnosticArgumentType type; 64.15 - private boolean mandatory; 64.16 - private String defaultValue; 64.17 - 64.18 - public DiagnosticCommand(String name, String desc, DiagnosticArgumentType type, 64.19 - boolean mandatory, String defaultValue) { 64.20 - this.name = name; 64.21 - this.desc = desc; 64.22 - this.type = type; 64.23 - this.mandatory = mandatory; 64.24 - this.defaultValue = defaultValue; 64.25 - } 64.26 - 64.27 - public String getName() { 64.28 - return name; 64.29 - } 64.30 - 64.31 - public String getDesc() { 64.32 - return desc; 64.33 - } 64.34 - 64.35 - public DiagnosticArgumentType getType() { 64.36 - return type; 64.37 - } 64.38 - 64.39 - public boolean isMandatory() { 64.40 - return mandatory; 64.41 - } 64.42 - 64.43 - public String getDefaultValue() { 64.44 - return defaultValue; 64.45 - } 64.46 -}
65.1 --- a/src/share/vm/ci/ciEnv.cpp Fri Feb 22 10:12:00 2013 -0800 65.2 +++ b/src/share/vm/ci/ciEnv.cpp Wed Feb 27 12:20:34 2013 -0800 65.3 @@ -1,5 +1,5 @@ 65.4 /* 65.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 65.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 65.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 65.8 * 65.9 * This code is free software; you can redistribute it and/or modify it 65.10 @@ -597,10 +597,6 @@ 65.11 assert (klass->is_instance_klass() || klass->is_array_klass(), 65.12 "must be an instance or array klass "); 65.13 return ciConstant(T_OBJECT, klass->java_mirror()); 65.14 - } else if (tag.is_object()) { 65.15 - oop obj = cpool->object_at(index); 65.16 - ciObject* ciobj = get_object(obj); 65.17 - return ciConstant(T_OBJECT, ciobj); 65.18 } else if (tag.is_method_type()) { 65.19 // must execute Java code to link this CP entry into cache[i].f1 65.20 ciSymbol* signature = get_symbol(cpool->method_type_signature_at(index));
66.1 --- a/src/share/vm/interpreter/bytecodeTracer.cpp Fri Feb 22 10:12:00 2013 -0800 66.2 +++ b/src/share/vm/interpreter/bytecodeTracer.cpp Wed Feb 27 12:20:34 2013 -0800 66.3 @@ -1,5 +1,5 @@ 66.4 /* 66.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 66.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 66.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 66.8 * 66.9 * This code is free software; you can redistribute it and/or modify it 66.10 @@ -335,9 +335,6 @@ 66.11 st->print_cr(" %s", constants->resolved_klass_at(i)->external_name()); 66.12 } else if (tag.is_unresolved_klass()) { 66.13 st->print_cr(" <unresolved klass at %d>", i); 66.14 - } else if (tag.is_object()) { 66.15 - st->print(" <Object>"); 66.16 - print_oop(constants->object_at(i), st); 66.17 } else if (tag.is_method_type()) { 66.18 int i2 = constants->method_type_index_at(i); 66.19 st->print(" <MethodType> %d", i2);
67.1 --- a/src/share/vm/interpreter/linkResolver.cpp Fri Feb 22 10:12:00 2013 -0800 67.2 +++ b/src/share/vm/interpreter/linkResolver.cpp Wed Feb 27 12:20:34 2013 -0800 67.3 @@ -1241,7 +1241,6 @@ 67.4 67.5 void LinkResolver::resolve_invokedynamic(CallInfo& result, constantPoolHandle pool, int index, TRAPS) { 67.6 assert(EnableInvokeDynamic, ""); 67.7 - pool->set_has_invokedynamic(); // mark header to flag active call sites 67.8 67.9 //resolve_pool(<resolved_klass>, method_name, method_signature, current_klass, pool, index, CHECK); 67.10 Symbol* method_name = pool->name_ref_at(index);
68.1 --- a/src/share/vm/interpreter/rewriter.cpp Fri Feb 22 10:12:00 2013 -0800 68.2 +++ b/src/share/vm/interpreter/rewriter.cpp Wed Feb 27 12:20:34 2013 -0800 68.3 @@ -1,5 +1,5 @@ 68.4 /* 68.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 68.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 68.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 68.8 * 68.9 * This code is free software; you can redistribute it and/or modify it 68.10 @@ -48,7 +48,6 @@ 68.11 add_cp_cache_entry(i); 68.12 break; 68.13 case JVM_CONSTANT_String: 68.14 - case JVM_CONSTANT_Object: 68.15 case JVM_CONSTANT_MethodHandle : // fall through 68.16 case JVM_CONSTANT_MethodType : // fall through 68.17 add_resolved_references_entry(i); 68.18 @@ -238,7 +237,7 @@ 68.19 address p = bcp + offset; 68.20 int cp_index = is_wide ? Bytes::get_Java_u2(p) : (u1)(*p); 68.21 constantTag tag = _pool->tag_at(cp_index).value(); 68.22 - if (tag.is_method_handle() || tag.is_method_type() || tag.is_string() || tag.is_object()) { 68.23 + if (tag.is_method_handle() || tag.is_method_type() || tag.is_string()) { 68.24 int ref_index = cp_entry_to_resolved_references(cp_index); 68.25 if (is_wide) { 68.26 (*bcp) = Bytecodes::_fast_aldc_w;
69.1 --- a/src/share/vm/oops/constantPool.cpp Fri Feb 22 10:12:00 2013 -0800 69.2 +++ b/src/share/vm/oops/constantPool.cpp Wed Feb 27 12:20:34 2013 -0800 69.3 @@ -695,10 +695,6 @@ 69.4 result_oop = string_at_impl(this_oop, index, cache_index, CHECK_NULL); 69.5 break; 69.6 69.7 - case JVM_CONSTANT_Object: 69.8 - result_oop = this_oop->object_at(index); 69.9 - break; 69.10 - 69.11 case JVM_CONSTANT_MethodHandleInError: 69.12 case JVM_CONSTANT_MethodTypeInError: 69.13 { 69.14 @@ -1824,8 +1820,6 @@ 69.15 st->print_cr(internal_name()); 69.16 if (flags() != 0) { 69.17 st->print(" - flags: 0x%x", flags()); 69.18 - if (has_pseudo_string()) st->print(" has_pseudo_string"); 69.19 - if (has_invokedynamic()) st->print(" has_invokedynamic"); 69.20 if (has_preresolution()) st->print(" has_preresolution"); 69.21 if (on_stack()) st->print(" on_stack"); 69.22 st->cr(); 69.23 @@ -1869,13 +1863,14 @@ 69.24 st->print(" name_and_type_index=%d", uncached_name_and_type_ref_index_at(index)); 69.25 break; 69.26 case JVM_CONSTANT_String : 69.27 - unresolved_string_at(index)->print_value_on(st); 69.28 + if (is_pseudo_string_at(index)) { 69.29 + oop anObj = pseudo_string_at(index); 69.30 + anObj->print_value_on(st); 69.31 + st->print(" {0x%lx}", (address)anObj); 69.32 + } else { 69.33 + unresolved_string_at(index)->print_value_on(st); 69.34 + } 69.35 break; 69.36 - case JVM_CONSTANT_Object : { 69.37 - oop anObj = object_at(index); 69.38 - anObj->print_value_on(st); 69.39 - st->print(" {0x%lx}", (address)anObj); 69.40 - } break; 69.41 case JVM_CONSTANT_Integer : 69.42 st->print("%d", int_at(index)); 69.43 break; 69.44 @@ -1939,8 +1934,6 @@ 69.45 void ConstantPool::print_value_on(outputStream* st) const { 69.46 assert(is_constantPool(), "must be constantPool"); 69.47 st->print("constant pool [%d]", length()); 69.48 - if (has_pseudo_string()) st->print("/pseudo_string"); 69.49 - if (has_invokedynamic()) st->print("/invokedynamic"); 69.50 if (has_preresolution()) st->print("/preresolution"); 69.51 if (operands() != NULL) st->print("/operands[%d]", operands()->length()); 69.52 print_address_on(st);
70.1 --- a/src/share/vm/oops/constantPool.hpp Fri Feb 22 10:12:00 2013 -0800 70.2 +++ b/src/share/vm/oops/constantPool.hpp Wed Feb 27 12:20:34 2013 -0800 70.3 @@ -97,10 +97,8 @@ 70.4 Array<u2>* _reference_map; 70.5 70.6 enum { 70.7 - _has_invokedynamic = 1, // Flags 70.8 - _has_pseudo_string = 2, 70.9 - _has_preresolution = 4, 70.10 - _on_stack = 8 70.11 + _has_preresolution = 1, // Flags 70.12 + _on_stack = 2 70.13 }; 70.14 70.15 int _flags; // old fashioned bit twiddling 70.16 @@ -175,12 +173,6 @@ 70.17 Array<u1>* tags() const { return _tags; } 70.18 Array<u2>* operands() const { return _operands; } 70.19 70.20 - bool has_invokedynamic() const { return (_flags & _has_invokedynamic) != 0; } 70.21 - void set_has_invokedynamic() { _flags |= _has_invokedynamic; } 70.22 - 70.23 - bool has_pseudo_string() const { return (_flags & _has_pseudo_string) != 0; } 70.24 - void set_has_pseudo_string() { _flags |= _has_pseudo_string; } 70.25 - 70.26 bool has_preresolution() const { return (_flags & _has_preresolution) != 0; } 70.27 void set_has_preresolution() { _flags |= _has_preresolution; } 70.28 70.29 @@ -324,14 +316,6 @@ 70.30 resolved_references()->obj_at_put(obj_index, str); 70.31 } 70.32 70.33 - void set_object_tag_at(int which) { 70.34 - release_tag_at_put(which, JVM_CONSTANT_Object); 70.35 - } 70.36 - 70.37 - void object_at_put(int which, oop obj) { 70.38 - resolved_references()->obj_at_put(cp_to_object_index(which), obj); 70.39 - } 70.40 - 70.41 // For temporary use while constructing constant pool 70.42 void string_index_at_put(int which, int string_index) { 70.43 tag_at_put(which, JVM_CONSTANT_StringIndex); 70.44 @@ -429,12 +413,6 @@ 70.45 // Version that can be used before string oop array is created. 70.46 oop uncached_string_at(int which, TRAPS); 70.47 70.48 - oop object_at(int which) { 70.49 - assert(tag_at(which).is_object(), "Corrupted constant pool"); 70.50 - int obj_index = cp_to_object_index(which); 70.51 - return resolved_references()->obj_at(obj_index); 70.52 - } 70.53 - 70.54 // A "pseudo-string" is an non-string oop that has found is way into 70.55 // a String entry. 70.56 // Under EnableInvokeDynamic this can happen if the user patches a live 70.57 @@ -454,10 +432,18 @@ 70.58 return s; 70.59 } 70.60 70.61 + oop pseudo_string_at(int which) { 70.62 + assert(tag_at(which).is_string(), "Corrupted constant pool"); 70.63 + assert(unresolved_string_at(which) == NULL, "shouldn't have symbol"); 70.64 + int obj_index = cp_to_object_index(which); 70.65 + oop s = resolved_references()->obj_at(obj_index); 70.66 + return s; 70.67 + } 70.68 + 70.69 void pseudo_string_at_put(int which, int obj_index, oop x) { 70.70 assert(EnableInvokeDynamic, ""); 70.71 - set_has_pseudo_string(); // mark header 70.72 assert(tag_at(which).is_string(), "Corrupted constant pool"); 70.73 + unresolved_string_at_put(which, NULL); // indicates patched string 70.74 string_at_put(which, obj_index, x); // this works just fine 70.75 } 70.76
71.1 --- a/src/share/vm/oops/generateOopMap.cpp Fri Feb 22 10:12:00 2013 -0800 71.2 +++ b/src/share/vm/oops/generateOopMap.cpp Wed Feb 27 12:20:34 2013 -0800 71.3 @@ -1,5 +1,5 @@ 71.4 /* 71.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 71.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 71.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 71.8 * 71.9 * This code is free software; you can redistribute it and/or modify it 71.10 @@ -1853,7 +1853,6 @@ 71.11 if (tag.is_klass() || 71.12 tag.is_unresolved_klass() || 71.13 tag.is_string() || 71.14 - tag.is_object() || 71.15 tag.is_method_handle() || 71.16 tag.is_method_type()) { 71.17 assert(bt == T_OBJECT, "Guard is incorrect");
72.1 --- a/src/share/vm/runtime/arguments.cpp Fri Feb 22 10:12:00 2013 -0800 72.2 +++ b/src/share/vm/runtime/arguments.cpp Wed Feb 27 12:20:34 2013 -0800 72.3 @@ -2181,19 +2181,6 @@ 72.4 FREE_C_HEAP_ARRAY(char, altclasses_path, mtInternal); 72.5 } 72.6 72.7 - if (WhiteBoxAPI) { 72.8 - // Append wb.jar to bootclasspath if enabled 72.9 - const char* wb_jar = "wb.jar"; 72.10 - size_t wb_path_len = strlen(get_meta_index_dir()) + 1 + 72.11 - strlen(wb_jar); 72.12 - char* wb_path = NEW_C_HEAP_ARRAY(char, wb_path_len, mtInternal); 72.13 - strcpy(wb_path, get_meta_index_dir()); 72.14 - strcat(wb_path, wb_jar); 72.15 - scp.add_suffix(wb_path); 72.16 - scp_assembly_required = true; 72.17 - FREE_C_HEAP_ARRAY(char, wb_path, mtInternal); 72.18 - } 72.19 - 72.20 // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM) 72.21 result = parse_java_options_environment_variable(&scp, &scp_assembly_required); 72.22 if (result != JNI_OK) {
73.1 --- a/src/share/vm/services/memSnapshot.cpp Fri Feb 22 10:12:00 2013 -0800 73.2 +++ b/src/share/vm/services/memSnapshot.cpp Wed Feb 27 12:20:34 2013 -0800 73.3 @@ -528,7 +528,8 @@ 73.4 // an arena record can be followed by a size record, we need to remove both 73.5 if (matched_rec->is_arena_record()) { 73.6 MemPointerRecord* next = (MemPointerRecord*)malloc_snapshot_itr.peek_next(); 73.7 - if (next->is_arena_memory_record() && next->is_memory_record_of_arena(matched_rec)) { 73.8 + if (next != NULL && next->is_arena_memory_record() && 73.9 + next->is_memory_record_of_arena(matched_rec)) { 73.10 malloc_snapshot_itr.remove(); 73.11 } 73.12 }
74.1 --- a/src/share/vm/utilities/constantTag.cpp Fri Feb 22 10:12:00 2013 -0800 74.2 +++ b/src/share/vm/utilities/constantTag.cpp Wed Feb 27 12:20:34 2013 -0800 74.3 @@ -1,5 +1,5 @@ 74.4 /* 74.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 74.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 74.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 74.8 * 74.9 * This code is free software; you can redistribute it and/or modify it 74.10 @@ -52,7 +52,6 @@ 74.11 case JVM_CONSTANT_StringIndex : 74.12 case JVM_CONSTANT_MethodHandle : 74.13 case JVM_CONSTANT_MethodType : 74.14 - case JVM_CONSTANT_Object : 74.15 return T_OBJECT; 74.16 default: 74.17 ShouldNotReachHere(); 74.18 @@ -96,8 +95,6 @@ 74.19 return "MethodType Error"; 74.20 case JVM_CONSTANT_InvokeDynamic : 74.21 return "InvokeDynamic"; 74.22 - case JVM_CONSTANT_Object : 74.23 - return "Object"; 74.24 case JVM_CONSTANT_Utf8 : 74.25 return "Utf8"; 74.26 case JVM_CONSTANT_UnresolvedClass :
75.1 --- a/src/share/vm/utilities/constantTag.hpp Fri Feb 22 10:12:00 2013 -0800 75.2 +++ b/src/share/vm/utilities/constantTag.hpp Wed Feb 27 12:20:34 2013 -0800 75.3 @@ -1,5 +1,5 @@ 75.4 /* 75.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 75.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 75.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 75.8 * 75.9 * This code is free software; you can redistribute it and/or modify it 75.10 @@ -43,8 +43,7 @@ 75.11 JVM_CONSTANT_UnresolvedClassInError = 103, // Error tag due to resolution error 75.12 JVM_CONSTANT_MethodHandleInError = 104, // Error tag due to resolution error 75.13 JVM_CONSTANT_MethodTypeInError = 105, // Error tag due to resolution error 75.14 - JVM_CONSTANT_Object = 106, // Required for BoundMethodHandle arguments. 75.15 - JVM_CONSTANT_InternalMax = 106 // Last implementation tag 75.16 + JVM_CONSTANT_InternalMax = 105 // Last implementation tag 75.17 }; 75.18 75.19 75.20 @@ -84,8 +83,6 @@ 75.21 bool is_klass_index() const { return _tag == JVM_CONSTANT_ClassIndex; } 75.22 bool is_string_index() const { return _tag == JVM_CONSTANT_StringIndex; } 75.23 75.24 - bool is_object() const { return _tag == JVM_CONSTANT_Object; } 75.25 - 75.26 bool is_klass_reference() const { return is_klass_index() || is_unresolved_klass(); } 75.27 bool is_klass_or_reference() const{ return is_klass() || is_klass_reference(); } 75.28 bool is_field_or_method() const { return is_field() || is_method() || is_interface_method(); } 75.29 @@ -98,7 +95,7 @@ 75.30 bool is_loadable_constant() const { 75.31 return ((_tag >= JVM_CONSTANT_Integer && _tag <= JVM_CONSTANT_String) || 75.32 is_method_type() || is_method_handle() || 75.33 - is_unresolved_klass() || is_object()); 75.34 + is_unresolved_klass()); 75.35 } 75.36 75.37 constantTag() {
76.1 --- a/src/share/vm/utilities/debug.cpp Fri Feb 22 10:12:00 2013 -0800 76.2 +++ b/src/share/vm/utilities/debug.cpp Wed Feb 27 12:20:34 2013 -0800 76.3 @@ -1,5 +1,5 @@ 76.4 /* 76.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 76.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 76.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 76.8 * 76.9 * This code is free software; you can redistribute it and/or modify it 76.10 @@ -228,28 +228,16 @@ 76.11 report_vm_error(file, line, "fatal error", message); 76.12 } 76.13 76.14 -// Used by report_vm_out_of_memory to detect recursion. 76.15 -static jint _exiting_out_of_mem = 0; 76.16 - 76.17 void report_vm_out_of_memory(const char* file, int line, size_t size, 76.18 const char* message) { 76.19 if (Debugging) return; 76.20 76.21 - // We try to gather additional information for the first out of memory 76.22 - // error only; gathering additional data might cause an allocation and a 76.23 - // recursive out_of_memory condition. 76.24 + Thread* thread = ThreadLocalStorage::get_thread_slow(); 76.25 + VMError(thread, file, line, size, message).report_and_die(); 76.26 76.27 - const jint exiting = 1; 76.28 - // If we succeed in changing the value, we're the first one in. 76.29 - bool first_time_here = Atomic::xchg(exiting, &_exiting_out_of_mem) != exiting; 76.30 - 76.31 - if (first_time_here) { 76.32 - Thread* thread = ThreadLocalStorage::get_thread_slow(); 76.33 - VMError(thread, file, line, size, message).report_and_die(); 76.34 - } 76.35 - 76.36 - // Dump core and abort 76.37 - vm_abort(true); 76.38 + // The UseOSErrorReporting option in report_and_die() may allow a return 76.39 + // to here. If so then we'll have to figure out how to handle it. 76.40 + guarantee(false, "report_and_die() should not return here"); 76.41 } 76.42 76.43 void report_should_not_call(const char* file, int line) {
77.1 --- a/test/compiler/whitebox/DeoptimizeAllTest.java Fri Feb 22 10:12:00 2013 -0800 77.2 +++ b/test/compiler/whitebox/DeoptimizeAllTest.java Wed Feb 27 12:20:34 2013 -0800 77.3 @@ -23,9 +23,10 @@ 77.4 77.5 /* 77.6 * @test DeoptimizeAllTest 77.7 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java 77.8 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI DeoptimizeAllTest.java 77.9 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeAllTest 77.10 + * @library /testlibrary /testlibrary/whitebox 77.11 + * @build DeoptimizeAllTest 77.12 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 77.13 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeAllTest 77.14 * @author igor.ignatyev@oracle.com 77.15 */ 77.16 public class DeoptimizeAllTest extends CompilerWhiteBoxTest {
78.1 --- a/test/compiler/whitebox/DeoptimizeMethodTest.java Fri Feb 22 10:12:00 2013 -0800 78.2 +++ b/test/compiler/whitebox/DeoptimizeMethodTest.java Wed Feb 27 12:20:34 2013 -0800 78.3 @@ -23,9 +23,10 @@ 78.4 78.5 /* 78.6 * @test DeoptimizeMethodTest 78.7 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java 78.8 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI DeoptimizeMethodTest.java 78.9 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeMethodTest 78.10 + * @library /testlibrary /testlibrary/whitebox 78.11 + * @build DeoptimizeMethodTest 78.12 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 78.13 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeMethodTest 78.14 * @author igor.ignatyev@oracle.com 78.15 */ 78.16 public class DeoptimizeMethodTest extends CompilerWhiteBoxTest {
79.1 --- a/test/compiler/whitebox/IsMethodCompilableTest.java Fri Feb 22 10:12:00 2013 -0800 79.2 +++ b/test/compiler/whitebox/IsMethodCompilableTest.java Wed Feb 27 12:20:34 2013 -0800 79.3 @@ -24,9 +24,10 @@ 79.4 /* 79.5 * @test IsMethodCompilableTest 79.6 * @bug 8007270 79.7 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java 79.8 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI IsMethodCompilableTest.java 79.9 - * @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI IsMethodCompilableTest 79.10 + * @library /testlibrary /testlibrary/whitebox 79.11 + * @build IsMethodCompilableTest 79.12 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 79.13 + * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI IsMethodCompilableTest 79.14 * @author igor.ignatyev@oracle.com 79.15 */ 79.16 public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
80.1 --- a/test/compiler/whitebox/MakeMethodNotCompilableTest.java Fri Feb 22 10:12:00 2013 -0800 80.2 +++ b/test/compiler/whitebox/MakeMethodNotCompilableTest.java Wed Feb 27 12:20:34 2013 -0800 80.3 @@ -23,9 +23,10 @@ 80.4 80.5 /* 80.6 * @test MakeMethodNotCompilableTest 80.7 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java 80.8 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI MakeMethodNotCompilableTest.java 80.9 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI MakeMethodNotCompilableTest 80.10 + * @library /testlibrary /testlibrary/whitebox 80.11 + * @build MakeMethodNotCompilableTest 80.12 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 80.13 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI MakeMethodNotCompilableTest 80.14 * @author igor.ignatyev@oracle.com 80.15 */ 80.16 public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
81.1 --- a/test/compiler/whitebox/SetDontInlineMethodTest.java Fri Feb 22 10:12:00 2013 -0800 81.2 +++ b/test/compiler/whitebox/SetDontInlineMethodTest.java Wed Feb 27 12:20:34 2013 -0800 81.3 @@ -23,9 +23,10 @@ 81.4 81.5 /* 81.6 * @test SetDontInlineMethodTest 81.7 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java 81.8 - * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI SetDontInlineMethodTest.java 81.9 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SetDontInlineMethodTest 81.10 + * @library /testlibrary /testlibrary/whitebox 81.11 + * @build SetDontInlineMethodTest 81.12 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 81.13 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SetDontInlineMethodTest 81.14 * @author igor.ignatyev@oracle.com 81.15 */ 81.16 public class SetDontInlineMethodTest extends CompilerWhiteBoxTest {
82.1 --- a/test/runtime/NMT/AllocTestType.java Fri Feb 22 10:12:00 2013 -0800 82.2 +++ b/test/runtime/NMT/AllocTestType.java Wed Feb 27 12:20:34 2013 -0800 82.3 @@ -25,9 +25,10 @@ 82.4 * @test 82.5 * @summary Test consistency of NMT by leaking a few select allocations of the Test type and then verify visibility with jcmd 82.6 * @key nmt jcmd 82.7 - * @library /testlibrary 82.8 - * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI AllocTestType.java 82.9 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail AllocTestType 82.10 + * @library /testlibrary /testlibrary/whitebox 82.11 + * @build AllocTestType 82.12 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 82.13 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail AllocTestType 82.14 */ 82.15 82.16 import com.oracle.java.testlibrary.*;
83.1 --- a/test/runtime/NMT/PrintNMTStatistics.java Fri Feb 22 10:12:00 2013 -0800 83.2 +++ b/test/runtime/NMT/PrintNMTStatistics.java Wed Feb 27 12:20:34 2013 -0800 83.3 @@ -26,8 +26,8 @@ 83.4 * @key nmt regression 83.5 * @bug 8005936 83.6 * @summary Make sure PrintNMTStatistics works on normal JVM exit 83.7 - * @library /testlibrary 83.8 - * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI PrintNMTStatistics.java 83.9 + * @library /testlibrary /testlibrary/whitebox 83.10 + * @run compile PrintNMTStatistics.java 83.11 */ 83.12 83.13 import com.oracle.java.testlibrary.*;
84.1 --- a/test/runtime/NMT/SummarySanityCheck.java Fri Feb 22 10:12:00 2013 -0800 84.2 +++ b/test/runtime/NMT/SummarySanityCheck.java Wed Feb 27 12:20:34 2013 -0800 84.3 @@ -25,9 +25,10 @@ 84.4 * @test 84.5 * @key nmt jcmd 84.6 * @summary Sanity check the output of NMT 84.7 - * @library /testlibrary 84.8 - * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI SummarySanityCheck.java 84.9 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -XX:+WhiteBoxAPI SummarySanityCheck 84.10 + * @library /testlibrary /testlibrary/whitebox 84.11 + * @build SummarySanityCheck 84.12 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 84.13 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -XX:+WhiteBoxAPI SummarySanityCheck 84.14 */ 84.15 84.16 import com.oracle.java.testlibrary.*;
85.1 --- a/test/sanity/WBApi.java Fri Feb 22 10:12:00 2013 -0800 85.2 +++ b/test/sanity/WBApi.java Wed Feb 27 12:20:34 2013 -0800 85.3 @@ -1,8 +1,33 @@ 85.4 +/* 85.5 + * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved. 85.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 85.7 + * 85.8 + * This code is free software; you can redistribute it and/or modify it 85.9 + * under the terms of the GNU General Public License version 2 only, as 85.10 + * published by the Free Software Foundation. 85.11 + * 85.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 85.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 85.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 85.15 + * version 2 for more details (a copy is included in the LICENSE file that 85.16 + * accompanied this code). 85.17 + * 85.18 + * You should have received a copy of the GNU General Public License version 85.19 + * 2 along with this work; if not, write to the Free Software Foundation, 85.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 85.21 + * 85.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 85.23 + * or visit www.oracle.com if you need additional information or have any 85.24 + * questions. 85.25 + */ 85.26 + 85.27 /* 85.28 * @test WBApi 85.29 * @summary verify that whitebox functions can be linked and executed 85.30 - * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI WBApi.java 85.31 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI WBApi 85.32 + * @library /testlibrary /testlibrary/whitebox 85.33 + * @build WBApi 85.34 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 85.35 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI WBApi 85.36 */ 85.37 85.38 import sun.hotspot.WhiteBox;
86.1 --- a/test/serviceability/ParserTest.java Fri Feb 22 10:12:00 2013 -0800 86.2 +++ b/test/serviceability/ParserTest.java Wed Feb 27 12:20:34 2013 -0800 86.3 @@ -1,8 +1,33 @@ 86.4 +/* 86.5 + * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved. 86.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 86.7 + * 86.8 + * This code is free software; you can redistribute it and/or modify it 86.9 + * under the terms of the GNU General Public License version 2 only, as 86.10 + * published by the Free Software Foundation. 86.11 + * 86.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 86.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 86.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 86.15 + * version 2 for more details (a copy is included in the LICENSE file that 86.16 + * accompanied this code). 86.17 + * 86.18 + * You should have received a copy of the GNU General Public License version 86.19 + * 2 along with this work; if not, write to the Free Software Foundation, 86.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 86.21 + * 86.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 86.23 + * or visit www.oracle.com if you need additional information or have any 86.24 + * questions. 86.25 + */ 86.26 + 86.27 /* 86.28 * @test ParserTest 86.29 - * @summary verify that whitebox functions can be linked and executed 86.30 - * @run compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI ParserTest.java 86.31 - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ParserTest 86.32 + * @summary Test that the diagnostic command arguemnt parser works 86.33 + * @library /testlibrary /testlibrary/whitebox 86.34 + * @build ParserTest 86.35 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 86.36 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ParserTest 86.37 */ 86.38 86.39 import java.math.BigInteger;
87.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 87.2 +++ b/test/testlibrary/ClassFileInstaller.java Wed Feb 27 12:20:34 2013 -0800 87.3 @@ -0,0 +1,53 @@ 87.4 +/* 87.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 87.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 87.7 + * 87.8 + * This code is free software; you can redistribute it and/or modify it 87.9 + * under the terms of the GNU General Public License version 2 only, as 87.10 + * published by the Free Software Foundation. 87.11 + * 87.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 87.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 87.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 87.15 + * version 2 for more details (a copy is included in the LICENSE file that 87.16 + * accompanied this code). 87.17 + * 87.18 + * You should have received a copy of the GNU General Public License version 87.19 + * 2 along with this work; if not, write to the Free Software Foundation, 87.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 87.21 + * 87.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 87.23 + * or visit www.oracle.com if you need additional information or have any 87.24 + * questions. 87.25 + */ 87.26 + 87.27 +import java.io.InputStream; 87.28 +import java.nio.file.Files; 87.29 +import java.nio.file.Path; 87.30 +import java.nio.file.Paths; 87.31 +import java.nio.file.StandardCopyOption; 87.32 + 87.33 +/** 87.34 + * Dump a class file for a class on the class path in the current directory 87.35 + */ 87.36 +public class ClassFileInstaller { 87.37 + /** 87.38 + * @param args The names of the classes to dump 87.39 + * @throws Exception 87.40 + */ 87.41 + public static void main(String... args) throws Exception { 87.42 + for (String arg : args) { 87.43 + ClassLoader cl = ClassFileInstaller.class.getClassLoader(); 87.44 + 87.45 + // Convert dotted class name to a path to a class file 87.46 + String pathName = arg.replace('.', '/').concat(".class"); 87.47 + InputStream is = cl.getResourceAsStream(pathName); 87.48 + 87.49 + // Create the class file's package directory 87.50 + Path p = Paths.get(pathName); 87.51 + Files.createDirectories(p.getParent()); 87.52 + // Create the class file 87.53 + Files.copy(is, p, StandardCopyOption.REPLACE_EXISTING); 87.54 + } 87.55 + } 87.56 +}
88.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 88.2 +++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Wed Feb 27 12:20:34 2013 -0800 88.3 @@ -0,0 +1,97 @@ 88.4 +/* 88.5 + * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved. 88.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 88.7 + * 88.8 + * This code is free software; you can redistribute it and/or modify it 88.9 + * under the terms of the GNU General Public License version 2 only, as 88.10 + * published by the Free Software Foundation. 88.11 + * 88.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 88.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 88.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 88.15 + * version 2 for more details (a copy is included in the LICENSE file that 88.16 + * accompanied this code). 88.17 + * 88.18 + * You should have received a copy of the GNU General Public License version 88.19 + * 2 along with this work; if not, write to the Free Software Foundation, 88.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 88.21 + * 88.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 88.23 + * or visit www.oracle.com if you need additional information or have any 88.24 + * questions. 88.25 + * 88.26 + */ 88.27 + 88.28 +package sun.hotspot; 88.29 + 88.30 +import java.lang.reflect.Method; 88.31 +import java.security.BasicPermission; 88.32 +import sun.hotspot.parser.DiagnosticCommand; 88.33 + 88.34 +public class WhiteBox { 88.35 + 88.36 + @SuppressWarnings("serial") 88.37 + public static class WhiteBoxPermission extends BasicPermission { 88.38 + public WhiteBoxPermission(String s) { 88.39 + super(s); 88.40 + } 88.41 + } 88.42 + 88.43 + private WhiteBox() {} 88.44 + private static final WhiteBox instance = new WhiteBox(); 88.45 + private static native void registerNatives(); 88.46 + 88.47 + /** 88.48 + * Returns the singleton WhiteBox instance. 88.49 + * 88.50 + * The returned WhiteBox object should be carefully guarded 88.51 + * by the caller, since it can be used to read and write data 88.52 + * at arbitrary memory addresses. It must never be passed to 88.53 + * untrusted code. 88.54 + */ 88.55 + public synchronized static WhiteBox getWhiteBox() { 88.56 + SecurityManager sm = System.getSecurityManager(); 88.57 + if (sm != null) { 88.58 + sm.checkPermission(new WhiteBoxPermission("getInstance")); 88.59 + } 88.60 + return instance; 88.61 + } 88.62 + 88.63 + static { 88.64 + registerNatives(); 88.65 + } 88.66 + 88.67 + // Memory 88.68 + public native long getObjectAddress(Object o); 88.69 + public native int getHeapOopSize(); 88.70 + 88.71 + // Runtime 88.72 + // Make sure class name is in the correct format 88.73 + public boolean isClassAlive(String name) { 88.74 + return isClassAlive0(name.replace('.', '/')); 88.75 + } 88.76 + private native boolean isClassAlive0(String name); 88.77 + 88.78 + // G1 88.79 + public native boolean g1InConcurrentMark(); 88.80 + public native boolean g1IsHumongous(Object o); 88.81 + public native long g1NumFreeRegions(); 88.82 + public native int g1RegionSize(); 88.83 + public native Object[] parseCommandLine(String commandline, DiagnosticCommand[] args); 88.84 + 88.85 + // NMT 88.86 + public native boolean NMTAllocTest(); 88.87 + public native boolean NMTFreeTestMemory(); 88.88 + public native boolean NMTWaitForDataMerge(); 88.89 + 88.90 + // Compiler 88.91 + public native void deoptimizeAll(); 88.92 + public native boolean isMethodCompiled(Method method); 88.93 + public native boolean isMethodCompilable(Method method); 88.94 + public native boolean isMethodQueuedForCompilation(Method method); 88.95 + public native int deoptimizeMethod(Method method); 88.96 + public native void makeMethodNotCompilable(Method method); 88.97 + public native int getMethodCompilationLevel(Method method); 88.98 + public native boolean setDontInlineMethod(Method method, boolean value); 88.99 + public native int getCompileQueuesSize(); 88.100 +}
89.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 89.2 +++ b/test/testlibrary/whitebox/sun/hotspot/parser/DiagnosticCommand.java Wed Feb 27 12:20:34 2013 -0800 89.3 @@ -0,0 +1,66 @@ 89.4 +/* 89.5 + * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved. 89.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 89.7 + * 89.8 + * This code is free software; you can redistribute it and/or modify it 89.9 + * under the terms of the GNU General Public License version 2 only, as 89.10 + * published by the Free Software Foundation. 89.11 + * 89.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 89.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 89.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 89.15 + * version 2 for more details (a copy is included in the LICENSE file that 89.16 + * accompanied this code). 89.17 + * 89.18 + * You should have received a copy of the GNU General Public License version 89.19 + * 2 along with this work; if not, write to the Free Software Foundation, 89.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 89.21 + * 89.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 89.23 + * or visit www.oracle.com if you need additional information or have any 89.24 + * questions. 89.25 + */ 89.26 + 89.27 +package sun.hotspot.parser; 89.28 + 89.29 +public class DiagnosticCommand { 89.30 + 89.31 + public enum DiagnosticArgumentType { 89.32 + JLONG, BOOLEAN, STRING, NANOTIME, STRINGARRAY, MEMORYSIZE 89.33 + } 89.34 + 89.35 + private String name; 89.36 + private String desc; 89.37 + private DiagnosticArgumentType type; 89.38 + private boolean mandatory; 89.39 + private String defaultValue; 89.40 + 89.41 + public DiagnosticCommand(String name, String desc, DiagnosticArgumentType type, 89.42 + boolean mandatory, String defaultValue) { 89.43 + this.name = name; 89.44 + this.desc = desc; 89.45 + this.type = type; 89.46 + this.mandatory = mandatory; 89.47 + this.defaultValue = defaultValue; 89.48 + } 89.49 + 89.50 + public String getName() { 89.51 + return name; 89.52 + } 89.53 + 89.54 + public String getDesc() { 89.55 + return desc; 89.56 + } 89.57 + 89.58 + public DiagnosticArgumentType getType() { 89.59 + return type; 89.60 + } 89.61 + 89.62 + public boolean isMandatory() { 89.63 + return mandatory; 89.64 + } 89.65 + 89.66 + public String getDefaultValue() { 89.67 + return defaultValue; 89.68 + } 89.69 +}