diff --git a/.hgtags b/.hgtags
index 2d2aae34dbb..07ac4027b55 100644
--- a/.hgtags
+++ b/.hgtags
@@ -121,3 +121,15 @@ f4298bc3f4b6baa315643be06966f09684290068 jdk7-b140
07a8728ad49ef6dfa469c3a8bf5ab1e9c80bed5c jdk7-b144
8294c99e685a1f6d1d37c45cd97854cf74be771e jdk7-b145
dca1e8a87e8f756f95b99bac8fe795750d42e1b0 jdk7-b146
+a2a589fc29543ed32919c78a1810ad93a6fcf5bc jdk7-b147
+de9223c94f9c710b3eebb599cd3586f36c8b94a9 jdk8-b01
+1b9d19620eb4606a25b1e28f86d66c8bfa867e06 jdk8-b02
+6815e85bf96d6d3875954f9777660372cd70d065 jdk8-b03
+31f5c34d78081572ad9a2401c0bb0c6b9711dd65 jdk8-b04
+c4f9ea1ecb55ff44e0dd21d2888ead308c86a3aa jdk8-b05
+429da7734bf491bccde2a752fae97e9f225896dc jdk8-b06
+bc5710332b294676661103bb20d47d2ea3ba8def jdk8-b07
+24ee504f80412770c6874836cd9e55b536427b1d jdk8-b08
+fbf3cabc9e3bb1fcf710941d777cb0400505fbe6 jdk8-b09
+f651ce87127980c58e3599daba964eba2f3b4026 jdk8-b10
+cc1f5ce8e504d350e0b0c28c5f84333f8d540132 jdk8-b11
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index fff0df0a70c..bb8cba99e8b 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -121,3 +121,15 @@ cfbbdb77eac0397b03eb99ee2e07ea00e0a7b81e jdk7-b142
7203965666a4fe63bf82f5e4204f41ce6285e716 jdk7-b144
55e9ebf032186c333e5964ed044419830ac02693 jdk7-b145
2d38c2a79c144c30cd04d143d83ee7ec6af40771 jdk7-b146
+d91364304d7c4ecd34caffdba2b840aeb0d10b51 jdk7-b147
+f42e3d9394b40a423d345b8da22687b5462e5f25 jdk8-b01
+69f592185747226a9c765a9fe139c1d34d616f9c jdk8-b02
+587bb549dff83131b65f40aa51864f69562f34a7 jdk8-b03
+0b66a233bfb9ba2ebda1e5cdfdb0373d6c1e3c69 jdk8-b04
+b910aac18c772b823b1f7da03e2c6528725cc6de jdk8-b05
+28cf2aec4dd7c3c75efc1c15078522467c781a6d jdk8-b06
+0db7ae9f2b1017124c779bccd016c976928859a0 jdk8-b07
+fb1bc13260d76447e269e843859eb593fe2a8ab2 jdk8-b08
+8adb70647b5af5273dfe6a540f07be667cd50216 jdk8-b09
+a6c4c248e8fa350c35014fa94bab5ac1a1ac3299 jdk8-b10
+1defbc57940a56f0aa41e9dee87b71e8c8b71103 jdk8-b11
diff --git a/.jcheck/conf b/.jcheck/conf
index d8227cd90e3..6d0dbe48e36 100644
--- a/.jcheck/conf
+++ b/.jcheck/conf
@@ -1 +1 @@
-project=jdk7
+project=jdk8
diff --git a/README b/README
index db7346b4432..45b71d266e0 100644
--- a/README
+++ b/README
@@ -9,11 +9,14 @@ README:
will be needed.
This one root repository can be obtained with something like:
- hg clone http://hg.openjdk.java.net/jdk7/jdk7 openjdk7
- To make sure you have all the nested repositories, you can run:
- cd openjdk7 && sh ./get_source.sh
- (This is identical to using the Mercurial Forest Extension command
- 'hg fclone http://hg.openjdk.java.net/jdk7/jdk7 openjdk7').
+
+ hg clone http://hg.openjdk.java.net/jdk8/jdk8 openjdk8
+
+ To make sure you have all the nested repositories, you can run the
+ get_source.sh script located in the same respository as this file:
+
+ cd openjdk8 && sh ./get_source.sh
+
People unfamiliar with Mercurial should read the first few chapters of
the Mercurial book: http://hgbook.red-bean.com/read/
@@ -22,7 +25,7 @@ README:
Simple Build Instructions:
0. Get the necessary system software/packages installed on your system, see
- http://hg.openjdk.java.net/jdk7/build/raw-file/tip/README-builds.html
+ http://hg.openjdk.java.net/jdk8/build/raw-file/tip/README-builds.html
1. If you don't have a jdk6 installed, download and install a JDK 6 from
http://java.sun.com/javase/downloads/index.jsp
diff --git a/README-builds.html b/README-builds.html
index 87b7cd80af2..1761534fab2 100644
--- a/README-builds.html
+++ b/README-builds.html
@@ -126,38 +126,15 @@
Developer Guide: Installing and Configuring Mercurial
section for more information.
- The Forest Extension is not part of the Mercurial install,
- and is optional,
- but can be obtained with the following commands:
-
-
- hg clone https://bitbucket.org/pmezard/hgforest-crew/overview/ YourHgForest
-
-
- Once you have the file forest.py, you need to add these
- lines to your ${HOME}/.hgrc file:
-
-
- [extensions]
-
forest = YourHgForest/forest.py
-
-
To get the entire set of OpenJDK Mercurial repositories
- using the Forest Extension:
+ use the script get_source.sh located in the root repository:
- hg fclone http://hg.openjdk.java.net/jdk7/jdk7 YourOpenJDK
-
-
- To get the entire set of OpenJDK Mercurial repositories
- without using the Forest Extension:
-
-
- hg clone http://hg.openjdk.java.net/jdk7/jdk7 YourOpenJDK
+ hg clone http://hg.openjdk.java.net/jdk8/jdk8 YourOpenJDK
cd YourOpenJDK
sh ./get_source.sh
@@ -172,9 +149,6 @@
sh ./make/scripts/hgforest.sh pull -u
- You may find this script make/scripts/hgforest.sh faster
- than the hg forest commands provided by the
- Forest Extension.
@@ -558,7 +532,7 @@
understood that this is not ideal for the open source community.
It is possible this process could change in the future.
- NOTE: The
+ NOTE: The
Complete OpenJDK Source Bundles will contain the JAXP and
JAX-WS sources.
@@ -578,7 +552,7 @@
The OpenJDK team copies this new bundle into shared
- area (e.g. /java/devtools/share/jdk7-drops).
+ area (e.g. /java/devtools/share/jdk8-drops).
Older bundles are never deleted so we retain the history.
@@ -1726,7 +1700,7 @@
The location of any source drop bundles
(see Managing the Source Drops).
The default will be
- $(ALT_JDK_DEVTOOLS_PATH)/share/jdk7-drops.
+ $(ALT_JDK_DEVTOOLS_PATH)/share/jdk8-drops.
ALT_UNIXCCS_PATH
@@ -1931,7 +1905,7 @@
PATH, INCLUDE, LIB, LIBPATH, and WINDOWSSDKDIR
variables set in your shell environment.
These bat files are not easy to use from a shell environment.
- However, there is a script placed in the root jdk7 repository called
+ However, there is a script placed in the root jdk8 repository called
vsvars.sh that can help, it should only be done once in a shell
that will be doing the build, e.g.
sh ./make/scripts/vsvars.sh -v10 > settings
diff --git a/corba/.hgtags b/corba/.hgtags
index 35cd3eb2f71..bd2e17921d4 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -122,3 +122,14 @@ a2f340a048c88d10cbedc0504f5cf03d39925a40 jdk7-b142
77ec0541aa2aa4da27e9e385a118a2e51e7fca24 jdk7-b145
770227a4087e4e401fe87ccd19738440111c3948 jdk7-b146
73323cb3396260d93e0ab731fd2d431096ceed0f jdk7-b147
+949fb60ca830364571e7c4c9964e6b351ca929ec jdk8-b01
+ed8d94519a87b4adac270c3eec9134ff1f62bff5 jdk8-b02
+cd0da00694fbce642db9be936d3e4909a71d911d jdk8-b03
+60a68d688e24473cf84dedd1e60901a61ab82555 jdk8-b04
+cc1b599b986a37cb57de4584c5e58169766ca535 jdk8-b05
+45c43dde7ba7f176333a51a98f086275478836fa jdk8-b06
+3d61f0856f349e2163bf98146465dab3b7437f63 jdk8-b07
+0d52b1c87aa8fdea7fdc9c4126ea58f95ca6b351 jdk8-b08
+a891732c1a83082177ff7a4cf1506068d9cc0a47 jdk8-b09
+cda87f7fefcee3b89742a57ce5ad9b03a54c210d jdk8-b10
+0199e4fef5cc2bd234c65b93220459ef7a3bb3b1 jdk8-b11
diff --git a/corba/make/jprt.properties b/corba/make/jprt.properties
index c95c9d06869..cb67b3c2d3a 100644
--- a/corba/make/jprt.properties
+++ b/corba/make/jprt.properties
@@ -25,12 +25,23 @@
# Properties for jprt
-# Use whatever release that the submitted job requests
-jprt.tools.default.release=${jprt.submit.release}
+# The release to build
+jprt.tools.default.release=jdk8
# The different build flavors we want, we override here so we just get these 2
jprt.build.flavors=product,fastdebug
+# Standard list of jprt build targets for this source tree
+jprt.build.targets= \
+ solaris_sparc_5.10-{product|fastdebug}, \
+ solaris_sparcv9_5.10-{product|fastdebug}, \
+ solaris_i586_5.10-{product|fastdebug}, \
+ solaris_x64_5.10-{product|fastdebug}, \
+ linux_i586_2.6-{product|fastdebug}, \
+ linux_x64_2.6-{product|fastdebug}, \
+ windows_i586_5.1-{product|fastdebug}, \
+ windows_x64_5.2-{product|fastdebug}
+
# Directories to be excluded from the source bundles
jprt.bundle.exclude.src.dirs=build dist webrev
diff --git a/hotspot/.hgignore b/hotspot/.hgignore
index 482470820ef..c652de177bf 100644
--- a/hotspot/.hgignore
+++ b/hotspot/.hgignore
@@ -6,3 +6,4 @@
^src/share/tools/IdealGraphVisualizer/build/
^src/share/tools/IdealGraphVisualizer/dist/
^.hgtip
+.DS_Store
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 8b20d73be2a..46612cd8947 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -172,3 +172,26 @@ d283b82966712b353fa307845a1316da42a355f4 hs21-b10
3aea9e9feb073f5500e031be6186666bcae89aa2 hs21-b11
9ad1548c6b63d596c411afc35147ffd5254426d9 jdk7-b142
9ad1548c6b63d596c411afc35147ffd5254426d9 hs21-b12
+c149193c768b8b7233da4c3a3fdc0756b975848e hs21-b13
+c149193c768b8b7233da4c3a3fdc0756b975848e jdk7-b143
+0cc8a70952c368e06de2adab1f2649a408f5e577 jdk8-b01
+31e253c1da429124bb87570ab095d9bc89850d0a jdk8-b02
+3a2fb61165dfc72e398179a2796d740c8da5b8c0 jdk8-b03
+0fa3ace511fe98fe948e751531f3e2b7c60c8376 jdk8-b04
+dce7d24674f4d0bed00de24f00119057fdce7cfb jdk8-b05
+0db80d8e77fccddf5e6fa49963226b54ac7d0f62 jdk8-b06
+3f0cf875af83f55ec5e1a5cea80455315f9322a2 jdk8-b07
+0cc8a70952c368e06de2adab1f2649a408f5e577 hs22-b01
+7c29742c41b44fb0cd5a13c7ac8834f3f2ca649e hs22-b02
+3a2fb61165dfc72e398179a2796d740c8da5b8c0 hs22-b03
+ce9bde819dcba4a5d2822229d9183e69c74326ca hs22-b04
+513a84dd0f8b56dc0836b4e0bdd5dd0a778fc634 hs22-b05
+650d15d8f37255d3b805aa00c5bd1c30984b203d hs22-b06
+da883b9e6d3788057f9577e72712998ed82c9b7e hs23-b01
+49ed7eacfd16616166ff066493143889741097af jdk8-b08
+7c20d272643f47195478708eff593a9cce40fec4 jdk8-b09
+e4f412d2b75d2c797acff965aa2c420e3d358f09 hs23-b02
+d815de2e85e511b7deab2a83cf80c0224d011da9 jdk8-b10
+4d3850d9d326ac3a9bee2d867727e954322d014e hs23-b03
+4538caeef7b6cbd4302bebced805d65e68ccf301 jdk8-b11
+6534482ff68ad79066dfe15dfb6d8905f09681bd hs23-b04
diff --git a/hotspot/.jcheck/conf b/hotspot/.jcheck/conf
index d8227cd90e3..6d0dbe48e36 100644
--- a/hotspot/.jcheck/conf
+++ b/hotspot/.jcheck/conf
@@ -1 +1 @@
-project=jdk7
+project=jdk8
diff --git a/hotspot/THIRD_PARTY_README b/hotspot/THIRD_PARTY_README
index db472345d22..ee5463a922e 100644
--- a/hotspot/THIRD_PARTY_README
+++ b/hotspot/THIRD_PARTY_README
@@ -1,38 +1,12 @@
DO NOT TRANSLATE OR LOCALIZE.
+-----------------------------
-%% This notice is provided with respect to Thai dictionary for text breaking, which may be included with this software:
+%% This notice is provided with respect to ASM Bytecode Manipulation
+Framework v3.1, which is included with JRE 7, JDK 7, and OpenJDK 7.
---- begin of LICENSE file ---
+--- begin of LICENSE ---
-Copyright (C) 1982 The Royal Institute, Thai Royal Government.
-
-Copyright (C) 1998 National Electronics and Computer Technology Center,
- National Science and Technology Development Agency,
- Ministry of Science Technology and Environment,
- Thai Royal Government.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without
-limitation the rights to use, copy, modify, merge, publish, distribute,
-sublicense, and/or sell copies of the Software, and to permit persons to
-whom the Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
-
---- end of LICENSE file ---
-%% This notice is provided with respect to ASM, which may be included with this software:
-Copyright (c) 2000-2007 INRIA, France Telecom
+Copyright (c) 2000-2005 INRIA, France Telecom
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -61,18 +35,3110 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
-%% This notice is provided with respect to zlib 1.1.3, which may be included with this software:
-Acknowledgments:
+--- end of LICENSE ---
- The deflate format used by zlib was defined by Phil Katz. The deflate
- and zlib specifications were written by L. Peter Deutsch. Thanks to all the
- people who reported problems and suggested various improvements in zlib;
- they are too numerous to cite here.
+--------------------------------------------------------------------------------
-Copyright notice:
+%% This notice is provided with respect to CodeViewer 1.0, which is included
+with JDK 7.
- (C) 1995-1998 Jean-loup Gailly and Mark Adler
+--- begin of LICENSE ---
+
+Copyright 1999 by CoolServlets.com.
+
+Any errors or suggested improvements to this class can be reported as
+instructed on CoolServlets.com. We hope you enjoy this program... your
+comments will encourage further development! This software is distributed
+under the terms of the BSD License. Redistribution and use in source and
+binary forms, with or without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+Neither name of CoolServlets.com nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY COOLSERVLETS.COM AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Cryptix AES 3.2.0, which is
+included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+Cryptix General License
+
+Copyright (c) 1995-2005 The Cryptix Foundation Limited.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ 1. Redistributions of source code must retain the copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED AND
+CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE CRYPTIX FOUNDATION LIMITED OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to CUP Parser Generator for
+Java 0.10k, which is included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted, provided
+that the above copyright notice appear in all copies and that both the
+copyright notice and this permission notice and warranty disclaimer appear in
+supporting documentation, and that the names of the authors or their
+employers not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+The authors and their employers disclaim all warranties with regard to
+this software, including all implied warranties of merchantability and fitness.
+In no event shall the authors or their employers be liable for any special,
+indirect or consequential damages or any damages whatsoever resulting from
+loss of use, data or profits, whether in an action of contract, negligence or
+other tortious action, arising out of or in connection with the use or
+performance of this software.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Document Object Model (DOM) Level 2
+& 3, which is included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+W3C SOFTWARE NOTICE AND LICENSE
+
+http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+This work (and included software, documentation such as READMEs, or other
+related items) is being provided by the copyright holders under the following
+license. By obtaining, using and/or copying this work, you (the licensee)
+agree that you have read, understood, and will comply with the following terms
+and conditions.
+
+Permission to copy, modify, and distribute this software and its
+documentation, with or without modification, for any purpose and without fee
+or royalty is hereby granted, provided that you include the following on ALL
+copies of the software and documentation or portions thereof, including
+modifications:
+
+ 1.The full text of this NOTICE in a location viewable to users of the
+ redistributed or derivative work.
+
+ 2.Any pre-existing intellectual property disclaimers, notices, or terms and
+ conditions. If none exist, the W3C Software Short Notice should be included
+ (hypertext is preferred, text is permitted) within the body of any
+ redistributed or derivative code.
+
+ 3.Notice of any changes or modifications to the files, including the date
+ changes were made. (We recommend you provide URIs to the location from
+ which the code is derived.)
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
+MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
+PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY
+THIRD PARTY PATENTS,COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL
+OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
+DOCUMENTATION. The name and trademarks of copyright holders may NOT be used
+in advertising or publicity pertaining to the software without specific,
+written prior permission. Title to copyright in this software and any
+associated documentation will at all times remain with copyright holders.
+
+____________________________________
+
+This formulation of W3C's notice and license became active on December 31
+2002. This version removes the copyright ownership notice such that this
+license can be used with materials other than those owned by the W3C, reflects
+that ERCIM is now a host of the W3C, includes references to this specific
+dated version of the license, and removes the ambiguous grant of "use".
+Otherwise, this version is the same as the previous version and is written so
+as to preserve the Free Software Foundation's assessment of GPL compatibility
+and OSI's certification under the Open Source Definition. Please see our
+Copyright FAQ for common questions about using materials from our site,
+including specific terms and conditions for packages like libwww, Amaya, and
+Jigsaw. Other questions about this notice can be directed to
+site-policy@w3.org.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Elliptic Curve Cryptography, which
+is included with JRE 7, JDK 7, and OpenJDK 7.
+
+You are receiving a copy of the Elliptic Curve Cryptography library in source
+form with the JDK 7 source distribution and object code in the JRE 7 & JDK 7
+runtime.
+
+The terms of the Oracle license do NOT apply to the Elliptic Curve
+Cryptography library program; it is licensed under the following license,
+separately from the Oracle programs you receive. If you do not wish to install
+this program, you may delete the library named libsunec.so (on Solaris and
+Linux systems) or sunec.dll (on Windows systems) from the JRE bin directory
+reserved for native libraries.
+
+--- begin of LICENSE ---
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to FontConfig 2.5, which is
+included with JRE 7, JDK 7, and OpenJDK 7 source distributions on
+Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Copyright © 2001,2003 Keith Packard
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that the
+above copyright notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation, and that
+the name of Keith Packard not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior permission.
+Keith Packard makes no representations about the suitability of this software
+for any purpose. It is provided "as is" without express or implied warranty.
+
+KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL KEITH
+PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to IAIK PKCS#11 Wrapper,
+which is included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+IAIK PKCS#11 Wrapper License
+
+Copyright (c) 2002 Graz University of Technology. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment:
+
+ "This product includes software developed by IAIK of Graz University of
+ Technology."
+
+ Alternately, this acknowledgment may appear in the software itself, if and
+ wherever such third-party acknowledgments normally appear.
+
+4. The names "Graz University of Technology" and "IAIK of Graz University of
+ Technology" must not be used to endorse or promote products derived from this
+ software without prior written permission.
+
+5. Products derived from this software may not be called "IAIK PKCS Wrapper",
+ nor may "IAIK" appear in their name, without prior written permission of
+ Graz University of Technology.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+LICENSOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to ICU4C 4.0.1 and ICU4J 4.4, which
+is included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+Copyright (c) 1995-2010 International Business Machines Corporation and others
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, and/or sell copies of the
+Software, and to permit persons to whom the Software is furnished to do so,
+provided that the above copyright notice(s) and this permission notice appear
+in all copies of the Software and that both the above copyright notice(s) and
+this permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
+NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE
+LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization of the copyright holder.
+All trademarks and registered trademarks mentioned herein are the property of
+their respective owners.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to IJG JPEG 6b, which is
+included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+This software is copyright (C) 1991-1998, Thomas G. Lane.
+All Rights Reserved except as specified below.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+software (or portions thereof) for any purpose, without fee, subject to these
+conditions:
+(1) If any part of the source code for this software is distributed, then this
+README file must be included, with this copyright and no-warranty notice
+unaltered; and any additions, deletions, or changes to the original files
+must be clearly indicated in accompanying documentation.
+(2) If only executable code is distributed, then the accompanying
+documentation must state that "this software is based in part on the work of
+the Independent JPEG Group".
+(3) Permission for use of this software is granted only if the user accepts
+full responsibility for any undesirable consequences; the authors accept
+NO LIABILITY for damages of any kind.
+
+These conditions apply to any software derived from or based on the IJG code,
+not just to the unmodified library. If you use our work, you ought to
+acknowledge us.
+
+Permission is NOT granted for the use of any IJG author's name or company name
+in advertising or publicity relating to this software or products derived from
+it. This software may be referred to only as "the Independent JPEG Group's
+software".
+
+We specifically permit and encourage the use of this software as the basis of
+commercial products, provided that all warranty or liability claims are
+assumed by the product vendor.
+
+--- end of LICENSE ---
+
+--------------------------------------------------------------------------------
+
+%% This notice is provided with respect to JOpt-Simple v3.0, which is
+included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+ Copyright (c) 2004-2009 Paul R. Holser, Jr.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE ---
+
+--------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kerberos functionality, which
+which is included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+ (C) Copyright IBM Corp. 1999 All Rights Reserved.
+ Copyright 1997 The Open Group Research Institute. All rights reserved.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kerberos functionality from
+FundsXpress, INC., which is included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+ Copyright (C) 1998 by the FundsXpress, INC.
+
+ All rights reserved.
+
+ Export of this software from the United States of America may require
+ a specific license from the United States Government. It is the
+ responsibility of any person or organization contemplating export to
+ obtain such a license before exporting.
+
+ WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ distribute this software and its documentation for any purpose and
+ without fee is hereby granted, provided that the above copyright
+ notice appear in all copies and that both that copyright notice and
+ this permission notice appear in supporting documentation, and that
+ the name of FundsXpress. not be used in advertising or publicity pertaining
+ to distribution of the software without specific, written prior
+ permission. FundsXpress makes no representations about the suitability of
+ this software for any purpose. It is provided "as is" without express
+ or implied warranty.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kronos OpenGL headers, which is
+included with JDK 7 and OpenJDK 7 source distributions.
+
+--- begin of LICENSE ---
+
+ Copyright (c) 2007 The Khronos Group Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and/or associated documentation files (the "Materials"), to
+ deal in the Materials without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Materials, and to permit persons to whom the Materials are
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Materials.
+
+ THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN THE
+ MATERIALS.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Portions Copyright Eastman Kodak Company 1992
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to libpng 1.2.18, which is
+included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+This copy of the libpng notices is provided for your convenience. In case of
+any discrepancy between this copy and the notices in the file png.h that is
+included in the libpng distribution, the latter shall prevail.
+
+COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
+
+If you modify libpng you may insert additional notices immediately following
+this sentence.
+
+libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are
+Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-1.2.5
+with the following individual added to the list of Contributing Authors
+
+ Cosmin Truta
+
+libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
+Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-1.0.6
+with the following individuals added to the list of Contributing Authors
+
+ Simon-Pierre Cadieux
+ Eric S. Raymond
+ Gilles Vollant
+
+and with the following additions to the disclaimer:
+
+ There is no warranty against interference with your enjoyment of the
+ library or against infringement. There is no warranty that our
+ efforts or the library will fulfill any of your particular purposes
+ or needs. This library is provided with all faults, and the entire
+ risk of satisfactory quality, performance, accuracy, and effort is with
+ the user.
+
+libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
+Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-0.96,
+with the following individuals added to the list of Contributing Authors:
+
+ Tom Lane
+ Glenn Randers-Pehrson
+ Willem van Schaik
+
+libpng versions 0.89, June 1996, through 0.96, May 1997, are
+Copyright (c) 1996, 1997 Andreas Dilger
+Distributed according to the same disclaimer and license as libpng-0.88,
+with the following individuals added to the list of Contributing Authors:
+
+ John Bowler
+ Kevin Bracey
+ Sam Bushell
+ Magnus Holmgren
+ Greg Roelofs
+ Tom Tanner
+
+libpng versions 0.5, May 1995, through 0.88, January 1996, are
+Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+
+For the purposes of this copyright and license, "Contributing Authors"
+is defined as the following set of individuals:
+
+ Andreas Dilger
+ Dave Martindale
+ Guy Eric Schalnat
+ Paul Schmidt
+ Tim Wegner
+
+The PNG Reference Library is supplied "AS IS". The Contributing Authors
+and Group 42, Inc. disclaim all warranties, expressed or implied,
+including, without limitation, the warranties of merchantability and of
+fitness for any purpose. The Contributing Authors and Group 42, Inc.
+assume no liability for direct, indirect, incidental, special, exemplary,
+or consequential damages, which may result from the use of the PNG
+Reference Library, even if advised of the possibility of such damage.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+source code, or portions hereof, for any purpose, without fee, subject
+to the following restrictions:
+
+1. The origin of this source code must not be misrepresented.
+
+2. Altered versions must be plainly marked as such and must not
+ be misrepresented as being the original source.
+
+3. This Copyright notice may not be removed or altered from any
+ source or altered source distribution.
+
+The Contributing Authors and Group 42, Inc. specifically permit, without
+fee, and encourage the use of this source code as a component to
+supporting the PNG file format in commercial products. If you use this
+source code in a product, acknowledgment is not required but would be
+appreciated.
+
+
+A "png_get_copyright" function is available, for convenient use in "about"
+boxes and the like:
+
+ printf("%s",png_get_copyright(NULL));
+
+Also, the PNG logo (in PNG format, of course) is supplied in the
+files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+
+Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
+certification mark of the Open Source Initiative.
+
+Glenn Randers-Pehrson
+glennrp at users.sourceforge.net
+May 15, 2007
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to libungif 4.1.3, which is
+included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+The GIFLIB distribution is Copyright (c) 1997 Eric S. Raymond
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Little CMS 2.0, which is
+included with OpenJDK 7.
+
+--- begin of LICENSE ---
+
+Little CMS
+Copyright (c) 1998-2010 Marti Maria Saguer
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Lucida is a registered trademark or trademark of Bigelow & Holmes in the
+U.S. and other countries.
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Mesa 3D Graphics Library v4.1,
+which is included with JRE 7, JDK 7, and OpenJDK 7 source distributions.
+
+--- begin of LICENSE ---
+
+ Mesa 3-D graphics library
+ Version: 4.1
+
+ Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to PC/SC Lite for Suse Linux v.1.1.1,
+which is included with JRE 7, JDK 7, and OpenJDK 7 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Copyright (c) 1999-2004 David Corcoran
+Copyright (c) 1999-2004 Ludovic Rousseau
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed by:
+ David Corcoran
+ http://www.linuxnet.com (MUSCLE)
+4. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+Changes to this license can be made only by the copyright author with
+explicit written consent.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Relax NG Object/Parser v.20050510,
+which is included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+Copyright (c) Kohsuke Kawaguchi
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions: The above copyright
+notice and this permission notice shall be included in all copies or
+substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to RelaxNGCC v1.12, which is
+included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2000-2003 Daisuke Okajima and Kohsuke Kawaguchi.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment:
+
+ "This product includes software developed by Daisuke Okajima
+ and Kohsuke Kawaguchi (http://relaxngcc.sf.net/)."
+
+Alternately, this acknowledgment may appear in the software itself, if and
+wherever such third-party acknowledgments normally appear.
+
+4. The names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission. For
+ written permission, please contact the copyright holders.
+
+5. Products derived from this software may not be called "RELAXNGCC", nor may
+ "RELAXNGCC" appear in their name, without prior written permission of the
+ copyright holders.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE APACHE
+SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Mozilla Rhino v1.7R3, which
+is included with JRE 7, JDK 7, and OpenJDK 7
+
+--- begin of LICENSE ---
+
+ MOZILLA PUBLIC LICENSE
+ Version 1.1
+
+ ---------------
+
+1. Definitions.
+
+ 1.0.1. "Commercial Use" means distribution or otherwise making the
+ Covered Code available to a third party.
+
+ 1.1. "Contributor" means each entity that creates or contributes to
+ the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the Original
+ Code, prior Modifications used by a Contributor, and the Modifications
+ made by that particular Contributor.
+
+ 1.3. "Covered Code" means the Original Code or Modifications or the
+ combination of the Original Code and Modifications, in each case
+ including portions thereof.
+
+ 1.4. "Electronic Distribution Mechanism" means a mechanism generally
+ accepted in the software development community for the electronic
+ transfer of data.
+
+ 1.5. "Executable" means Covered Code in any form other than Source
+ Code.
+
+ 1.6. "Initial Developer" means the individual or entity identified
+ as the Initial Developer in the Source Code notice required by Exhibit
+ A.
+
+ 1.7. "Larger Work" means a work which combines Covered Code or
+ portions thereof with code not governed by the terms of this License.
+
+ 1.8. "License" means this document.
+
+ 1.8.1. "Licensable" means having the right to grant, to the maximum
+ extent possible, whether at the time of the initial grant or
+ subsequently acquired, any and all of the rights conveyed herein.
+
+ 1.9. "Modifications" means any addition to or deletion from the
+ substance or structure of either the Original Code or any previous
+ Modifications. When Covered Code is released as a series of files, a
+ Modification is:
+ A. Any addition to or deletion from the contents of a file
+ containing Original Code or previous Modifications.
+
+ B. Any new file that contains any part of the Original Code or
+ previous Modifications.
+
+ 1.10. "Original Code" means Source Code of computer software code
+ which is described in the Source Code notice required by Exhibit A as
+ Original Code, and which, at the time of its release under this
+ License is not already Covered Code governed by this License.
+
+ 1.10.1. "Patent Claims" means any patent claim(s), now owned or
+ hereafter acquired, including without limitation, method, process,
+ and apparatus claims, in any patent Licensable by grantor.
+
+ 1.11. "Source Code" means the preferred form of the Covered Code for
+ making modifications to it, including all modules it contains, plus
+ any associated interface definition files, scripts used to control
+ compilation and installation of an Executable, or source code
+ differential comparisons against either the Original Code or another
+ well known, available Covered Code of the Contributor's choice. The
+ Source Code can be in a compressed or archival form, provided the
+ appropriate decompression or de-archiving software is widely available
+ for no charge.
+
+ 1.12. "You" (or "Your") means an individual or a legal entity
+ exercising rights under, and complying with all of the terms of, this
+ License or a future version of this License issued under Section 6.1.
+ For legal entities, "You" includes any entity which controls, is
+ controlled by, or is under common control with You. For purposes of
+ this definition, "control" means (a) the power, direct or indirect,
+ to cause the direction or management of such entity, whether by
+ contract or otherwise, or (b) ownership of more than fifty percent
+ (50%) of the outstanding shares or beneficial ownership of such
+ entity.
+
+2. Source Code License.
+
+ 2.1. The Initial Developer Grant.
+ The Initial Developer hereby grants You a world-wide, royalty-free,
+ non-exclusive license, subject to third party intellectual property
+ claims:
+ (a) under intellectual property rights (other than patent or
+ trademark) Licensable by Initial Developer to use, reproduce,
+ modify, display, perform, sublicense and distribute the Original
+ Code (or portions thereof) with or without Modifications, and/or
+ as part of a Larger Work; and
+
+ (b) under Patents Claims infringed by the making, using or
+ selling of Original Code, to make, have made, use, practice,
+ sell, and offer for sale, and/or otherwise dispose of the
+ Original Code (or portions thereof).
+
+ (c) the licenses granted in this Section 2.1(a) and (b) are
+ effective on the date Initial Developer first distributes
+ Original Code under the terms of this License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
+ granted: 1) for code that You delete from the Original Code; 2)
+ separate from the Original Code; or 3) for infringements caused
+ by: i) the modification of the Original Code or ii) the
+ combination of the Original Code with other software or devices.
+
+ 2.2. Contributor Grant.
+ Subject to third party intellectual property claims, each Contributor
+ hereby grants You a world-wide, royalty-free, non-exclusive license
+
+ (a) under intellectual property rights (other than patent or
+ trademark) Licensable by Contributor, to use, reproduce, modify,
+ display, perform, sublicense and distribute the Modifications
+ created by such Contributor (or portions thereof) either on an
+ unmodified basis, with other Modifications, as Covered Code
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making, using, or
+ selling of Modifications made by that Contributor either alone
+ and/or in combination with its Contributor Version (or portions
+ of such combination), to make, use, sell, offer for sale, have
+ made, and/or otherwise dispose of: 1) Modifications made by that
+ Contributor (or portions thereof); and 2) the combination of
+ Modifications made by that Contributor with its Contributor
+ Version (or portions of such combination).
+
+ (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
+ effective on the date Contributor first makes Commercial Use of
+ the Covered Code.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
+ granted: 1) for any code that Contributor has deleted from the
+ Contributor Version; 2) separate from the Contributor Version;
+ 3) for infringements caused by: i) third party modifications of
+ Contributor Version or ii) the combination of Modifications made
+ by that Contributor with other software (except as part of the
+ Contributor Version) or other devices; or 4) under Patent Claims
+ infringed by Covered Code in the absence of Modifications made by
+ that Contributor.
+
+3. Distribution Obligations.
+
+ 3.1. Application of License.
+ The Modifications which You create or to which You contribute are
+ governed by the terms of this License, including without limitation
+ Section 2.2. The Source Code version of Covered Code may be
+ distributed only under the terms of this License or a future version
+ of this License released under Section 6.1, and You must include a
+ copy of this License with every copy of the Source Code You
+ distribute. You may not offer or impose any terms on any Source Code
+ version that alters or restricts the applicable version of this
+ License or the recipients' rights hereunder. However, You may include
+ an additional document offering the additional rights described in
+ Section 3.5.
+
+ 3.2. Availability of Source Code.
+ Any Modification which You create or to which You contribute must be
+ made available in Source Code form under the terms of this License
+ either on the same media as an Executable version or via an accepted
+ Electronic Distribution Mechanism to anyone to whom you made an
+ Executable version available; and if made available via Electronic
+ Distribution Mechanism, must remain available for at least twelve (12)
+ months after the date it initially became available, or at least six
+ (6) months after a subsequent version of that particular Modification
+ has been made available to such recipients. You are responsible for
+ ensuring that the Source Code version remains available even if the
+ Electronic Distribution Mechanism is maintained by a third party.
+
+ 3.3. Description of Modifications.
+ You must cause all Covered Code to which You contribute to contain a
+ file documenting the changes You made to create that Covered Code and
+ the date of any change. You must include a prominent statement that
+ the Modification is derived, directly or indirectly, from Original
+ Code provided by the Initial Developer and including the name of the
+ Initial Developer in (a) the Source Code, and (b) in any notice in an
+ Executable version or related documentation in which You describe the
+ origin or ownership of the Covered Code.
+
+ 3.4. Intellectual Property Matters
+ (a) Third Party Claims.
+ If Contributor has knowledge that a license under a third party's
+ intellectual property rights is required to exercise the rights
+ granted by such Contributor under Sections 2.1 or 2.2,
+ Contributor must include a text file with the Source Code
+ distribution titled "LEGAL" which describes the claim and the
+ party making the claim in sufficient detail that a recipient will
+ know whom to contact. If Contributor obtains such knowledge after
+ the Modification is made available as described in Section 3.2,
+ Contributor shall promptly modify the LEGAL file in all copies
+ Contributor makes available thereafter and shall take other steps
+ (such as notifying appropriate mailing lists or newsgroups)
+ reasonably calculated to inform those who received the Covered
+ Code that new knowledge has been obtained.
+
+ (b) Contributor APIs.
+ If Contributor's Modifications include an application programming
+ interface and Contributor has knowledge of patent licenses which
+ are reasonably necessary to implement that API, Contributor must
+ also include this information in the LEGAL file.
+
+ (c) Representations.
+ Contributor represents that, except as disclosed pursuant to
+ Section 3.4(a) above, Contributor believes that Contributor's
+ Modifications are Contributor's original creation(s) and/or
+ Contributor has sufficient rights to grant the rights conveyed by
+ this License.
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source
+ Code. If it is not possible to put such notice in a particular Source
+ Code file due to its structure, then You must include such notice in a
+ location (such as a relevant directory) where a user would be likely
+ to look for such a notice. If You created one or more Modification(s)
+ You may add your name as a Contributor to the notice described in
+ Exhibit A. You must also duplicate this License in any documentation
+ for the Source Code where You describe recipients' rights or ownership
+ rights relating to Covered Code. You may choose to offer, and to
+ charge a fee for, warranty, support, indemnity or liability
+ obligations to one or more recipients of Covered Code. However, You
+ may do so only on Your own behalf, and not on behalf of the Initial
+ Developer or any Contributor. You must make it absolutely clear than
+ any such warranty, support, indemnity or liability obligation is
+ offered by You alone, and You hereby agree to indemnify the Initial
+ Developer and every Contributor for any liability incurred by the
+ Initial Developer or such Contributor as a result of warranty,
+ support, indemnity or liability terms You offer.
+
+ 3.6. Distribution of Executable Versions.
+ You may distribute Covered Code in Executable form only if the
+ requirements of Section 3.1-3.5 have been met for that Covered Code,
+ and if You include a notice stating that the Source Code version of
+ the Covered Code is available under the terms of this License,
+ including a description of how and where You have fulfilled the
+ obligations of Section 3.2. The notice must be conspicuously included
+ in any notice in an Executable version, related documentation or
+ collateral in which You describe recipients' rights relating to the
+ Covered Code. You may distribute the Executable version of Covered
+ Code or ownership rights under a license of Your choice, which may
+ contain terms different from this License, provided that You are in
+ compliance with the terms of this License and that the license for the
+ Executable version does not attempt to limit or alter the recipient's
+ rights in the Source Code version from the rights set forth in this
+ License. If You distribute the Executable version under a different
+ license You must make it absolutely clear that any terms which differ
+ from this License are offered by You alone, not by the Initial
+ Developer or any Contributor. You hereby agree to indemnify the
+ Initial Developer and every Contributor for any liability incurred by
+ the Initial Developer or such Contributor as a result of any such
+ terms You offer.
+
+ 3.7. Larger Works.
+ You may create a Larger Work by combining Covered Code with other code
+ not governed by the terms of this License and distribute the Larger
+ Work as a single product. In such a case, You must make sure the
+ requirements of this License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+ If it is impossible for You to comply with any of the terms of this
+ License with respect to some or all of the Covered Code due to
+ statute, judicial order, or regulation then You must: (a) comply with
+ the terms of this License to the maximum extent possible; and (b)
+ describe the limitations and the code they affect. Such description
+ must be included in the LEGAL file described in Section 3.4 and must
+ be included with all distributions of the Source Code. Except to the
+ extent prohibited by statute or regulation, such description must be
+ sufficiently detailed for a recipient of ordinary skill to be able to
+ understand it.
+
+5. Application of this License.
+
+ This License applies to code to which the Initial Developer has
+ attached the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+ 6.1. New Versions.
+ Netscape Communications Corporation ("Netscape") may publish revised
+ and/or new versions of the License from time to time. Each version
+ will be given a distinguishing version number.
+
+ 6.2. Effect of New Versions.
+ Once Covered Code has been published under a particular version of the
+ License, You may always continue to use it under the terms of that
+ version. You may also choose to use such Covered Code under the terms
+ of any subsequent version of the License published by Netscape. No one
+ other than Netscape has the right to modify the terms applicable to
+ Covered Code created under this License.
+
+ 6.3. Derivative Works.
+ If You create or use a modified version of this License (which you may
+ only do in order to apply it to code which is not already Covered Code
+ governed by this License), You must (a) rename Your license so that
+ the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
+ "MPL", "NPL" or any confusingly similar phrase do not appear in your
+ license (except to note that your license differs from this License)
+ and (b) otherwise make it clear that Your version of the license
+ contains terms which differ from the Mozilla Public License and
+ Netscape Public License. (Filling in the name of the Initial
+ Developer, Original Code or Contributor in the notice described in
+ Exhibit A shall not of themselves be deemed to be modifications of
+ this License.)
+
+7. DISCLAIMER OF WARRANTY.
+
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
+ DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
+ THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
+ IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
+ YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
+ COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
+ OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+8. TERMINATION.
+
+ 8.1. This License and the rights granted hereunder will terminate
+ automatically if You fail to comply with terms herein and fail to cure
+ such breach within 30 days of becoming aware of the breach. All
+ sublicenses to the Covered Code which are properly granted shall
+ survive any termination of this License. Provisions which, by their
+ nature, must remain in effect beyond the termination of this License
+ shall survive.
+
+ 8.2. If You initiate litigation by asserting a patent infringement
+ claim (excluding declatory judgment actions) against Initial Developer
+ or a Contributor (the Initial Developer or Contributor against whom
+ You file such action is referred to as "Participant") alleging that:
+
+ (a) such Participant's Contributor Version directly or indirectly
+ infringes any patent, then any and all rights granted by such
+ Participant to You under Sections 2.1 and/or 2.2 of this License
+ shall, upon 60 days notice from Participant terminate prospectively,
+ unless if within 60 days after receipt of notice You either: (i)
+ agree in writing to pay Participant a mutually agreeable reasonable
+ royalty for Your past and future use of Modifications made by such
+ Participant, or (ii) withdraw Your litigation claim with respect to
+ the Contributor Version against such Participant. If within 60 days
+ of notice, a reasonable royalty and payment arrangement are not
+ mutually agreed upon in writing by the parties or the litigation claim
+ is not withdrawn, the rights granted by Participant to You under
+ Sections 2.1 and/or 2.2 automatically terminate at the expiration of
+ the 60 day notice period specified above.
+
+ (b) any software, hardware, or device, other than such Participant's
+ Contributor Version, directly or indirectly infringes any patent, then
+ any rights granted to You by such Participant under Sections 2.1(b)
+ and 2.2(b) are revoked effective as of the date You first made, used,
+ sold, distributed, or had made, Modifications made by that
+ Participant.
+
+ 8.3. If You assert a patent infringement claim against Participant
+ alleging that such Participant's Contributor Version directly or
+ indirectly infringes any patent where such claim is resolved (such as
+ by license or settlement) prior to the initiation of patent
+ infringement litigation, then the reasonable value of the licenses
+ granted by such Participant under Sections 2.1 or 2.2 shall be taken
+ into account in determining the amount or value of any payment or
+ license.
+
+ 8.4. In the event of termination under Sections 8.1 or 8.2 above,
+ all end user license agreements (excluding distributors and resellers)
+ which have been validly granted by You or any distributor hereunder
+ prior to termination shall survive termination.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
+ DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
+ OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
+ ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+ CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
+ WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
+ RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
+ PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
+ EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
+ THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+ The Covered Code is a "commercial item," as that term is defined in
+ 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
+ software" and "commercial computer software documentation," as such
+ terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
+ C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
+ all U.S. Government End Users acquire Covered Code with only those
+ rights set forth herein.
+
+11. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the extent
+ necessary to make it enforceable. This License shall be governed by
+ California law provisions (except to the extent applicable law, if
+ any, provides otherwise), excluding its conflict-of-law provisions.
+ With respect to disputes in which at least one party is a citizen of,
+ or an entity chartered or registered to do business in the United
+ States of America, any litigation relating to this License shall be
+ subject to the jurisdiction of the Federal Courts of the Northern
+ District of California, with venue lying in Santa Clara County,
+ California, with the losing party responsible for costs, including
+ without limitation, court costs and reasonable attorneys' fees and
+ expenses. The application of the United Nations Convention on
+ Contracts for the International Sale of Goods is expressly excluded.
+ Any law or regulation which provides that the language of a contract
+ shall be construed against the drafter shall not apply to this
+ License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or indirectly,
+ out of its utilization of rights under this License and You agree to
+ work with Initial Developer and Contributors to distribute such
+ responsibility on an equitable basis. Nothing herein is intended or
+ shall be deemed to constitute any admission of liability.
+
+13. MULTIPLE-LICENSED CODE.
+
+ Initial Developer may designate portions of the Covered Code as
+ "Multiple-Licensed". "Multiple-Licensed" means that the Initial
+ Developer permits you to utilize portions of the Covered Code under
+ Your choice of the NPL or the alternative licenses, if any, specified
+ by the Initial Developer in the file described in Exhibit A.
+
+EXHIBIT A - Mozilla Public License.
+
+ ``The contents of this file are subject to the Mozilla Public License
+ Version 1.1 (the "License"); you may not use this file except in
+ compliance with the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ License for the specific language governing rights and limitations
+ under the License.
+
+ The Original Code is ______________________________________.
+
+ The Initial Developer of the Original Code is ________________________.
+ Portions created by ______________________ are Copyright (C) ______
+ _______________________. All Rights Reserved.
+
+ Contributor(s): ______________________________________.
+
+ Alternatively, the contents of this file may be used under the terms
+ of the _____ license (the "[___] License"), in which case the
+ provisions of [______] License are applicable instead of those
+ above. If you wish to allow use of your version of this file only
+ under the terms of the [____] License and not to allow others to use
+ your version of this file under the MPL, indicate your decision by
+ deleting the provisions above and replace them with the notice and
+ other provisions required by the [___] License. If you do not delete
+ the provisions above, a recipient may use your version of this file
+ under either the MPL or the [___] License."
+
+ [NOTE: The text of this Exhibit A may differ slightly from the text of
+ the notices in the Source Code files of the Original Code. You should
+ use the text of this Exhibit A rather than the text found in the
+ Original Code Source Code for Your Modifications.]
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to SAX 2.0.1, which is included
+with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+ SAX is free!
+
+ In fact, it's not possible to own a license to SAX, since it's been placed in
+ the public domain.
+
+ No Warranty
+
+ Because SAX is released to the public domain, there is no warranty for the
+ design or for the software implementation, to the extent permitted by
+ applicable law. Except when otherwise stated in writing the copyright holders
+ and/or other parties provide SAX "as is" without warranty of any kind, either
+ expressed or implied, including, but not limited to, the implied warranties
+ of merchantability and fitness for a particular purpose. The entire risk as
+ to the quality and performance of SAX is with you. Should SAX prove
+ defective, you assume the cost of all necessary servicing, repair or
+ correction.
+
+ In no event unless required by applicable law or agreed to in writing will
+ any copyright holder, or any other party who may modify and/or redistribute
+ SAX, be liable to you for damages, including any general, special, incidental
+ or consequential damages arising out of the use or inability to use SAX
+ (including but not limited to loss of data or data being rendered inaccurate
+ or losses sustained by you or third parties or a failure of the SAX to
+ operate with any other programs), even if such holder or other party has been
+ advised of the possibility of such damages.
+
+ Copyright Disclaimers
+
+ This page includes statements to that effect by David Megginson, who would
+ have been able to claim copyright for the original work. SAX 1.0
+
+ Version 1.0 of the Simple API for XML (SAX), created collectively by the
+ membership of the XML-DEV mailing list, is hereby released into the public
+ domain.
+
+ No one owns SAX: you may use it freely in both commercial and non-commercial
+ applications, bundle it with your software distribution, include it on a
+ CD-ROM, list the source code in a book, mirror the documentation at your own
+ web site, or use it in any other way you see fit.
+
+ David Megginson, sax@megginson.com
+ 1998-05-11
+
+ SAX 2.0
+
+ I hereby abandon any property rights to SAX 2.0 (the Simple API for XML), and
+ release all of the SAX 2.0 source code, compiled code, and documentation
+ contained in this distribution into the Public Domain. SAX comes with NO
+ WARRANTY or guarantee of fitness for any purpose.
+
+ David Megginson, david@megginson.com
+ 2000-05-05
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to SoftFloat version 2b, which is
+included with JRE 7, JDK 7, and OpenJDK 7 on Linux/ARM.
+
+--- begin of LICENSE ---
+
+Use of any of this software is governed by the terms of the license below:
+
+SoftFloat was written by me, John R. Hauser. This work was made possible in
+part by the International Computer Science Institute, located at Suite 600,
+1947 Center Street, Berkeley, California 94704. Funding was partially
+provided by the National Science Foundation under grant MIP-9311980. The
+original version of this code was written as part of a project to build
+a fixed-point vector processor in collaboration with the University of
+California at Berkeley, overseen by Profs. Nelson Morgan and John Wawrzynek.
+
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
+has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
+TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
+PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL
+LOSSES, COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO
+FURTHERMORE EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER
+SCIENCE INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES,
+COSTS, OR OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE
+SOFTWARE.
+
+Derivative works are acceptable, even for commercial purposes, provided
+that the minimal documentation requirements stated in the source code are
+satisfied.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Portions licensed from Taligent, Inc.
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Thai Dictionary, which is
+included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+Copyright (C) 1982 The Royal Institute, Thai Royal Government.
+
+Copyright (C) 1998 National Electronics and Computer Technology Center,
+National Science and Technology Development Agency,
+Ministry of Science Technology and Environment,
+Thai Royal Government.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Unicode 6.0.0, CLDR v1.4.1, & CLDR
+v1.9, which is included with JRE 7, JDK 7, and OpenJDK 7.
+
+--- begin of LICENSE ---
+
+Unicode Terms of Use
+
+For the general privacy policy governing access to this site, see the Unicode
+Privacy Policy. For trademark usage, see the Unicode® Consortium Name and
+Trademark Usage Policy.
+
+A. Unicode Copyright.
+ 1. Copyright © 1991-2011 Unicode, Inc. All rights reserved.
+
+ 2. Certain documents and files on this website contain a legend indicating
+ that "Modification is permitted." Any person is hereby authorized,
+ without fee, to modify such documents and files to create derivative
+ works conforming to the Unicode® Standard, subject to Terms and
+ Conditions herein.
+
+ 3. Any person is hereby authorized, without fee, to view, use, reproduce,
+ and distribute all documents and files solely for informational
+ purposes in the creation of products supporting the Unicode Standard,
+ subject to the Terms and Conditions herein.
+
+ 4. Further specifications of rights and restrictions pertaining to the use
+ of the particular set of data files known as the "Unicode Character
+ Database" can be found in Exhibit 1.
+
+ 5. Each version of the Unicode Standard has further specifications of
+ rights and restrictions of use. For the book editions (Unicode 5.0 and
+ earlier), these are found on the back of the title page. The online
+ code charts carry specific restrictions. All other files, including
+ online documentation of the core specification for Unicode 6.0 and
+ later, are covered under these general Terms of Use.
+
+ 6. No license is granted to "mirror" the Unicode website where a fee is
+ charged for access to the "mirror" site.
+
+ 7. Modification is not permitted with respect to this document. All copies
+ of this document must be verbatim.
+
+B. Restricted Rights Legend. Any technical data or software which is licensed
+ to the United States of America, its agencies and/or instrumentalities
+ under this Agreement is commercial technical data or commercial computer
+ software developed exclusively at private expense as defined in FAR 2.101,
+ or DFARS 252.227-7014 (June 1995), as applicable. For technical data, use,
+ duplication, or disclosure by the Government is subject to restrictions as
+ set forth in DFARS 202.227-7015 Technical Data, Commercial and Items (Nov
+ 1995) and this Agreement. For Software, in accordance with FAR 12-212 or
+ DFARS 227-7202, as applicable, use, duplication or disclosure by the
+ Government is subject to the restrictions set forth in this Agreement.
+
+C. Warranties and Disclaimers.
+ 1. This publication and/or website may include technical or typographical
+ errors or other inaccuracies . Changes are periodically added to the
+ information herein; these changes will be incorporated in new editions
+ of the publication and/or website. Unicode may make improvements and/or
+ changes in the product(s) and/or program(s) described in this
+ publication and/or website at any time.
+
+ 2. If this file has been purchased on magnetic or optical media from
+ Unicode, Inc. the sole and exclusive remedy for any claim will be
+ exchange of the defective media within ninety (90) days of original
+ purchase.
+
+ 3. EXCEPT AS PROVIDED IN SECTION C.2, THIS PUBLICATION AND/OR SOFTWARE IS
+ PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS, IMPLIED,
+ OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+ UNICODE AND ITS LICENSORS ASSUME NO RESPONSIBILITY FOR ERRORS OR
+ OMISSIONS IN THIS PUBLICATION AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH
+ ARE REFERENCED BY OR LINKED TO THIS PUBLICATION OR THE UNICODE WEBSITE.
+
+D. Waiver of Damages. In no event shall Unicode or its licensors be liable for
+ any special, incidental, indirect or consequential damages of any kind, or
+ any damages whatsoever, whether or not Unicode was advised of the
+ possibility of the damage, including, without limitation, those resulting
+ from the following: loss of use, data or profits, in connection with the
+ use, modification or distribution of this information or its derivatives.
+
+E.Trademarks & Logos.
+ 1. The Unicode Word Mark and the Unicode Logo are trademarks of Unicode,
+ Inc. “The Unicode Consortium” and “Unicode, Inc.” are trade names of
+ Unicode, Inc. Use of the information and materials found on this
+ website indicates your acknowledgement of Unicode, Inc.’s exclusive
+ worldwide rights in the Unicode Word Mark, the Unicode Logo, and the
+ Unicode trade names.
+
+ 2. The Unicode Consortium Name and Trademark Usage Policy (“Trademark
+ Policy”) are incorporated herein by reference and you agree to abide by
+ the provisions of the Trademark Policy, which may be changed from time
+ to time in the sole discretion of Unicode, Inc.
+
+ 3. All third party trademarks referenced herein are the property of their
+ respective owners.
+
+Miscellaneous.
+ 1. Jurisdiction and Venue. This server is operated from a location in the
+ State of California, United States of America. Unicode makes no
+ representation that the materials are appropriate for use in other
+ locations. If you access this server from other locations, you are
+ responsible for compliance with local laws. This Agreement, all use of
+ this site and any claims and damages resulting from use of this site are
+ governed solely by the laws of the State of California without regard to
+ any principles which would apply the laws of a different jurisdiction.
+ The user agrees that any disputes regarding this site shall be resolved
+ solely in the courts located in Santa Clara County, California. The user
+ agrees said courts have personal jurisdiction and agree to waive any
+ right to transfer the dispute to any other forum.
+
+ 2. Modification by Unicode. Unicode shall have the right to modify this
+ Agreement at any time by posting it to this site. The user may not
+ assign any part of this Agreement without Unicode’s prior written
+ consent.
+
+ 3. Taxes. The user agrees to pay any taxes arising from access to this
+ website or use of the information herein, except for those based on
+ Unicode’s net income.
+
+ 4. Severability. If any provision of this Agreement is declared invalid or
+ unenforceable, the remaining provisions of this Agreement shall remain
+ in effect.
+
+ 5. Entire Agreement. This Agreement constitutes the entire agreement
+ between the parties.
+
+EXHIBIT 1
+UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
+
+Unicode Data Files include all data files under the directories
+http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
+http://www.unicode.org/cldr/data/. Unicode Data Files do not include PDF
+online code charts under the directory http://www.unicode.org/Public/.
+Software includes any source code published in the Unicode Standard or under
+the directories http://www.unicode.org/Public/,
+http://www.unicode.org/reports/, and http://www.unicode.org/cldr/data/.
+
+NOTICE TO USER: Carefully read the following legal agreement. BY DOWNLOADING,
+INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES ("DATA
+FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO
+BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT
+AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR
+SOFTWARE.
+
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright © 1991-2011 Unicode, Inc. All rights reserved. Distributed under the
+Terms of Use in http://www.unicode.org/copyright.html.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the Unicode data files and any associated documentation (the "Data Files")
+or Unicode software and any associated documentation (the "Software") to deal
+in the Data Files or Software without restriction, including without
+limitation the rights to use, copy, modify, merge, publish, distribute, and/or
+sell copies of the Data Files or Software, and to permit persons to whom the
+Data Files or Software are furnished to do so, provided that (a) the above
+copyright notice(s) and this permission notice appear with all copies of the
+Data Files or Software, (b) both the above copyright notice(s) and this
+permission notice appear in associated documentation, and (c) there is clear
+notice in each modified Data File or in the Software as well as in the
+documentation associated with the Data File(s) or Software that the data or
+software has been modified.
+
+THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD
+PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
+DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE
+DATA FILES OR SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in these Data Files or Software without prior written authorization of the
+copyright holder.
+
+Unicode and the Unicode logo are trademarks of Unicode, Inc. in the United
+States and other countries. All third party trademarks referenced herein are
+the property of their respective owners.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to UPX v3.01, which is included
+with JRE 7 on Windows.
+
+--- begin of LICENSE ---
+
+Use of any of this software is governed by the terms of the license below:
+
+
+ ooooo ooo ooooooooo. ooooooo ooooo
+ `888' `8' `888 `Y88. `8888 d8'
+ 888 8 888 .d88' Y888..8P
+ 888 8 888ooo88P' `8888'
+ 888 8 888 .8PY888.
+ `88. .8' 888 d8' `888b
+ `YbodP' o888o o888o o88888o
+
+
+ The Ultimate Packer for eXecutables
+ Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar
+ http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
+ http://www.nexus.hu/upx
+ http://upx.tsx.org
+
+
+PLEASE CAREFULLY READ THIS LICENSE AGREEMENT, ESPECIALLY IF YOU PLAN
+TO MODIFY THE UPX SOURCE CODE OR USE A MODIFIED UPX VERSION.
+
+
+ABSTRACT
+========
+
+ UPX and UCL are copyrighted software distributed under the terms
+ of the GNU General Public License (hereinafter the "GPL").
+
+ The stub which is imbedded in each UPX compressed program is part
+ of UPX and UCL, and contains code that is under our copyright. The
+ terms of the GNU General Public License still apply as compressing
+ a program is a special form of linking with our stub.
+
+ As a special exception we grant the free usage of UPX for all
+ executables, including commercial programs.
+ See below for details and restrictions.
+
+
+COPYRIGHT
+=========
+
+ UPX and UCL are copyrighted software. All rights remain with the authors.
+
+ UPX is Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
+ UPX is Copyright (C) 1996-2000 Laszlo Molnar
+
+ UCL is Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
+
+
+GNU GENERAL PUBLIC LICENSE
+==========================
+
+ UPX and the UCL library are free software; you can redistribute them
+ and/or modify them under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ UPX and UCL are distributed in the hope that they will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING.
+
+
+SPECIAL EXCEPTION FOR COMPRESSED EXECUTABLES
+============================================
+
+ The stub which is imbedded in each UPX compressed program is part
+ of UPX and UCL, and contains code that is under our copyright. The
+ terms of the GNU General Public License still apply as compressing
+ a program is a special form of linking with our stub.
+
+ Hereby Markus F.X.J. Oberhumer and Laszlo Molnar grant you special
+ permission to freely use and distribute all UPX compressed programs
+ (including commercial ones), subject to the following restrictions:
+
+ 1. You must compress your program with a completely unmodified UPX
+ version; either with our precompiled version, or (at your option)
+ with a self compiled version of the unmodified UPX sources as
+ distributed by us.
+ 2. This also implies that the UPX stub must be completely unmodfied, i.e.
+ the stub imbedded in your compressed program must be byte-identical
+ to the stub that is produced by the official unmodified UPX version.
+ 3. The decompressor and any other code from the stub must exclusively get
+ used by the unmodified UPX stub for decompressing your program at
+ program startup. No portion of the stub may get read, copied,
+ called or otherwise get used or accessed by your program.
+
+
+ANNOTATIONS
+===========
+
+ - You can use a modified UPX version or modified UPX stub only for
+ programs that are compatible with the GNU General Public License.
+
+ - We grant you special permission to freely use and distribute all UPX
+ compressed programs. But any modification of the UPX stub (such as,
+ but not limited to, removing our copyright string or making your
+ program non-decompressible) will immediately revoke your right to
+ use and distribute a UPX compressed program.
+
+ - UPX is not a software protection tool; by requiring that you use
+ the unmodified UPX version for your proprietary programs we
+ make sure that any user can decompress your program. This protects
+ both you and your users as nobody can hide malicious code -
+ any program that cannot be decompressed is highly suspicious
+ by definition.
+
+ - You can integrate all or part of UPX and UCL into projects that
+ are compatible with the GNU GPL, but obviously you cannot grant
+ any special exceptions beyond the GPL for our code in your project.
+
+ - We want to actively support manufacturers of virus scanners and
+ similar security software. Please contact us if you would like to
+ incorporate parts of UPX or UCL into such a product.
+
+
+
+Markus F.X.J. Oberhumer Laszlo Molnar
+markus.oberhumer@jk.uni-linz.ac.at ml1050@cdata.tvnet.hu
+
+Linz, Austria, 25 Feb 2000
+
+Additional License(s)
+
+The UPX license file is at http://upx.sourceforge.net/upx-license.html.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Xfree86-VidMode Extension 1.0,
+which is included with JRE 7, JDK 7, and OpenJDK 7 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Version 1.1 of XFree86 ProjectLicence.
+
+Copyright (C) 1994-2004 The XFree86 Project, Inc. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicence, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so,subject to the following conditions:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice,this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution, and in the same place
+ and form as other copyright, license and disclaimer information.
+
+ 3. The end-user documentation included with the redistribution, if any,must
+ include the following acknowledgment: "This product includes
+ software developed by The XFree86 Project, Inc (http://www.xfree86.org/) and
+ its contributors", in the same place and form as other third-party
+ acknowledgments. Alternately, this acknowledgment may appear in the software
+ itself, in the same form and location as other such third-party
+ acknowledgments.
+
+ 4. Except as contained in this notice, the name of The XFree86 Project,Inc
+ shall not be used in advertising or otherwise to promote the sale, use
+ or other dealings in this Software without prior written authorization from
+ The XFree86 Project, Inc.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to X Window System 6.8.2, which is
+included with JRE 7, JDK 7, and OpenJDK 7 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+ Licenses
+The X.Org Foundation March 2004
+
+1. Introduction
+
+The X.org Foundation X Window System distribution is a compilation of code and
+documentation from many sources. This document is intended primarily as a
+guide to the licenses used in the distribution: you must check each file
+and/or package for precise redistribution terms. None-the-less, this summary
+may be useful to many users. No software incorporating the XFree86 1.1 license
+has been incorporated.
+
+This document is based on the compilation from XFree86.
+
+2. XFree86 License
+
+XFree86 code without an explicit copyright is covered by the following
+copyright/license:
+
+Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the XFree86 Project shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the XFree86 Project.
+
+3. Other Licenses
+
+Portions of code are covered by the following licenses/copyrights. See
+individual files for the copyright dates.
+
+3.1. X/MIT Copyrights
+
+3.1.1. X Consortium
+
+Copyright (C) X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
+CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization from the X Consortium.
+
+X Window System is a trademark of X Consortium, Inc.
+
+3.1.2. The Open Group
+
+Copyright The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that the
+above copyright notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation.
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization from The Open Group. 3.2.
+Berkeley-based copyrights:
+
+o
+3.2.1. General
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE. 3.2.2. UCB/LBL
+
+Copyright (c) 1993 The Regents of the University of California. All rights
+reserved.
+
+This software was developed by the Computer Systems Engineering group at
+Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and contributed to
+Berkeley.
+
+All advertising materials mentioning features or use of this software must
+display the following acknowledgement: This product includes software
+developed by the University of California, Lawrence Berkeley Laboratory.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement: This product includes software
+ developed by the University of California, Berkeley and its contributors.
+
+ 4. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3.2.3. The
+NetBSD Foundation, Inc.
+
+Copyright (c) 2003 The NetBSD Foundation, Inc. All rights reserved.
+
+This code is derived from software contributed to The NetBSD Foundation by Ben
+Collver
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement: This product includes software
+ developed by the NetBSD Foundation, Inc. and its contributors.
+
+ 4. Neither the name of The NetBSD Foundation nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS ``AS
+IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3.2.4. Theodore
+Ts'o.
+
+Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All rights
+reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ and the entire permission notice in its entirety, including the disclaimer
+ of warranties.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. he name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE, ALL OF WHICH ARE HEREBY DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE. 3.2.5. Theo de Raadt and Damien Miller
+
+Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. Copyright (c)
+2001-2002 Damien Miller. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE. 3.2.6. Todd C. Miller
+
+Copyright (c) 1998 Todd C. Miller
+
+Permission to use, copy, modify, and distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright
+notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 3.2.7. Thomas
+Winischhofer
+
+Copyright (C) 2001-2004 Thomas Winischhofer
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE. 3.3. NVIDIA Corp
+
+Copyright (c) 1996 NVIDIA, Corp. All rights reserved.
+
+NOTICE TO USER: The source code is copyrighted under U.S. and international
+laws. NVIDIA, Corp. of Sunnyvale, California owns the copyright and as design
+patents pending on the design and interface of the NV chips. Users and
+possessors of this source code are hereby granted a nonexclusive, royalty-free
+copyright and design patent license to use this code in individual and
+commercial software.
+
+Any use of this source code must include, in the user documentation and
+internal comments to the code, notices to the end user as follows:
+
+Copyright (c) 1996 NVIDIA, Corp. NVIDIA design patents pending in the U.S. and
+foreign countries.
+
+NVIDIA, CORP. MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
+CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
+WARRANTY OF ANY KIND. NVIDIA, CORP. DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA, CORP. BE LIABLE
+FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. 3.4. GLX Public
+License
+
+GLX PUBLIC LICENSE (Version 1.0 (2/11/99)) ("License")
+
+Subject to any third party claims, Silicon Graphics, Inc. ("SGI") hereby
+grants permission to Recipient (defined below), under Recipient's copyrights
+in the Original Software (defined below), to use, copy, modify, merge,
+publish, distribute, sublicense and/or sell copies of Subject Software
+(defined below), and to permit persons to whom the Subject Software is
+furnished in accordance with this License to do the same, subject to all of
+the following terms and conditions, which Recipient accepts by engaging in any
+such use, copying, modifying, merging, publishing, distributing, sublicensing
+or selling:
+
+1. Definitions.
+
+ (a) "Original Software" means source code of computer software code which
+ is described in Exhibit A as Original Software.
+
+ (b) "Modifications" means any addition to or deletion from the substance
+ or structure of either the Original Software or any previous
+ Modifications. When Subject Software is released as a series of files, a
+ Modification means (i) any addition to or deletion from the contents of a
+ file containing Original Software or previous Modifications and (ii) any
+ new file that contains any part of the Original Code or previous
+ Modifications.
+
+ (c) "Subject Software" means the Original Software or Modifications or the
+ combination of the Original Software and Modifications, or portions of any
+ of the foregoing.
+
+ (d) "Recipient" means an individual or a legal entity exercising rights
+ under, and complying with all of the terms of, this License. For legal
+ entities, "Recipient" includes any entity which controls, is controlled
+ by, or is under common control with Recipient. For purposes of this
+ definition, "control" of an entity means (a) the power, direct or
+ indirect, to direct or manage such entity, or (b) ownership of fifty
+ percent (50%) or more of the outstanding shares or beneficial ownership of
+ such entity.
+
+2. Redistribution of Source Code Subject to These Terms. Redistributions of
+Subject Software in source code form must retain the notice set forth in
+Exhibit A, below, in every file. A copy of this License must be included in
+any documentation for such Subject Software where the recipients' rights
+relating to Subject Software are described. Recipient may distribute the
+source code version of Subject Software under a license of Recipient's choice,
+which may contain terms different from this License, provided that (i)
+Recipient is in compliance with the terms of this License, and (ii) the
+license terms include this Section 2 and Sections 3, 4, 7, 8, 10, 12 and 13 of
+this License, which terms may not be modified or superseded by any other terms
+of such license. If Recipient distributes the source code version under a
+different license Recipient must make it absolutely clear that any terms which
+differ from this License are offered by Recipient alone, not by SGI. Recipient
+hereby agrees to indemnify SGI for any liability incurred by SGI as a result
+of any such terms Recipient offers.
+
+3. Redistribution in Executable Form. The notice set forth in Exhibit A must
+be conspicuously included in any notice in an executable version of Subject
+Software, related documentation or collateral in which Recipient describes the
+user's rights relating to the Subject Software. Recipient may distribute the
+executable version of Subject Software under a license of Recipient's choice,
+which may contain terms different from this License, provided that (i)
+Recipient is in compliance with the terms of this License, and (ii) the
+license terms include this Section 3 and Sections 4, 7, 8, 10, 12 and 13 of
+this License, which terms may not be modified or superseded by any other terms
+of such license. If Recipient distributes the executable version under a
+different license Recipient must make it absolutely clear that any terms which
+differ from this License are offered by Recipient alone, not by SGI. Recipient
+hereby agrees to indemnify SGI for any liability incurred by SGI as a result
+of any such terms Recipient offers.
+
+4. Termination. This License and the rights granted hereunder will terminate
+automatically if Recipient fails to comply with terms herein and fails to cure
+such breach within 30 days of the breach. Any sublicense to the Subject
+Software which is properly granted shall survive any termination of this
+License absent termination by the terms of such sublicense. Provisions which,
+by their nature, must remain in effect beyond the termination of this License
+shall survive.
+
+5. No Trademark Rights. This License does not grant any rights to use any
+trade name, trademark or service mark whatsoever. No trade name, trademark or
+service mark of SGI may be used to endorse or promote products derived from
+the Subject Software without prior written permission of SGI.
+
+6. No Other Rights. This License does not grant any rights with respect to the
+OpenGL API or to any software or hardware implementation thereof or to any
+other software whatsoever, nor shall any other rights or licenses not
+expressly granted hereunder arise by implication, estoppel or otherwise with
+respect to the Subject Software. Title to and ownership of the Original
+Software at all times remains with SGI. All rights in the Original Software
+not expressly granted under this License are reserved.
+
+7. Compliance with Laws; Non-Infringement. Recipient shall comply with all
+applicable laws and regulations in connection with use and distribution of the
+Subject Software, including but not limited to, all export and import control
+laws and regulations of the U.S. government and other countries. Recipient may
+not distribute Subject Software that (i) in any way infringes (directly or
+contributorily) the rights (including patent, copyright, trade secret,
+trademark or other intellectual property rights of any kind) of any other
+person or entity or (ii) breaches any representation or warranty, express,
+implied or statutory, which under any applicable law it might be deemed to
+have been distributed.
+
+8. Claims of Infringement. If Recipient at any time has knowledge of any one
+or more third party claims that reproduction, modification, use, distribution,
+import or sale of Subject Software (including particular functionality or code
+incorporated in Subject Software) infringes the third party's intellectual
+property rights, Recipient must place in a well-identified web page bearing
+the title "LEGAL" a description of each such claim and a description of the
+party making each such claim in sufficient detail that a user of the Subject
+Software will know whom to contact regarding the claim. Also, upon gaining
+such knowledge of any such claim, Recipient must conspicuously include the URL
+for such web page in the Exhibit A notice required under Sections 2 and 3,
+above, and in the text of any related documentation, license agreement or
+collateral in which Recipient describes end user's rights relating to the
+Subject Software. If Recipient obtains such knowledge after it makes Subject
+Software available to any other person or entity, Recipient shall take other
+steps (such as notifying appropriate mailing lists or newsgroups) reasonably
+calculated to inform those who received the Subject Software that new
+knowledge has been obtained.
+
+9. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS,
+MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON- INFRINGING. SGI ASSUMES NO
+RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
+PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY
+SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
+HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+10. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
+WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY),
+CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY
+DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, LOSS OF DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF
+THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY
+TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SGI's NEGLIGENCE TO
+THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT
+ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
+THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO RECIPIENT.
+
+11. Indemnity. Recipient shall be solely responsible for damages arising,
+directly or indirectly, out of its utilization of rights under this License.
+Recipient will defend, indemnify and hold harmless Silicon Graphics, Inc. from
+and against any loss, liability, damages, costs or expenses (including the
+payment of reasonable attorneys fees) arising out of Recipient's use,
+modification, reproduction and distribution of the Subject Software or out of
+any representation or warranty made by Recipient.
+
+12. U.S. Government End Users. The Subject Software is a "commercial item"
+consisting of "commercial computer software" as such terms are defined in
+title 48 of the Code of Federal Regulations and all U.S. Government End Users
+acquire only the rights set forth in this License and are subject to the terms
+of this License.
+
+13. Miscellaneous. This License represents the complete agreement concerning
+subject matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed so as to achieve as nearly as
+possible the same economic effect as the original provision and the remainder
+of this License will remain in effect. This License shall be governed by and
+construed in accordance with the laws of the United States and the State of
+California as applied to agreements entered into and to be performed entirely
+within California between California residents. Any litigation relating to
+this License shall be subject to the exclusive jurisdiction of the Federal
+Courts of the Northern District of California (or, absent subject matter
+jurisdiction in such courts, the courts of the State of California), with
+venue lying exclusively in Santa Clara County, California, with the losing
+party responsible for costs, including without limitation, court costs and
+reasonable attorneys fees and expenses. The application of the United Nations
+Convention on Contracts for the International Sale of Goods is expressly
+excluded. Any law or regulation which provides that the language of a contract
+shall be construed against the drafter shall not apply to this License.
+
+Exhibit A
+
+The contents of this file are subject to Sections 2, 3, 4, 7, 8, 10, 12 and 13
+of the GLX Public License Version 1.0 (the "License"). You may not use this
+file except in compliance with those sections of the License. You may obtain a
+copy of the License at Silicon Graphics, Inc., attn: Legal Services, 2011 N.
+Shoreline Blvd., Mountain View, CA 94043 or at
+http://www.sgi.com/software/opensource/glx/license.html.
+
+Software distributed under the License is distributed on an "AS IS" basis. ALL
+WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON-
+INFRINGEMENT. See the License for the specific language governing rights and
+limitations under the License.
+
+The Original Software is GLX version 1.2 source code, released February, 1999.
+The developer of the Original Software is Silicon Graphics, Inc. Those
+portions of the Subject Software created by Silicon Graphics, Inc. are
+Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. 3.5. CID
+Font Code Public License
+
+CID FONT CODE PUBLIC LICENSE (Version 1.0 (3/31/99))("License")
+
+Subject to any applicable third party claims, Silicon Graphics, Inc. ("SGI")
+hereby grants permission to Recipient (defined below), under SGI's copyrights
+in the Original Software (defined below), to use, copy, modify, merge,
+publish, distribute, sublicense and/or sell copies of Subject Software
+(defined below) in both source code and executable form, and to permit persons
+to whom the Subject Software is furnished in accordance with this License to
+do the same, subject to all of the following terms and conditions, which
+Recipient accepts by engaging in any such use, copying, modifying, merging,
+publication, distributing, sublicensing or selling:
+
+1. Definitions.
+
+ a. "Original Software" means source code of computer software code that is
+ described in Exhibit A as Original Software.
+
+ b. "Modifications" means any addition to or deletion from the substance or
+ structure of either the Original Software or any previous Modifications.
+ When Subject Software is released as a series of files, a Modification
+ means (i) any addition to or deletion from the contents of a file
+ containing Original Software or previous Modifications and (ii) any new
+ file that contains any part of the Original Code or previous
+ Modifications.
+
+ c. "Subject Software" means the Original Software or Modifications or the
+ combination of the Original Software and Modifications, or portions of any
+ of the foregoing.
+
+ d. "Recipient" means an individual or a legal entity exercising rights
+ under the terms of this License. For legal entities, "Recipient" includes
+ any entity that controls, is controlled by, or is under common control
+ with Recipient. For purposes of this definition, "control" of an entity
+ means (i) the power, direct or indirect, to direct or manage such entity,
+ or (ii) ownership of fifty percent (50%) or more of the outstanding shares
+ or beneficial ownership of such entity.
+
+ e. "Required Notice" means the notice set forth in Exhibit A to this
+ License.
+
+ f. "Accompanying Technology" means any software or other technology that
+ is not a Modification and that is distributed or made publicly available
+ by Recipient with the Subject Software. Separate software files that do
+ not contain any Original Software or any previous Modification shall not
+ be deemed a Modification, even if such software files are aggregated as
+ part of a product, or in any medium of storage, with any file that does
+ contain Original Software or any previous Modification.
+
+2. License Terms. All distribution of the Subject Software must be made
+subject to the terms of this License. A copy of this License and the Required
+Notice must be included in any documentation for Subject Software where
+Recipient's rights relating to Subject Software and/or any Accompanying
+Technology are described. Distributions of Subject Software in source code
+form must also include the Required Notice in every file distributed. In
+addition, a ReadMe file entitled "Important Legal Notice" must be distributed
+with each distribution of one or more files that incorporate Subject Software.
+That file must be included with distributions made in both source code and
+executable form. A copy of the License and the Required Notice must be
+included in that file. Recipient may distribute Accompanying Technology under
+a license of Recipient's choice, which may contain terms different from this
+License, provided that (i) Recipient is in compliance with the terms of this
+License, (ii) such other license terms do not modify or supersede the terms of
+this License as applicable to the Subject Software, (iii) Recipient hereby
+indemnifies SGI for any liability incurred by SGI as a result of the
+distribution of Accompanying Technology or the use of other license terms.
+
+3. Termination. This License and the rights granted hereunder will terminate
+automatically if Recipient fails to comply with terms herein and fails to cure
+such breach within 30 days of the breach. Any sublicense to the Subject
+Software that is properly granted shall survive any termination of this
+License absent termination by the terms of such sublicense. Provisions which,
+by their nature, must remain in effect beyond the termination of this License
+shall survive.
+
+4. Trademark Rights. This License does not grant any rights to use any trade
+name, trademark or service mark whatsoever. No trade name, trademark or
+service mark of SGI may be used to endorse or promote products derived from or
+incorporating any Subject Software without prior written permission of SGI.
+
+5. No Other Rights. No rights or licenses not expressly granted hereunder
+shall arise by implication, estoppel or otherwise. Title to and ownership of
+the Original Software at all times remains with SGI. All rights in the
+Original Software not expressly granted under this License are reserved.
+
+6. Compliance with Laws; Non-Infringement. Recipient shall comply with all
+applicable laws and regulations in connection with use and distribution of the
+Subject Software, including but not limited to, all export and import control
+laws and regulations of the U.S. government and other countries. Recipient may
+not distribute Subject Software that (i) in any way infringes (directly or
+contributorily) the rights (including patent, copyright, trade secret,
+trademark or other intellectual property rights of any kind) of any other
+person or entity, or (ii) breaches any representation or warranty, express,
+implied or statutory, which under any applicable law it might be deemed to
+have been distributed.
+
+7. Claims of Infringement. If Recipient at any time has knowledge of any one
+or more third party claims that reproduction, modification, use, distribution,
+import or sale of Subject Software (including particular functionality or code
+incorporated in Subject Software) infringes the third party's intellectual
+property rights, Recipient must place in a well-identified web page bearing
+the title "LEGAL" a description of each such claim and a description of the
+party making each such claim in sufficient detail that a user of the Subject
+Software will know whom to contact regarding the claim. Also, upon gaining
+such knowledge of any such claim, Recipient must conspicuously include the URL
+for such web page in the Required Notice, and in the text of any related
+documentation, license agreement or collateral in which Recipient describes
+end user's rights relating to the Subject Software. If Recipient obtains such
+knowledge after it makes Subject Software available to any other person or
+entity, Recipient shall take other steps (such as notifying appropriate
+mailing lists or newsgroups) reasonably calculated to provide such knowledge
+to those who received the Subject Software.
+
+8. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS,
+MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. SGI ASSUMES NO
+RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
+PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY
+SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
+HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
+WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY),
+CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SUBJECT SOFTWARE OR
+THE USE OR OTHER DEALINGS IN THE SUBJECT SOFTWARE. SOME JURISDICTIONS DO NOT
+ALLOW THE EXCLUSION OR LIMITATION OF CERTAIN DAMAGES, SO THIS EXCLUSION AND
+LIMITATION MAY NOT APPLY TO RECIPIENT TO THE EXTENT SO DISALLOWED.
+
+10. Indemnity. Recipient shall be solely responsible for damages arising,
+directly or indirectly, out of its utilization of rights under this License.
+Recipient will defend, indemnify and hold SGI and its successors and assigns
+harmless from and against any loss, liability, damages, costs or expenses
+(including the payment of reasonable attorneys fees) arising out of
+(Recipient's use, modification, reproduction and distribution of the Subject
+Software or out of any representation or warranty made by Recipient.
+
+11. U.S. Government End Users. The Subject Software is a "commercial item"
+consisting of "commercial computer software" as such terms are defined in
+title 48 of the Code of Federal Regulations and all U.S. Government End Users
+acquire only the rights set forth in this License and are subject to the terms
+of this License.
+
+12. Miscellaneous. This License represents the complete agreement concerning
+subject matter hereof. If any provision of this License is held to be
+unenforceable by any judicial or administrative authority having proper
+jurisdiction with respect thereto, such provision shall be reformed so as to
+achieve as nearly as possible the same economic effect as the original
+provision and the remainder of this License will remain in effect. This
+License shall be governed by and construed in accordance with the laws of the
+United States and the State of California as applied to agreements entered
+into and to be performed entirely within California between California
+residents. Any litigation relating to this License shall be subject to the
+exclusive jurisdiction of the Federal Courts of the Northern District of
+California (or, absent subject matter jurisdiction in such courts, the courts
+of the State of California), with venue lying exclusively in Santa Clara
+County, California, with the losing party responsible for costs, including
+without limitation, court costs and reasonable attorneys fees and expenses.
+The application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or regulation that
+provides that the language of a contract shall be construed against the
+drafter shall not apply to this License.
+
+Exhibit A
+
+Copyright (c) 1994-1999 Silicon Graphics, Inc.
+
+The contents of this file are subject to the CID Font Code Public License
+Version 1.0 (the "License"). You may not use this file except in compliance
+with the License. You may obtain a copy of the License at Silicon Graphics,
+Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+or at http://www.sgi.com/software/opensource/cid/license.html
+
+Software distributed under the License is distributed on an "AS IS" basis. ALL
+WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
+NON-INFRINGEMENT. See the License for the specific language governing rights
+and limitations under the License.
+
+The Original Software (as defined in the License) is CID font code that was
+developed by Silicon Graphics, Inc. Those portions of the Subject Software (as
+defined in the License) that were created by Silicon Graphics, Inc. are
+Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
+
+[NOTE: When using this text in connection with Subject Software delivered
+solely in object code form, Recipient may replace the words "this file" with
+"this software" in both the first and second sentences.] 3.6. Bitstream Vera
+Fonts Copyright
+
+The fonts have a generous copyright, allowing derivative works (as long as
+"Bitstream" or "Vera" are not in the names), and full redistribution (so long
+as they are not *sold* by themselves). They can be be bundled, redistributed
+and sold with any software.
+
+The fonts are distributed under the following copyright:
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a
+trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the fonts accompanying this license ("Fonts") and associated documentation
+files (the "Font Software"), to reproduce and distribute the Font Software,
+including without limitation the rights to use, copy, merge, publish,
+distribute, and/or sell copies of the Font Software, and to permit persons to
+whom the Font Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright and trademark notices and this permission notice shall be
+included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular the
+designs of glyphs or characters in the Fonts may be modified and additional
+glyphs or characters may be added to the Fonts, only if the fonts are renamed
+to names not containing either the words "Bitstream" or the word "Vera".
+
+This License becomes null and void to the extent applicable to Fonts or Font
+Software that has been modified and is distributed under the "Bitstream Vera"
+names.
+
+The Font Software may be sold as part of a larger software package but no copy
+of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,
+SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO
+USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome Foundation,
+and Bitstream Inc., shall not be used in advertising or otherwise to promote
+the sale, use or other dealings in this Font Software without prior written
+authorization from the Gnome Foundation or Bitstream Inc., respectively. For
+further information, contact: fonts at gnome dot org. 3.7. Bigelow & Holmes
+Inc and URW++ GmbH Luxi font license
+
+Luxi fonts copyright (c) 2001 by Bigelow & Holmes Inc. Luxi font instruction
+code copyright (c) 2001 by URW++ GmbH. All Rights Reserved. Luxi is a
+registered trademark of Bigelow & Holmes Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of these Fonts and associated documentation files (the "Font Software"), to
+deal in the Font Software, including without limitation the rights to use,
+copy, merge, publish, distribute, sublicense, and/or sell copies of the Font
+Software, and to permit persons to whom the Font Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright and trademark notices and this permission notice shall be
+included in all copies of one or more of the Font Software.
+
+The Font Software may not be modified, altered, or added to, and in particular
+the designs of glyphs or characters in the Fonts may not be modified nor may
+additional glyphs or characters be added to the Fonts. This License becomes
+null and void when the Fonts or Font Software have been modified.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BIGELOW & HOLMES INC. OR URW++
+GMBH. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY
+GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
+INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT
+SOFTWARE.
+
+Except as contained in this notice, the names of Bigelow & Holmes Inc. and
+URW++ GmbH. shall not be used in advertising or otherwise to promote the sale,
+use or other dealings in this Font Software without prior written
+authorization from Bigelow & Holmes Inc. and URW++ GmbH.
+
+For further information, contact:
+
+info@urwpp.de or design@bigelowandholmes.com
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to zlib v1.2.3, which is included
+with JRE 7, JDK 7, and OpenJDK 7
+
+--- begin of LICENSE ---
+
+ version 1.2.3, July 18th, 2005
+
+ Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -93,686 +3159,23 @@ Copyright notice:
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
-If you use the zlib library in a product, we would appreciate *not*
-receiving lengthy legal documents to sign. The sources are provided
-for free but without warranty of any kind. The library has been
-entirely written by Jean-loup Gailly and Mark Adler; it does not
-include third-party code.
+--- end of LICENSE ---
-If you redistribute modified sources, we would appreciate that you include
-in the file ChangeLog history information documenting your changes.
+-------------------------------------------------------------------------------
-%% This notice is provided with respect to W3C (DTD for XML Signatures), which may be included with this software:
-W3C SOFTWARE NOTICE AND LICENSE
-Copyright 1994-2002 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/
-This W3C work (including software, documents, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions:
-Permission to use, copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications, that you make:
-1.The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
-2.Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, a short notice of the following form (hypertext is preferred, text is permitted) should be used within the body of any redistributed or derivative code: "Copyright [$date-of-software] World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/"
-3.Notice of any changes or modifications to the W3C files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
-THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
-COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
-The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
-____________________________________
-This formulation of W3C's notice and license became active on August 14 1998 so as to improve compatibility with GPL. This version ensures that W3C software licensing terms are no more restrictive than GPL and consequently W3C software may be distributed in GPL packages. See the older formulation for the policy prior to this date. Please see our Copyright FAQ for common questions about using materials from our site, including specific terms and conditions for packages like libwww, Amaya, and Jigsaw. Other questions about this notice can be directed to site-policy@w3.org.
-
-%% This notice is provided with respect to jscheme.jar, which may be included with this software:
-Software License Agreement
-Copyright 1998-2002 by Peter Norvig.
-Permission is granted to anyone to use this software, in source or object code form, on any computer system, and to modify, compile, decompile, run, and redistribute it to anyone else, subject to the following restrictions:
-1.The author makes no warranty of any kind, either expressed or implied, about the suitability of this software for any purpose.
-2.The author accepts no liability of any kind for damages or other consequences of the use of this software, even if they arise from defects in the software.
-3.The origin of this software must not be misrepresented, either by explicit claim or by omission.
-4.Altered versions must be plainly marked as such, and must not be misrepresented as being the original software. Altered versions may be distributed in packages under other licenses (such as the GNU license).
-If you find this software useful, it would be nice if you let me (peter@norvig.com) know about it, and nicer still if you send me modifications that you are willing to share. However, you are not required to do so.
+%% This notice is provided with respect to the following which is
+included with JRE 7, JDK 7, and OpenJDK 7, except where noted:
+ Apache Derby 10.8.1.2 [included with JDK 7 only]
+ Apache Jakarta BCEL 5.2
+ Apache Jakarta Regexp 1.4
+ Apache Santuario XMLSec-Java 1.4.2
+ Apache Xalan-Java 2.7.1
+ Apache Xerces2 Java 2.10.0
+ Apache XML Resolver 1.1
-%% This notice is provided with respect to PC/SC Lite for Suse Linux v. 1.1.1, which may be included with this software:
-Copyright (c) 1999-2004 David Corcoran
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-Changes to this license can be made only by the copyright author with
-explicit written consent.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-%% This notice is provided with respect to IAIK PKCS Wrapper, which may be included with this software:
-
-Copyright (c) 2002 Graz University of Technology. All rights reserved.
-Redistribution and use in source and binary forms, with or without modification,are permitted provided that the following conditions are met:
-
-
-1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment:
-
- "This product includes software developed by IAIK of Graz University of Technology."
-
- Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear.
-
-4. The names "Graz University of Technology" and "IAIK of Graz University of Technology" must not be used to endorse or promote products derived from this software without prior written permission.
-
-5. Products derived from this software may not be called "IAIK PKCS Wrapper", nor may "IAIK" appear in their name, without prior written permission of Graz University of Technology.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
-OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-%% This notice is provided with respect to Document Object Model (DOM) v. Level 3, which may be included with this software:
-
-W3Cýý SOFTWARE NOTICE AND LICENSE
-
-http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
-
-This work (and included software, documentation such as READMEs, or other related items) is being
-provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you
-(the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
-
-Permission to copy, modify, and distribute this software and its documentation, with or without modification, for
-any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies
-of the software and documentation or portions thereof, including modifications:
- 1.The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
- 2.Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the
- W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body
- of any redistributed or derivative code.
- 3.Notice of any changes or modifications to the files, including the date changes were made. (We
- recommend you provide URIs to the location from which the code is derived.)
-THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKENO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,
-WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THEUSE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS,COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
-
-COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL ORCONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
-The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the
-software without specific, written prior permission. Title to copyright in this software and any associated
-documentation will at all times remain with copyright holders.
-
-____________________________________
-
-This formulation of W3C's notice and license became active on December 31 2002. This version removes the
-copyright ownership notice such that this license can be used with materials other than those owned by the
-W3C, reflects that ERCIM is now a host of the W3C, includes references to this specific dated version of the
-license, and removes the ambiguous grant of "use". Otherwise, this version is the same as the previous
-version and is written so as to preserve the Free Software Foundation's assessment of GPL compatibility and
-OSI's certification under the Open Source Definition. Please see our Copyright FAQ for common questions
-about using materials from our site, including specific terms and conditions for packages like libwww, Amaya,
-and Jigsaw. Other questions about this notice can be directed to
-site-policy@w3.org.
-
-%% This notice is provided with respect to Xalan, Xerces, which may be included with this software:
-
-/*
- * The Apache Software License, Version 1.1
- *
- *
- * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer. *
- * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. *
- * 4. The names "Xerces" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ==================================================================== *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation and was
- * originally based on software copyright (c) 1999, International
- * Business Machines, Inc., http://www.ibm.com. For more
- * information on the Apache Software Foundation, please see
- *
-
-%% This notice is provided with respect to JavaScript, which may be included with this software:
-
-AMENDMENTS
-The Netscape Public License Version 1.1 ("NPL") consists of the Mozilla Public License Version 1.1 with the following Amendments, including Exhibit A-Netscape Public License. Files identified with "Exhibit A-Netscape Public License" are governed by the Netscape Public License Version 1.1.
-Additional Terms applicable to the Netscape Public License.
-I. Effect.
-These additional terms described in this Netscape Public License -- Amendments shall apply to the Mozilla Communicator client code and to all Covered Code under this License.
-II. ''Netscape's Branded Code'' means Covered Code that Netscape distributes and/or permits others to distribute under one or more trademark(s) which are controlled by Netscape but which are not licensed for use under this License.
-III. Netscape and logo.
-This License does not grant any rights to use the trademarks "Netscape'', the "Netscape N and horizon'' logo or the "Netscape lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript", "Smart Browsing" even if such marks are included in the Original Code or Modifications.
-IV. Inability to Comply Due to Contractual Obligation.
-Prior to licensing the Original Code under this License, Netscape has licensed third party code for use in Netscape's Branded Code. To the extent that Netscape is limited contractually from making such third party code available under this License, Netscape may choose to reintegrate such code into Covered Code without being required to distribute such code in Source Code form, even if such code would otherwise be considered ''Modifications'' under this License.
-V. Use of Modifications and Covered Code by Initial Developer.
-V.1. In General.
-The obligations of Section 3 apply to Netscape, except to the extent specified in this Amendment, Section V.2 and V.3.
-V.2. Other Products.
-Netscape may include Covered Code in products other than the Netscape's Branded Code which are released by Netscape during the two (2) years following the release date of the Original Code, without such additional products becoming subject to the terms of this License, and may license such additional products on different terms from those contained in this License.
-V.3. Alternative Licensing.
-Netscape may license the Source Code of Netscape's Branded Code, including Modifications incorporated therein, without such Netscape Branded Code becoming subject to the terms of this License, and may license such Netscape Branded Code on different terms from those contained in this License.
-
-VI. Litigation.
-Notwithstanding the limitations of Section 11 above, the provisions regarding litigation in Section 11(a), (b) and (c) of the License shall apply to all disputes relating to this License.
-
-EXHIBIT A-Netscape Public License.
-
-''The contents of this file are subject to the Netscape Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/NPL/
-Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
-The Original Code is Mozilla Communicator client code, released March 31, 1998.
-The Initial Developer of the Original Code is Netscape Communications Corporation. Portions created by Netscape are Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights Reserved.
-Contributor(s): ______________________________________.
-
-Alternatively, the contents of this file may be used under the terms of the _____ license (the "[___] License"), in which case the provisions of [______] License are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the [____] License and not to allow others to use your version of this file under the NPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the [___] License. If you do not delete the provisions above, a recipient may use your version of this file under either the NPL or the [___] License."
-
-MOZILLA PUBLIC LICENSE
-Version 1.1
-
-1. Definitions.
-1.0.1. "Commercial Use" means distribution or otherwise making the Covered Code available to a third party.
-1.1. ''Contributor'' means each entity that creates or contributes to the creation of Modifications.
-1.2. ''Contributor Version'' means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor.
-1.3. ''Covered Code'' means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof.
-1.4. ''Electronic Distribution Mechanism'' means a mechanism generally accepted in the software development community for the electronic transfer of data.
-1.5. ''Executable'' means Covered Code in any form other than Source Code.
-1.6. ''Initial Developer'' means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A.
-1.7. ''Larger Work'' means a work which combines Covered Code or portions thereof with code not governed by the terms of this License.
-1.8. ''License'' means this document.
-1.8.1. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.
-1.9. ''Modifications'' means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is:
-A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications.
-B. Any new file that contains any part of the Original Code or previous Modifications.
-
-1.10. ''Original Code'' means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License.
-1.10.1. "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.
-1.11. ''Source Code'' means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge.
-1.12. "You'' (or "Your") means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You'' includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control'' means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.
-2. Source Code License.
-2.1. The Initial Developer Grant.
-The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
-(a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and
-(b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof).
-
-(c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License.
-(d) Notwithstanding Section 2.1(b) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code; or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices.
-
-2.2. Contributor Grant.
-Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license
-
-(a) under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and
-(b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).
-(c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code.
-(d) Notwithstanding Section 2.2(b) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2) separate from the Contributor Version; 3) for infringements caused by: i) third party modifications of Contributor Version or ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor.
-
-3. Distribution Obligations.
-3.1. Application of License.
-The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5.
-3.2. Availability of Source Code.
-Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party.
-3.3. Description of Modifications.
-You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code.
-3.4. Intellectual Property Matters
-(a) Third Party Claims.
-If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL'' which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained.
-(b) Contributor APIs.
-If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the LEGAL file.
-
- (c) Representations.
-Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License.
-
-3.5. Required Notices.
-You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A. You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.
-3.6. Distribution of Executable Versions.
-You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.
-3.7. Larger Works.
-You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code.
-4. Inability to Comply Due to Statute or Regulation.
-If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it.
-5. Application of this License.
-This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code.
-6. Versions of the License.
-6.1. New Versions.
-Netscape Communications Corporation (''Netscape'') may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number.
-6.2. Effect of New Versions.
-Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Netscape. No one other than Netscape has the right to modify the terms applicable to Covered Code created under this License.
-6.3. Derivative Works.
-If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases ''Mozilla'', ''MOZILLAPL'', ''MOZPL'', ''Netscape'', "MPL", ''NPL'' or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the Mozilla Public License and Netscape Public License. (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.)
-7. DISCLAIMER OF WARRANTY.
-COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS'' BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
-8. TERMINATION.
-8.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.
-8.2. If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You file such action is referred to as "Participant") alleging that:
-(a) such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant. If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above.
-(b) any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant.
-8.3. If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license.
-8.4. In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination.
-9. LIMITATION OF LIABILITY.
-UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
-10. U.S. GOVERNMENT END USERS.
-The Covered Code is a ''commercial item,'' as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of ''commercial computer software'' and ''commercial computer software documentation,'' as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein.
-11. MISCELLANEOUS.
-This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License.
-12. RESPONSIBILITY FOR CLAIMS.
-As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.
-13. MULTIPLE-LICENSED CODE.
-Initial Developer may designate portions of the Covered Code as "Multiple-Licensed". "Multiple-Licensed" means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of the NPL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A.
-
-EXHIBIT A -Mozilla Public License.
-``The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
-http://www.mozilla.org/MPL/
-Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
-ANY KIND, either express or implied. See the License for the specific language governing rights and
-limitations under the License.
-The Original Code is ______________________________________.
-The Initial Developer of the Original Code is ________________________. Portions created by
-______________________ are Copyright (C) ______ _______________________. All Rights
-Reserved.
-Contributor(s): ______________________________________.
-Alternatively, the contents of this file may be used under the terms of the _____ license (the "[___] License"), in which case the provisions of [______] License are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the [____] License and not to allow others to use your version of this file under the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the [___] License. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the [___] License."
-[NOTE: The text of this Exhibit A may differ slightly from the text of the notices in the Source Code files of the Original Code. You should use the text of this Exhibit A rather than the text found in the Original Code Source Code for Your Modifications.]
-
-%% This notice is provided with respect to Mesa 3-D graphics library v. 5, which may be included with this software:
-
-Copyright (c) 2007 The Khronos Group Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and/or associated documentation files (the
-"Materials"), to deal in the Materials without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Materials, and to
-permit persons to whom the Materials are furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Materials.
-
-THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-
-%% This notice is provided with respect to Byte Code Engineering Library (BCEL), which may be included with this software:
-
- Apache Software License
-
- /*
-==================================================================== * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. Allrights
- * reserved.
- *
- * Redistribution and use in source and binary forms, withor without
- * modification, are permitted provided that the followingconditions
- * are met:
- *
- * 1. Redistributions of source code must retain the abovecopyright
- * notice, this list of conditions and the followingdisclaimer.
- *
- * 2. Redistributions in binary form must reproduce theabove copyright
- * notice, this list of conditions and the followingdisclaimer in
- * the documentation and/or other materials providedwith the
- * distribution.
- *
- * 3. The end-user documentation included with theredistribution,
- * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation
-(http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in thesoftware itself,
- * if and wherever such third-party acknowledgmentsnormally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation"and
- * "Apache BCEL" must not be used to endorse or promoteproducts
- * derived from this software without prior writtenpermission. For
- * written permission, please contact apache@apache.org. *
- * 5. Products derived from this software may not be called"Apache",
- * "Apache BCEL", nor may "Apache" appear in their name,without
- * prior written permission of the Apache SoftwareFoundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED ORIMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSEARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWAREFOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVERCAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICTLIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING INANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
- * SUCH DAMAGE.
- *
-==================================================================== *
- * This software consists of voluntary contributions madeby many
- * individuals on behalf of the Apache Software
-Foundation. For more
- * information on the Apache Software Foundation, pleasesee
- * .
- */
-
-%% This notice is provided with respect to Regexp, Regular Expression Package, which may be included with this software:
-
-The Apache Software License, Version 1.1
-Copyright (c) 2001 The Apache Software Foundation. All rights
-reserved.
-Redistribution and use in source and binary forms, with or without modification,are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in
-the documentation and/or other materials provided with the
-distribution.
-
-3. The end-user documentation included with the redistribution,
-if any, must include the following acknowledgment:
-"This product includes software developed by the
-Apache Software Foundation (http://www.apache.org/)."
-Alternately, this acknowledgment may appear in the software itself,
-if and wherever such third-party acknowledgments normally appear.
-
-4. The names "Apache" and "Apache Software Foundation" and
-"Apache Turbine" must not be used to endorse or promote products
-derived from this software without prior written permission. For
-written permission, please contact apache@apache.org.
-
-5. Products derived from this software may not be called "Apache",
-"Apache Turbine", nor may "Apache" appear in their name, without
-prior written permission of the Apache Software Foundation.
-
-THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
-ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-====================================================================
-This software consists of voluntary contributions made by many
-individuals on behalf of the Apache Software Foundation. For more
-information on the Apache Software Foundation, please see
-
-http://www.apache.org.
-
-%% This notice is provided with respect to CUP Parser Generator for Java, which may be included with this software:
-
-CUP Parser Generator Copyright Notice, License, and Disclaimer
-
-Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted, provided thatthe above copyright notice appear in all copies and that both the copyrightnotice and this permission notice and warranty disclaimer appear in
-supporting documentation, and that the names of the authors or their employersnot be used in advertising or publicity pertaining to distribution of
-the software without specific, written prior permission.
-
-The authors and their employers disclaim all warranties with regard to thissoftware, including all implied warranties of merchantability and
-fitness. In no event shall the authors or their employers be liable for anyspecial, indirect or consequential damages or any damages whatsoever
-resulting from loss of use, data or profits, whether in an action of contract,negligence or other tortious action, arising out of or in connection withthe use or performance of this software.
-
-%% This notice is provided with respect to SAX v. 2.0.1, which may be included with this software:
-
-Copyright Status
-
- SAX is free!
-
- In fact, it's not possible to own a license to SAX, since it's been placed in the public
- domain.
-
- No Warranty
-
- Because SAX is released to the public domain, there is no warranty for the design or for
- the software implementation, to the extent permitted by applicable law. Except when
- otherwise stated in writing the copyright holders and/or other parties provide SAX "as is"
- without warranty of any kind, either expressed or implied, including, but not limited to, the
- implied warranties of merchantability and fitness for a particular purpose. The entire risk as
- to the quality and performance of SAX is with you. Should SAX prove defective, you
- assume the cost of all necessary servicing, repair or correction.
-
- In no event unless required by applicable law or agreed to in writing will any copyright
- holder, or any other party who may modify and/or redistribute SAX, be liable to you for
- damages, including any general, special, incidental or consequential damages arising out of
- the use or inability to use SAX (including but not limited to loss of data or data being
- rendered inaccurate or losses sustained by you or third parties or a failure of the SAX to
- operate with any other programs), even if such holder or other party has been advised of
- the possibility of such damages.
-
- Copyright Disclaimers
-
- This page includes statements to that effect by David Megginson, who would have been
- able to claim copyright for the original work.
- SAX 1.0
-
- Version 1.0 of the Simple API for XML (SAX), created collectively by the membership of
- the XML-DEV mailing list, is hereby released into the public domain.
-
- No one owns SAX: you may use it freely in both commercial and non-commercial
- applications, bundle it with your software distribution, include it on a CD-ROM, list the
- source code in a book, mirror the documentation at your own web site, or use it in any
- other way you see fit.
-
- David Megginson, sax@megginson.com
- 1998-05-11
-
- SAX 2.0
-
- I hereby abandon any property rights to SAX 2.0 (the Simple API for XML), and release
- all of the SAX 2.0 source code, compiled code, and documentation contained in this
- distribution into the Public Domain. SAX comes with NO WARRANTY or guarantee of
- fitness for any purpose.
-
- David Megginson, david@megginson.com
- 2000-05-05
-
-%% This notice is provided with respect to Cryptix, which may be included with this software:
-
-Cryptix General License
-
-Copyright © 1995-2003 The Cryptix Foundation Limited. All rights reserved.
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions aremet:
-
- 1.Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer. 2.Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS ORIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FORA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CRYPTIX FOUNDATION LIMITED OR CONTRIBUTORS BELIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOTLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESSINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OFTHE POSSIBILITY OF SUCH DAMAGE.
-
-%% This notice is provided with respect to X Window System, which may be included with this software:
-
-Copyright The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and itsdocumentation for any purpose is hereby granted without fee, provided that theabove copyright notice appear in all copies and that both that copyright noticeand this permission notice appear in supporting documentation.
-
-The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESSFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUPBE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OFCONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THESOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group.
-
-Portions also covered by other licenses as noted in the above URL.
-
-%% This notice is provided with respect to Retroweaver, which may be included with this software:
-
-Copyright (c) February 2004, Toby Reyelts
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-Neither the name of Toby Reyelts nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICTLIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-%% This notice is provided with respect to stripper, which may be included with this software:
-
-Stripper : debug information stripper
- Copyright (c) 2003 Kohsuke Kawaguchi
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-%% This notice is provided with respect to libpng official PNG reference library, which may be included with this software:
-
-This copy of the libpng notices is provided for your convenience. In case ofany discrepancy between this copy and the notices in the file png.h that isincluded in the libpng distribution, the latter shall prevail.
-
-COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
-
-If you modify libpng you may insert additional notices immediately followingthis sentence.
-
-libpng version 1.2.6, December 3, 2004, is
-Copyright (c) 2004 Glenn Randers-Pehrson, and is
-distributed according to the same disclaimer and license as libpng-1.2.5with the following individual added to the list of Contributing Authors
- Cosmin Truta
-
-libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, areCopyright (c) 2000-2002 Glenn Randers-Pehrson, and are
-distributed according to the same disclaimer and license as libpng-1.0.6with the following individuals added to the list of Contributing Authors
- Simon-Pierre Cadieux
- Eric S. Raymond
- Gilles Vollant
-
-and with the following additions to the disclaimer:
-
- There is no warranty against interference with your enjoyment of the library or against infringement. There is no warranty that our
- efforts or the library will fulfill any of your particular purposes or needs. This library is provided with all faults, and the entire risk of satisfactory quality, performance, accuracy, and effort is with the user.
-
-libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, areCopyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
-distributed according to the same disclaimer and license as libpng-0.96,with the following individuals added to the list of Contributing Authors:
- Tom Lane
- Glenn Randers-Pehrson
- Willem van Schaik
-
-libpng versions 0.89, June 1996, through 0.96, May 1997, are
-Copyright (c) 1996, 1997 Andreas Dilger
-Distributed according to the same disclaimer and license as libpng-0.88,with the following individuals added to the list of Contributing Authors:
- John Bowler
- Kevin Bracey
- Sam Bushell
- Magnus Holmgren
- Greg Roelofs
- Tom Tanner
-
-libpng versions 0.5, May 1995, through 0.88, January 1996, are
-Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-
-For the purposes of this copyright and license, "Contributing Authors"is defined as the following set of individuals:
-
- Andreas Dilger
- Dave Martindale
- Guy Eric Schalnat
- Paul Schmidt
- Tim Wegner
-
-The PNG Reference Library is supplied "AS IS". The Contributing Authorsand Group 42, Inc. disclaim all warranties, expressed or implied,
-including, without limitation, the warranties of merchantability and offitness for any purpose. The Contributing Authors and Group 42, Inc.
-assume no liability for direct, indirect, incidental, special, exemplary,or consequential damages, which may result from the use of the PNG
-Reference Library, even if advised of the possibility of such damage.
-
-Permission is hereby granted to use, copy, modify, and distribute thissource code, or portions hereof, for any purpose, without fee, subjectto the following restrictions:
-
-1. The origin of this source code must not be misrepresented.
-
-2. Altered versions must be plainly marked as such and must not
- be misrepresented as being the original source.
-
-3. This Copyright notice may not be removed or altered from any
- source or altered source distribution.
-
-The Contributing Authors and Group 42, Inc. specifically permit, withoutfee, and encourage the use of this source code as a component to
-supporting the PNG file format in commercial products. If you use thissource code in a product, acknowledgment is not required but would be
-appreciated.
-
-
-A "png_get_copyright" function is available, for convenient use in "about"boxes and the like:
-
- printf("%s",png_get_copyright(NULL));
-
-Also, the PNG logo (in PNG format, of course) is supplied in the
-files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
-
-Libpng is OSI Certified Open Source Software. OSI Certified Open Source is acertification mark of the Open Source Initiative.
-
-Glenn Randers-Pehrson
-glennrp at users.sourceforge.net
-December 3, 2004
-
-%% This notice is provided with respect to Libungif - An uncompressed GIF library, which may be included with this software:
-
-The GIFLIB distribution is Copyright (c) 1997 Eric S. Raymond
-
-Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.
-
-%% This notice is provided with respect to XML Resolver library, Xalan J2, and StAX API, which may be included with this software:
+--- begin of LICENSE ---
Apache License
Version 2.0, January 2004
@@ -782,17 +3185,26 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIE
1. Definitions.
- "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
- "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
- "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition,
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
- "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
@@ -800,25 +3212,56 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIE
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
- "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
- "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
- 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
@@ -830,7 +3273,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIE
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
- (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
@@ -839,35 +3283,74 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIE
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
- You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
- 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
- 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
- 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify,
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
@@ -878,7 +3361,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIE
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
@@ -889,728 +3373,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIE
http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
-%% Some Portions licensed from IBM are available at:
-http://www.ibm.com/software/globalization/icu/
+--- end of LICENSE ---
-%% This notice is provided with respect to ICU4J, ICU 1.8.1 and later, which may be included with this software:
+-------------------------------------------------------------------------------
-ICU License - ICU 1.8.1 and later COPYRIGHT AND PERMISSION NOTICE Cop
-yright (c)
-1995-2003 International Business Machines Corporation and others All rightsreserved. Permission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the "Software"), todeal in the Software without restriction, including without limitation therights to use, copy, modify, merge, publish, distribute, and/or sell copies ofthe Software, and to permit persons to whom the Software is furnished to do so,provided that the above copyright notice(s) and this permission notice appear inall copies of the Software and that both the above copyright notice(s) and thispermission notice appear in supporting documentation. THE SOFTWARE IS PROVIDED"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOTLIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSEAND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHTHOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY C
- LAIM, OR ANYSPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTINGFROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCEOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE ORPERFORMANCE OF THIS SOFTWARE. Except as contained in this notice, the name of acopyright holder shall not be used in advertising or otherwise to promote thesale, use or other dealings in this Software without prior written authorizationof the copyright holder.
-
-%% This notice is provided with respect to Jing, which may be included with this software:
-
-Jing Copying Conditions
-
-Copyright (c) 2001-2003 Thai Open Source Software Center Ltd
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentation and/orother materials provided with the distribution.
- * Neither the name of the Thai Open Source Software Center Ltd nor the namesof its contributors may be used to endorse or promote products derived from thissoftware without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ANDANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AREDISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ONANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THISSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-%% This notice is provided with respect to RELAX NG Object Model/Parser, which may be included with this software:
-
-
-The MIT License
-
-Copyright (c)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy ofthis software and associated documentation files (the "Software"), to deal inthe Software without restriction, including without limitation the rights touse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies ofthe Software, and to permit persons to whom the Software is furnished to do so,subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESSFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS ORCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHERIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR INCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-%% This notice is provided with respect to XFree86-VidMode Extension, which may be included with this software:
-
-Version 1.1 of XFree86 ProjectLicence.
-
- Copyright (C) 1994-2004 The XFree86 Project, Inc. All rights reserved.
-
- Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to deal inthe Software without restriction, including without limitation the rights touse, copy, modify, merge, publish, distribute, sublicence, and/or sell copies ofthe Software, and to permit persons to whom the Software is furnished to do so,subject to the following conditions:
-
- 1. Redistributions of source code must retain the above copyright notice,this list of conditions, and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyrightnotice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution, and in thesame place and form as other copyright, license and disclaimer information. 3. The end-user documentation included with the redistribution, if any,must include the following acknowledgment: "This product includes softwaredeveloped by The XFree86 Project, Inc (http://www.xfree86.org/) and itscontributors", in the same place and form as other third-party acknowledgments.Alternately, this acknowledgment may appear in the software itself, in the sameform and location as other such third-party acknowledgments.
- 4. Except as contained in this notice, the name of The XFree86 Project,Inc shall not be used in advertising or otherwise to promote the sale, use orother dealings in this Software without prior written authorization from TheXFree86 Project, Inc.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY ANDFITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE XFREE86PROJECT, INC OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; ORBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER INCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISINGIN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITYOF SUCH DAMAGE.
-
-%% This notice is provided with respect to XML Security, which may be included with this software:
-
- The Apache Software License,
- Version 1.1
-
-
- PDF
-
-
- Copyright (C) 2002 The Apache SoftwareFoundation.
- All rights reserved. Redistribution anduse in
- source and binary forms, with or withoutmodifica-
- tion, are permitted provided that thefollowing
- conditions are met: 1. Redistributions ofsource
- code must retain the above copyrightnotice, this
- list of conditions and the followingdisclaimer.
- 2. Redistributions in binary form mustreproduce
- the above copyright notice, this list of conditions and the following disclaimerin the
- documentation and/or other materialsprovided with
- the distribution. 3. The end-userdocumentation
- included with the redistribution, if any,must
- include the following acknowledgment:"This
- product includes software developed bythe Apache
- Software Foundation
-(http://www.apache.org/)."
- Alternately, this acknowledgment mayappear in the
- software itself, if and wherever suchthird-party
- acknowledgments normally appear. 4. Thenames
- "Apache Forrest" and "Apache SoftwareFoundation"
- must not be used to endorse or promoteproducts
- derived from this software without priorwritten
- permission. For written permission,please contact
- apache@apache.org. 5. Products derivedfrom this
- software may not be called "Apache", normay
- "Apache" appear in their name, withoutprior
- written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED``AS IS''
- AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESSFOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NOEVENT
- SHALL THE APACHE SOFTWARE FOUNDATION ORITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, ORCONSEQUENTIAL
- DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ORSERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANYTHEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICTLIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OROTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
- SUCH DAMAGE. This software consists ofvoluntary
- contributions made by many individuals onbehalf
- of the Apache Software Foundation. Formore
- information on the Apache SoftwareFoundation,
- please see .
-
-%% This notice is provided with respect to Independent JPEG Group's software (libjpeg), which may be included with this software:
-
-In plain English:
-
-1. We don't promise that this software works. (But if you find any bugs,
- please let us know!)
-2. You can use this software for whatever you want. You don't have to pay us.
-3. You may not pretend that you wrote this software. If you use it in a program, you must acknowledge somewhere in your documentation that you've used the IJG code.
-
-In legalese:
-
-The authors make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy.
-
-This software is copyright (C) 1991-1998, Thomas G. Lane.
-All Rights Reserved except as specified below.
-
-Permission is hereby granted to use, copy, modify, and distribute this software (or portions thereof) for any purpose, without fee, subject to these conditions:
-
-(1) If any part of the source code for this software is distributed, then this
-README file must be included, with this copyright and no-warranty notice unaltered; and any additions, deletions, or changes to the original files must be clearly indicated in accompanying documentation.
-
-(2) If only executable code is distributed, then the accompanying documentation must state that "this software is based in part on the work of the Independent JPEG Group".
-
-(3) Permission for use of this software is granted only if the user accepts full responsibility for any undesirable consequences; the authors accept NO LIABILITY for damages of any kind.
-
-These conditions apply to any software derived from or based on the IJG code, not just to the unmodified library. If you use our work, you ought to acknowledge us.
-
-Permission is NOT granted for the use of any IJG author's name or company name in advertising or publicity relating to this software or products derived from it. This software may be referred to only as "the Independent JPEG Group's software".
-
-We specifically permit and encourage the use of this software as the basis of commercial products, provided that all warranty or liability claims are assumed by the product vendor.
-
-ansi2knr.c is included in this distribution by permission of L. Peter Deutsch, sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA. ansi2knr.c is NOT covered by the above copyright and conditions, but instead by the usual distribution terms of the Free Software Foundation; principally, that you must include source code if you redistribute it. (See the file ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part of any program generated from the IJG code, this does not limit you more than the foregoing paragraphs do.
-
-The Unix configuration script "configure" was produced with GNU Autoconf. It is copyright by the Free Software Foundation but is freely distributable. The same holds for its supporting scripts (config.guess, config.sub, ltconfig, ltmain.sh). Another support script, install-sh, is copyright by M.I.T. but is also freely distributable.
-
-It appears that the arithmetic coding option of the JPEG spec is covered by patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot legally be used without obtaining one or more licenses. For this reason, support for arithmetic coding has been removed from the free JPEG software. (Since arithmetic coding provides only a marginal gain over the unpatented Huffman mode, it is unlikely that very many implementations will support it.) So far as we are aware, there are no patent restrictions on the remaining code.
-
-The IJG distribution formerly included code to read and write GIF files. To avoid entanglement with the Unisys LZW patent, GIF reading support has been removed altogether, and the GIF writer has been simplified to produce "uncompressed GIFs". This technique does not use the LZW algorithm; the resulting GIF files are larger than usual, but are readable by all standard GIF decoders.
-
-We are required to state that
- "The Graphics Interchange Format(c) is the Copyright property of
- CompuServe Incorporated. GIF(sm) is a Service Mark property of
- CompuServe Incorporated."
-
-%% This notice is provided with respect to X Resize and Rotate (Xrandr) Extension, which may be included with this software:
-2. XFree86 License
-
-XFree86 code without an explicit copyright is covered by the following
-copyright/license:
-
-Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86
-PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the XFree86 Project shall not be
-used in advertising or otherwise to promote the sale, use or other dealings in
-this Software without prior written authorization from the XFree86 Project.
-
-%% This notice is provided with respect to fontconfig, which may be included with this software:
-Id: COPYING,v 1.3 2003/04/04 20:17:40 keithp Exp $
-Copyright 2001,2003 Keith Packard
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation, and that the name of Keith Packard not be used in
-advertising or publicity pertaining to distribution of the software without
-specific, written prior permission. Keith Packard makes no
-representations about the suitability of this software for any purpose. It
-is provided "as is" without express or implied warranty.
-
-KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-%% This notice is provided with respect to XFree86, which may be included with this software:
-Copyright (C) 1994-2002 The XFree86 Project, Inc. All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated
-documentation files (the "Software"), to deal in the Software without
-restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to the
-following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT
-NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the XFree86 Project shall not be
-used in advertising or otherwise
-to promote the sale, use or other dealings in this Software without prior
-written authorization from the XFree86
-Project.
-%% This notice is provided with respect to Fast Infoset, which may be included with this software:
-* Fast Infoset ver. 0.1 software ("Software")
-*
-* Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
-*
-* Software is licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License. You may
-* obtain a copy of the License at:
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations.
-*
-* Oracle supports and benefits from the global community of open source
-* developers, and thanks the community for its important contributions and
-* open standards-based technology, which Oracle has adopted into many of its
-* products.
-*
-* Please note that portions of Software may be provided with notices and
-* open source licenses from such communities and third parties that govern the
-* use of those portions, and any licenses granted hereunder do not alter any
-* rights and obligations you may have under such open source licenses,
-* however, the disclaimer of warranty and limitation of liability provisions
-* in this License will apply to all Software in this distribution.
-*
-* You acknowledge that the Software is not designed, licensed or intended
-* for use in the design, construction, operation or maintenance of any nuclear
-* facility.
-*
-* Apache License
-* Version 2.0, January 2004
-* http://www.apache.org/licenses/
-*
-*/
-/*
-* ====================================================================
-*
-* This code is subject to the freebxml License, Version 1.1
-*
-* Copyright (c) 2001 - 2005 freebxml.org. All rights reserved.
-*
-* $Header: /cvs/fi/FastInfoset/src/com/sun/xml/internal/fastinfoset/AbstractResourceBundle.java,v 1.2
-* ====================================================================
-*/
-%% This notice is provided with respect to Kerberos, which may be included with this software:
-
-/*
- * Copyright (C) 1998 by the FundsXpress, INC.
- *
- * All rights reserved.
- *
- * Export of this software from the United States of America may require
- * a specific license from the United States Government. It is the
- * responsibility of any person or organization contemplating export to
- * obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
- * distribute this software and its documentation for any purpose and
- * without fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of FundsXpress. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. FundsXpress makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-%% This notice is provided with respect to Unicode's CLDR data repository, which may be included with this software:
-
- Unicode Copyright
-
- For the general privacy policy governing access to this site, see the
-Unicode Privacy Policy. For trademark usage, see the the Unicode Consortium
-Trademarks and Logo Policy.
- Notice to End User: Terms of Use
- Carefully read the following legal agreement ("Agreement"). Use or copying
-of the software and/or codes provided with this agreement (The "Software")
-constitutes your acceptance of these terms
-
- 1. Unicode Copyright.
- 1. Copyright 1991-2005 Unicode, Inc. All rights reserved.
- 2. Certain documents and files on this website contain a legend
-indicating that "Modification is permitted." Any person is hereby authorized,
-without fee, to modify such documents and files to create derivative works
-conforming to the Unicode Standard, subject to Terms and Conditions herein.
- 3. Any person is hereby authorized, without fee, to view, use,
-reproduce, and distribute all documents and files solely for informational
-purposes in the creation of products supporting the Unicode Standard, subject to
-the Terms and Conditions herein.
- 4. Further specifications of rights and restrictions pertaining to
-the use of the particular set of data files known as the "Unicode Character
-Database" can be found in Exhibit 1.
- 5. Further specifications of rights and restrictions pertaining to
-the use of the particular set of files that constitute the online edition of The
-Unicode Standard, Version 4.0, may be found in V4.0 online edition.
- 6. No license is granted to "mirror" the Unicode website where a
-fee is charged for access to the "mirror" site.
- 7. Modification is not permitted with respect to this document. All
-copies of this document must be verbatim.
- 2. Restricted Rights Legend. Any technical data or software which is
-licensed to the United States of America, its agencies and/or instrumentalities
-under this Agreement is commercial technical data or commercial computer
-software developed exclusively at private expense as defined in FAR 2.101, or
-DFARS 252.227-7014 (June 1995), as applicable. For technical data, use,
-duplication, or disclosure by the Government is subject to restrictions as set
-forth in DFARS 202.227-7015 Technical Data, Commercial and Items (Nov 1995) and
-this Agreement. For Software, in accordance with FAR 12-212 or DFARS 227-7202,
-as applicable, use, duplication or disclosure by the Government is subject to
-the restrictions set forth in this Agreement.
- 3. Warranties and Disclaimers.
- 1. This publication and/or website may include technical or
-typographical errors or other inaccuracies . Changes are periodically added to
-the information herein; these changes will be incorporated in new editions of
-the publication and/or website. Unicode may make improvements and/or changes in
-the product(s) and/or program(s) described in this publication and/or website at
-any time.
- 2. If this file has been purchased on magnetic or optical media
-from Unicode, Inc. the sole and exclusive remedy for any claim will be exchange
-of the defective media within ninety (90) days of original purchase.
- 3. EXCEPT AS PROVIDED IN SECTION C.2, THIS PUBLICATION AND/OR
-SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS,
-IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UNICODE
-AND ITS LICENSORS ASSUME NO RESPONSIBILITY FOR ERRORS OR OMISSIONS IN THIS
-PUBLICATION AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH ARE REFERENCED BY OR LINKED
-TO THIS PUBLICATION OR THE UNICODE WEBSITE.
- 4. Waiver of Damages. In no event shall Unicode or its licensors be
-liable for any special, incidental, indirect or consequential damages of any
-kind, or any damages whatsoever, whether or not Unicode was advised of the
-possibility of the damage, including, without limitation, those resulting from
-the following: loss of use, data or profits, in connection with the use,
-modification or distribution of this information or its derivatives.
- 5. Trademarks.
- 1. Unicode and the Unicode logo are registered trademarks of
-Unicode, Inc.
- 2. This site contains product names and corporate names of other
-companies. All product names and company names and logos mentioned herein are
-the trademarks or registered trademarks of their respective owners. Other
-products and corporate names mentioned herein which are trademarks of a third
-party are used only for explanation and for the owners' benefit and with no
-intent to infringe.
- 3. Use of third party products or information referred to herein is
-at the user's risk.
- 6. Miscellaneous.
- 1. Jurisdiction and Venue. This server is operated from a location
-in the State of California, United States of America. Unicode makes no
-representation that the materials are appropriate for use in other locations. If
-you access this server from other locations, you are responsible for compliance
-with local laws. This Agreement, all use of this site and any claims and damages
-resulting from use of this site are governed solely by the laws of the State of
-California without regard to any principles which would apply the laws of a
-different jurisdiction. The user agrees that any disputes regarding this site
-shall be resolved solely in the courts located in Santa Clara County,
-California. The user agrees said courts have personal jurisdiction and agree to
-waive any right to transfer the dispute to any other forum.
- 2. Modification by Unicode Unicode shall have the right to modify
-this Agreement at any time by posting it to this site. The user may not assign
-any part of this Agreement without Unicode's prior written consent.
- 3. Taxes. The user agrees to pay any taxes arising from access to
-this website or use of the information herein, except for those based on
-Unicode's net income.
- 4. Severability. If any provision of this Agreement is declared
-invalid or unenforceable, the remaining provisions of this Agreement shall
-remain in effect.
- 5. Entire Agreement. This Agreement constitutes the entire
-agreement between the parties.
-
-EXHIBIT 1
-UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
-
- Unicode Data Files include all data files under the directories
-http://www.unicode.org/Public/ and http://www.unicode.org/reports/. Unicode
-Software includes any source code under the directories
-http://www.unicode.org/Public/ and http://www.unicode.org/reports/.
-
- NOTICE TO USER: Carefully read the following legal agreement. BY
-DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES
-("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND
-AGREE TO BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU
-DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES
-OR SOFTWARE.
-
- COPYRIGHT AND PERMISSION NOTICE
-
- Copyright ?,,© 1991-2004 Unicode, Inc. All rights reserved. Distributed under
-the Terms of Use in http://www.unicode.org/copyright.html.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
-of the Unicode data files and associated documentation (the "Data Files") or
-Unicode software and associated documentation (the "Software") to deal in the
-Data Files or Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, and/or sell copies of
-the Data Files or Software, and to permit persons to whom the Data Files or
-Software are furnished to do so, provided that (a) the above copyright notice(s)
-and this permission notice appear with all copies of the Data Files or Software,
-(b) both the above copyright notice(s) and this permission notice appear in
-associated documentation, and (c) there is clear notice in each modified Data
-File or in the Software as well as in the documentation associated with the Data
-File(s) or Software that the data or software has been modified.
-
- THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD
-PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
-NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
-DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
-OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR SOFTWARE.
-
- Except as contained in this notice, the name of a copyright holder shall not
-be used in advertising or otherwise to promote the sale, use or other dealings
-in these Data Files or Software without prior written authorization of the
-copyright holder.
-
- Unicode and the Unicode logo are trademarks of Unicode, Inc., and may be
-registered in some jurisdictions. All other trademarks and registered trademarks
-mentioned herein are the property of their respective owners.
-%% This notice is provided with respect to RSA PKCS#11 Header Files & Specification, which may be included with this software:
-
-/*
- * Copyright (C) 1998 by the FundsXpress, INC.
- *
- * All rights reserved.
- *
- * Export of this software from the United States of America may require
- * a specific license from the United States Government. It is the
- * responsibility of any person or organization contemplating export to
- * obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
- * distribute this software and its documentation for any purpose and
- * without fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of FundsXpress. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. FundsXpress makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-%% This notice is provided with respect to certain files/code which may included in the implementation of AWT within the software:
-
-******************************************************
-BEGIN src/solaris/native/sun/awt/HPkeysym.h
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
-
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Hewlett Packard
-or Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
-TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. Hewlett-Packard shall not be liable for errors
-contained herein or direct, indirect, special, incidental or
-consequential damages in connection with the furnishing,
-performance, or use of this material.
-
-END src/solaris/native/sun/awt/HPkeysym.h
-******************************************************
-******************************************************
-BEGIN src/solaris/native/sun/awt/Xrandr.h
-/*
-* $XFree86: xc/lib/Xrandr/Xrandr.h,v 1.9 2002/09/29 23:39:44 keithp Exp $
-*
-* Copyright 2000 Compaq Computer Corporation, Inc.
-* Copyright 2002 Hewlett-Packard Company, Inc.
-*
-* Permission to use, copy, modify, distribute, and sell this software and its
-* documentation for any purpose is hereby granted without fee, provided that
-* the above copyright notice appear in all copies and that both that
-* copyright notice and this permission notice appear in supporting
-* documentation, and that the name of Compaq not be used in advertising or
-* publicity pertaining to distribution of the software without specific,
-* written prior permission. HP makes no representations about the
-* suitability of this software for any purpose. It is provided "as is"
-* without express or implied warranty.
-*
-* HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ
-* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
-* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*
-* Author: Jim Gettys, HP Labs, HP.
-*/
-
-
-END src/solaris/native/sun/awt/Xrandr.h
-******************************************************
-BEGIN src/solaris/native/sun/awt/extutil.h
-/*
-* $Xorg: extutil.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $
-*
-Copyright 1989, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-*
-* Author: Jim Fulton, MIT The Open Group
-*
-* Xlib Extension-Writing Utilities
-*
-* This package contains utilities for writing the client API for various
-* protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND
-* ARE SUBJECT TO CHANGE!
-*/
-/* $XFree86: xc/include/extensions/extutil.h,v 1.5 2001/01/17 17:53:20 dawes Exp $ */
-
-END src/solaris/native/sun/awt/extutil.h
-******************************************************
-BEGIN src/solaris/native/sun/awt/fontconfig.h
-/*
-* $RCSId: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.30 2002/09/26 00:17:27
-keithp Exp $
-*
-* Copyright 2001 Keith Packard
-*
-* Permission to use, copy, modify, distribute, and sell this software and its
-* documentation for any purpose is hereby granted without fee, provided that
-* the above copyright notice appear in all copies and that both that
-* copyright notice and this permission notice appear in supporting
-* documentation, and that the name of Keith Packard not be used in
-* advertising or publicity pertaining to distribution of the software without
-* specific, written prior permission. Keith Packard makes no
-* representations about the suitability of this software for any purpose. It
-* is provided "as is" without express or implied warranty.
-*
-* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-* PERFORMANCE OF THIS SOFTWARE.
-
-END src/solaris/native/sun/awt/fontconfig.h
-******************************************************
-BEGIN src/solaris/native/sun/awt/list.c
-AND src/solaris/native/sun/awt/list.h
-AND src/solaris/native/sun/awt/multiVis.c
-AND src/solaris/native/sun/awt/multiVis.h
-AND src/solaris/native/sun/awt/wsutils.h
-
-Copyright (c) 1994 Hewlett-Packard Co.
-Copyright (c) 1996 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from the X Consortium.
-
-END src/solaris/native/sun/awt/list.c
-AND src/solaris/native/sun/awt/list.h
-AND src/solaris/native/sun/awt/multiVis.c
-AND src/solaris/native/sun/awt/multiVis.h
-AND src/solaris/native/sun/awt/wsutils.h
-
-*****************************************************************
-BEGIN src/solaris/native/sun/awt/randr.h
-
-*
-* Copyright 2000, Compaq Computer Corporation,
-* Copyright 2002, Hewlett Packard, Inc.
-*
-* Permission to use, copy, modify, distribute, and sell this software and its
-* documentation for any purpose is hereby granted without fee, provided that
-* the above copyright notice appear in all copies and that both that
-* copyright notice and this permission notice appear in supporting
-* documentation, and that the name of Compaq or HP not be used in advertising
-* or publicity pertaining to distribution of the software without specific,
-* written prior permission. HP makes no representations about the
-* suitability of this software for any purpose. It is provided "as is"
-* without express or implied warranty.
-*
-* HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP
-* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
-* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*
-* Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.
-
-END src/solaris/native/sun/awt/randr.h
-*****************************************************
-
-BEGIN src/solaris/native/sun/java2d/opengl/J2D_GL/glx.h
-* Mesa 3-D graphics library
-* Version: 4.1
-*
-* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-END src/solaris/native/sun/java2d/opengl/J2D_GL/glx.h
diff --git a/hotspot/agent/make/Makefile b/hotspot/agent/make/Makefile
index c1c8ddabc3b..fd5499367a0 100644
--- a/hotspot/agent/make/Makefile
+++ b/hotspot/agent/make/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -48,17 +48,18 @@ sun.jvm.hotspot.asm.x86 \
sun.jvm.hotspot.bugspot \
sun.jvm.hotspot.bugspot.tree \
sun.jvm.hotspot.c1 \
+sun.jvm.hotspot.ci \
sun.jvm.hotspot.code \
sun.jvm.hotspot.compiler \
sun.jvm.hotspot.debugger \
sun.jvm.hotspot.debugger.amd64 \
+sun.jvm.hotspot.debugger.bsd \
+sun.jvm.hotspot.debugger.bsd.amd64 \
+sun.jvm.hotspot.debugger.bsd.x86 \
sun.jvm.hotspot.debugger.cdbg \
sun.jvm.hotspot.debugger.cdbg.basic \
sun.jvm.hotspot.debugger.cdbg.basic.amd64 \
sun.jvm.hotspot.debugger.cdbg.basic.x86 \
-sun.jvm.hotspot.debugger.dbx \
-sun.jvm.hotspot.debugger.dbx.sparc \
-sun.jvm.hotspot.debugger.dbx.x86 \
sun.jvm.hotspot.debugger.dummy \
sun.jvm.hotspot.debugger.ia64 \
sun.jvm.hotspot.debugger.linux \
@@ -76,7 +77,6 @@ sun.jvm.hotspot.debugger.remote.amd64 \
sun.jvm.hotspot.debugger.remote.sparc \
sun.jvm.hotspot.debugger.remote.x86 \
sun.jvm.hotspot.debugger.sparc \
-sun.jvm.hotspot.debugger.win32 \
sun.jvm.hotspot.debugger.win32.coff \
sun.jvm.hotspot.debugger.windbg \
sun.jvm.hotspot.debugger.windbg.amd64 \
@@ -84,6 +84,7 @@ sun.jvm.hotspot.debugger.windbg.ia64 \
sun.jvm.hotspot.debugger.windbg.x86 \
sun.jvm.hotspot.debugger.x86 \
sun.jvm.hotspot.gc_implementation \
+sun.jvm.hotspot.gc_implementation.g1 \
sun.jvm.hotspot.gc_implementation.parallelScavenge \
sun.jvm.hotspot.gc_implementation.shared \
sun.jvm.hotspot.gc_interface \
@@ -91,9 +92,14 @@ sun.jvm.hotspot.interpreter \
sun.jvm.hotspot.jdi \
sun.jvm.hotspot.livejvm \
sun.jvm.hotspot.memory \
+sun.jvm.hotspot.opto \
sun.jvm.hotspot.oops \
+sun.jvm.hotspot.prims \
sun.jvm.hotspot.runtime \
sun.jvm.hotspot.runtime.amd64 \
+sun.jvm.hotspot.runtime.bsd \
+sun.jvm.hotspot.runtime.bsd_amd64 \
+sun.jvm.hotspot.runtime.bsd_x86 \
sun.jvm.hotspot.runtime.ia64 \
sun.jvm.hotspot.runtime.linux \
sun.jvm.hotspot.runtime.linux_amd64 \
@@ -139,17 +145,18 @@ sun/jvm/hotspot/asm/x86/*.java \
sun/jvm/hotspot/bugspot/*.java \
sun/jvm/hotspot/bugspot/tree/*.java \
sun/jvm/hotspot/c1/*.java \
+sun/jvm/hotspot/ci/*.java \
sun/jvm/hotspot/code/*.java \
sun/jvm/hotspot/compiler/*.java \
sun/jvm/hotspot/debugger/*.java \
sun/jvm/hotspot/debugger/amd64/*.java \
+sun/jvm/hotspot/debugger/bsd/*.java \
+sun/jvm/hotspot/debugger/bsd/amd64/*.java \
+sun/jvm/hotspot/debugger/bsd/x86/*.java \
sun/jvm/hotspot/debugger/cdbg/*.java \
sun/jvm/hotspot/debugger/cdbg/basic/*.java \
sun/jvm/hotspot/debugger/cdbg/basic/amd64/*.java \
sun/jvm/hotspot/debugger/cdbg/basic/x86/*.java \
-sun/jvm/hotspot/debugger/dbx/*.java \
-sun/jvm/hotspot/debugger/dbx/sparc/*.java \
-sun/jvm/hotspot/debugger/dbx/x86/*.java \
sun/jvm/hotspot/debugger/dummy/*.java \
sun/jvm/hotspot/debugger/ia64/*.java \
sun/jvm/hotspot/debugger/linux/*.java \
@@ -165,19 +172,26 @@ sun/jvm/hotspot/debugger/remote/amd64/*.java \
sun/jvm/hotspot/debugger/remote/sparc/*.java \
sun/jvm/hotspot/debugger/remote/x86/*.java \
sun/jvm/hotspot/debugger/sparc/*.java \
-sun/jvm/hotspot/debugger/win32/*.java \
sun/jvm/hotspot/debugger/win32/coff/*.java \
sun/jvm/hotspot/debugger/windbg/*.java \
sun/jvm/hotspot/debugger/windbg/ia64/*.java \
sun/jvm/hotspot/debugger/windbg/x86/*.java \
sun/jvm/hotspot/debugger/x86/*.java \
+sun/jvm/hotspot/gc_implementation/g1/*.java \
+sun/jvm/hotspot/gc_implementation/parallelScavenge/*.java \
+sun/jvm/hotspot/gc_implementation/shared/*.java \
sun/jvm/hotspot/interpreter/*.java \
sun/jvm/hotspot/jdi/*.java \
sun/jvm/hotspot/livejvm/*.java \
sun/jvm/hotspot/memory/*.java \
sun/jvm/hotspot/oops/*.java \
+sun/jvm/hotspot/opto/*.java \
+sun/jvm/hotspot/prims/*.java \
sun/jvm/hotspot/runtime/*.java \
sun/jvm/hotspot/runtime/amd64/*.java \
+sun/jvm/hotspot/runtime/bsd/*.java \
+sun/jvm/hotspot/runtime/bsd_amd64/*.java \
+sun/jvm/hotspot/runtime/bsd_x86/*.java \
sun/jvm/hotspot/runtime/ia64/*.java \
sun/jvm/hotspot/runtime/linux/*.java \
sun/jvm/hotspot/runtime/linux_amd64/*.java \
diff --git a/hotspot/agent/make/saenv.sh b/hotspot/agent/make/saenv.sh
index b41a3113cfe..81c2d152c67 100644
--- a/hotspot/agent/make/saenv.sh
+++ b/hotspot/agent/make/saenv.sh
@@ -70,6 +70,14 @@ fi
SA_CLASSPATH=$STARTDIR/../build/classes:$STARTDIR/../src/share/lib/js.jar:$STARTDIR/sa.jar:$STARTDIR/lib/js.jar
+if [ ! -z "$SA_TYPEDB" ]; then
+ if [ ! -f $SA_TYPEDB ]; then
+ echo "$SA_TYPEDB is unreadable"
+ exit 1
+ fi
+ OPTIONS="-Dsun.jvm.hotspot.typedb=$SA_TYPEDB ${OPTIONS}"
+fi
+
OPTIONS="-Djava.system.class.loader=sun.jvm.hotspot.SALauncherLoader ${OPTIONS}"
SA_JAVA_CMD="$SA_PREFIX_CMD $SA_JAVA -showversion ${OPTIONS} -cp $SA_CLASSPATH $SA_OPTIONS"
diff --git a/hotspot/agent/make/saenv64.sh b/hotspot/agent/make/saenv64.sh
index 98d5885b3d5..c00dc0d17c0 100644
--- a/hotspot/agent/make/saenv64.sh
+++ b/hotspot/agent/make/saenv64.sh
@@ -67,6 +67,14 @@ fi
SA_CLASSPATH=$STARTDIR/../build/classes:$STARTDIR/../src/share/lib/js.jar:$STARTDIR/sa.jar::$STARTDIR/lib/js.jar
+if [ ! -z "$SA_TYPEDB" ]; then
+ if [ ! -f $SA_TYPEDB ]; then
+ echo "$SA_TYPEDB is unreadable"
+ exit 1
+ fi
+ OPTIONS="-Dsun.jvm.hotspot.typedb=$SA_TYPEDB ${OPTIONS}"
+fi
+
OPTIONS="-Djava.system.class.loader=sun.jvm.hotspot.SALauncherLoader ${OPTIONS}"
SA_JAVA_CMD="$SA_PREFIX_CMD $SA_JAVA -d64 -showversion ${OPTIONS} -cp $SA_CLASSPATH $SA_OPTIONS"
diff --git a/hotspot/agent/src/os/bsd/BsdDebuggerLocal.c b/hotspot/agent/src/os/bsd/BsdDebuggerLocal.c
new file mode 100644
index 00000000000..85b07f76440
--- /dev/null
+++ b/hotspot/agent/src/os/bsd/BsdDebuggerLocal.c
@@ -0,0 +1,413 @@
+/*
+ * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include
+#include
+#include "libproc.h"
+
+#if defined(x86_64) && !defined(amd64)
+#define amd64 1
+#endif
+
+#ifdef i386
+#include "sun_jvm_hotspot_debugger_x86_X86ThreadContext.h"
+#endif
+
+#ifdef amd64
+#include "sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext.h"
+#endif
+
+#if defined(sparc) || defined(sparcv9)
+#include "sun_jvm_hotspot_debugger_sparc_SPARCThreadContext.h"
+#endif
+
+static jfieldID p_ps_prochandle_ID = 0;
+static jfieldID threadList_ID = 0;
+static jfieldID loadObjectList_ID = 0;
+
+static jmethodID createClosestSymbol_ID = 0;
+static jmethodID createLoadObject_ID = 0;
+static jmethodID getThreadForThreadId_ID = 0;
+static jmethodID listAdd_ID = 0;
+
+#define CHECK_EXCEPTION_(value) if ((*env)->ExceptionOccurred(env)) { return value; }
+#define CHECK_EXCEPTION if ((*env)->ExceptionOccurred(env)) { return;}
+#define THROW_NEW_DEBUGGER_EXCEPTION_(str, value) { throw_new_debugger_exception(env, str); return value; }
+#define THROW_NEW_DEBUGGER_EXCEPTION(str) { throw_new_debugger_exception(env, str); return;}
+
+static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) {
+ (*env)->ThrowNew(env, (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"), errMsg);
+}
+
+static struct ps_prochandle* get_proc_handle(JNIEnv* env, jobject this_obj) {
+ jlong ptr = (*env)->GetLongField(env, this_obj, p_ps_prochandle_ID);
+ return (struct ps_prochandle*)(intptr_t)ptr;
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: init0
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0
+ (JNIEnv *env, jclass cls) {
+ jclass listClass;
+
+ if (init_libproc(getenv("LIBSAPROC_DEBUG") != NULL) != true) {
+ THROW_NEW_DEBUGGER_EXCEPTION("can't initialize libproc");
+ }
+
+ // fields we use
+ p_ps_prochandle_ID = (*env)->GetFieldID(env, cls, "p_ps_prochandle", "J");
+ CHECK_EXCEPTION;
+ threadList_ID = (*env)->GetFieldID(env, cls, "threadList", "Ljava/util/List;");
+ CHECK_EXCEPTION;
+ loadObjectList_ID = (*env)->GetFieldID(env, cls, "loadObjectList", "Ljava/util/List;");
+ CHECK_EXCEPTION;
+
+ // methods we use
+ createClosestSymbol_ID = (*env)->GetMethodID(env, cls, "createClosestSymbol",
+ "(Ljava/lang/String;J)Lsun/jvm/hotspot/debugger/cdbg/ClosestSymbol;");
+ CHECK_EXCEPTION;
+ createLoadObject_ID = (*env)->GetMethodID(env, cls, "createLoadObject",
+ "(Ljava/lang/String;JJ)Lsun/jvm/hotspot/debugger/cdbg/LoadObject;");
+ CHECK_EXCEPTION;
+ getThreadForThreadId_ID = (*env)->GetMethodID(env, cls, "getThreadForThreadId",
+ "(J)Lsun/jvm/hotspot/debugger/ThreadProxy;");
+ CHECK_EXCEPTION;
+ // java.util.List method we call
+ listClass = (*env)->FindClass(env, "java/util/List");
+ CHECK_EXCEPTION;
+ listAdd_ID = (*env)->GetMethodID(env, listClass, "add", "(Ljava/lang/Object;)Z");
+ CHECK_EXCEPTION;
+}
+
+JNIEXPORT jint JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getAddressSize
+ (JNIEnv *env, jclass cls)
+{
+#ifdef _LP64
+ return 8;
+#else
+ return 4;
+#endif
+
+}
+
+
+static void fillThreadsAndLoadObjects(JNIEnv* env, jobject this_obj, struct ps_prochandle* ph) {
+ int n = 0, i = 0;
+
+ // add threads
+ n = get_num_threads(ph);
+ for (i = 0; i < n; i++) {
+ jobject thread;
+ jobject threadList;
+ lwpid_t lwpid;
+
+ lwpid = get_lwp_id(ph, i);
+ thread = (*env)->CallObjectMethod(env, this_obj, getThreadForThreadId_ID,
+ (jlong)lwpid);
+ CHECK_EXCEPTION;
+ threadList = (*env)->GetObjectField(env, this_obj, threadList_ID);
+ CHECK_EXCEPTION;
+ (*env)->CallBooleanMethod(env, threadList, listAdd_ID, thread);
+ CHECK_EXCEPTION;
+ }
+
+ // add load objects
+ n = get_num_libs(ph);
+ for (i = 0; i < n; i++) {
+ uintptr_t base;
+ const char* name;
+ jobject loadObject;
+ jobject loadObjectList;
+
+ base = get_lib_base(ph, i);
+ name = get_lib_name(ph, i);
+ loadObject = (*env)->CallObjectMethod(env, this_obj, createLoadObject_ID,
+ (*env)->NewStringUTF(env, name), (jlong)0, (jlong)base);
+ CHECK_EXCEPTION;
+ loadObjectList = (*env)->GetObjectField(env, this_obj, loadObjectList_ID);
+ CHECK_EXCEPTION;
+ (*env)->CallBooleanMethod(env, loadObjectList, listAdd_ID, loadObject);
+ CHECK_EXCEPTION;
+ }
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: attach0
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__I
+ (JNIEnv *env, jobject this_obj, jint jpid) {
+
+ struct ps_prochandle* ph;
+ if ( (ph = Pgrab(jpid)) == NULL) {
+ THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process");
+ }
+ (*env)->SetLongField(env, this_obj, p_ps_prochandle_ID, (jlong)(intptr_t)ph);
+ fillThreadsAndLoadObjects(env, this_obj, ph);
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: attach0
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2
+ (JNIEnv *env, jobject this_obj, jstring execName, jstring coreName) {
+ const char *execName_cstr;
+ const char *coreName_cstr;
+ jboolean isCopy;
+ struct ps_prochandle* ph;
+
+ execName_cstr = (*env)->GetStringUTFChars(env, execName, &isCopy);
+ CHECK_EXCEPTION;
+ coreName_cstr = (*env)->GetStringUTFChars(env, coreName, &isCopy);
+ CHECK_EXCEPTION;
+
+ if ( (ph = Pgrab_core(execName_cstr, coreName_cstr)) == NULL) {
+ (*env)->ReleaseStringUTFChars(env, execName, execName_cstr);
+ (*env)->ReleaseStringUTFChars(env, coreName, coreName_cstr);
+ THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the core file");
+ }
+ (*env)->SetLongField(env, this_obj, p_ps_prochandle_ID, (jlong)(intptr_t)ph);
+ (*env)->ReleaseStringUTFChars(env, execName, execName_cstr);
+ (*env)->ReleaseStringUTFChars(env, coreName, coreName_cstr);
+ fillThreadsAndLoadObjects(env, this_obj, ph);
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: detach0
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_detach0
+ (JNIEnv *env, jobject this_obj) {
+ struct ps_prochandle* ph = get_proc_handle(env, this_obj);
+ if (ph != NULL) {
+ Prelease(ph);
+ }
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: lookupByName0
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByName0
+ (JNIEnv *env, jobject this_obj, jstring objectName, jstring symbolName) {
+ const char *objectName_cstr, *symbolName_cstr;
+ jlong addr;
+ jboolean isCopy;
+ struct ps_prochandle* ph = get_proc_handle(env, this_obj);
+
+ objectName_cstr = NULL;
+ if (objectName != NULL) {
+ objectName_cstr = (*env)->GetStringUTFChars(env, objectName, &isCopy);
+ CHECK_EXCEPTION_(0);
+ }
+ symbolName_cstr = (*env)->GetStringUTFChars(env, symbolName, &isCopy);
+ CHECK_EXCEPTION_(0);
+
+ addr = (jlong) lookup_symbol(ph, objectName_cstr, symbolName_cstr);
+
+ if (objectName_cstr != NULL) {
+ (*env)->ReleaseStringUTFChars(env, objectName, objectName_cstr);
+ }
+ (*env)->ReleaseStringUTFChars(env, symbolName, symbolName_cstr);
+ return addr;
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: lookupByAddress0
+ * Signature: (J)Lsun/jvm/hotspot/debugger/cdbg/ClosestSymbol;
+ */
+JNIEXPORT jobject JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByAddress0
+ (JNIEnv *env, jobject this_obj, jlong addr) {
+ uintptr_t offset;
+ const char* sym = NULL;
+
+ struct ps_prochandle* ph = get_proc_handle(env, this_obj);
+ sym = symbol_for_pc(ph, (uintptr_t) addr, &offset);
+ if (sym == NULL) return 0;
+ return (*env)->CallObjectMethod(env, this_obj, createClosestSymbol_ID,
+ (*env)->NewStringUTF(env, sym), (jlong)offset);
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: readBytesFromProcess0
+ * Signature: (JJ)Lsun/jvm/hotspot/debugger/ReadResult;
+ */
+JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0
+ (JNIEnv *env, jobject this_obj, jlong addr, jlong numBytes) {
+
+ jboolean isCopy;
+ jbyteArray array;
+ jbyte *bufPtr;
+ ps_err_e err;
+
+ array = (*env)->NewByteArray(env, numBytes);
+ CHECK_EXCEPTION_(0);
+ bufPtr = (*env)->GetByteArrayElements(env, array, &isCopy);
+ CHECK_EXCEPTION_(0);
+
+ err = ps_pread(get_proc_handle(env, this_obj), (psaddr_t) (uintptr_t)addr, bufPtr, numBytes);
+ (*env)->ReleaseByteArrayElements(env, array, bufPtr, 0);
+ return (err == PS_OK)? array : 0;
+}
+
+JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0
+ (JNIEnv *env, jobject this_obj, jint lwp_id) {
+
+ struct reg gregs;
+ jboolean isCopy;
+ jlongArray array;
+ jlong *regs;
+
+ struct ps_prochandle* ph = get_proc_handle(env, this_obj);
+ if (get_lwp_regs(ph, lwp_id, &gregs) != true) {
+ THROW_NEW_DEBUGGER_EXCEPTION_("get_thread_regs failed for a lwp", 0);
+ }
+
+#undef NPRGREG
+#ifdef i386
+#define NPRGREG sun_jvm_hotspot_debugger_x86_X86ThreadContext_NPRGREG
+#endif
+#ifdef ia64
+#define NPRGREG IA64_REG_COUNT
+#endif
+#ifdef amd64
+#define NPRGREG sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext_NPRGREG
+#endif
+#if defined(sparc) || defined(sparcv9)
+#define NPRGREG sun_jvm_hotspot_debugger_sparc_SPARCThreadContext_NPRGREG
+#endif
+
+ array = (*env)->NewLongArray(env, NPRGREG);
+ CHECK_EXCEPTION_(0);
+ regs = (*env)->GetLongArrayElements(env, array, &isCopy);
+
+#undef REG_INDEX
+
+#ifdef i386
+#define REG_INDEX(reg) sun_jvm_hotspot_debugger_x86_X86ThreadContext_##reg
+
+ regs[REG_INDEX(GS)] = (uintptr_t) gregs.r_gs;
+ regs[REG_INDEX(FS)] = (uintptr_t) gregs.r_fs;
+ regs[REG_INDEX(ES)] = (uintptr_t) gregs.r_es;
+ regs[REG_INDEX(DS)] = (uintptr_t) gregs.r_ds;
+ regs[REG_INDEX(EDI)] = (uintptr_t) gregs.r_edi;
+ regs[REG_INDEX(ESI)] = (uintptr_t) gregs.r_esi;
+ regs[REG_INDEX(FP)] = (uintptr_t) gregs.r_ebp;
+ regs[REG_INDEX(SP)] = (uintptr_t) gregs.r_isp;
+ regs[REG_INDEX(EBX)] = (uintptr_t) gregs.r_ebx;
+ regs[REG_INDEX(EDX)] = (uintptr_t) gregs.r_edx;
+ regs[REG_INDEX(ECX)] = (uintptr_t) gregs.r_ecx;
+ regs[REG_INDEX(EAX)] = (uintptr_t) gregs.r_eax;
+ regs[REG_INDEX(PC)] = (uintptr_t) gregs.r_eip;
+ regs[REG_INDEX(CS)] = (uintptr_t) gregs.r_cs;
+ regs[REG_INDEX(SS)] = (uintptr_t) gregs.r_ss;
+
+#endif /* i386 */
+
+#if ia64
+ regs = (*env)->GetLongArrayElements(env, array, &isCopy);
+ int i;
+ for (i = 0; i < NPRGREG; i++ ) {
+ regs[i] = 0xDEADDEAD;
+ }
+#endif /* ia64 */
+
+#ifdef amd64
+#define REG_INDEX(reg) sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext_##reg
+
+ regs[REG_INDEX(R15)] = gregs.r_r15;
+ regs[REG_INDEX(R14)] = gregs.r_r14;
+ regs[REG_INDEX(R13)] = gregs.r_r13;
+ regs[REG_INDEX(R12)] = gregs.r_r12;
+ regs[REG_INDEX(RBP)] = gregs.r_rbp;
+ regs[REG_INDEX(RBX)] = gregs.r_rbx;
+ regs[REG_INDEX(R11)] = gregs.r_r11;
+ regs[REG_INDEX(R10)] = gregs.r_r10;
+ regs[REG_INDEX(R9)] = gregs.r_r9;
+ regs[REG_INDEX(R8)] = gregs.r_r8;
+ regs[REG_INDEX(RAX)] = gregs.r_rax;
+ regs[REG_INDEX(RCX)] = gregs.r_rcx;
+ regs[REG_INDEX(RDX)] = gregs.r_rdx;
+ regs[REG_INDEX(RSI)] = gregs.r_rsi;
+ regs[REG_INDEX(RDI)] = gregs.r_rdi;
+ regs[REG_INDEX(RIP)] = gregs.r_rip;
+ regs[REG_INDEX(CS)] = gregs.r_cs;
+ regs[REG_INDEX(RSP)] = gregs.r_rsp;
+ regs[REG_INDEX(SS)] = gregs.r_ss;
+// regs[REG_INDEX(FSBASE)] = gregs.fs_base;
+// regs[REG_INDEX(GSBASE)] = gregs.gs_base;
+// regs[REG_INDEX(DS)] = gregs.ds;
+// regs[REG_INDEX(ES)] = gregs.es;
+// regs[REG_INDEX(FS)] = gregs.fs;
+// regs[REG_INDEX(GS)] = gregs.gs;
+
+#endif /* amd64 */
+
+#if defined(sparc) || defined(sparcv9)
+
+#define REG_INDEX(reg) sun_jvm_hotspot_debugger_sparc_SPARCThreadContext_##reg
+
+#ifdef _LP64
+ regs[REG_INDEX(R_PSR)] = gregs.tstate;
+ regs[REG_INDEX(R_PC)] = gregs.tpc;
+ regs[REG_INDEX(R_nPC)] = gregs.tnpc;
+ regs[REG_INDEX(R_Y)] = gregs.y;
+#else
+ regs[REG_INDEX(R_PSR)] = gregs.psr;
+ regs[REG_INDEX(R_PC)] = gregs.pc;
+ regs[REG_INDEX(R_nPC)] = gregs.npc;
+ regs[REG_INDEX(R_Y)] = gregs.y;
+#endif
+ regs[REG_INDEX(R_G0)] = 0 ;
+ regs[REG_INDEX(R_G1)] = gregs.u_regs[0];
+ regs[REG_INDEX(R_G2)] = gregs.u_regs[1];
+ regs[REG_INDEX(R_G3)] = gregs.u_regs[2];
+ regs[REG_INDEX(R_G4)] = gregs.u_regs[3];
+ regs[REG_INDEX(R_G5)] = gregs.u_regs[4];
+ regs[REG_INDEX(R_G6)] = gregs.u_regs[5];
+ regs[REG_INDEX(R_G7)] = gregs.u_regs[6];
+ regs[REG_INDEX(R_O0)] = gregs.u_regs[7];
+ regs[REG_INDEX(R_O1)] = gregs.u_regs[8];
+ regs[REG_INDEX(R_O2)] = gregs.u_regs[ 9];
+ regs[REG_INDEX(R_O3)] = gregs.u_regs[10];
+ regs[REG_INDEX(R_O4)] = gregs.u_regs[11];
+ regs[REG_INDEX(R_O5)] = gregs.u_regs[12];
+ regs[REG_INDEX(R_O6)] = gregs.u_regs[13];
+ regs[REG_INDEX(R_O7)] = gregs.u_regs[14];
+#endif /* sparc */
+
+
+ (*env)->ReleaseLongArrayElements(env, array, regs, JNI_COMMIT);
+ return array;
+}
diff --git a/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m b/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m
new file mode 100644
index 00000000000..04eaf9429cc
--- /dev/null
+++ b/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m
@@ -0,0 +1,406 @@
+/*
+ * Copyright (c) 2002, 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include
+#import
+#import
+
+#include
+
+#import
+#import
+#import
+#import
+
+jboolean debug = JNI_FALSE;
+
+static jfieldID symbolicatorID = 0; // set in _init0
+static jfieldID taskID = 0; // set in _init0
+
+static void putSymbolicator(JNIEnv *env, jobject this_obj, id symbolicator) {
+ (*env)->SetLongField(env, this_obj, symbolicatorID, (jlong)(intptr_t)symbolicator);
+}
+
+static id getSymbolicator(JNIEnv *env, jobject this_obj) {
+ jlong ptr = (*env)->GetLongField(env, this_obj, symbolicatorID);
+ return (id)(intptr_t)ptr;
+}
+
+static void putTask(JNIEnv *env, jobject this_obj, task_t task) {
+ (*env)->SetLongField(env, this_obj, taskID, (jlong)task);
+}
+
+static task_t getTask(JNIEnv *env, jobject this_obj) {
+ jlong ptr = (*env)->GetLongField(env, this_obj, taskID);
+ return (task_t)ptr;
+}
+
+#define CHECK_EXCEPTION_(value) if ((*env)->ExceptionOccurred(env)) { return value; }
+#define CHECK_EXCEPTION if ((*env)->ExceptionOccurred(env)) { return;}
+#define THROW_NEW_DEBUGGER_EXCEPTION_(str, value) { throw_new_debugger_exception(env, str); return value; }
+#define THROW_NEW_DEBUGGER_EXCEPTION(str) { throw_new_debugger_exception(env, str); return;}
+
+static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) {
+ (*env)->ThrowNew(env, (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"), errMsg);
+}
+
+#if defined(__i386__)
+ #define hsdb_thread_state_t x86_thread_state32_t
+ #define hsdb_float_state_t x86_float_state32_t
+ #define HSDB_THREAD_STATE x86_THREAD_STATE32
+ #define HSDB_FLOAT_STATE x86_FLOAT_STATE32
+ #define HSDB_THREAD_STATE_COUNT x86_THREAD_STATE32_COUNT
+ #define HSDB_FLOAT_STATE_COUNT x86_FLOAT_STATE32_COUNT
+#elif defined(__x86_64__)
+ #define hsdb_thread_state_t x86_thread_state64_t
+ #define hsdb_float_state_t x86_float_state64_t
+ #define HSDB_THREAD_STATE x86_THREAD_STATE64
+ #define HSDB_FLOAT_STATE x86_FLOAT_STATE64
+ #define HSDB_THREAD_STATE_COUNT x86_THREAD_STATE64_COUNT
+ #define HSDB_FLOAT_STATE_COUNT x86_FLOAT_STATE64_COUNT
+#else
+ #error "Unsupported architecture"
+#endif
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: init0
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0(JNIEnv *env, jclass cls) {
+ symbolicatorID = (*env)->GetFieldID(env, cls, "symbolicator", "J");
+ taskID = (*env)->GetFieldID(env, cls, "task", "J");
+ CHECK_EXCEPTION;
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: lookupByName0
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByName0(JNIEnv *env, jobject this_obj, jstring objectName, jstring symbolName) {
+ jlong address = 0;
+
+JNF_COCOA_ENTER(env);
+ NSString *symbolNameString = JNFJavaToNSString(env, symbolName);
+
+ if (debug) {
+ printf("lookupInProcess called for %s\n", [symbolNameString UTF8String]);
+ }
+
+ id symbolicator = getSymbolicator(env, this_obj);
+ if (symbolicator != nil) {
+ uint64_t (*dynamicCall)(id, SEL, NSString *) = (uint64_t (*)(id, SEL, NSString *))&objc_msgSend;
+ address = (jlong) dynamicCall(symbolicator, @selector(addressForSymbol:), symbolNameString);
+ }
+
+ if (debug) {
+ printf("address of symbol %s = %llx\n", [symbolNameString UTF8String], address);
+ }
+JNF_COCOA_EXIT(env);
+
+ return address;
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: readBytesFromProcess0
+ * Signature: (JJ)Lsun/jvm/hotspot/debugger/ReadResult;
+ */
+JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0(JNIEnv *env, jobject this_obj, jlong addr, jlong numBytes) {
+ if (debug) printf("readBytesFromProcess called. addr = %llx numBytes = %lld\n", addr, numBytes);
+
+ // must allocate storage instead of using former parameter buf
+ jboolean isCopy;
+ jbyteArray array;
+ jbyte *bufPtr;
+
+ array = (*env)->NewByteArray(env, numBytes);
+ CHECK_EXCEPTION_(0);
+
+ unsigned long alignedAddress;
+ unsigned long alignedLength;
+ kern_return_t result;
+ vm_offset_t *pages;
+ int *mapped;
+ long pageCount;
+ uint byteCount;
+ int i;
+ unsigned long remaining;
+
+ alignedAddress = trunc_page(addr);
+ if (addr != alignedAddress) {
+ alignedLength += addr - alignedAddress;
+ }
+ alignedLength = round_page(numBytes);
+ pageCount = alignedLength/vm_page_size;
+
+ // Allocate storage for pages and flags.
+ pages = malloc(pageCount * sizeof(vm_offset_t));
+ mapped = calloc(pageCount, sizeof(int));
+
+ task_t gTask = getTask(env, this_obj);
+ // Try to read each of the pages.
+ for (i = 0; i < pageCount; i++) {
+ result = vm_read(gTask, alignedAddress + i*vm_page_size, vm_page_size,
+ &pages[i], &byteCount);
+ mapped[i] = (result == KERN_SUCCESS);
+ // assume all failures are unmapped pages
+ }
+
+ if (debug) fprintf(stderr, "%ld pages\n", pageCount);
+
+ remaining = numBytes;
+
+ for (i = 0; i < pageCount; i++) {
+ unsigned long len = vm_page_size;
+ unsigned long start = 0;
+
+ if (i == 0) {
+ start = addr - alignedAddress;
+ len = vm_page_size - start;
+ }
+
+ if (i == (pageCount - 1)) {
+ len = remaining;
+ }
+
+ if (mapped[i]) {
+ if (debug) fprintf(stderr, "page %d mapped (len %ld start %ld)\n", i, len, start);
+ (*env)->SetByteArrayRegion(env, array, 0, len, ((jbyte *) pages[i] + start));
+ vm_deallocate(mach_task_self(), pages[i], vm_page_size);
+ }
+
+ remaining -= len;
+ }
+
+ free (pages);
+ free (mapped);
+ return array;
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_macosx_MacOSXDebuggerLocal
+ * Method: getThreadIntegerRegisterSet0
+ * Signature: (I)[J
+ */
+JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0(JNIEnv *env, jobject this_obj, jint lwp_id) {
+ if (debug)
+ printf("getThreadRegisterSet0 called\n");
+
+ kern_return_t result;
+ thread_t tid;
+ mach_msg_type_number_t count = HSDB_THREAD_STATE_COUNT;
+ hsdb_thread_state_t state;
+ unsigned int *r;
+ int i;
+ jlongArray registerArray;
+ jlong *primitiveArray;
+
+ tid = lwp_id;
+
+ result = thread_get_state(tid, HSDB_THREAD_STATE, (thread_state_t)&state, &count);
+
+ if (result != KERN_SUCCESS) {
+ if (debug)
+ printf("getregs: thread_get_state(%d) failed (%d)\n", tid, result);
+ return NULL;
+ }
+
+ // 40 32-bit registers on ppc, 16 on x86.
+ // Output order is the same as the order in the ppc_thread_state/i386_thread_state struct.
+#if defined(__i386__)
+ r = (unsigned int *)&state;
+ registerArray = (*env)->NewLongArray(env, 8);
+ primitiveArray = (*env)->GetLongArrayElements(env, registerArray, NULL);
+ primitiveArray[0] = r[0]; // eax
+ primitiveArray[1] = r[2]; // ecx
+ primitiveArray[2] = r[3]; // edx
+ primitiveArray[3] = r[1]; // ebx
+ primitiveArray[4] = r[7]; // esp
+ primitiveArray[5] = r[6]; // ebp
+ primitiveArray[6] = r[5]; // esi
+ primitiveArray[7] = r[4]; // edi
+ (*env)->ReleaseLongArrayElements(env, registerArray, primitiveArray, 0);
+#elif defined(__x86_64__)
+ /* From AMD64ThreadContext.java
+ public static final int R15 = 0;
+ public static final int R14 = 1;
+ public static final int R13 = 2;
+ public static final int R12 = 3;
+ public static final int R11 = 4;
+ public static final int R10 = 5;
+ public static final int R9 = 6;
+ public static final int R8 = 7;
+ public static final int RDI = 8;
+ public static final int RSI = 9;
+ public static final int RBP = 10;
+ public static final int RBX = 11;
+ public static final int RDX = 12;
+ public static final int RCX = 13;
+ public static final int RAX = 14;
+ public static final int TRAPNO = 15;
+ public static final int ERR = 16;
+ public static final int RIP = 17;
+ public static final int CS = 18;
+ public static final int RFL = 19;
+ public static final int RSP = 20;
+ public static final int SS = 21;
+ public static final int FS = 22;
+ public static final int GS = 23;
+ public static final int ES = 24;
+ public static final int DS = 25;
+ public static final int FSBASE = 26;
+ public static final int GSBASE = 27;
+ */
+ // 64 bit
+ if (debug) printf("Getting threads for a 64-bit process\n");
+ registerArray = (*env)->NewLongArray(env, 28);
+ primitiveArray = (*env)->GetLongArrayElements(env, registerArray, NULL);
+
+ primitiveArray[0] = state.__r15;
+ primitiveArray[1] = state.__r14;
+ primitiveArray[2] = state.__r13;
+ primitiveArray[3] = state.__r12;
+ primitiveArray[4] = state.__r11;
+ primitiveArray[5] = state.__r10;
+ primitiveArray[6] = state.__r9;
+ primitiveArray[7] = state.__r8;
+ primitiveArray[8] = state.__rdi;
+ primitiveArray[9] = state.__rsi;
+ primitiveArray[10] = state.__rbp;
+ primitiveArray[11] = state.__rbx;
+ primitiveArray[12] = state.__rdx;
+ primitiveArray[13] = state.__rcx;
+ primitiveArray[14] = state.__rax;
+ primitiveArray[15] = 0; // trapno ?
+ primitiveArray[16] = 0; // err ?
+ primitiveArray[17] = state.__rip;
+ primitiveArray[18] = state.__cs;
+ primitiveArray[19] = state.__rflags;
+ primitiveArray[20] = state.__rsp;
+ primitiveArray[21] = 0; // We don't have SS
+ primitiveArray[22] = state.__fs;
+ primitiveArray[23] = state.__gs;
+ primitiveArray[24] = 0;
+ primitiveArray[25] = 0;
+ primitiveArray[26] = 0;
+ primitiveArray[27] = 0;
+
+ if (debug) printf("set registers\n");
+
+ (*env)->ReleaseLongArrayElements(env, registerArray, primitiveArray, 0);
+#else
+#error Unsupported architecture
+#endif
+
+ return registerArray;
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_macosx_MacOSXDebuggerLocal
+ * Method: translateTID0
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL
+Java_sun_jvm_hotspot_debugger_macosx_MacOSXDebuggerLocal_translateTID0(JNIEnv *env, jobject this_obj, jint tid) {
+ if (debug)
+ printf("translateTID0 called on tid = 0x%x\n", (int)tid);
+
+ kern_return_t result;
+ thread_t foreign_tid, usable_tid;
+ mach_msg_type_name_t type;
+
+ foreign_tid = tid;
+
+ task_t gTask = getTask(env, this_obj);
+ result = mach_port_extract_right(gTask, foreign_tid,
+ MACH_MSG_TYPE_COPY_SEND,
+ &usable_tid, &type);
+ if (result != KERN_SUCCESS)
+ return -1;
+
+ if (debug)
+ printf("translateTID0: 0x%x -> 0x%x\n", foreign_tid, usable_tid);
+
+ return (jint) usable_tid;
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: attach0
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__I(JNIEnv *env, jobject this_obj, jint jpid) {
+JNF_COCOA_ENTER(env);
+ if (getenv("JAVA_SAPROC_DEBUG") != NULL)
+ debug = JNI_TRUE;
+ else
+ debug = JNI_FALSE;
+ if (debug) printf("attach0 called for jpid=%d\n", (int)jpid);
+
+ kern_return_t result;
+ task_t gTask = 0;
+ result = task_for_pid(mach_task_self(), jpid, &gTask);
+ if (result != KERN_SUCCESS) {
+ fprintf(stderr, "attach: task_for_pid(%d) failed (%d)\n", (int)jpid, result);
+ THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process");
+ }
+ putTask(env, this_obj, gTask);
+
+ id symbolicator = nil;
+ id jrsSymbolicator = objc_lookUpClass("JRSSymbolicator");
+ if (jrsSymbolicator != nil) {
+ id (*dynamicCall)(id, SEL, pid_t) = (id (*)(id, SEL, pid_t))&objc_msgSend;
+ symbolicator = dynamicCall(jrsSymbolicator, @selector(symbolicatorForPid:), (pid_t)jpid);
+ }
+ if (symbolicator != nil) {
+ CFRetain(symbolicator); // pin symbolicator while in java heap
+ }
+
+ putSymbolicator(env, this_obj, symbolicator);
+ if (symbolicator == nil) {
+ THROW_NEW_DEBUGGER_EXCEPTION("Can't attach symbolicator to the process");
+ }
+
+JNF_COCOA_EXIT(env);
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: detach0
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_detach0(JNIEnv *env, jobject this_obj) {
+JNF_COCOA_ENTER(env);
+ if (debug) printf("detach0 called\n");
+
+ task_t gTask = getTask(env, this_obj);
+ mach_port_deallocate(mach_task_self(), gTask);
+ id symbolicator = getSymbolicator(env, this_obj);
+ if (symbolicator != nil) {
+ CFRelease(symbolicator);
+ }
+JNF_COCOA_EXIT(env);
+}
diff --git a/hotspot/agent/src/os/bsd/Makefile b/hotspot/agent/src/os/bsd/Makefile
new file mode 100644
index 00000000000..90085c6ee9e
--- /dev/null
+++ b/hotspot/agent/src/os/bsd/Makefile
@@ -0,0 +1,77 @@
+#
+# Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+#
+
+ARCH := $(shell if ([ `uname -m` = "ia64" ]) ; then echo ia64 ; elif ([ `uname -m` = "amd64" ]) ; then echo amd64; elif ([ `uname -m` = "sparc64" ]) ; then echo sparc; else echo i386 ; fi )
+GCC = gcc
+
+JAVAH = ${JAVA_HOME}/bin/javah
+
+SOURCES = salibelf.c \
+ symtab.c \
+ libproc_impl.c \
+ ps_proc.c \
+ ps_core.c \
+ BsdDebuggerLocal.c
+
+INCLUDES = -I${JAVA_HOME}/include -I${JAVA_HOME}/include/$(shell uname -s | tr "[:upper:]" "[:lower:]")
+
+OBJS = $(SOURCES:.c=.o)
+
+LIBS = -lutil -lthread_db
+
+CFLAGS = -c -fPIC -g -Wall -D_ALLBSD_SOURCE -D_GNU_SOURCE -D$(ARCH) $(INCLUDES)
+
+LIBSA = $(ARCH)/libsaproc.so
+
+all: $(LIBSA)
+
+BsdDebuggerLocal.o: BsdDebuggerLocal.c
+ $(JAVAH) -jni -classpath ../../../../../build/bsd-i586/hotspot/outputdir/bsd_i486_compiler2/generated/saclasses \
+ sun.jvm.hotspot.debugger.x86.X86ThreadContext \
+ sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext
+ $(GCC) $(CFLAGS) $<
+
+.c.obj:
+ $(GCC) $(CFLAGS)
+
+ifndef LDNOMAP
+ LFLAGS_LIBSA = -Xlinker --version-script=mapfile
+endif
+
+$(LIBSA): $(OBJS) mapfile
+ if [ ! -d $(ARCH) ] ; then mkdir $(ARCH) ; fi
+ $(GCC) -shared $(LFLAGS_LIBSA) -o $(LIBSA) $(OBJS) $(LIBS)
+
+test.o: $(LIBSA) test.c
+ $(GCC) -c -o test.o -g -D_GNU_SOURCE -D$(ARCH) $(INCLUDES) test.c
+
+test: test.o
+ $(GCC) -o test test.o -L$(ARCH) -lsaproc $(LIBS)
+
+clean:
+ rm -f $(LIBSA)
+ rm -f $(OBJS)
+ rm -f test.o
+ -rmdir $(ARCH)
+
diff --git a/hotspot/agent/src/os/bsd/StubDebuggerLocal.c b/hotspot/agent/src/os/bsd/StubDebuggerLocal.c
new file mode 100644
index 00000000000..bce0babff57
--- /dev/null
+++ b/hotspot/agent/src/os/bsd/StubDebuggerLocal.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include
+#include
+
+#define CHECK_EXCEPTION_(value) if ((*env)->ExceptionOccurred(env)) { return value; }
+#define CHECK_EXCEPTION if ((*env)->ExceptionOccurred(env)) { return;}
+#define THROW_NEW_DEBUGGER_EXCEPTION_(str, value) { throw_new_debugger_exception(env, str); return value; }
+#define THROW_NEW_DEBUGGER_EXCEPTION(str) { throw_new_debugger_exception(env, str); return;}
+
+static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) {
+ (*env)->ThrowNew(env, (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"), errMsg);
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: init0
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0
+ (JNIEnv *env, jclass cls) {
+}
+
+JNIEXPORT jint JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getAddressSize
+ (JNIEnv *env, jclass cls)
+{
+#ifdef _LP64
+ return 8;
+#else
+ return 4;
+#endif
+
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: attach0
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__I
+ (JNIEnv *env, jobject this_obj, jint jpid) {
+
+ THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process");
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: attach0
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2
+ (JNIEnv *env, jobject this_obj, jstring execName, jstring coreName) {
+ THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the core file");
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: detach0
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_detach0
+ (JNIEnv *env, jobject this_obj) {
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: lookupByName0
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByName0
+ (JNIEnv *env, jobject this_obj, jstring objectName, jstring symbolName) {
+ return 0;
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: lookupByAddress0
+ * Signature: (J)Lsun/jvm/hotspot/debugger/cdbg/ClosestSymbol;
+ */
+JNIEXPORT jobject JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByAddress0
+ (JNIEnv *env, jobject this_obj, jlong addr) {
+ return 0;
+}
+
+/*
+ * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
+ * Method: readBytesFromProcess0
+ * Signature: (JJ)Lsun/jvm/hotspot/debugger/ReadResult;
+ */
+JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0
+ (JNIEnv *env, jobject this_obj, jlong addr, jlong numBytes) {
+ return 0;
+}
+
+JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0
+ (JNIEnv *env, jobject this_obj, jint lwp_id) {
+ return 0;
+}
diff --git a/hotspot/agent/src/os/win32/procList.hpp b/hotspot/agent/src/os/bsd/elfmacros.h
similarity index 57%
rename from hotspot/agent/src/os/win32/procList.hpp
rename to hotspot/agent/src/os/bsd/elfmacros.h
index 962c7b276c5..0d089c2cad6 100644
--- a/hotspot/agent/src/os/win32/procList.hpp
+++ b/hotspot/agent/src/os/bsd/elfmacros.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,34 +22,37 @@
*
*/
-#ifndef _PROCLIST_
-#define _PROCLIST_
+#ifndef _ELFMACROS_H_
+#define _ELFMACROS_H_
-#include
-#include
+#define ELF_NHDR Elf_Note
-class ProcEntry {
-public:
- /** name may not be NULL */
- ProcEntry(ULONG pid, USHORT nameLength, wchar_t* name);
- ProcEntry(ULONG pid, USHORT nameLength, char* name);
- ~ProcEntry();
- ProcEntry(const ProcEntry& arg);
- ProcEntry& operator=(const ProcEntry& arg);
+#if defined(_LP64)
+#define ELF_EHDR Elf64_Ehdr
+#define ELF_SHDR Elf64_Shdr
+#define ELF_PHDR Elf64_Phdr
+#define ELF_SYM Elf64_Sym
+#define ELF_DYN Elf64_Dyn
+#define ELF_ADDR Elf64_Addr
- ULONG getPid();
- /** Returns number of WCHAR characters in getName() */
- USHORT getNameLength();
- WCHAR* getName();
+#ifndef ELF_ST_TYPE
+#define ELF_ST_TYPE ELF64_ST_TYPE
+#endif
-private:
- ULONG pid;
- USHORT nameLength;
- WCHAR* name;
- void copyFrom(const ProcEntry& arg);
-};
+#else
-typedef std::vector ProcEntryList;
-void procList(ProcEntryList& processes);
+#define ELF_EHDR Elf32_Ehdr
+#define ELF_SHDR Elf32_Shdr
+#define ELF_PHDR Elf32_Phdr
+#define ELF_SYM Elf32_Sym
+#define ELF_DYN Elf32_Dyn
+#define ELF_ADDR Elf32_Addr
-#endif // #defined _PROCLIST_
+#ifndef ELF_ST_TYPE
+#define ELF_ST_TYPE ELF32_ST_TYPE
+#endif
+
+#endif
+
+
+#endif /* _ELFMACROS_H_ */
diff --git a/hotspot/agent/src/os/bsd/libproc.h b/hotspot/agent/src/os/bsd/libproc.h
new file mode 100644
index 00000000000..74bb84c1760
--- /dev/null
+++ b/hotspot/agent/src/os/bsd/libproc.h
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef _LIBPROC_H_
+#define _LIBPROC_H_
+
+#include
+#include
+#include
+#include
+
+#if defined(sparc) || defined(sparcv9)
+/*
+ If _LP64 is defined ptrace.h should be taken from /usr/include/asm-sparc64
+ otherwise it should be from /usr/include/asm-sparc
+ These two files define pt_regs structure differently
+*/
+#ifdef _LP64
+#include "asm-sparc64/ptrace.h"
+#else
+#include "asm-sparc/ptrace.h"
+#endif
+
+#endif //sparc or sparcv9
+
+/************************************************************************************
+
+0. This is very minimal subset of Solaris libproc just enough for current application.
+Please note that the bulk of the functionality is from proc_service interface. This
+adds Pgrab__ and some missing stuff. We hide the difference b/w live process and core
+file by this interface.
+
+1. pthread_id is unique. We store this in OSThread::_pthread_id in JVM code.
+
+2. All threads see the same pid when they call getpid().
+We used to save the result of ::getpid() call in OSThread::_thread_id.
+Because gettid returns actual pid of thread (lwp id), this is
+unique again. We therefore use OSThread::_thread_id as unique identifier.
+
+3. There is a unique LWP id under both thread libraries. libthread_db maps pthread_id
+to its underlying lwp_id under both the thread libraries. thread_info.lwp_id stores
+lwp_id of the thread. The lwp id is nothing but the actual pid of clone'd processes. But
+unfortunately libthread_db does not work very well for core dumps. So, we get pthread_id
+only for processes. For core dumps, we don't use libthread_db at all (like gdb).
+
+4. ptrace operates on this LWP id under both the thread libraries. When we say 'pid' for
+ptrace call, we refer to lwp_id of the thread.
+
+5. for core file, we parse ELF files and read data from them. For processes we use
+combination of ptrace and /proc calls.
+
+*************************************************************************************/
+
+// This C bool type must be int for compatibility with BSD calls and
+// it would be a mistake to equivalence it to C++ bool on many platforms
+
+typedef int bool;
+#define true 1
+#define false 0
+
+struct ps_prochandle;
+
+// attach to a process
+struct ps_prochandle* Pgrab(pid_t pid);
+
+// attach to a core dump
+struct ps_prochandle* Pgrab_core(const char* execfile, const char* corefile);
+
+// release a process or core
+void Prelease(struct ps_prochandle* ph);
+
+// functions not directly available in Solaris libproc
+
+// initialize libproc (call this only once per app)
+// pass true to make library verbose
+bool init_libproc(bool verbose);
+
+// get number of threads
+int get_num_threads(struct ps_prochandle* ph);
+
+// get lwp_id of n'th thread
+lwpid_t get_lwp_id(struct ps_prochandle* ph, int index);
+
+// get regs for a given lwp
+bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lid, struct reg* regs);
+
+// get number of shared objects
+int get_num_libs(struct ps_prochandle* ph);
+
+// get name of n'th lib
+const char* get_lib_name(struct ps_prochandle* ph, int index);
+
+// get base of lib
+uintptr_t get_lib_base(struct ps_prochandle* ph, int index);
+
+// returns true if given library is found in lib list
+bool find_lib(struct ps_prochandle* ph, const char *lib_name);
+
+// symbol lookup
+uintptr_t lookup_symbol(struct ps_prochandle* ph, const char* object_name,
+ const char* sym_name);
+
+// address->nearest symbol lookup. return NULL for no symbol
+const char* symbol_for_pc(struct ps_prochandle* ph, uintptr_t addr, uintptr_t* poffset);
+
+#endif //__LIBPROC_H_
diff --git a/hotspot/agent/src/os/bsd/libproc_impl.c b/hotspot/agent/src/os/bsd/libproc_impl.c
new file mode 100644
index 00000000000..4f2d2822ea8
--- /dev/null
+++ b/hotspot/agent/src/os/bsd/libproc_impl.c
@@ -0,0 +1,452 @@
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include
+#include
+#include
+#include
+#include
+#include
+#include "libproc_impl.h"
+
+static const char* alt_root = NULL;
+static int alt_root_len = -1;
+
+#define SA_ALTROOT "SA_ALTROOT"
+
+static void init_alt_root() {
+ if (alt_root_len == -1) {
+ alt_root = getenv(SA_ALTROOT);
+ if (alt_root) {
+ alt_root_len = strlen(alt_root);
+ } else {
+ alt_root_len = 0;
+ }
+ }
+}
+
+int pathmap_open(const char* name) {
+ int fd;
+ char alt_path[PATH_MAX + 1];
+
+ init_alt_root();
+ fd = open(name, O_RDONLY);
+ if (fd >= 0) {
+ return fd;
+ }
+
+ if (alt_root_len > 0) {
+ strcpy(alt_path, alt_root);
+ strcat(alt_path, name);
+ fd = open(alt_path, O_RDONLY);
+ if (fd >= 0) {
+ print_debug("path %s substituted for %s\n", alt_path, name);
+ return fd;
+ }
+
+ if (strrchr(name, '/')) {
+ strcpy(alt_path, alt_root);
+ strcat(alt_path, strrchr(name, '/'));
+ fd = open(alt_path, O_RDONLY);
+ if (fd >= 0) {
+ print_debug("path %s substituted for %s\n", alt_path, name);
+ return fd;
+ }
+ }
+ }
+
+ return -1;
+}
+
+static bool _libsaproc_debug;
+
+void print_debug(const char* format,...) {
+ if (_libsaproc_debug) {
+ va_list alist;
+
+ va_start(alist, format);
+ fputs("libsaproc DEBUG: ", stderr);
+ vfprintf(stderr, format, alist);
+ va_end(alist);
+ }
+}
+
+bool is_debug() {
+ return _libsaproc_debug;
+}
+
+// initialize libproc
+bool init_libproc(bool debug) {
+ // init debug mode
+ _libsaproc_debug = debug;
+
+ // initialize the thread_db library
+ if (td_init() != TD_OK) {
+ print_debug("libthread_db's td_init failed\n");
+ return false;
+ }
+
+ return true;
+}
+
+static void destroy_lib_info(struct ps_prochandle* ph) {
+ lib_info* lib = ph->libs;
+ while (lib) {
+ lib_info *next = lib->next;
+ if (lib->symtab) {
+ destroy_symtab(lib->symtab);
+ }
+ free(lib);
+ lib = next;
+ }
+}
+
+static void destroy_thread_info(struct ps_prochandle* ph) {
+ thread_info* thr = ph->threads;
+ while (thr) {
+ thread_info *next = thr->next;
+ free(thr);
+ thr = next;
+ }
+}
+
+// ps_prochandle cleanup
+
+// ps_prochandle cleanup
+void Prelease(struct ps_prochandle* ph) {
+ // do the "derived class" clean-up first
+ ph->ops->release(ph);
+ destroy_lib_info(ph);
+ destroy_thread_info(ph);
+ free(ph);
+}
+
+lib_info* add_lib_info(struct ps_prochandle* ph, const char* libname, uintptr_t base) {
+ return add_lib_info_fd(ph, libname, -1, base);
+}
+
+lib_info* add_lib_info_fd(struct ps_prochandle* ph, const char* libname, int fd, uintptr_t base) {
+ lib_info* newlib;
+
+ if ( (newlib = (lib_info*) calloc(1, sizeof(struct lib_info))) == NULL) {
+ print_debug("can't allocate memory for lib_info\n");
+ return NULL;
+ }
+
+ strncpy(newlib->name, libname, sizeof(newlib->name));
+ newlib->base = base;
+
+ if (fd == -1) {
+ if ( (newlib->fd = pathmap_open(newlib->name)) < 0) {
+ print_debug("can't open shared object %s\n", newlib->name);
+ free(newlib);
+ return NULL;
+ }
+ } else {
+ newlib->fd = fd;
+ }
+
+ // check whether we have got an ELF file. /proc//map
+ // gives out all file mappings and not just shared objects
+ if (is_elf_file(newlib->fd) == false) {
+ close(newlib->fd);
+ free(newlib);
+ return NULL;
+ }
+
+ newlib->symtab = build_symtab(newlib->fd);
+ if (newlib->symtab == NULL) {
+ print_debug("symbol table build failed for %s\n", newlib->name);
+ }
+ else {
+ print_debug("built symbol table for %s\n", newlib->name);
+ }
+
+ // even if symbol table building fails, we add the lib_info.
+ // This is because we may need to read from the ELF file for core file
+ // address read functionality. lookup_symbol checks for NULL symtab.
+ if (ph->libs) {
+ ph->lib_tail->next = newlib;
+ ph->lib_tail = newlib;
+ } else {
+ ph->libs = ph->lib_tail = newlib;
+ }
+ ph->num_libs++;
+
+ return newlib;
+}
+
+// lookup for a specific symbol
+uintptr_t lookup_symbol(struct ps_prochandle* ph, const char* object_name,
+ const char* sym_name) {
+ // ignore object_name. search in all libraries
+ // FIXME: what should we do with object_name?? The library names are obtained
+ // by parsing /proc//maps, which may not be the same as object_name.
+ // What we need is a utility to map object_name to real file name, something
+ // dlopen() does by looking at LD_LIBRARY_PATH and /etc/ld.so.cache. For
+ // now, we just ignore object_name and do a global search for the symbol.
+
+ lib_info* lib = ph->libs;
+ while (lib) {
+ if (lib->symtab) {
+ uintptr_t res = search_symbol(lib->symtab, lib->base, sym_name, NULL);
+ if (res) return res;
+ }
+ lib = lib->next;
+ }
+
+ print_debug("lookup failed for symbol '%s' in obj '%s'\n",
+ sym_name, object_name);
+ return (uintptr_t) NULL;
+}
+
+
+const char* symbol_for_pc(struct ps_prochandle* ph, uintptr_t addr, uintptr_t* poffset) {
+ const char* res = NULL;
+ lib_info* lib = ph->libs;
+ while (lib) {
+ if (lib->symtab && addr >= lib->base) {
+ res = nearest_symbol(lib->symtab, addr - lib->base, poffset);
+ if (res) return res;
+ }
+ lib = lib->next;
+ }
+ return NULL;
+}
+
+// add a thread to ps_prochandle
+thread_info* add_thread_info(struct ps_prochandle* ph, pthread_t pthread_id, lwpid_t lwp_id) {
+ thread_info* newthr;
+ if ( (newthr = (thread_info*) calloc(1, sizeof(thread_info))) == NULL) {
+ print_debug("can't allocate memory for thread_info\n");
+ return NULL;
+ }
+
+ // initialize thread info
+ newthr->pthread_id = pthread_id;
+ newthr->lwp_id = lwp_id;
+
+ // add new thread to the list
+ newthr->next = ph->threads;
+ ph->threads = newthr;
+ ph->num_threads++;
+ return newthr;
+}
+
+
+// struct used for client data from thread_db callback
+struct thread_db_client_data {
+ struct ps_prochandle* ph;
+ thread_info_callback callback;
+};
+
+// callback function for libthread_db
+static int thread_db_callback(const td_thrhandle_t *th_p, void *data) {
+ struct thread_db_client_data* ptr = (struct thread_db_client_data*) data;
+ td_thrinfo_t ti;
+ td_err_e err;
+
+ memset(&ti, 0, sizeof(ti));
+ err = td_thr_get_info(th_p, &ti);
+ if (err != TD_OK) {
+ print_debug("libthread_db : td_thr_get_info failed, can't get thread info\n");
+ return err;
+ }
+
+ print_debug("thread_db : pthread %d (lwp %d)\n", ti.ti_tid, ti.ti_lid);
+
+ if (ptr->callback(ptr->ph, (pthread_t)ti.ti_tid, ti.ti_lid) != true)
+ return TD_ERR;
+
+ return TD_OK;
+}
+
+// read thread_info using libthread_db
+bool read_thread_info(struct ps_prochandle* ph, thread_info_callback cb) {
+ struct thread_db_client_data mydata;
+ td_thragent_t* thread_agent = NULL;
+ if (td_ta_new(ph, &thread_agent) != TD_OK) {
+ print_debug("can't create libthread_db agent\n");
+ return false;
+ }
+
+ mydata.ph = ph;
+ mydata.callback = cb;
+
+ // we use libthread_db iterator to iterate thru list of threads.
+ if (td_ta_thr_iter(thread_agent, thread_db_callback, &mydata,
+ TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
+ TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS) != TD_OK) {
+ td_ta_delete(thread_agent);
+ return false;
+ }
+
+ // delete thread agent
+ td_ta_delete(thread_agent);
+ return true;
+}
+
+
+// get number of threads
+int get_num_threads(struct ps_prochandle* ph) {
+ return ph->num_threads;
+}
+
+// get lwp_id of n'th thread
+lwpid_t get_lwp_id(struct ps_prochandle* ph, int index) {
+ int count = 0;
+ thread_info* thr = ph->threads;
+ while (thr) {
+ if (count == index) {
+ return thr->lwp_id;
+ }
+ count++;
+ thr = thr->next;
+ }
+ return -1;
+}
+
+// get regs for a given lwp
+bool get_lwp_regs(struct ps_prochandle* ph, lwpid_t lwp_id, struct reg* regs) {
+ return ph->ops->get_lwp_regs(ph, lwp_id, regs);
+}
+
+// get number of shared objects
+int get_num_libs(struct ps_prochandle* ph) {
+ return ph->num_libs;
+}
+
+// get name of n'th solib
+const char* get_lib_name(struct ps_prochandle* ph, int index) {
+ int count = 0;
+ lib_info* lib = ph->libs;
+ while (lib) {
+ if (count == index) {
+ return lib->name;
+ }
+ count++;
+ lib = lib->next;
+ }
+ return NULL;
+}
+
+// get base address of a lib
+uintptr_t get_lib_base(struct ps_prochandle* ph, int index) {
+ int count = 0;
+ lib_info* lib = ph->libs;
+ while (lib) {
+ if (count == index) {
+ return lib->base;
+ }
+ count++;
+ lib = lib->next;
+ }
+ return (uintptr_t)NULL;
+}
+
+bool find_lib(struct ps_prochandle* ph, const char *lib_name) {
+ lib_info *p = ph->libs;
+ while (p) {
+ if (strcmp(p->name, lib_name) == 0) {
+ return true;
+ }
+ p = p->next;
+ }
+ return false;
+}
+
+//--------------------------------------------------------------------------
+// proc service functions
+
+// ps_pglobal_lookup() looks up the symbol sym_name in the symbol table
+// of the load object object_name in the target process identified by ph.
+// It returns the symbol's value as an address in the target process in
+// *sym_addr.
+
+ps_err_e ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name,
+ const char *sym_name, psaddr_t *sym_addr) {
+ *sym_addr = (psaddr_t) lookup_symbol(ph, object_name, sym_name);
+ return (*sym_addr ? PS_OK : PS_NOSYM);
+}
+
+// read "size" bytes info "buf" from address "addr"
+ps_err_e ps_pread(struct ps_prochandle *ph, psaddr_t addr,
+ void *buf, size_t size) {
+ return ph->ops->p_pread(ph, (uintptr_t) addr, buf, size)? PS_OK: PS_ERR;
+}
+
+// write "size" bytes of data to debuggee at address "addr"
+ps_err_e ps_pwrite(struct ps_prochandle *ph, psaddr_t addr,
+ const void *buf, size_t size) {
+ return ph->ops->p_pwrite(ph, (uintptr_t)addr, buf, size)? PS_OK: PS_ERR;
+}
+
+// fill in ptrace_lwpinfo for lid
+ps_err_e ps_linfo(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo) {
+ return ph->ops->get_lwp_info(ph, lwp_id, linfo)? PS_OK: PS_ERR;
+}
+
+// needed for when libthread_db is compiled with TD_DEBUG defined
+void
+ps_plog (const char *format, ...)
+{
+ va_list alist;
+
+ va_start(alist, format);
+ vfprintf(stderr, format, alist);
+ va_end(alist);
+}
+
+// ------------------------------------------------------------------------
+// Functions below this point are not yet implemented. They are here only
+// to make the linker happy.
+
+ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs) {
+ print_debug("ps_lsetfpregs not implemented\n");
+ return PS_OK;
+}
+
+ps_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid, const prgregset_t gregset) {
+ print_debug("ps_lsetregs not implemented\n");
+ return PS_OK;
+}
+
+ps_err_e ps_lgetfpregs(struct ps_prochandle *ph, lwpid_t lid, prfpregset_t *fpregs) {
+ print_debug("ps_lgetfpregs not implemented\n");
+ return PS_OK;
+}
+
+ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid, prgregset_t gregset) {
+ print_debug("ps_lgetfpregs not implemented\n");
+ return PS_OK;
+}
+
+ps_err_e ps_lstop(struct ps_prochandle *ph, lwpid_t lid) {
+ print_debug("ps_lstop not implemented\n");
+ return PS_OK;
+}
+
+ps_err_e ps_pcontinue(struct ps_prochandle *ph) {
+ print_debug("ps_pcontinue not implemented\n");
+ return PS_OK;
+}
diff --git a/hotspot/agent/src/os/bsd/libproc_impl.h b/hotspot/agent/src/os/bsd/libproc_impl.h
new file mode 100644
index 00000000000..8b9d2331691
--- /dev/null
+++ b/hotspot/agent/src/os/bsd/libproc_impl.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef _LIBPROC_IMPL_H_
+#define _LIBPROC_IMPL_H_
+
+#include
+#include
+#include "libproc.h"
+#include "symtab.h"
+
+// data structures in this file mimic those of Solaris 8.0 - libproc's Pcontrol.h
+
+#define BUF_SIZE (PATH_MAX + NAME_MAX + 1)
+
+// list of shared objects
+typedef struct lib_info {
+ char name[BUF_SIZE];
+ uintptr_t base;
+ struct symtab* symtab;
+ int fd; // file descriptor for lib
+ struct lib_info* next;
+} lib_info;
+
+// list of threads
+typedef struct thread_info {
+ lwpid_t lwp_id;
+ pthread_t pthread_id; // not used cores, always -1
+ struct reg regs; // not for process, core uses for caching regset
+ struct thread_info* next;
+} thread_info;
+
+// list of virtual memory maps
+typedef struct map_info {
+ int fd; // file descriptor
+ off_t offset; // file offset of this mapping
+ uintptr_t vaddr; // starting virtual address
+ size_t memsz; // size of the mapping
+ struct map_info* next;
+} map_info;
+
+// vtable for ps_prochandle
+typedef struct ps_prochandle_ops {
+ // "derived class" clean-up
+ void (*release)(struct ps_prochandle* ph);
+ // read from debuggee
+ bool (*p_pread)(struct ps_prochandle *ph,
+ uintptr_t addr, char *buf, size_t size);
+ // write into debuggee
+ bool (*p_pwrite)(struct ps_prochandle *ph,
+ uintptr_t addr, const char *buf , size_t size);
+ // get integer regset of a thread
+ bool (*get_lwp_regs)(struct ps_prochandle* ph, lwpid_t lwp_id, struct reg* regs);
+ // get info on thread
+ bool (*get_lwp_info)(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo);
+} ps_prochandle_ops;
+
+// the ps_prochandle
+
+struct core_data {
+ int core_fd; // file descriptor of core file
+ int exec_fd; // file descriptor of exec file
+ int interp_fd; // file descriptor of interpreter (ld-elf.so.1)
+ // part of the class sharing workaround
+ int classes_jsa_fd; // file descriptor of class share archive
+ uintptr_t dynamic_addr; // address of dynamic section of a.out
+ uintptr_t ld_base_addr; // base address of ld.so
+ size_t num_maps; // number of maps.
+ map_info* maps; // maps in a linked list
+ // part of the class sharing workaround
+ map_info* class_share_maps;// class share maps in a linked list
+ map_info** map_array; // sorted (by vaddr) array of map_info pointers
+};
+
+struct ps_prochandle {
+ ps_prochandle_ops* ops; // vtable ptr
+ pid_t pid;
+ int num_libs;
+ lib_info* libs; // head of lib list
+ lib_info* lib_tail; // tail of lib list - to append at the end
+ int num_threads;
+ thread_info* threads; // head of thread list
+ struct core_data* core; // data only used for core dumps, NULL for process
+};
+
+int pathmap_open(const char* name);
+
+void print_debug(const char* format,...);
+bool is_debug();
+
+typedef bool (*thread_info_callback)(struct ps_prochandle* ph, pthread_t pid, lwpid_t lwpid);
+
+// reads thread info using libthread_db and calls above callback for each thread
+bool read_thread_info(struct ps_prochandle* ph, thread_info_callback cb);
+
+// adds a new shared object to lib list, returns NULL on failure
+lib_info* add_lib_info(struct ps_prochandle* ph, const char* libname, uintptr_t base);
+
+// adds a new shared object to lib list, supply open lib file descriptor as well
+lib_info* add_lib_info_fd(struct ps_prochandle* ph, const char* libname, int fd,
+ uintptr_t base);
+
+// adds a new thread to threads list, returns NULL on failure
+thread_info* add_thread_info(struct ps_prochandle* ph, pthread_t pthread_id, lwpid_t lwp_id);
+
+// a test for ELF signature without using libelf
+bool is_elf_file(int fd);
+
+#endif //_LIBPROC_IMPL_H_
diff --git a/hotspot/agent/src/os/bsd/mapfile b/hotspot/agent/src/os/bsd/mapfile
new file mode 100644
index 00000000000..36b4334f03b
--- /dev/null
+++ b/hotspot/agent/src/os/bsd/mapfile
@@ -0,0 +1,66 @@
+#
+
+#
+# Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+#
+
+# Define public interface.
+
+SUNWprivate_1.1 {
+ global:
+
+ # native methods of BsdDebuggerLocal class
+ Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0;
+ Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getAddressSize;
+ Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__I;
+ Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2;
+ Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_detach0;
+ Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByName0;
+ Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByAddress0;
+ Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0;
+ Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0;
+
+ # proc_service.h functions - to be used by libthread_db
+ ps_getpid;
+ ps_pglobal_lookup;
+ ps_pread;
+ ps_pwrite;
+ ps_lsetfpregs;
+ ps_lsetregs;
+ ps_lgetfpregs;
+ ps_lgetregs;
+ ps_lcontinue;
+ ps_lgetxmmregs;
+ ps_lsetxmmregs;
+ ps_lstop;
+ ps_linfo;
+
+ # used by attach test program
+ init_libproc;
+ Pgrab;
+ Pgrab_core;
+ Prelease;
+
+ local:
+ *;
+};
diff --git a/hotspot/agent/src/os/bsd/ps_core.c b/hotspot/agent/src/os/bsd/ps_core.c
new file mode 100644
index 00000000000..4e2049b2219
--- /dev/null
+++ b/hotspot/agent/src/os/bsd/ps_core.c
@@ -0,0 +1,1023 @@
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "libproc_impl.h"
+#include "salibelf.h"
+
+// This file has the libproc implementation to read core files.
+// For live processes, refer to ps_proc.c. Portions of this is adapted
+// /modelled after Solaris libproc.so (in particular Pcore.c)
+
+//----------------------------------------------------------------------
+// ps_prochandle cleanup helper functions
+
+// close all file descriptors
+static void close_elf_files(struct ps_prochandle* ph) {
+ lib_info* lib = NULL;
+
+ // close core file descriptor
+ if (ph->core->core_fd >= 0)
+ close(ph->core->core_fd);
+
+ // close exec file descriptor
+ if (ph->core->exec_fd >= 0)
+ close(ph->core->exec_fd);
+
+ // close interp file descriptor
+ if (ph->core->interp_fd >= 0)
+ close(ph->core->interp_fd);
+
+ // close class share archive file
+ if (ph->core->classes_jsa_fd >= 0)
+ close(ph->core->classes_jsa_fd);
+
+ // close all library file descriptors
+ lib = ph->libs;
+ while (lib) {
+ int fd = lib->fd;
+ if (fd >= 0 && fd != ph->core->exec_fd) close(fd);
+ lib = lib->next;
+ }
+}
+
+// clean all map_info stuff
+static void destroy_map_info(struct ps_prochandle* ph) {
+ map_info* map = ph->core->maps;
+ while (map) {
+ map_info* next = map->next;
+ free(map);
+ map = next;
+ }
+
+ if (ph->core->map_array) {
+ free(ph->core->map_array);
+ }
+
+ // Part of the class sharing workaround
+ map = ph->core->class_share_maps;
+ while (map) {
+ map_info* next = map->next;
+ free(map);
+ map = next;
+ }
+}
+
+// ps_prochandle operations
+static void core_release(struct ps_prochandle* ph) {
+ if (ph->core) {
+ close_elf_files(ph);
+ destroy_map_info(ph);
+ free(ph->core);
+ }
+}
+
+static map_info* allocate_init_map(int fd, off_t offset, uintptr_t vaddr, size_t memsz) {
+ map_info* map;
+ if ( (map = (map_info*) calloc(1, sizeof(map_info))) == NULL) {
+ print_debug("can't allocate memory for map_info\n");
+ return NULL;
+ }
+
+ // initialize map
+ map->fd = fd;
+ map->offset = offset;
+ map->vaddr = vaddr;
+ map->memsz = memsz;
+ return map;
+}
+
+// add map info with given fd, offset, vaddr and memsz
+static map_info* add_map_info(struct ps_prochandle* ph, int fd, off_t offset,
+ uintptr_t vaddr, size_t memsz) {
+ map_info* map;
+ if ((map = allocate_init_map(fd, offset, vaddr, memsz)) == NULL) {
+ return NULL;
+ }
+
+ // add this to map list
+ map->next = ph->core->maps;
+ ph->core->maps = map;
+ ph->core->num_maps++;
+
+ return map;
+}
+
+// Part of the class sharing workaround
+static map_info* add_class_share_map_info(struct ps_prochandle* ph, off_t offset,
+ uintptr_t vaddr, size_t memsz) {
+ map_info* map;
+ if ((map = allocate_init_map(ph->core->classes_jsa_fd,
+ offset, vaddr, memsz)) == NULL) {
+ return NULL;
+ }
+
+ map->next = ph->core->class_share_maps;
+ ph->core->class_share_maps = map;
+ return map;
+}
+
+// Return the map_info for the given virtual address. We keep a sorted
+// array of pointers in ph->map_array, so we can binary search.
+static map_info* core_lookup(struct ps_prochandle *ph, uintptr_t addr)
+{
+ int mid, lo = 0, hi = ph->core->num_maps - 1;
+ map_info *mp;
+
+ while (hi - lo > 1) {
+ mid = (lo + hi) / 2;
+ if (addr >= ph->core->map_array[mid]->vaddr)
+ lo = mid;
+ else
+ hi = mid;
+ }
+
+ if (addr < ph->core->map_array[hi]->vaddr)
+ mp = ph->core->map_array[lo];
+ else
+ mp = ph->core->map_array[hi];
+
+ if (addr >= mp->vaddr && addr < mp->vaddr + mp->memsz)
+ return (mp);
+
+
+ // Part of the class sharing workaround
+ // Unfortunately, we have no way of detecting -Xshare state.
+ // Check out the share maps atlast, if we don't find anywhere.
+ // This is done this way so to avoid reading share pages
+ // ahead of other normal maps. For eg. with -Xshare:off we don't
+ // want to prefer class sharing data to data from core.
+ mp = ph->core->class_share_maps;
+ if (mp) {
+ print_debug("can't locate map_info at 0x%lx, trying class share maps\n",
+ addr);
+ }
+ while (mp) {
+ if (addr >= mp->vaddr && addr < mp->vaddr + mp->memsz) {
+ print_debug("located map_info at 0x%lx from class share maps\n",
+ addr);
+ return (mp);
+ }
+ mp = mp->next;
+ }
+
+ print_debug("can't locate map_info at 0x%lx\n", addr);
+ return (NULL);
+}
+
+//---------------------------------------------------------------
+// Part of the class sharing workaround:
+//
+// With class sharing, pages are mapped from classes[_g].jsa file.
+// The read-only class sharing pages are mapped as MAP_SHARED,
+// PROT_READ pages. These pages are not dumped into core dump.
+// With this workaround, these pages are read from classes[_g].jsa.
+
+// FIXME: !HACK ALERT!
+// The format of sharing achive file header is needed to read shared heap
+// file mappings. For now, I am hard coding portion of FileMapHeader here.
+// Refer to filemap.hpp.
+
+// FileMapHeader describes the shared space data in the file to be
+// mapped. This structure gets written to a file. It is not a class,
+// so that the compilers don't add any compiler-private data to it.
+
+// Refer to CompactingPermGenGen::n_regions in compactingPermGenGen.hpp
+#define NUM_SHARED_MAPS 4
+
+// Refer to FileMapInfo::_current_version in filemap.hpp
+#define CURRENT_ARCHIVE_VERSION 1
+
+struct FileMapHeader {
+ int _magic; // identify file type.
+ int _version; // (from enum, above.)
+ size_t _alignment; // how shared archive should be aligned
+
+ struct space_info {
+ int _file_offset; // sizeof(this) rounded to vm page size
+ char* _base; // copy-on-write base address
+ size_t _capacity; // for validity checking
+ size_t _used; // for setting space top on read
+
+ // 4991491 NOTICE These are C++ bool's in filemap.hpp and must match up with
+ // the C type matching the C++ bool type on any given platform. For
+ // Hotspot on BSD we assume the corresponding C type is char but
+ // licensees on BSD versions may need to adjust the type of these fields.
+ char _read_only; // read only space?
+ char _allow_exec; // executable code in space?
+
+ } _space[NUM_SHARED_MAPS]; // was _space[CompactingPermGenGen::n_regions];
+
+ // Ignore the rest of the FileMapHeader. We don't need those fields here.
+};
+
+static bool read_jboolean(struct ps_prochandle* ph, uintptr_t addr, jboolean* pvalue) {
+ jboolean i;
+ if (ps_pread(ph, (psaddr_t) addr, &i, sizeof(i)) == PS_OK) {
+ *pvalue = i;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+static bool read_pointer(struct ps_prochandle* ph, uintptr_t addr, uintptr_t* pvalue) {
+ uintptr_t uip;
+ if (ps_pread(ph, (psaddr_t) addr, &uip, sizeof(uip)) == PS_OK) {
+ *pvalue = uip;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+// used to read strings from debuggee
+static bool read_string(struct ps_prochandle* ph, uintptr_t addr, char* buf, size_t size) {
+ size_t i = 0;
+ char c = ' ';
+
+ while (c != '\0') {
+ if (ps_pread(ph, (psaddr_t) addr, &c, sizeof(char)) != PS_OK)
+ return false;
+ if (i < size - 1)
+ buf[i] = c;
+ else // smaller buffer
+ return false;
+ i++; addr++;
+ }
+
+ buf[i] = '\0';
+ return true;
+}
+
+#define USE_SHARED_SPACES_SYM "UseSharedSpaces"
+// mangled name of Arguments::SharedArchivePath
+#define SHARED_ARCHIVE_PATH_SYM "_ZN9Arguments17SharedArchivePathE"
+
+static bool init_classsharing_workaround(struct ps_prochandle* ph) {
+ lib_info* lib = ph->libs;
+ while (lib != NULL) {
+ // we are iterating over shared objects from the core dump. look for
+ // libjvm[_g].so.
+ const char *jvm_name = 0;
+ if ((jvm_name = strstr(lib->name, "/libjvm.so")) != 0 ||
+ (jvm_name = strstr(lib->name, "/libjvm_g.so")) != 0) {
+ char classes_jsa[PATH_MAX];
+ struct FileMapHeader header;
+ size_t n = 0;
+ int fd = -1, m = 0;
+ uintptr_t base = 0, useSharedSpacesAddr = 0;
+ uintptr_t sharedArchivePathAddrAddr = 0, sharedArchivePathAddr = 0;
+ jboolean useSharedSpaces = 0;
+
+ memset(classes_jsa, 0, sizeof(classes_jsa));
+ jvm_name = lib->name;
+ useSharedSpacesAddr = lookup_symbol(ph, jvm_name, USE_SHARED_SPACES_SYM);
+ if (useSharedSpacesAddr == 0) {
+ print_debug("can't lookup 'UseSharedSpaces' flag\n");
+ return false;
+ }
+
+ // Hotspot vm types are not exported to build this library. So
+ // using equivalent type jboolean to read the value of
+ // UseSharedSpaces which is same as hotspot type "bool".
+ if (read_jboolean(ph, useSharedSpacesAddr, &useSharedSpaces) != true) {
+ print_debug("can't read the value of 'UseSharedSpaces' flag\n");
+ return false;
+ }
+
+ if ((int)useSharedSpaces == 0) {
+ print_debug("UseSharedSpaces is false, assuming -Xshare:off!\n");
+ return true;
+ }
+
+ sharedArchivePathAddrAddr = lookup_symbol(ph, jvm_name, SHARED_ARCHIVE_PATH_SYM);
+ if (sharedArchivePathAddrAddr == 0) {
+ print_debug("can't lookup shared archive path symbol\n");
+ return false;
+ }
+
+ if (read_pointer(ph, sharedArchivePathAddrAddr, &sharedArchivePathAddr) != true) {
+ print_debug("can't read shared archive path pointer\n");
+ return false;
+ }
+
+ if (read_string(ph, sharedArchivePathAddr, classes_jsa, sizeof(classes_jsa)) != true) {
+ print_debug("can't read shared archive path value\n");
+ return false;
+ }
+
+ print_debug("looking for %s\n", classes_jsa);
+ // open the class sharing archive file
+ fd = pathmap_open(classes_jsa);
+ if (fd < 0) {
+ print_debug("can't open %s!\n", classes_jsa);
+ ph->core->classes_jsa_fd = -1;
+ return false;
+ } else {
+ print_debug("opened %s\n", classes_jsa);
+ }
+
+ // read FileMapHeader from the file
+ memset(&header, 0, sizeof(struct FileMapHeader));
+ if ((n = read(fd, &header, sizeof(struct FileMapHeader)))
+ != sizeof(struct FileMapHeader)) {
+ print_debug("can't read shared archive file map header from %s\n", classes_jsa);
+ close(fd);
+ return false;
+ }
+
+ // check file magic
+ if (header._magic != 0xf00baba2) {
+ print_debug("%s has bad shared archive file magic number 0x%x, expecing 0xf00baba2\n",
+ classes_jsa, header._magic);
+ close(fd);
+ return false;
+ }
+
+ // check version
+ if (header._version != CURRENT_ARCHIVE_VERSION) {
+ print_debug("%s has wrong shared archive file version %d, expecting %d\n",
+ classes_jsa, header._version, CURRENT_ARCHIVE_VERSION);
+ close(fd);
+ return false;
+ }
+
+ ph->core->classes_jsa_fd = fd;
+ // add read-only maps from classes[_g].jsa to the list of maps
+ for (m = 0; m < NUM_SHARED_MAPS; m++) {
+ if (header._space[m]._read_only) {
+ base = (uintptr_t) header._space[m]._base;
+ // no need to worry about the fractional pages at-the-end.
+ // possible fractional pages are handled by core_read_data.
+ add_class_share_map_info(ph, (off_t) header._space[m]._file_offset,
+ base, (size_t) header._space[m]._used);
+ print_debug("added a share archive map at 0x%lx\n", base);
+ }
+ }
+ return true;
+ }
+ lib = lib->next;
+ }
+ return true;
+}
+
+
+//---------------------------------------------------------------------------
+// functions to handle map_info
+
+// Order mappings based on virtual address. We use this function as the
+// callback for sorting the array of map_info pointers.
+static int core_cmp_mapping(const void *lhsp, const void *rhsp)
+{
+ const map_info *lhs = *((const map_info **)lhsp);
+ const map_info *rhs = *((const map_info **)rhsp);
+
+ if (lhs->vaddr == rhs->vaddr)
+ return (0);
+
+ return (lhs->vaddr < rhs->vaddr ? -1 : 1);
+}
+
+// we sort map_info by starting virtual address so that we can do
+// binary search to read from an address.
+static bool sort_map_array(struct ps_prochandle* ph) {
+ size_t num_maps = ph->core->num_maps;
+ map_info* map = ph->core->maps;
+ int i = 0;
+
+ // allocate map_array
+ map_info** array;
+ if ( (array = (map_info**) malloc(sizeof(map_info*) * num_maps)) == NULL) {
+ print_debug("can't allocate memory for map array\n");
+ return false;
+ }
+
+ // add maps to array
+ while (map) {
+ array[i] = map;
+ i++;
+ map = map->next;
+ }
+
+ // sort is called twice. If this is second time, clear map array
+ if (ph->core->map_array) free(ph->core->map_array);
+ ph->core->map_array = array;
+ // sort the map_info array by base virtual address.
+ qsort(ph->core->map_array, ph->core->num_maps, sizeof (map_info*),
+ core_cmp_mapping);
+
+ // print map
+ if (is_debug()) {
+ int j = 0;
+ print_debug("---- sorted virtual address map ----\n");
+ for (j = 0; j < ph->core->num_maps; j++) {
+ print_debug("base = 0x%lx\tsize = %d\n", ph->core->map_array[j]->vaddr,
+ ph->core->map_array[j]->memsz);
+ }
+ }
+
+ return true;
+}
+
+#ifndef MIN
+#define MIN(x, y) (((x) < (y))? (x): (y))
+#endif
+
+static bool core_read_data(struct ps_prochandle* ph, uintptr_t addr, char *buf, size_t size) {
+ ssize_t resid = size;
+ int page_size=sysconf(_SC_PAGE_SIZE);
+ while (resid != 0) {
+ map_info *mp = core_lookup(ph, addr);
+ uintptr_t mapoff;
+ ssize_t len, rem;
+ off_t off;
+ int fd;
+
+ if (mp == NULL)
+ break; /* No mapping for this address */
+
+ fd = mp->fd;
+ mapoff = addr - mp->vaddr;
+ len = MIN(resid, mp->memsz - mapoff);
+ off = mp->offset + mapoff;
+
+ if ((len = pread(fd, buf, len, off)) <= 0)
+ break;
+
+ resid -= len;
+ addr += len;
+ buf = (char *)buf + len;
+
+ // mappings always start at page boundary. But, may end in fractional
+ // page. fill zeros for possible fractional page at the end of a mapping.
+ rem = mp->memsz % page_size;
+ if (rem > 0) {
+ rem = page_size - rem;
+ len = MIN(resid, rem);
+ resid -= len;
+ addr += len;
+ // we are not assuming 'buf' to be zero initialized.
+ memset(buf, 0, len);
+ buf += len;
+ }
+ }
+
+ if (resid) {
+ print_debug("core read failed for %d byte(s) @ 0x%lx (%d more bytes)\n",
+ size, addr, resid);
+ return false;
+ } else {
+ return true;
+ }
+}
+
+// null implementation for write
+static bool core_write_data(struct ps_prochandle* ph,
+ uintptr_t addr, const char *buf , size_t size) {
+ return false;
+}
+
+static bool core_get_lwp_regs(struct ps_prochandle* ph, lwpid_t lwp_id,
+ struct reg* regs) {
+ // for core we have cached the lwp regs from NOTE section
+ thread_info* thr = ph->threads;
+ while (thr) {
+ if (thr->lwp_id == lwp_id) {
+ memcpy(regs, &thr->regs, sizeof(struct reg));
+ return true;
+ }
+ thr = thr->next;
+ }
+ return false;
+}
+
+static bool core_get_lwp_info(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo) {
+ print_debug("core_get_lwp_info not implemented\n");
+ return false;
+}
+
+static ps_prochandle_ops core_ops = {
+ .release= core_release,
+ .p_pread= core_read_data,
+ .p_pwrite= core_write_data,
+ .get_lwp_regs= core_get_lwp_regs,
+ .get_lwp_info= core_get_lwp_info
+};
+
+// read regs and create thread from NT_PRSTATUS entries from core file
+static bool core_handle_prstatus(struct ps_prochandle* ph, const char* buf, size_t nbytes) {
+ // we have to read prstatus_t from buf
+ // assert(nbytes == sizeof(prstaus_t), "size mismatch on prstatus_t");
+ prstatus_t* prstat = (prstatus_t*) buf;
+ thread_info* newthr;
+ print_debug("got integer regset for lwp %d\n", prstat->pr_pid);
+ // we set pthread_t to -1 for core dump
+ if((newthr = add_thread_info(ph, (pthread_t) -1, prstat->pr_pid)) == NULL)
+ return false;
+
+ // copy regs
+ memcpy(&newthr->regs, &prstat->pr_reg, sizeof(struct reg));
+
+ if (is_debug()) {
+ print_debug("integer regset\n");
+#ifdef i386
+ // print the regset
+ print_debug("\teax = 0x%x\n", newthr->regs.r_eax);
+ print_debug("\tebx = 0x%x\n", newthr->regs.r_ebx);
+ print_debug("\tecx = 0x%x\n", newthr->regs.r_ecx);
+ print_debug("\tedx = 0x%x\n", newthr->regs.r_edx);
+ print_debug("\tesp = 0x%x\n", newthr->regs.r_esp);
+ print_debug("\tebp = 0x%x\n", newthr->regs.r_ebp);
+ print_debug("\tesi = 0x%x\n", newthr->regs.r_esi);
+ print_debug("\tedi = 0x%x\n", newthr->regs.r_edi);
+ print_debug("\teip = 0x%x\n", newthr->regs.r_eip);
+#endif
+
+#if defined(amd64) || defined(x86_64)
+ // print the regset
+ print_debug("\tr15 = 0x%lx\n", newthr->regs.r_r15);
+ print_debug("\tr14 = 0x%lx\n", newthr->regs.r_r14);
+ print_debug("\tr13 = 0x%lx\n", newthr->regs.r_r13);
+ print_debug("\tr12 = 0x%lx\n", newthr->regs.r_r12);
+ print_debug("\trbp = 0x%lx\n", newthr->regs.r_rbp);
+ print_debug("\trbx = 0x%lx\n", newthr->regs.r_rbx);
+ print_debug("\tr11 = 0x%lx\n", newthr->regs.r_r11);
+ print_debug("\tr10 = 0x%lx\n", newthr->regs.r_r10);
+ print_debug("\tr9 = 0x%lx\n", newthr->regs.r_r9);
+ print_debug("\tr8 = 0x%lx\n", newthr->regs.r_r8);
+ print_debug("\trax = 0x%lx\n", newthr->regs.r_rax);
+ print_debug("\trcx = 0x%lx\n", newthr->regs.r_rcx);
+ print_debug("\trdx = 0x%lx\n", newthr->regs.r_rdx);
+ print_debug("\trsi = 0x%lx\n", newthr->regs.r_rsi);
+ print_debug("\trdi = 0x%lx\n", newthr->regs.r_rdi);
+ //print_debug("\torig_rax = 0x%lx\n", newthr->regs.orig_rax);
+ print_debug("\trip = 0x%lx\n", newthr->regs.r_rip);
+ print_debug("\tcs = 0x%lx\n", newthr->regs.r_cs);
+ //print_debug("\teflags = 0x%lx\n", newthr->regs.eflags);
+ print_debug("\trsp = 0x%lx\n", newthr->regs.r_rsp);
+ print_debug("\tss = 0x%lx\n", newthr->regs.r_ss);
+ //print_debug("\tfs_base = 0x%lx\n", newthr->regs.fs_base);
+ //print_debug("\tgs_base = 0x%lx\n", newthr->regs.gs_base);
+ //print_debug("\tds = 0x%lx\n", newthr->regs.ds);
+ //print_debug("\tes = 0x%lx\n", newthr->regs.es);
+ //print_debug("\tfs = 0x%lx\n", newthr->regs.fs);
+ //print_debug("\tgs = 0x%lx\n", newthr->regs.gs);
+#endif
+ }
+
+ return true;
+}
+
+#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y))
+
+// read NT_PRSTATUS entries from core NOTE segment
+static bool core_handle_note(struct ps_prochandle* ph, ELF_PHDR* note_phdr) {
+ char* buf = NULL;
+ char* p = NULL;
+ size_t size = note_phdr->p_filesz;
+
+ // we are interested in just prstatus entries. we will ignore the rest.
+ // Advance the seek pointer to the start of the PT_NOTE data
+ if (lseek(ph->core->core_fd, note_phdr->p_offset, SEEK_SET) == (off_t)-1) {
+ print_debug("failed to lseek to PT_NOTE data\n");
+ return false;
+ }
+
+ // Now process the PT_NOTE structures. Each one is preceded by
+ // an Elf{32/64}_Nhdr structure describing its type and size.
+ if ( (buf = (char*) malloc(size)) == NULL) {
+ print_debug("can't allocate memory for reading core notes\n");
+ goto err;
+ }
+
+ // read notes into buffer
+ if (read(ph->core->core_fd, buf, size) != size) {
+ print_debug("failed to read notes, core file must have been truncated\n");
+ goto err;
+ }
+
+ p = buf;
+ while (p < buf + size) {
+ ELF_NHDR* notep = (ELF_NHDR*) p;
+ char* descdata = p + sizeof(ELF_NHDR) + ROUNDUP(notep->n_namesz, 4);
+ print_debug("Note header with n_type = %d and n_descsz = %u\n",
+ notep->n_type, notep->n_descsz);
+
+ if (notep->n_type == NT_PRSTATUS) {
+ if (core_handle_prstatus(ph, descdata, notep->n_descsz) != true)
+ return false;
+ }
+ p = descdata + ROUNDUP(notep->n_descsz, 4);
+ }
+
+ free(buf);
+ return true;
+
+err:
+ if (buf) free(buf);
+ return false;
+}
+
+// read all segments from core file
+static bool read_core_segments(struct ps_prochandle* ph, ELF_EHDR* core_ehdr) {
+ int i = 0;
+ ELF_PHDR* phbuf = NULL;
+ ELF_PHDR* core_php = NULL;
+
+ if ((phbuf = read_program_header_table(ph->core->core_fd, core_ehdr)) == NULL)
+ return false;
+
+ /*
+ * Now iterate through the program headers in the core file.
+ * We're interested in two types of Phdrs: PT_NOTE (which
+ * contains a set of saved /proc structures), and PT_LOAD (which
+ * represents a memory mapping from the process's address space).
+ *
+ * Difference b/w Solaris PT_NOTE and BSD PT_NOTE:
+ *
+ * In Solaris there are two PT_NOTE segments the first PT_NOTE (if present)
+ * contains /proc structs in the pre-2.6 unstructured /proc format. the last
+ * PT_NOTE has data in new /proc format.
+ *
+ * In Solaris, there is only one pstatus (process status). pstatus contains
+ * integer register set among other stuff. For each LWP, we have one lwpstatus
+ * entry that has integer regset for that LWP.
+ *
+ * Linux threads are actually 'clone'd processes. To support core analysis
+ * of "multithreaded" process, Linux creates more than one pstatus (called
+ * "prstatus") entry in PT_NOTE. Each prstatus entry has integer regset for one
+ * "thread". Please refer to Linux kernel src file 'fs/binfmt_elf.c', in particular
+ * function "elf_core_dump".
+ */
+
+ for (core_php = phbuf, i = 0; i < core_ehdr->e_phnum; i++) {
+ switch (core_php->p_type) {
+ case PT_NOTE:
+ if (core_handle_note(ph, core_php) != true) goto err;
+ break;
+
+ case PT_LOAD: {
+ if (core_php->p_filesz != 0) {
+ if (add_map_info(ph, ph->core->core_fd, core_php->p_offset,
+ core_php->p_vaddr, core_php->p_filesz) == NULL) goto err;
+ }
+ break;
+ }
+ }
+
+ core_php++;
+ }
+
+ free(phbuf);
+ return true;
+err:
+ free(phbuf);
+ return false;
+}
+
+// read segments of a shared object
+static bool read_lib_segments(struct ps_prochandle* ph, int lib_fd, ELF_EHDR* lib_ehdr, uintptr_t lib_base) {
+ int i = 0;
+ ELF_PHDR* phbuf;
+ ELF_PHDR* lib_php = NULL;
+
+ if ((phbuf = read_program_header_table(lib_fd, lib_ehdr)) == NULL)
+ return false;
+
+ // we want to process only PT_LOAD segments that are not writable.
+ // i.e., text segments. The read/write/exec (data) segments would
+ // have been already added from core file segments.
+ for (lib_php = phbuf, i = 0; i < lib_ehdr->e_phnum; i++) {
+ if ((lib_php->p_type == PT_LOAD) && !(lib_php->p_flags & PF_W) && (lib_php->p_filesz != 0)) {
+ if (add_map_info(ph, lib_fd, lib_php->p_offset, lib_php->p_vaddr + lib_base, lib_php->p_filesz) == NULL)
+ goto err;
+ }
+ lib_php++;
+ }
+
+ free(phbuf);
+ return true;
+err:
+ free(phbuf);
+ return false;
+}
+
+// process segments from interpreter (ld-elf.so.1)
+static bool read_interp_segments(struct ps_prochandle* ph) {
+ ELF_EHDR interp_ehdr;
+
+ if (read_elf_header(ph->core->interp_fd, &interp_ehdr) != true) {
+ print_debug("interpreter is not a valid ELF file\n");
+ return false;
+ }
+
+ if (read_lib_segments(ph, ph->core->interp_fd, &interp_ehdr, ph->core->ld_base_addr) != true) {
+ print_debug("can't read segments of interpreter\n");
+ return false;
+ }
+
+ return true;
+}
+
+// process segments of a a.out
+static bool read_exec_segments(struct ps_prochandle* ph, ELF_EHDR* exec_ehdr) {
+ int i = 0;
+ ELF_PHDR* phbuf = NULL;
+ ELF_PHDR* exec_php = NULL;
+
+ if ((phbuf = read_program_header_table(ph->core->exec_fd, exec_ehdr)) == NULL)
+ return false;
+
+ for (exec_php = phbuf, i = 0; i < exec_ehdr->e_phnum; i++) {
+ switch (exec_php->p_type) {
+
+ // add mappings for PT_LOAD segments
+ case PT_LOAD: {
+ // add only non-writable segments of non-zero filesz
+ if (!(exec_php->p_flags & PF_W) && exec_php->p_filesz != 0) {
+ if (add_map_info(ph, ph->core->exec_fd, exec_php->p_offset, exec_php->p_vaddr, exec_php->p_filesz) == NULL) goto err;
+ }
+ break;
+ }
+
+ // read the interpreter and it's segments
+ case PT_INTERP: {
+ char interp_name[BUF_SIZE];
+
+ pread(ph->core->exec_fd, interp_name, MIN(exec_php->p_filesz, BUF_SIZE), exec_php->p_offset);
+ print_debug("ELF interpreter %s\n", interp_name);
+ // read interpreter segments as well
+ if ((ph->core->interp_fd = pathmap_open(interp_name)) < 0) {
+ print_debug("can't open runtime loader\n");
+ goto err;
+ }
+ break;
+ }
+
+ // from PT_DYNAMIC we want to read address of first link_map addr
+ case PT_DYNAMIC: {
+ ph->core->dynamic_addr = exec_php->p_vaddr;
+ print_debug("address of _DYNAMIC is 0x%lx\n", ph->core->dynamic_addr);
+ break;
+ }
+
+ } // switch
+ exec_php++;
+ } // for
+
+ free(phbuf);
+ return true;
+err:
+ free(phbuf);
+ return false;
+}
+
+
+#define FIRST_LINK_MAP_OFFSET offsetof(struct r_debug, r_map)
+#define LD_BASE_OFFSET offsetof(struct r_debug, r_ldbase)
+#define LINK_MAP_ADDR_OFFSET offsetof(struct link_map, l_addr)
+#define LINK_MAP_NAME_OFFSET offsetof(struct link_map, l_name)
+#define LINK_MAP_NEXT_OFFSET offsetof(struct link_map, l_next)
+
+// read shared library info from runtime linker's data structures.
+// This work is done by librtlb_db in Solaris
+static bool read_shared_lib_info(struct ps_prochandle* ph) {
+ uintptr_t addr = ph->core->dynamic_addr;
+ uintptr_t debug_base;
+ uintptr_t first_link_map_addr;
+ uintptr_t ld_base_addr;
+ uintptr_t link_map_addr;
+ uintptr_t lib_base_diff;
+ uintptr_t lib_base;
+ uintptr_t lib_name_addr;
+ char lib_name[BUF_SIZE];
+ ELF_DYN dyn;
+ ELF_EHDR elf_ehdr;
+ int lib_fd;
+
+ // _DYNAMIC has information of the form
+ // [tag] [data] [tag] [data] .....
+ // Both tag and data are pointer sized.
+ // We look for dynamic info with DT_DEBUG. This has shared object info.
+ // refer to struct r_debug in link.h
+
+ dyn.d_tag = DT_NULL;
+ while (dyn.d_tag != DT_DEBUG) {
+ if (ps_pread(ph, (psaddr_t) addr, &dyn, sizeof(ELF_DYN)) != PS_OK) {
+ print_debug("can't read debug info from _DYNAMIC\n");
+ return false;
+ }
+ addr += sizeof(ELF_DYN);
+ }
+
+ // we have got Dyn entry with DT_DEBUG
+ debug_base = dyn.d_un.d_ptr;
+ // at debug_base we have struct r_debug. This has first link map in r_map field
+ if (ps_pread(ph, (psaddr_t) debug_base + FIRST_LINK_MAP_OFFSET,
+ &first_link_map_addr, sizeof(uintptr_t)) != PS_OK) {
+ print_debug("can't read first link map address\n");
+ return false;
+ }
+
+ // read ld_base address from struct r_debug
+ // XXX: There is no r_ldbase member on BSD
+/*
+ if (ps_pread(ph, (psaddr_t) debug_base + LD_BASE_OFFSET, &ld_base_addr,
+ sizeof(uintptr_t)) != PS_OK) {
+ print_debug("can't read ld base address\n");
+ return false;
+ }
+ ph->core->ld_base_addr = ld_base_addr;
+*/
+ ph->core->ld_base_addr = 0;
+
+ print_debug("interpreter base address is 0x%lx\n", ld_base_addr);
+
+ // now read segments from interp (i.e ld-elf.so.1)
+ if (read_interp_segments(ph) != true)
+ return false;
+
+ // after adding interpreter (ld.so) mappings sort again
+ if (sort_map_array(ph) != true)
+ return false;
+
+ print_debug("first link map is at 0x%lx\n", first_link_map_addr);
+
+ link_map_addr = first_link_map_addr;
+ while (link_map_addr != 0) {
+ // read library base address of the .so. Note that even though calls
+ // link_map->l_addr as "base address", this is * not * really base virtual
+ // address of the shared object. This is actually the difference b/w the virtual
+ // address mentioned in shared object and the actual virtual base where runtime
+ // linker loaded it. We use "base diff" in read_lib_segments call below.
+
+ if (ps_pread(ph, (psaddr_t) link_map_addr + LINK_MAP_ADDR_OFFSET,
+ &lib_base_diff, sizeof(uintptr_t)) != PS_OK) {
+ print_debug("can't read shared object base address diff\n");
+ return false;
+ }
+
+ // read address of the name
+ if (ps_pread(ph, (psaddr_t) link_map_addr + LINK_MAP_NAME_OFFSET,
+ &lib_name_addr, sizeof(uintptr_t)) != PS_OK) {
+ print_debug("can't read address of shared object name\n");
+ return false;
+ }
+
+ // read name of the shared object
+ if (read_string(ph, (uintptr_t) lib_name_addr, lib_name, sizeof(lib_name)) != true) {
+ print_debug("can't read shared object name\n");
+ return false;
+ }
+
+ if (lib_name[0] != '\0') {
+ // ignore empty lib names
+ lib_fd = pathmap_open(lib_name);
+
+ if (lib_fd < 0) {
+ print_debug("can't open shared object %s\n", lib_name);
+ // continue with other libraries...
+ } else {
+ if (read_elf_header(lib_fd, &elf_ehdr)) {
+ lib_base = lib_base_diff + find_base_address(lib_fd, &elf_ehdr);
+ print_debug("reading library %s @ 0x%lx [ 0x%lx ]\n",
+ lib_name, lib_base, lib_base_diff);
+ // while adding library mappings we need to use "base difference".
+ if (! read_lib_segments(ph, lib_fd, &elf_ehdr, lib_base_diff)) {
+ print_debug("can't read shared object's segments\n");
+ close(lib_fd);
+ return false;
+ }
+ add_lib_info_fd(ph, lib_name, lib_fd, lib_base);
+ // Map info is added for the library (lib_name) so
+ // we need to re-sort it before calling the p_pdread.
+ if (sort_map_array(ph) != true)
+ return false;
+ } else {
+ print_debug("can't read ELF header for shared object %s\n", lib_name);
+ close(lib_fd);
+ // continue with other libraries...
+ }
+ }
+ }
+
+ // read next link_map address
+ if (ps_pread(ph, (psaddr_t) link_map_addr + LINK_MAP_NEXT_OFFSET,
+ &link_map_addr, sizeof(uintptr_t)) != PS_OK) {
+ print_debug("can't read next link in link_map\n");
+ return false;
+ }
+ }
+
+ return true;
+}
+
+// the one and only one exposed stuff from this file
+struct ps_prochandle* Pgrab_core(const char* exec_file, const char* core_file) {
+ ELF_EHDR core_ehdr;
+ ELF_EHDR exec_ehdr;
+
+ struct ps_prochandle* ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle));
+ if (ph == NULL) {
+ print_debug("can't allocate ps_prochandle\n");
+ return NULL;
+ }
+
+ if ((ph->core = (struct core_data*) calloc(1, sizeof(struct core_data))) == NULL) {
+ free(ph);
+ print_debug("can't allocate ps_prochandle\n");
+ return NULL;
+ }
+
+ // initialize ph
+ ph->ops = &core_ops;
+ ph->core->core_fd = -1;
+ ph->core->exec_fd = -1;
+ ph->core->interp_fd = -1;
+
+ // open the core file
+ if ((ph->core->core_fd = open(core_file, O_RDONLY)) < 0) {
+ print_debug("can't open core file\n");
+ goto err;
+ }
+
+ // read core file ELF header
+ if (read_elf_header(ph->core->core_fd, &core_ehdr) != true || core_ehdr.e_type != ET_CORE) {
+ print_debug("core file is not a valid ELF ET_CORE file\n");
+ goto err;
+ }
+
+ if ((ph->core->exec_fd = open(exec_file, O_RDONLY)) < 0) {
+ print_debug("can't open executable file\n");
+ goto err;
+ }
+
+ if (read_elf_header(ph->core->exec_fd, &exec_ehdr) != true || exec_ehdr.e_type != ET_EXEC) {
+ print_debug("executable file is not a valid ELF ET_EXEC file\n");
+ goto err;
+ }
+
+ // process core file segments
+ if (read_core_segments(ph, &core_ehdr) != true)
+ goto err;
+
+ // process exec file segments
+ if (read_exec_segments(ph, &exec_ehdr) != true)
+ goto err;
+
+ // exec file is also treated like a shared object for symbol search
+ if (add_lib_info_fd(ph, exec_file, ph->core->exec_fd,
+ (uintptr_t)0 + find_base_address(ph->core->exec_fd, &exec_ehdr)) == NULL)
+ goto err;
+
+ // allocate and sort maps into map_array, we need to do this
+ // here because read_shared_lib_info needs to read from debuggee
+ // address space
+ if (sort_map_array(ph) != true)
+ goto err;
+
+ if (read_shared_lib_info(ph) != true)
+ goto err;
+
+ // sort again because we have added more mappings from shared objects
+ if (sort_map_array(ph) != true)
+ goto err;
+
+ if (init_classsharing_workaround(ph) != true)
+ goto err;
+
+ return ph;
+
+err:
+ Prelease(ph);
+ return NULL;
+}
diff --git a/hotspot/agent/src/os/bsd/ps_proc.c b/hotspot/agent/src/os/bsd/ps_proc.c
new file mode 100644
index 00000000000..f8957c099dc
--- /dev/null
+++ b/hotspot/agent/src/os/bsd/ps_proc.c
@@ -0,0 +1,444 @@
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "libproc_impl.h"
+#include "elfmacros.h"
+
+// This file has the libproc implementation specific to live process
+// For core files, refer to ps_core.c
+
+static inline uintptr_t align(uintptr_t ptr, size_t size) {
+ return (ptr & ~(size - 1));
+}
+
+// ---------------------------------------------
+// ptrace functions
+// ---------------------------------------------
+
+// read "size" bytes of data from "addr" within the target process.
+// unlike the standard ptrace() function, process_read_data() can handle
+// unaligned address - alignment check, if required, should be done
+// before calling process_read_data.
+
+static bool process_read_data(struct ps_prochandle* ph, uintptr_t addr, char *buf, size_t size) {
+ int rslt;
+ size_t i, words;
+ uintptr_t end_addr = addr + size;
+ uintptr_t aligned_addr = align(addr, sizeof(int));
+
+ if (aligned_addr != addr) {
+ char *ptr = (char *)&rslt;
+ errno = 0;
+ rslt = ptrace(PT_READ_D, ph->pid, (caddr_t) aligned_addr, 0);
+ if (errno) {
+ print_debug("ptrace(PT_READ_D, ..) failed for %d bytes @ %lx\n", size, addr);
+ return false;
+ }
+ for (; aligned_addr != addr; aligned_addr++, ptr++);
+ for (; ((intptr_t)aligned_addr % sizeof(int)) && aligned_addr < end_addr;
+ aligned_addr++)
+ *(buf++) = *(ptr++);
+ }
+
+ words = (end_addr - aligned_addr) / sizeof(int);
+
+ // assert((intptr_t)aligned_addr % sizeof(int) == 0);
+ for (i = 0; i < words; i++) {
+ errno = 0;
+ rslt = ptrace(PT_READ_D, ph->pid, (caddr_t) aligned_addr, 0);
+ if (errno) {
+ print_debug("ptrace(PT_READ_D, ..) failed for %d bytes @ %lx\n", size, addr);
+ return false;
+ }
+ *(int *)buf = rslt;
+ buf += sizeof(int);
+ aligned_addr += sizeof(int);
+ }
+
+ if (aligned_addr != end_addr) {
+ char *ptr = (char *)&rslt;
+ errno = 0;
+ rslt = ptrace(PT_READ_D, ph->pid, (caddr_t) aligned_addr, 0);
+ if (errno) {
+ print_debug("ptrace(PT_READ_D, ..) failed for %d bytes @ %lx\n", size, addr);
+ return false;
+ }
+ for (; aligned_addr != end_addr; aligned_addr++)
+ *(buf++) = *(ptr++);
+ }
+ return true;
+}
+
+// null implementation for write
+static bool process_write_data(struct ps_prochandle* ph,
+ uintptr_t addr, const char *buf , size_t size) {
+ return false;
+}
+
+// "user" should be a pointer to a reg
+static bool process_get_lwp_regs(struct ps_prochandle* ph, pid_t pid, struct reg *user) {
+ // we have already attached to all thread 'pid's, just use ptrace call
+ // to get regset now. Note that we don't cache regset upfront for processes.
+ if (ptrace(PT_GETREGS, pid, (caddr_t) user, 0) < 0) {
+ print_debug("ptrace(PTRACE_GETREGS, ...) failed for lwp %d\n", pid);
+ return false;
+ }
+ return true;
+}
+
+// fill in ptrace_lwpinfo for lid
+static bool process_get_lwp_info(struct ps_prochandle *ph, lwpid_t lwp_id, void *linfo) {
+ errno = 0;
+ ptrace(PT_LWPINFO, lwp_id, linfo, sizeof(struct ptrace_lwpinfo));
+
+ return (errno == 0)? true: false;
+}
+
+// attach to a process/thread specified by "pid"
+static bool ptrace_attach(pid_t pid) {
+ if (ptrace(PT_ATTACH, pid, NULL, 0) < 0) {
+ print_debug("ptrace(PTRACE_ATTACH, ..) failed for %d\n", pid);
+ return false;
+ } else {
+ int ret;
+ int status;
+ do {
+ // Wait for debuggee to stop.
+ ret = waitpid(pid, &status, 0);
+ if (ret >= 0) {
+ if (WIFSTOPPED(status)) {
+ // Debuggee stopped.
+ return true;
+ } else {
+ print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status);
+ return false;
+ }
+ } else {
+ switch (errno) {
+ case EINTR:
+ continue;
+ break;
+ case ECHILD:
+ print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid);
+ break;
+ case EINVAL:
+ print_debug("waitpid() failed. Invalid options argument.\n");
+ break;
+ default:
+ print_debug("waitpid() failed. Unexpected error %d\n",errno);
+ }
+ return false;
+ }
+ } while(true);
+ }
+}
+
+// -------------------------------------------------------
+// functions for obtaining library information
+// -------------------------------------------------------
+
+// callback for read_thread_info
+static bool add_new_thread(struct ps_prochandle* ph, pthread_t pthread_id, lwpid_t lwp_id) {
+ return add_thread_info(ph, pthread_id, lwp_id) != NULL;
+}
+
+#if defined(__FreeBSD__) && __FreeBSD_version < 701000
+/*
+ * TEXT_START_ADDR from binutils/ld/emulparams/.sh
+ * Not the most robust but good enough.
+ */
+
+#if defined(amd64) || defined(x86_64)
+#define TEXT_START_ADDR 0x400000
+#elif defined(i386)
+#define TEXT_START_ADDR 0x8048000
+#else
+#error TEXT_START_ADDR not defined
+#endif
+
+#define BUF_SIZE (PATH_MAX + NAME_MAX + 1)
+
+uintptr_t linkmap_addr(struct ps_prochandle *ph) {
+ uintptr_t ehdr_addr, phdr_addr, dyn_addr, dmap_addr, lmap_addr;
+ ELF_EHDR ehdr;
+ ELF_PHDR *phdrs, *phdr;
+ ELF_DYN *dyns, *dyn;
+ struct r_debug dmap;
+ unsigned long hdrs_size;
+ unsigned int i;
+
+ /* read ELF_EHDR at TEXT_START_ADDR and validate */
+
+ ehdr_addr = (uintptr_t)TEXT_START_ADDR;
+
+ if (process_read_data(ph, ehdr_addr, (char *)&ehdr, sizeof(ehdr)) != true) {
+ print_debug("process_read_data failed for ehdr_addr %p\n", ehdr_addr);
+ return (0);
+ }
+
+ if (!IS_ELF(ehdr) ||
+ ehdr.e_ident[EI_CLASS] != ELF_TARG_CLASS ||
+ ehdr.e_ident[EI_DATA] != ELF_TARG_DATA ||
+ ehdr.e_ident[EI_VERSION] != EV_CURRENT ||
+ ehdr.e_phentsize != sizeof(ELF_PHDR) ||
+ ehdr.e_version != ELF_TARG_VER ||
+ ehdr.e_machine != ELF_TARG_MACH) {
+ print_debug("not an ELF_EHDR at %p\n", ehdr_addr);
+ return (0);
+ }
+
+ /* allocate space for all ELF_PHDR's and read */
+
+ phdr_addr = ehdr_addr + ehdr.e_phoff;
+ hdrs_size = ehdr.e_phnum * sizeof(ELF_PHDR);
+
+ if ((phdrs = malloc(hdrs_size)) == NULL)
+ return (0);
+
+ if (process_read_data(ph, phdr_addr, (char *)phdrs, hdrs_size) != true) {
+ print_debug("process_read_data failed for phdr_addr %p\n", phdr_addr);
+ return (0);
+ }
+
+ /* find PT_DYNAMIC section */
+
+ for (i = 0, phdr = phdrs; i < ehdr.e_phnum; i++, phdr++) {
+ if (phdr->p_type == PT_DYNAMIC)
+ break;
+ }
+
+ if (i >= ehdr.e_phnum) {
+ print_debug("PT_DYNAMIC section not found!\n");
+ free(phdrs);
+ return (0);
+ }
+
+ /* allocate space and read in ELF_DYN headers */
+
+ dyn_addr = phdr->p_vaddr;
+ hdrs_size = phdr->p_memsz;
+ free(phdrs);
+
+ if ((dyns = malloc(hdrs_size)) == NULL)
+ return (0);
+
+ if (process_read_data(ph, dyn_addr, (char *)dyns, hdrs_size) != true) {
+ print_debug("process_read_data failed for dyn_addr %p\n", dyn_addr);
+ free(dyns);
+ return (0);
+ }
+
+ /* find DT_DEBUG */
+
+ dyn = dyns;
+ while (dyn->d_tag != DT_DEBUG && dyn->d_tag != DT_NULL) {
+ dyn++;
+ }
+
+ if (dyn->d_tag != DT_DEBUG) {
+ print_debug("failed to find DT_DEBUG\n");
+ free(dyns);
+ return (0);
+ }
+
+ /* read struct r_debug into dmap */
+
+ dmap_addr = (uintptr_t)dyn->d_un.d_ptr;
+ free(dyns);
+
+ if (process_read_data(ph, dmap_addr, (char *)&dmap, sizeof(dmap)) != true) {
+ print_debug("process_read_data failed for dmap_addr %p\n", dmap_addr);
+ return (0);
+ }
+
+ lmap_addr = (uintptr_t)dmap.r_map;
+
+ return (lmap_addr);
+}
+#endif // __FreeBSD__ && __FreeBSD_version < 701000
+
+static bool read_lib_info(struct ps_prochandle* ph) {
+#if defined(__FreeBSD__) && __FreeBSD_version >= 701000
+ struct kinfo_vmentry *freep, *kve;
+ int i, cnt;
+
+ freep = kinfo_getvmmap(ph->pid, &cnt);
+ if (freep == NULL) {
+ print_debug("can't get vm map for pid\n", ph->pid);
+ return false;
+ }
+
+ for (i = 0; i < cnt; i++) {
+ kve = &freep[i];
+ if ((kve->kve_flags & KVME_FLAG_COW) &&
+ kve->kve_path != NULL &&
+ strlen(kve->kve_path) > 0) {
+
+ if (find_lib(ph, kve->kve_path) == false) {
+ lib_info* lib;
+ if ((lib = add_lib_info(ph, kve->kve_path,
+ (uintptr_t) kve->kve_start)) == NULL)
+ continue; // ignore, add_lib_info prints error
+
+ // we don't need to keep the library open, symtab is already
+ // built. Only for core dump we need to keep the fd open.
+ close(lib->fd);
+ lib->fd = -1;
+ }
+ }
+ }
+
+ free(freep);
+
+ return true;
+#else
+ char *l_name;
+ struct link_map *lmap;
+ uintptr_t lmap_addr;
+
+ if ((l_name = malloc(BUF_SIZE)) == NULL)
+ return false;
+
+ if ((lmap = malloc(sizeof(*lmap))) == NULL) {
+ free(l_name);
+ return false;
+ }
+
+ lmap_addr = linkmap_addr(ph);
+
+ if (lmap_addr == 0) {
+ free(l_name);
+ free(lmap);
+ return false;
+ }
+
+ do {
+ if (process_read_data(ph, lmap_addr, (char *)lmap, sizeof(*lmap)) != true) {
+ print_debug("process_read_data failed for lmap_addr %p\n", lmap_addr);
+ free (l_name);
+ free (lmap);
+ return false;
+ }
+
+ if (process_read_data(ph, (uintptr_t)lmap->l_name, l_name,
+ BUF_SIZE) != true) {
+ print_debug("process_read_data failed for lmap->l_name %p\n",
+ lmap->l_name);
+ free (l_name);
+ free (lmap);
+ return false;
+ }
+
+ if (find_lib(ph, l_name) == false) {
+ lib_info* lib;
+ if ((lib = add_lib_info(ph, l_name,
+ (uintptr_t) lmap->l_addr)) == NULL)
+ continue; // ignore, add_lib_info prints error
+
+ // we don't need to keep the library open, symtab is already
+ // built. Only for core dump we need to keep the fd open.
+ close(lib->fd);
+ lib->fd = -1;
+ }
+ lmap_addr = (uintptr_t)lmap->l_next;
+ } while (lmap->l_next != NULL);
+
+ free (l_name);
+ free (lmap);
+
+ return true;
+#endif
+}
+
+// detach a given pid
+static bool ptrace_detach(pid_t pid) {
+ if (pid && ptrace(PT_DETACH, pid, (caddr_t)1, 0) < 0) {
+ print_debug("ptrace(PTRACE_DETACH, ..) failed for %d\n", pid);
+ return false;
+ } else {
+ return true;
+ }
+}
+
+static void process_cleanup(struct ps_prochandle* ph) {
+ ptrace_detach(ph->pid);
+}
+
+static ps_prochandle_ops process_ops = {
+ .release= process_cleanup,
+ .p_pread= process_read_data,
+ .p_pwrite= process_write_data,
+ .get_lwp_regs= process_get_lwp_regs,
+ .get_lwp_info= process_get_lwp_info
+};
+
+// attach to the process. One and only one exposed stuff
+struct ps_prochandle* Pgrab(pid_t pid) {
+ struct ps_prochandle* ph = NULL;
+ thread_info* thr = NULL;
+
+ if ( (ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle))) == NULL) {
+ print_debug("can't allocate memory for ps_prochandle\n");
+ return NULL;
+ }
+
+ if (ptrace_attach(pid) != true) {
+ free(ph);
+ return NULL;
+ }
+
+ // initialize ps_prochandle
+ ph->pid = pid;
+
+ // initialize vtable
+ ph->ops = &process_ops;
+
+ // read library info and symbol tables, must do this before attaching threads,
+ // as the symbols in the pthread library will be used to figure out
+ // the list of threads within the same process.
+ if (read_lib_info(ph) != true) {
+ ptrace_detach(pid);
+ free(ph);
+ return NULL;
+ }
+
+ // read thread info
+ read_thread_info(ph, add_new_thread);
+
+ return ph;
+}
diff --git a/hotspot/agent/src/os/bsd/salibelf.c b/hotspot/agent/src/os/bsd/salibelf.c
new file mode 100644
index 00000000000..4c860a0fe08
--- /dev/null
+++ b/hotspot/agent/src/os/bsd/salibelf.c
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "salibelf.h"
+#include
+#include
+#include
+
+extern void print_debug(const char*,...);
+
+// ELF file parsing helpers. Note that we do *not* use libelf here.
+int read_elf_header(int fd, ELF_EHDR* ehdr) {
+ if (pread(fd, ehdr, sizeof (ELF_EHDR), 0) != sizeof (ELF_EHDR) ||
+ memcmp(&ehdr->e_ident[EI_MAG0], ELFMAG, SELFMAG) != 0 ||
+ ehdr->e_version != EV_CURRENT) {
+ return 0;
+ }
+ return 1;
+}
+
+bool is_elf_file(int fd) {
+ ELF_EHDR ehdr;
+ return read_elf_header(fd, &ehdr);
+}
+
+// read program header table of an ELF file
+ELF_PHDR* read_program_header_table(int fd, ELF_EHDR* hdr) {
+ ELF_PHDR* phbuf = 0;
+ // allocate memory for program header table
+ size_t nbytes = hdr->e_phnum * hdr->e_phentsize;
+
+ if ((phbuf = (ELF_PHDR*) malloc(nbytes)) == NULL) {
+ print_debug("can't allocate memory for reading program header table\n");
+ return NULL;
+ }
+
+ if (pread(fd, phbuf, nbytes, hdr->e_phoff) != nbytes) {
+ print_debug("ELF file is truncated! can't read program header table\n");
+ free(phbuf);
+ return NULL;
+ }
+
+ return phbuf;
+}
+
+// read section header table of an ELF file
+ELF_SHDR* read_section_header_table(int fd, ELF_EHDR* hdr) {
+ ELF_SHDR* shbuf = 0;
+ // allocate memory for section header table
+ size_t nbytes = hdr->e_shnum * hdr->e_shentsize;
+
+ if ((shbuf = (ELF_SHDR*) malloc(nbytes)) == NULL) {
+ print_debug("can't allocate memory for reading section header table\n");
+ return NULL;
+ }
+
+ if (pread(fd, shbuf, nbytes, hdr->e_shoff) != nbytes) {
+ print_debug("ELF file is truncated! can't read section header table\n");
+ free(shbuf);
+ return NULL;
+ }
+
+ return shbuf;
+}
+
+// read a particular section's data
+void* read_section_data(int fd, ELF_EHDR* ehdr, ELF_SHDR* shdr) {
+ void *buf = NULL;
+ if (shdr->sh_type == SHT_NOBITS || shdr->sh_size == 0) {
+ return buf;
+ }
+ if ((buf = calloc(shdr->sh_size, 1)) == NULL) {
+ print_debug("can't allocate memory for reading section data\n");
+ return NULL;
+ }
+ if (pread(fd, buf, shdr->sh_size, shdr->sh_offset) != shdr->sh_size) {
+ free(buf);
+ print_debug("section data read failed\n");
+ return NULL;
+ }
+ return buf;
+}
+
+uintptr_t find_base_address(int fd, ELF_EHDR* ehdr) {
+ uintptr_t baseaddr = (uintptr_t)-1;
+ int cnt;
+ ELF_PHDR *phbuf, *phdr;
+
+ // read program header table
+ if ((phbuf = read_program_header_table(fd, ehdr)) == NULL) {
+ goto quit;
+ }
+
+ // the base address of a shared object is the lowest vaddr of
+ // its loadable segments (PT_LOAD)
+ for (phdr = phbuf, cnt = 0; cnt < ehdr->e_phnum; cnt++, phdr++) {
+ if (phdr->p_type == PT_LOAD && phdr->p_vaddr < baseaddr) {
+ baseaddr = phdr->p_vaddr;
+ }
+ }
+
+quit:
+ if (phbuf) free(phbuf);
+ return baseaddr;
+}
diff --git a/hotspot/agent/src/os/win32/nt4internals.cpp b/hotspot/agent/src/os/bsd/salibelf.h
similarity index 50%
rename from hotspot/agent/src/os/win32/nt4internals.cpp
rename to hotspot/agent/src/os/bsd/salibelf.h
index e16dcf89383..957694b25b5 100644
--- a/hotspot/agent/src/os/win32/nt4internals.cpp
+++ b/hotspot/agent/src/os/bsd/salibelf.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,54 +22,31 @@
*
*/
-#include "nt4internals.hpp"
-#include
-#include
-#include
+#ifndef _SALIBELF_H_
+#define _SALIBELF_H_
-namespace NT4 {
+#include
+#include "elfmacros.h"
+#include "libproc_impl.h"
-static HMODULE ntDLL = NULL;
+// read ELF file header.
+int read_elf_header(int fd, ELF_EHDR* ehdr);
-HMODULE loadNTDLL() {
- if (ntDLL == NULL) {
- ntDLL = LoadLibrary("NTDLL.DLL");
- }
+// is given file descriptor corresponds to an ELF file?
+bool is_elf_file(int fd);
- assert(ntDLL != NULL);
- return ntDLL;
-}
+// read program header table of an ELF file. caller has to
+// free the result pointer after use. NULL on failure.
+ELF_PHDR* read_program_header_table(int fd, ELF_EHDR* hdr);
-void unloadNTDLL() {
- if (ntDLL != NULL) {
- FreeLibrary(ntDLL);
- ntDLL = NULL;
- }
-}
+// read section header table of an ELF file. caller has to
+// free the result pointer after use. NULL on failure.
+ELF_SHDR* read_section_header_table(int fd, ELF_EHDR* hdr);
-} // namespace NT4
+// read a particular section's data. caller has to free the
+// result pointer after use. NULL on failure.
+void* read_section_data(int fd, ELF_EHDR* ehdr, ELF_SHDR* shdr);
-static HMODULE psapiDLL = NULL;
-
-HMODULE
-loadPSAPIDLL() {
- if (psapiDLL == NULL) {
- psapiDLL = LoadLibrary("PSAPI.DLL");
- }
-
- if (psapiDLL == NULL) {
- fprintf(stderr, "Simple Windows Debug Server requires PSAPI.DLL on Windows NT 4.0.\n");
- fprintf(stderr, "Please install this DLL from the SDK and restart the server.\n");
- exit(1);
- }
-
- return psapiDLL;
-}
-
-void
-unloadPSAPIDLL() {
- if (psapiDLL != NULL) {
- FreeLibrary(psapiDLL);
- psapiDLL = NULL;
- }
-}
+// find the base address at which the library wants to load itself
+uintptr_t find_base_address(int fd, ELF_EHDR* ehdr);
+#endif /* _SALIBELF_H_ */
diff --git a/hotspot/agent/src/os/bsd/symtab.c b/hotspot/agent/src/os/bsd/symtab.c
new file mode 100644
index 00000000000..9a9fbd23491
--- /dev/null
+++ b/hotspot/agent/src/os/bsd/symtab.c
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include "symtab.h"
+#include "salibelf.h"
+
+
+// ----------------------------------------------------
+// functions for symbol lookups
+// ----------------------------------------------------
+
+struct elf_section {
+ ELF_SHDR *c_shdr;
+ void *c_data;
+};
+
+struct elf_symbol {
+ char *name;
+ uintptr_t offset;
+ uintptr_t size;
+};
+
+typedef struct symtab {
+ char *strs;
+ size_t num_symbols;
+ struct elf_symbol *symbols;
+ DB* hash_table;
+} symtab_t;
+
+// read symbol table from given fd.
+struct symtab* build_symtab(int fd) {
+ ELF_EHDR ehdr;
+ struct symtab* symtab = NULL;
+
+ // Reading of elf header
+ struct elf_section *scn_cache = NULL;
+ int cnt = 0;
+ ELF_SHDR* shbuf = NULL;
+ ELF_SHDR* cursct = NULL;
+ ELF_PHDR* phbuf = NULL;
+ int symtab_found = 0;
+ int dynsym_found = 0;
+ uint32_t symsection = SHT_SYMTAB;
+
+ uintptr_t baseaddr = (uintptr_t)-1;
+
+ lseek(fd, (off_t)0L, SEEK_SET);
+ if (! read_elf_header(fd, &ehdr)) {
+ // not an elf
+ return NULL;
+ }
+
+ // read ELF header
+ if ((shbuf = read_section_header_table(fd, &ehdr)) == NULL) {
+ goto quit;
+ }
+
+ baseaddr = find_base_address(fd, &ehdr);
+
+ scn_cache = calloc(ehdr.e_shnum, sizeof(*scn_cache));
+ if (scn_cache == NULL) {
+ goto quit;
+ }
+
+ for (cursct = shbuf, cnt = 0; cnt < ehdr.e_shnum; cnt++) {
+ scn_cache[cnt].c_shdr = cursct;
+ if (cursct->sh_type == SHT_SYMTAB ||
+ cursct->sh_type == SHT_STRTAB ||
+ cursct->sh_type == SHT_DYNSYM) {
+ if ( (scn_cache[cnt].c_data = read_section_data(fd, &ehdr, cursct)) == NULL) {
+ goto quit;
+ }
+ }
+
+ if (cursct->sh_type == SHT_SYMTAB)
+ symtab_found++;
+
+ if (cursct->sh_type == SHT_DYNSYM)
+ dynsym_found++;
+
+ cursct++;
+ }
+
+ if (!symtab_found && dynsym_found)
+ symsection = SHT_DYNSYM;
+
+ for (cnt = 1; cnt < ehdr.e_shnum; cnt++) {
+ ELF_SHDR *shdr = scn_cache[cnt].c_shdr;
+
+ if (shdr->sh_type == symsection) {
+ ELF_SYM *syms;
+ int j, n;
+ size_t size;
+
+ // FIXME: there could be multiple data buffers associated with the
+ // same ELF section. Here we can handle only one buffer. See man page
+ // for elf_getdata on Solaris.
+
+ // guarantee(symtab == NULL, "multiple symtab");
+ symtab = calloc(1, sizeof(*symtab));
+ if (symtab == NULL) {
+ goto quit;
+ }
+ // the symbol table
+ syms = (ELF_SYM *)scn_cache[cnt].c_data;
+
+ // number of symbols
+ n = shdr->sh_size / shdr->sh_entsize;
+
+ // create hash table, we use berkeley db to
+ // manipulate the hash table.
+ symtab->hash_table = dbopen(NULL, O_CREAT | O_RDWR, 0600, DB_HASH, NULL);
+ // guarantee(symtab->hash_table, "unexpected failure: dbopen");
+ if (symtab->hash_table == NULL)
+ goto bad;
+
+ // shdr->sh_link points to the section that contains the actual strings
+ // for symbol names. the st_name field in ELF_SYM is just the
+ // string table index. we make a copy of the string table so the
+ // strings will not be destroyed by elf_end.
+ size = scn_cache[shdr->sh_link].c_shdr->sh_size;
+ symtab->strs = malloc(size);
+ if (symtab->strs == NULL)
+ goto bad;
+ memcpy(symtab->strs, scn_cache[shdr->sh_link].c_data, size);
+
+ // allocate memory for storing symbol offset and size;
+ symtab->num_symbols = n;
+ symtab->symbols = calloc(n , sizeof(*symtab->symbols));
+ if (symtab->symbols == NULL)
+ goto bad;
+
+ // copy symbols info our symtab and enter them info the hash table
+ for (j = 0; j < n; j++, syms++) {
+ DBT key, value;
+ char *sym_name = symtab->strs + syms->st_name;
+
+ // skip non-object and non-function symbols
+ int st_type = ELF_ST_TYPE(syms->st_info);
+ if ( st_type != STT_FUNC && st_type != STT_OBJECT)
+ continue;
+ // skip empty strings and undefined symbols
+ if (*sym_name == '\0' || syms->st_shndx == SHN_UNDEF) continue;
+
+ symtab->symbols[j].name = sym_name;
+ symtab->symbols[j].offset = syms->st_value - baseaddr;
+ symtab->symbols[j].size = syms->st_size;
+
+ key.data = sym_name;
+ key.size = strlen(sym_name) + 1;
+ value.data = &(symtab->symbols[j]);
+ value.size = sizeof(void *);
+ (*symtab->hash_table->put)(symtab->hash_table, &key, &value, 0);
+ }
+ }
+ }
+ goto quit;
+
+bad:
+ destroy_symtab(symtab);
+ symtab = NULL;
+
+quit:
+ if (shbuf) free(shbuf);
+ if (phbuf) free(phbuf);
+ if (scn_cache) {
+ for (cnt = 0; cnt < ehdr.e_shnum; cnt++) {
+ if (scn_cache[cnt].c_data != NULL) {
+ free(scn_cache[cnt].c_data);
+ }
+ }
+ free(scn_cache);
+ }
+ return symtab;
+}
+
+void destroy_symtab(struct symtab* symtab) {
+ if (!symtab) return;
+ if (symtab->strs) free(symtab->strs);
+ if (symtab->symbols) free(symtab->symbols);
+ if (symtab->hash_table) {
+ (*symtab->hash_table->close)(symtab->hash_table);
+ }
+ free(symtab);
+}
+
+uintptr_t search_symbol(struct symtab* symtab, uintptr_t base,
+ const char *sym_name, int *sym_size) {
+ DBT key, value;
+ int ret;
+
+ // library does not have symbol table
+ if (!symtab || !symtab->hash_table)
+ return 0;
+
+ key.data = (char*)(uintptr_t)sym_name;
+ key.size = strlen(sym_name) + 1;
+ ret = (*symtab->hash_table->get)(symtab->hash_table, &key, &value, 0);
+ if (ret == 0) {
+ struct elf_symbol *sym = value.data;
+ uintptr_t rslt = (uintptr_t) ((char*)base + sym->offset);
+ if (sym_size) *sym_size = sym->size;
+ return rslt;
+ }
+
+ return 0;
+}
+
+const char* nearest_symbol(struct symtab* symtab, uintptr_t offset,
+ uintptr_t* poffset) {
+ int n = 0;
+ if (!symtab) return NULL;
+ for (; n < symtab->num_symbols; n++) {
+ struct elf_symbol* sym = &(symtab->symbols[n]);
+ if (sym->name != NULL &&
+ offset >= sym->offset && offset < sym->offset + sym->size) {
+ if (poffset) *poffset = (offset - sym->offset);
+ return sym->name;
+ }
+ }
+ return NULL;
+}
diff --git a/hotspot/agent/src/os/bsd/symtab.h b/hotspot/agent/src/os/bsd/symtab.h
new file mode 100644
index 00000000000..9b7eef77d69
--- /dev/null
+++ b/hotspot/agent/src/os/bsd/symtab.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef _SYMTAB_H_
+#define _SYMTAB_H_
+
+#include
+
+// interface to manage ELF symbol tables
+
+struct symtab;
+
+// build symbol table for a given ELF file descriptor
+struct symtab* build_symtab(int fd);
+
+// destroy the symbol table
+void destroy_symtab(struct symtab* symtab);
+
+// search for symbol in the given symbol table. Adds offset
+// to the base uintptr_t supplied. Returns NULL if not found.
+uintptr_t search_symbol(struct symtab* symtab, uintptr_t base,
+ const char *sym_name, int *sym_size);
+
+// look for nearest symbol for a given offset (not address - base
+// subtraction done by caller
+const char* nearest_symbol(struct symtab* symtab, uintptr_t offset,
+ uintptr_t* poffset);
+
+#endif /*_SYMTAB_H_*/
diff --git a/jdk/src/share/classes/sun/io/CharToByteJIS0212_Solaris.java b/hotspot/agent/src/os/bsd/test.c
similarity index 59%
rename from jdk/src/share/classes/sun/io/CharToByteJIS0212_Solaris.java
rename to hotspot/agent/src/os/bsd/test.c
index 43c4670370b..3659542d545 100644
--- a/jdk/src/share/classes/sun/io/CharToByteJIS0212_Solaris.java
+++ b/hotspot/agent/src/os/bsd/test.c
@@ -4,9 +4,7 @@
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
+ * published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -21,27 +19,41 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.JIS_X_0212_Solaris_Encoder;
-
-/**
- * Tables and data to convert Unicode to JIS0212_Solaris
*
- * @author ConverterGenerator tool
*/
-public class CharToByteJIS0212_Solaris extends CharToByteDoubleByte {
+#include
+#include
+#include "libproc.h"
- public String getCharacterEncoding() {
- return "JIS0212_Solaris";
- }
+int main(int argc, char** argv) {
+ struct ps_prochandle* ph;
- public CharToByteJIS0212_Solaris() {
- super.index1 = JIS_X_0212_Solaris_Encoder.getIndex1();
- super.index2 = JIS_X_0212_Solaris_Encoder.getIndex2();
- }
+ init_libproc(true);
+ switch (argc) {
+ case 2: {
+ // process
+ ph = Pgrab(atoi(argv[1]));
+ break;
+ }
+
+ case 3: {
+ // core
+ ph = Pgrab_core(argv[1], argv[2]);
+ break;
+ }
+
+ default: {
+ fprintf(stderr, "usage %s or %s \n", argv[0], argv[0]);
+ return 1;
+ }
+ }
+
+ if (ph) {
+ Prelease(ph);
+ return 0;
+ } else {
+ printf("can't connect to debuggee\n");
+ return 1;
+ }
}
diff --git a/hotspot/agent/src/os/solaris/Makefile b/hotspot/agent/src/os/solaris/Makefile
index f1bb0b3df00..0e964bf2c60 100644
--- a/hotspot/agent/src/os/solaris/Makefile
+++ b/hotspot/agent/src/os/solaris/Makefile
@@ -24,9 +24,7 @@
all:
- cd dbx; $(MAKE) all
cd proc; $(MAKE) all
clean:
- cd dbx; $(MAKE) clean
cd proc; $(MAKE) clean
diff --git a/hotspot/agent/src/os/solaris/dbx/Makefile b/hotspot/agent/src/os/solaris/dbx/Makefile
deleted file mode 100644
index 4b1760d9795..00000000000
--- a/hotspot/agent/src/os/solaris/dbx/Makefile
+++ /dev/null
@@ -1,91 +0,0 @@
-#
-# Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-#
-
-
-# Targets are:
-# 32bit: Build the 32 bit version in ./32bit
-# 64bit: Build the 64 bit version in ./64bit
-# helloWorld: Build the helloWorld test program
-# all: Build all of the above. This is the default.
-#
-# NOTE: This makefile uses IOBuf.cpp, IOBuf.hpp, Buffer.cpp, and
-# Buffer.hpp from the src/os/win32/agent directory.
-
-.PHONY: 32bit 64bit
-
-ARCH_ORIG = $(shell uname -p)
-
-# C++ := /java/devtools/$(ARCH_ORIG)/SUNWspro/SC6.1/bin/CC
-
-C++ := CC
-RM := /usr/bin/rm
-MKDIRS := /usr/bin/mkdir -p
-
-
-WIN32_DIR := ../../win32
-ARCH := $(subst i386,i486,$(ARCH_ORIG))
-# INCLUDES := -I/net/sparcworks.eng/export/set/sparcworks5/dbx_62_intg/dev/src/dbx -I$(WIN32_DIR)
-INCLUDES := -I. -I$(WIN32_DIR)
-CFLAGS_32bit := -xarch=v8
-CFLAGS_64bit := -xarch=v9
-CFLAGS := -PIC -xO3 $(INCLUDES)
-LIBS := -lsocket -lnsl -lrtld_db
-LDFLAGS := -G
-
-ifneq "$(ARCH)" "i486"
- CFLAGS += $(CFLAGS_$(VERSION))
- LDFLAGS += $(CFLAGS_$(VERSION))
-endif
-
-# We use IOBuf.hpp, IOBuf.cpp, Buffer.hpp, and Buffer.cpp from the win32 dir.
-vpath %.cpp .:$(WIN32_DIR)
-vpath %.hpp .:$(WIN32_DIR)
-
-OBJS = $(VERSION)/svc_agent_dbx.o $(VERSION)/IOBuf.o $(VERSION)/Buffer.o
-
-
-
-# The default is to make both 32 bit and 64 bit versions.
-all:: 32bit 64bit
-
-32bit 64bit::
- $(MKDIRS) $@
- $(MAKE) $@/libsvc_agent_dbx.so helloWorld VERSION=$@
-
-$(VERSION)/IOBuf.o: IOBuf.hpp
-$(VERSION)/Buffer.o: Buffer.hpp
-$(VERSION)/svc_agent_dbx.o: svc_agent_dbx.hpp
-
-$(VERSION)/%.o: %.cpp
- $(C++) $(CFLAGS) -c $< -o $@
-
-$(VERSION)/libsvc_agent_dbx.so:: $(OBJS)
- $(C++) $(LDFLAGS) -o $(VERSION)/libsvc_agent_dbx.so $(OBJS) $(LIBS)
-
-# Would be nice to move this into a shared directory
-helloWorld:: helloWorld.cpp
- $(C++) -g $< -o $@
-
-clean::
- $(RM) -rf 32bit 64bit *.o helloWorld
diff --git a/hotspot/agent/src/os/solaris/dbx/README b/hotspot/agent/src/os/solaris/dbx/README
deleted file mode 100644
index e043f7e1642..00000000000
--- a/hotspot/agent/src/os/solaris/dbx/README
+++ /dev/null
@@ -1,9 +0,0 @@
-shell_impl.h
-proc_service_2.h
-
-The above files are captured from the dbx build environment.
-Rather then use a -I that points to stuff in .eng domain that
-may not be accessible in other domains these files are just
-copied here so local builds in other domains will work.
-These files rarely change so the fact that we might have to
-strobe in new ones on rare occasions is no big deal.
diff --git a/hotspot/agent/src/os/solaris/dbx/README-commands.txt b/hotspot/agent/src/os/solaris/dbx/README-commands.txt
deleted file mode 100644
index 4bc22d20d93..00000000000
--- a/hotspot/agent/src/os/solaris/dbx/README-commands.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-This import module uses a largely text-based protocol, except for
-certain bulk data transfer operations. All text is in single-byte
-US-ASCII.
-
-Commands understood:
-
-address_size ::=
-
- Returns 32 if attached to 32-bit process, 64 if 64-bit.
-
-peek_fail_fast ::=
-
- Indicates whether "peek" requests should "fail fast"; that is, if
- any of the addresses in the requested range are unmapped, report
- the entire range as unmapped. This is substantially faster than
- the alternative, which is to read the entire range byte-by-byte.
- However, it should only be used when it is guaranteed by the
- client application that peeks come from at most one page. The
- default is that peek_fast_fail is not enabled.
-
-peek ::=
- B
- [ []...]...
-
- NOTE that the binary portion of this message is prefixed by the
- uppercase US-ASCII letter 'B', allowing easier synchronization by
- clients. There is no data between the 'B' and the rest of the
- message.
-
- May only be called once attached. Reads the address space of the
- target process starting at the given address (see below for format
- specifications) and extending the given number of bytes. Whether
- the read succeeded is indicated by a single byte containing a 1 or
- 0 (success or failure). If successful, the return result is given
- in a sequence of ranges. _len_, the length of each range, is
- indicated by a 32-bit unsigned integer transmitted with big-endian
- byte ordering (i.e., most significant byte first). _isMapped_
- indicates whether the range is mapped or unmapped in the target
- process's address space, and will contain the value 1 or 0 for
- mapped or unmapped, respectively. If the range is mapped,
- _isMapped_ is followed by _data_, containing the raw binary data
- for the range. The sum of all ranges' lengths is guaranteed to be
- equivalent to the number of bytes requested.
-
-poke B[]... ::=
-
- NOTE that the binary portion of this message is prefixed by the
- uppercase US-ASCII letter 'B', allowing easier synchronization by
- clients. There is no data between the 'B' and the rest of the
- message.
-
- Writes the given data to the target process starting at the given
- address. Returns 1 on success, 0 on failure (i.e., one or more of
- target addresses were unmapped).
-
-mapped ::=
-
- Returns 1 if entire address range [address...address + int arg) is
- mapped in target process's address space, 0 if not
-
-lookup ::=
-
- First symbol is object name; second is symbol to be looked up.
- Looks up symbol in target process's symbol table and returns
- address. Returns NULL (0x0) if symbol is not found.
-
-thr_gregs ::=
-
- Fetch the "general" (integer) register set for the given thread.
- Returned as a series of hexidecimal values. NOTE: the meaning of
- the return value is architecture-dependent. In general it is the
- contents of the prgregset_t.
-
-exit ::=
-
- Exits the serviceability agent dbx module, returning control to
- the dbx prompt.
-
-// Data formats and example values:
- ::= 0x12345678[9ABCDEF0] /* up to 64-bit hex value */
- ::= 5 /* up to 32-bit integer number; no leading sign */
- ::= 1 /* ASCII '0' or '1' */
diff --git a/hotspot/agent/src/os/solaris/dbx/helloWorld.cpp b/hotspot/agent/src/os/solaris/dbx/helloWorld.cpp
deleted file mode 100644
index 7fd4ea47466..00000000000
--- a/hotspot/agent/src/os/solaris/dbx/helloWorld.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include
-#include
-
-extern "C" {
- const char* helloWorldString = "Hello, world!";
- // Do not change these values without changing TestDebugger.java as well
- // FIXME: should make these jbyte, jshort, etc...
- volatile int8_t testByte = 132;
- volatile int16_t testShort = 27890;
- volatile int32_t testInt = 1020304050;
- volatile int64_t testLong = 102030405060708090LL;
- volatile float testFloat = 35.4F;
- volatile double testDouble = 1.23456789;
-
- volatile int helloWorldTrigger = 0;
-}
-
-int
-main(int, char**) {
- while (1) {
- while (helloWorldTrigger == 0) {
- }
-
- fprintf(stderr, "%s\n", helloWorldString);
- fprintf(stderr, "testByte=%d\n", testByte);
- fprintf(stderr, "testShort=%d\n", testShort);
- fprintf(stderr, "testInt=%d\n", testInt);
- fprintf(stderr, "testLong=%d\n", testLong);
- fprintf(stderr, "testFloat=%d\n", testFloat);
- fprintf(stderr, "testDouble=%d\n", testDouble);
-
- while (helloWorldTrigger != 0) {
- }
- }
-}
diff --git a/hotspot/agent/src/os/solaris/dbx/proc_service_2.h b/hotspot/agent/src/os/solaris/dbx/proc_service_2.h
deleted file mode 100644
index 93163cbc7c0..00000000000
--- a/hotspot/agent/src/os/solaris/dbx/proc_service_2.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _PROC_SERVICE_2_H
-#define _PROC_SERVICE_2_H
-
-/*
- * Types, function definitions for the provider of services beyond
- * proc_service. This interface will be used by import modules like
- * BAT/prex, NEO debugger etc.
- */
-
-/*
- CCR info
-
- Version history:
-
- 1.0 - Initial CCR release
-
- 1.1 - Changes for GLUE/neo.
- New entry points ps_svnt_generic() and ps_svc_generic()
- - New entry point ps_getpid()
-
- Release information for automatic CCR updates:
- BEGIN RELEASE NOTES: (signifies what gets put into CCR release notes)
- 1.2 - Changes to support Solaris 2.7
-
- END RELEASE NOTES: (signifies what gets put into CCR release notes)
-
- Following is used for CCR version number:
-
-#define CCR_PROC_SERVICE_2_VERSION 1.2
-
-*/
-
-
-#include
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct ps_loadobj {
- int objfd; /* fd of the load object or executable
- * -1 implies its not available.
- * This file decriptor is live only during the
- * particular call to ps_iter_f(). If you
- * need it beyond that you need to dup() it.
- */
- psaddr_t
- text_base; /* address where text of loadobj was mapped */
- psaddr_t
- data_base; /* address where data of loadobj was mapped */
- const char *objname; /* loadobj name */
-};
-
-typedef int ps_iter_f(const struct ps_prochandle *, const struct ps_loadobj *,
- void *cd);
-
-/*
- * Returns the ps_prochandle for the current process under focus. Returns
- * NULL if there is none.
- */
-
-const struct ps_prochandle *
-ps_get_prochandle(void);
-
-/*
- * Returns the ps_prochandle for the current process(allows core files to
- * be specified) under focus. Returns NULL if there is none.
- */
-const struct ps_prochandle *
-ps_get_prochandle2(int cores_too);
-
-/*
- * Returns the pid of the process referred to by the ps_prochandle.
- *
- * 0 is returned in case the ps_prochandle is not valid or refers to dead
- * process.
- *
- */
-pid_t
-ps_getpid(const struct ps_prochandle *);
-
-/*
- * Iteration function that iterates over all load objects *and the
- * executable*
- *
- * If the callback routine returns:
- * 0 - continue processing link objects
- * non zero - stop calling the callback function
- *
- */
-
-ps_err_e
-ps_loadobj_iter(const struct ps_prochandle *, ps_iter_f *, void *clnt_data);
-
-/*
- * Address => function name mapping
- *
- * Given an address, returns a pointer to the function's
- * linker name (null terminated).
- */
-
-ps_err_e
-ps_find_fun_name(const struct ps_prochandle *, psaddr_t addr,
- const char **name);
-
-/*
- * Interface to LD_PRELOAD. LD_PRELOAD given library across the
- * program 'exec'.
- *
- */
-
-/*
- * Append/Prepend the 'lib' (has to be library name as understood by LD_PRELOAD)
- * to the LD_PRELOAD variable setting to be used by the debugee
- * Returns a cookie (in id).
- */
-ps_err_e
-ps_ld_preload_append(const char *lib, int *id);
-ps_err_e
-ps_ld_preload_prepend(const char *lib, int *id);
-
-/*
- * Remove the library associated with 'id' from the LD_PRELOAD setting.
- *
- */
-ps_err_e
-ps_ld_preload_remove(int id);
-
-#ifdef __cplusplus
-}
-#endif
-
-/*
- * The following are C++ only interfaces
- */
-#ifdef __cplusplus
-
-/*
- * classes ServiceDbx and ServantDbx and defined in "gp_dbx_svc.h" which is
- * accessed via CCR
- */
-extern class ServantDbx *ps_svnt_generic();
-extern class ServiceDbx *ps_svc_generic();
-
-#endif
-
-#endif /* _PROC_SERVICE_2_H */
diff --git a/hotspot/agent/src/os/solaris/dbx/shell_imp.h b/hotspot/agent/src/os/solaris/dbx/shell_imp.h
deleted file mode 100644
index 65de0ce7b8f..00000000000
--- a/hotspot/agent/src/os/solaris/dbx/shell_imp.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHELL_IMP_H
-#define SHELL_IMP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-
-/*
- CCR info
-
- Vesrion history:
-
- 1.0 - Initial CCR release
-
- Release information for automatic CCR updates:
-
- BEGIN RELEASE NOTES: (signifies what gets put into CCR release notes)
- 1.1
- - Entry points for va_list style msgs; new shell_imp_vmsg()
- and shell_imp_verrmsg()
- - shell_imp_env_checker() is now shell_imp_var_checker().
- Also the var_checker callback gets passed interp.
- 1.2 - interposition framework (used by jdbx)
- - access to input FILE pointer.
-
- END RELEASE NOTES: (signifies what gets put into CCR release notes)
-
-Following is used as a CCR version number:
-#define CCR_SHELL_IMP_VERSION 1.1
-*/
-
-#include
-
-#define SHELL_IMP_MAJOR 1
-#define SHELL_IMP_MINOR 2
-#define SHELL_IMP_FLAG_GLOB 0x1
-#define SHELL_IMP_FLAG_ARGQ 0x2
-
-typedef void *shell_imp_interp_t;
-typedef void *shell_imp_command_t;
-typedef int shell_imp_fun_t(shell_imp_interp_t, int, char **, void *);
-
-int
-shell_imp_init(
- int, /* major version number */
- int, /* minor version number */
- shell_imp_interp_t, /* interpreter */
- int, /* argc */
- char *[] /* argv */
-);
-
-int
-shell_imp_fini(shell_imp_interp_t);
-
-shell_imp_command_t
-shell_imp_define_command(char *, /* command name e.g. "tnf" */
- shell_imp_fun_t *, /* callback function */
- int, /* SHELL_IMP_FLAG_* bit vector */
- void *, /* client_data Passed as last arg to
- /* callback function */
- char * /* help message, e.g. */
- /* "enable the specified tnf probes" */
- );
-
-int
-shell_imp_undefine_command(shell_imp_command_t);
-
-int
-shell_imp_var_checker(shell_imp_interp_t,
- const char *, /* var name */
- int (*)(shell_imp_interp_t, const char*) /* env checker */
- );
-
-int
-shell_imp_execute(shell_imp_interp_t, const char *);
-
-const char *
-shell_imp_get_var(shell_imp_interp_t, const char *);
-
-void
-shell_imp_msg(shell_imp_interp_t, const char *, ...);
-
-void
-shell_imp_errmsg(shell_imp_interp_t, const char *, ...);
-
-void
-shell_imp_vmsg(shell_imp_interp_t, const char *, va_list);
-
-void
-shell_imp_verrmsg(shell_imp_interp_t, const char *, va_list);
-
-
-
-/*
- * Stuff added for 1.2
- */
-
-struct shell_imp_interposition_info_t {
- shell_imp_fun_t *
- new_func;
- void * new_client_data;
- shell_imp_fun_t *
- original_func;
- void * original_client_data;
- int original_flags;
-};
-
-typedef int shell_imp_dispatcher_t(shell_imp_interp_t, int, char **,
- shell_imp_interposition_info_t *);
-
-shell_imp_command_t
-shell_imp_interpose(char *name,
- shell_imp_fun_t *new_func,
- int flags,
- void *client_data,
- char * description,
- shell_imp_dispatcher_t *);
-
-int shell_imp_uninterpose(shell_imp_command_t);
-
-int
-shell_imp_dispatch_interposition(shell_imp_interp_t,
- shell_imp_interposition_info_t *,
- int argc, char *argv[]);
-
-int
-shell_imp_dispatch_original(shell_imp_interp_t,
- shell_imp_interposition_info_t *,
- int argc, char *argv[]);
-
-FILE *
-shell_imp_cur_input(shell_imp_interp_t);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/hotspot/agent/src/os/solaris/dbx/svc_agent_dbx.cpp b/hotspot/agent/src/os/solaris/dbx/svc_agent_dbx.cpp
deleted file mode 100644
index 5547fdc161d..00000000000
--- a/hotspot/agent/src/os/solaris/dbx/svc_agent_dbx.cpp
+++ /dev/null
@@ -1,1068 +0,0 @@
-/*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-// This is the implementation of a very simple dbx import module which
-// handles requests from the VM which come in over a socket. The
-// higher-level Java wrapper for dbx starts the debugger, attaches to
-// the process, imports this command, and runs it. After that, the SA
-// writes commands to this agent via its own private communications
-// channel. The intent is to move away from the text-based front-end
-// completely in the near future (no more calling "debug" by printing
-// text to dbx's stdin).
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include "proc_service_2.h"
-#include "svc_agent_dbx.hpp"
-
-static ServiceabilityAgentDbxModule* module = NULL;
-#define NEEDS_CLEANUP
-
-// Useful for debugging
-#define VERBOSE_DEBUGGING
-
-#ifdef VERBOSE_DEBUGGING
-# define debug_only(x) x
-#else
-# define debug_only(x)
-#endif
-
-// For profiling
-//#define PROFILING
-
-#ifdef PROFILING
-#define PROFILE_COUNT 200
-static Timer scanTimer;
-static Timer workTimer;
-static Timer writeTimer;
-static int numRequests = 0;
-#endif /* PROFILING */
-
-const char* ServiceabilityAgentDbxModule::CMD_ADDRESS_SIZE = "address_size";
-const char* ServiceabilityAgentDbxModule::CMD_PEEK_FAIL_FAST = "peek_fail_fast";
-const char* ServiceabilityAgentDbxModule::CMD_PEEK = "peek";
-const char* ServiceabilityAgentDbxModule::CMD_POKE = "poke";
-const char* ServiceabilityAgentDbxModule::CMD_MAPPED = "mapped";
-const char* ServiceabilityAgentDbxModule::CMD_LOOKUP = "lookup";
-const char* ServiceabilityAgentDbxModule::CMD_THR_GREGS = "thr_gregs";
-const char* ServiceabilityAgentDbxModule::CMD_EXIT = "exit";
-
-// The initialization routines must not have C++ name mangling
-extern "C" {
-
-/** This is the initialization routine called by dbx upon importing of
- this module. Returns 0 upon successful initialization, -1 upon
- failure. */
-int shell_imp_init(int major, int minor,
- shell_imp_interp_t interp, int argc, char *argv[])
-{
- // Ensure shell interpreter data structure is laid out the way we
- // expect
- if (major != SHELL_IMP_MAJOR) {
- debug_only(fprintf(stderr, "Serviceability agent: unexpected value for SHELL_IMP_MAJOR (got %d, expected %d)\n", major, SHELL_IMP_MAJOR);)
- return -1;
- }
- if (minor < SHELL_IMP_MINOR) {
- debug_only(fprintf(stderr, "Serviceability agent: unexpected value for SHELL_IMP_MINOR (got %d, expected >= %d)\n", minor, SHELL_IMP_MINOR);)
- return -1;
- }
-
- if (module != NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: module appears to already be initialized (should not happen)\n");)
- // Already initialized. Should not happen.
- return -1;
- }
-
- module = new ServiceabilityAgentDbxModule(major, minor, interp, argc, argv);
- if (!module->install()) {
- debug_only(fprintf(stderr, "Serviceability agent: error installing import module\n");)
- delete module;
- module = NULL;
- return -1;
- }
-
- // Installation was successful. Next step will be for the user to
- // enter the appropriate command on the command line, which will
- // make the SA's dbx module wait for commands to come in over the
- // socket.
- return 0;
-}
-
-/** This is the routine called by dbx upon unloading of this module.
- Returns 0 upon success, -1 upon failure. */
-int
-shell_imp_fini(shell_imp_interp_t)
-{
- if (module == NULL) {
- return -1;
- }
-
- bool res = module->uninstall();
- delete module;
- module = NULL;
- if (!res) {
- return -1;
- }
- return 0;
-}
-
-} // extern "C"
-
-/** This is the routine which is called by the dbx shell when the user
- requests the serviceability agent module to run. This delegates to
- ServiceabilityAgentDbxModule::run. This routine's signature must
- match that of shell_imp_fun_t. */
-extern "C" {
-static int
-svc_agent_run(shell_imp_interp_t, int, char **, void *) {
- if (module == NULL) {
- return -1;
- }
-
- module->run();
- return 0;
-}
-}
-
-/*
- * Implementation of ServiceabilityAgentDbxModule class
- */
-
-// NOTE: we need to forward declare the special "ps_get_prochandle2"
-// function which allows examination of core files as well. It isn't
-// currently in proc_service_2.h. Note also that it has name mangling
-// because it isn't declared extern "C".
-//const struct ps_prochandle *ps_get_prochandle2(int cores_too);
-
-ServiceabilityAgentDbxModule::ServiceabilityAgentDbxModule(int, int, shell_imp_interp_t interp,
- int argc, char *argv[])
- :myComm(32768, 131072)
-{
- _interp = interp;
- _argc = argc;
- _argv = argv;
- _tdb_agent = NULL;
- peek_fail_fast = false;
- libThreadName = NULL;
-}
-
-ServiceabilityAgentDbxModule::~ServiceabilityAgentDbxModule() {
- if (_command != NULL) {
- uninstall();
- }
-}
-
-char*
-readCStringFromProcess(psaddr_t addr) {
- char c;
- int num = 0;
- ps_prochandle* cur_proc = (ps_prochandle*) ps_get_prochandle2(1);
-
- // Search for null terminator
- do {
- if (ps_pread(cur_proc, addr + num, &c, 1) != PS_OK) {
- return NULL;
- }
- ++num;
- } while (c != 0);
-
- // Allocate string
- char* res = new char[num];
- if (ps_pread(cur_proc, addr, res, num) != PS_OK) {
- delete[] res;
- return NULL;
- }
- return res;
-}
-
-int
-findLibThreadCB(const rd_loadobj_t* lo, void* data) {
- ServiceabilityAgentDbxModule* module = (ServiceabilityAgentDbxModule*) data;
- char* name = readCStringFromProcess(lo->rl_nameaddr);
- if (strstr(name, "libthread.so") != NULL) {
- module->libThreadName = name;
- return 0;
- } else {
- delete[] name;
- return 1;
- }
-}
-
-bool
-ServiceabilityAgentDbxModule::install() {
- // NOTE interdependency between here and Java side wrapper
- // FIXME: casts of string literal to char * to match prototype
- _command = shell_imp_define_command((char *) "svc_agent_run",
- &svc_agent_run,
- 0,
- NULL,
- (char *) "Run the serviceability agent's dbx module.\n"
- "This routine causes the module to listen on a socket for requests.\n"
- "It does not return until the Java-side code tells it to exit, at\n"
- "which point control is returned to the dbx shell.");
- if (_command == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: Failed to install svc_agent_run command\n"));
- return false;
- }
-
- // This is fairly painful. Since dbx doesn't currently load
- // libthread_db with RTLD_GLOBAL, we can't just use RTLD_DEFAULT for
- // the argument to dlsym. Instead, we have to use rtld_db to search
- // through the loaded objects in the target process for libthread.so and
-
- // Try rtld_db
- if (rd_init(RD_VERSION) != RD_OK) {
- debug_only(fprintf(stderr, "Serviceability agent: Unable to init rtld_db\n"));
- return false;
- }
-
- rd_agent_t* rda = rd_new((struct ps_prochandle*) ps_get_prochandle2(1));
- if (rda == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: Unable to allocate rtld_db agent\n"));
- return false;
- }
-
- if (rd_loadobj_iter(rda, (rl_iter_f*) findLibThreadCB, this) != RD_OK) {
- debug_only(fprintf(stderr, "Serviceability agent: Loadobject iteration failed\n"));
- return false;
- }
-
- if (libThreadName == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: Failed to find pathname to libthread.so in target process\n"));
- return false;
- }
-
- // Find and open libthread_db.so
- char* slash = strrchr(libThreadName, '/');
- if (slash == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: can't parse path to libthread.so \"%s\"\n"));
- return false;
- }
-
- int slashPos = slash - libThreadName;
- char* buf = new char[slashPos + strlen("libthread_db.so") + 20]; // slop
- if (buf == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: error allocating libthread_db.so pathname\n"));
- return false;
- }
- strncpy(buf, libThreadName, slashPos + 1);
-
- // Check dbx's data model; use sparcv9/ subdirectory if 64-bit and
- // if target process is 32-bit
- if ((sizeof(void*) == 8) &&
- (strstr(libThreadName, "sparcv9") == NULL)) {
- strcpy(buf + slashPos + 1, "sparcv9/");
- slashPos += strlen("sparcv9/");
- }
-
- strcpy(buf + slashPos + 1, "libthread_db.so");
-
- libThreadDB = dlopen(buf, RTLD_LAZY);
- void* tmpDB = libThreadDB;
- if (libThreadDB == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: Warning: unable to find libthread_db.so at \"%s\"\n", buf));
- // Would like to handle this case as well. Maybe dbx has a better
- // idea of where libthread_db.so lies. If the problem with dbx
- // loading libthread_db without RTLD_GLOBAL specified ever gets
- // fixed, we could run this code all the time.
- tmpDB = RTLD_DEFAULT;
- }
-
- delete[] buf;
-
- // Initialize access to libthread_db
- td_init_fn = (td_init_fn_t*) dlsym(tmpDB, "td_init");
- td_ta_new_fn = (td_ta_new_fn_t*) dlsym(tmpDB, "td_ta_new");
- td_ta_delete_fn = (td_ta_delete_fn_t*) dlsym(tmpDB, "td_ta_delete");
- td_ta_map_id2thr_fn = (td_ta_map_id2thr_fn_t*) dlsym(tmpDB, "td_ta_map_id2thr");
- td_thr_getgregs_fn = (td_thr_getgregs_fn_t*) dlsym(tmpDB, "td_thr_getgregs");
-
- if (td_init_fn == NULL ||
- td_ta_new_fn == NULL ||
- td_ta_delete_fn == NULL ||
- td_ta_map_id2thr_fn == NULL ||
- td_thr_getgregs_fn == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: Failed to find one or more libthread_db symbols:\n"));
- debug_only(if (td_init_fn == NULL) fprintf(stderr, " td_init\n"));
- debug_only(if (td_ta_new_fn == NULL) fprintf(stderr, " td_ta_new\n"));
- debug_only(if (td_ta_delete_fn == NULL) fprintf(stderr, " td_ta_delete\n"));
- debug_only(if (td_ta_map_id2thr_fn == NULL) fprintf(stderr, " td_ta_map_id2thr\n"));
- debug_only(if (td_thr_getgregs_fn == NULL) fprintf(stderr, " td_thr_getgregs\n"));
- return false;
- }
-
- if ((*td_init_fn)() != TD_OK) {
- debug_only(fprintf(stderr, "Serviceability agent: Failed to initialize libthread_db\n"));
- return false;
- }
-
- return true;
-}
-
-bool
-ServiceabilityAgentDbxModule::uninstall() {
- if (_command == NULL) {
- return false;
- }
-
- if (libThreadDB != NULL) {
- dlclose(libThreadDB);
- libThreadDB = NULL;
- }
-
- int res = shell_imp_undefine_command(_command);
-
- if (res != 0) {
- return false;
- }
-
- return true;
-}
-
-bool
-ServiceabilityAgentDbxModule::run() {
- // This is where most of the work gets done.
- // The command processor loop looks like the following:
- // - create listening socket
- // - accept a connection (only one for now)
- // - while that connection is open and the "exit" command has not
- // been received:
- // - read command
- // - if it's the exit command, cleanup and return
- // - otherwise, process command and write result
-
- int listening_socket = socket(AF_INET, SOCK_STREAM, 0);
- if (listening_socket < 0) {
- return false;
- }
-
- // Set the SO_REUSEADDR property on the listening socket. This
- // prevents problems with calls to bind() to the same port failing
- // after this process exits. This seems to work on all platforms.
- int reuse_address = 1;
- if (setsockopt(listening_socket, SOL_SOCKET, SO_REUSEADDR,
- (char *)&reuse_address, sizeof(reuse_address)) < 0) {
- close(listening_socket);
- return false;
- }
-
- sockaddr_in server_address;
- // Build the server address. We can bind the listening socket to the
- // INADDR_ANY internet address.
- memset((char*)&server_address, 0, sizeof(server_address));
- server_address.sin_family = AF_INET;
- server_address.sin_addr.s_addr = (unsigned long)htonl(INADDR_ANY);
- server_address.sin_port = htons((short)PORT);
-
- // Bind socket to port
- if (bind(listening_socket, (sockaddr*) &server_address,
- sizeof(server_address)) < 0) {
- close(listening_socket);
- return false;
- }
-
- // Arbitrarily chosen backlog of 5 (shouldn't matter since we expect
- // at most one connection)
- if (listen(listening_socket, 5) < 0) {
- close(listening_socket);
- return false;
- }
-
- // OK, now ready to wait for a data connection. This call to
- // accept() will block.
- struct sockaddr_in client_address;
- int address_len = sizeof(client_address);
- int client_socket = accept(listening_socket, (sockaddr*) &client_address,
- &address_len);
- // Close listening socket regardless of whether accept() succeeded.
- // (FIXME: this may be annoying, especially during debugging, but I
- // really feel that robustness and multiple connections should be
- // handled higher up, e.g., at the Java level -- multiple clients
- // could conceivably connect to the SA via RMI, and that would be a
- // more robust solution than implementing multiple connections at
- // this level)
- NEEDS_CLEANUP;
-
- // NOTE: the call to shutdown() usually fails, so don't panic if this happens
- shutdown(listening_socket, 2);
-
- if (close(listening_socket) < 0) {
- debug_only(fprintf(stderr, "Serviceability agent: Error closing listening socket\n"));
- return false;
- }
-
- if (client_socket < 0) {
- debug_only(fprintf(stderr, "Serviceability agent: Failed to open client socket\n"));
- // No more cleanup necessary
- return false;
- }
-
- // Attempt to disable TCP buffering on this socket. We send small
- // amounts of data back and forth and don't want buffering.
- int buffer_val = 1;
- if (setsockopt(client_socket, IPPROTO_IP, TCP_NODELAY, (char *) &buffer_val, sizeof(buffer_val)) < 0) {
- debug_only(fprintf(stderr, "Serviceability agent: Failed to set TCP_NODELAY option on client socket\n"));
- cleanup(client_socket);
- return false;
- }
-
- // OK, we have the data socket through which we will communicate
- // with the Java side. Wait for commands or until reading or writing
- // caused an error.
-
- bool should_continue = true;
-
- myComm.setSocket(client_socket);
-
-#ifdef PROFILING
- scanTimer.reset();
- workTimer.reset();
- writeTimer.reset();
-#endif
-
- // Allocate a new thread agent for libthread_db
- if ((*td_ta_new_fn)((ps_prochandle*) ps_get_prochandle2(1), &_tdb_agent) !=
- TD_OK) {
- debug_only(fprintf(stderr, "Serviceability agent: Failed to allocate thread agent\n"));
- cleanup(client_socket);
- return false;
- }
-
- do {
- // Decided to use text to communicate between these processes.
- // Probably will make debugging easier -- could telnet in if
- // necessary. Will make scanning harder, but probably doesn't
- // matter.
-
- // Why not just do what workshop does and parse dbx's console?
- // Probably could do that, but at least this way we are in control
- // of the text format on both ends.
-
- // FIXME: should have some way of synchronizing these commands
- // between the C and Java sources.
-
- NEEDS_CLEANUP;
-
- // Do a blocking read of a line from the socket.
- char *input_buffer = myComm.readLine();
- if (input_buffer == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: error during read: errno = %d\n", errno));
- debug_only(perror("Serviceability agent"));
- // Error occurred during read.
- // FIXME: should guard against SIGPIPE
- cleanup(client_socket);
- return false;
- }
-
- // OK, now ready to scan. See README-commands.txt for syntax
- // descriptions.
-
- bool res = false;
- if (!strncmp(input_buffer, CMD_ADDRESS_SIZE, strlen(CMD_ADDRESS_SIZE))) {
- res = handleAddressSize(input_buffer + strlen(CMD_ADDRESS_SIZE));
- } else if (!strncmp(input_buffer, CMD_PEEK_FAIL_FAST, strlen(CMD_PEEK_FAIL_FAST))) {
- res = handlePeekFailFast(input_buffer + strlen(CMD_PEEK_FAIL_FAST));
- } else if (!strncmp(input_buffer, CMD_PEEK, strlen(CMD_PEEK))) {
- res = handlePeek(input_buffer + strlen(CMD_PEEK));
- } else if (!strncmp(input_buffer, CMD_POKE, strlen(CMD_POKE))) {
- res = handlePoke(input_buffer + strlen(CMD_POKE));
- } else if (!strncmp(input_buffer, CMD_MAPPED, strlen(CMD_MAPPED))) {
- res = handleMapped(input_buffer + strlen(CMD_MAPPED));
- } else if (!strncmp(input_buffer, CMD_LOOKUP, strlen(CMD_LOOKUP))) {
- res = handleLookup(input_buffer + strlen(CMD_LOOKUP));
- } else if (!strncmp(input_buffer, CMD_THR_GREGS, strlen(CMD_THR_GREGS))) {
- res = handleThrGRegs(input_buffer + strlen(CMD_THR_GREGS));
- } else if (!strncmp(input_buffer, CMD_EXIT, strlen(CMD_EXIT))) {
- should_continue = false;
- }
-
- if (should_continue) {
- if (!res) {
- cleanup(client_socket);
- return false;
- }
- }
-
-#ifdef PROFILING
- if (++numRequests == PROFILE_COUNT) {
- fprintf(stderr, "%d requests: %d ms scanning, %d ms work, %d ms writing\n",
- PROFILE_COUNT, scanTimer.total(), workTimer.total(), writeTimer.total());
- fflush(stderr);
- scanTimer.reset();
- workTimer.reset();
- writeTimer.reset();
- numRequests = 0;
- }
-#endif
-
- } while (should_continue);
-
- // Successful exit
- cleanup(client_socket);
- return true;
-}
-
-void
-ServiceabilityAgentDbxModule::cleanup(int client_socket) {
- shutdown(client_socket, 2);
- close(client_socket);
- if (_tdb_agent != NULL) {
- (*td_ta_delete_fn)(_tdb_agent);
- }
-}
-
-bool
-ServiceabilityAgentDbxModule::handleAddressSize(char* data) {
- int data_model;
- ps_err_e result = ps_pdmodel((ps_prochandle*) ps_get_prochandle2(1),
- &data_model);
- if (result != PS_OK) {
- myComm.writeString("0");
- myComm.flush();
- return false;
- }
-
- int val;
- switch (data_model) {
- case PR_MODEL_ILP32:
- val = 32;
- break;
- case PR_MODEL_LP64:
- val = 64;
- break;
- default:
- val = 0;
- break;
- }
-
- if (!myComm.writeInt(val)) {
- return false;
- }
- if (!myComm.writeEOL()) {
- return false;
- }
- return myComm.flush();
-}
-
-bool
-ServiceabilityAgentDbxModule::handlePeekFailFast(char* data) {
- unsigned int val;
- if (!scanUnsignedInt(&data, &val)) {
- return false;
- }
- peek_fail_fast = (val ? true : false);
- return true;
-}
-
-bool
-ServiceabilityAgentDbxModule::handlePeek(char* data) {
- // Scan hex address, return false if failed
- psaddr_t addr;
-#ifdef PROFILING
- scanTimer.start();
-#endif /* PROFILING */
- if (!scanAddress(&data, &addr)) {
- return false;
- }
- unsigned int num;
- if (!scanUnsignedInt(&data, &num)) {
- return false;
- }
- if (num == 0) {
-#ifdef PROFILING
- writeTimer.start();
-#endif /* PROFILING */
- myComm.writeBinChar('B');
- myComm.writeBinChar(1);
- myComm.writeBinUnsignedInt(0);
- myComm.writeBinChar(0);
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
- return true;
- }
-#ifdef PROFILING
- scanTimer.stop();
- workTimer.start();
-#endif /* PROFILING */
- char* buf = new char[num];
- ps_prochandle* cur_proc = (ps_prochandle*) ps_get_prochandle2(1);
- ps_err_e result = ps_pread(cur_proc, addr, buf, num);
- if (result == PS_OK) {
- // Fast case; entire read succeeded.
-#ifdef PROFILING
- workTimer.stop();
- writeTimer.start();
-#endif /* PROFILING */
- myComm.writeBinChar('B');
- myComm.writeBinChar(1);
- myComm.writeBinUnsignedInt(num);
- myComm.writeBinChar(1);
- myComm.writeBinBuf(buf, num);
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
- } else {
-#ifdef PROFILING
- workTimer.stop();
-#endif /* PROFILING */
-
- if (peek_fail_fast) {
-#ifdef PROFILING
- writeTimer.start();
-#endif /* PROFILING */
- // Fail fast
- myComm.writeBinChar('B');
- myComm.writeBinChar(1);
- myComm.writeBinUnsignedInt(num);
- myComm.writeBinChar(0);
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
- } else {
- // Slow case: try to read one byte at a time
- // FIXME: need better way of handling this, a la VirtualQuery
-
- unsigned int strideLen = 0;
- int bufIdx = 0;
- bool lastByteMapped = (ps_pread(cur_proc, addr, buf, 1) == PS_OK ? true : false);
-
-#ifdef PROFILING
- writeTimer.start();
-#endif /* PROFILING */
- myComm.writeBinChar('B');
- myComm.writeBinChar(1);
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
-
- for (int i = 0; i < num; ++i, ++addr) {
-#ifdef PROFILING
- workTimer.start();
-#endif /* PROFILING */
- result = ps_pread(cur_proc, addr, &buf[bufIdx], 1);
-#ifdef PROFILING
- workTimer.stop();
-#endif /* PROFILING */
- bool tmpMapped = (result == PS_OK ? true : false);
-#ifdef PROFILING
- writeTimer.start();
-#endif /* PROFILING */
- if (tmpMapped != lastByteMapped) {
- // State change. Write the length of the last stride.
- myComm.writeBinUnsignedInt(strideLen);
- if (lastByteMapped) {
- // Stop gathering data. Write the data of the last stride.
- myComm.writeBinChar(1);
- myComm.writeBinBuf(buf, strideLen);
- bufIdx = 0;
- } else {
- // Start gathering data to write.
- myComm.writeBinChar(0);
- }
- strideLen = 0;
- lastByteMapped = tmpMapped;
- }
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
- if (lastByteMapped) {
- ++bufIdx;
- }
- ++strideLen;
- }
-
- // Write last stride (must be at least one byte long by definition)
-#ifdef PROFILING
- writeTimer.start();
-#endif /* PROFILING */
- myComm.writeBinUnsignedInt(strideLen);
- if (lastByteMapped) {
- myComm.writeBinChar(1);
- myComm.writeBinBuf(buf, strideLen);
- } else {
- myComm.writeBinChar(0);
- }
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
- }
- }
- delete[] buf;
- myComm.flush();
- return true;
-}
-
-bool
-ServiceabilityAgentDbxModule::handlePoke(char* data) {
- // FIXME: not yet implemented
- NEEDS_CLEANUP;
- bool res = myComm.writeBoolAsInt(false);
- myComm.flush();
- return res;
-}
-
-bool
-ServiceabilityAgentDbxModule::handleMapped(char* data) {
- // Scan address
- psaddr_t addr;
- if (!scanAddress(&data, &addr)) {
- return false;
- }
- unsigned int num;
- if (!scanUnsignedInt(&data, &num)) {
- return false;
- }
- unsigned char val;
- ps_prochandle* cur_proc = (ps_prochandle*) ps_get_prochandle2(1);
- char* buf = new char[num];
- if (ps_pread(cur_proc, addr, buf, num) == PS_OK) {
- myComm.writeBoolAsInt(true);
- } else {
- myComm.writeBoolAsInt(false);
- }
- delete[] buf;
- myComm.writeEOL();
- myComm.flush();
- return true;
-}
-
-extern "C"
-int loadobj_iterator(const rd_loadobj_t* loadobj, void *) {
- if (loadobj != NULL) {
- fprintf(stderr, "loadobj_iterator: visited loadobj \"%p\"\n", (void*) loadobj->rl_nameaddr);
- return 1;
- }
-
- fprintf(stderr, "loadobj_iterator: NULL loadobj\n");
- return 0;
-}
-
-bool
-ServiceabilityAgentDbxModule::handleLookup(char* data) {
- // Debugging: iterate over loadobjs
- /*
- rd_agent_t* rld_agent = rd_new((ps_prochandle*) ps_get_prochandle2(1));
- rd_loadobj_iter(rld_agent, &loadobj_iterator, NULL);
- rd_delete(rld_agent);
- */
-
-#ifdef PROFILING
- scanTimer.start();
-#endif /* PROFILING */
-
- char* object_name = scanSymbol(&data);
- if (object_name == NULL) {
- return false;
- }
- char* symbol_name = scanSymbol(&data);
- if (symbol_name == NULL) {
- delete[] object_name;
- return false;
- }
-
-#ifdef PROFILING
- scanTimer.stop();
- workTimer.start();
-#endif /* PROFILING */
-
- ps_sym_t sym;
- // FIXME: check return values from write routines
- ps_prochandle* process = (ps_prochandle*) ps_get_prochandle2(1);
- ps_err_e lookup_res = ps_pglobal_sym(process,
- object_name, symbol_name, &sym);
-#ifdef PROFILING
- workTimer.stop();
- writeTimer.start();
-#endif /* PROFILING */
-
- delete[] object_name;
- delete[] symbol_name;
- if (lookup_res != PS_OK) {
- // This is too noisy
- // debug_only(fprintf(stderr, "ServiceabilityAgentDbxModule::handleLookup: error %d\n", lookup_res));
- myComm.writeString("0x0");
- } else {
- myComm.writeAddress((void *)sym.st_value);
- }
- myComm.writeEOL();
- myComm.flush();
-
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
-
- return true;
-}
-
-bool
-ServiceabilityAgentDbxModule::handleThrGRegs(char* data) {
-#ifdef PROFILING
- scanTimer.start();
-#endif /* PROFILING */
-
- unsigned int num;
- // Get the thread ID
- if (!scanUnsignedInt(&data, &num)) {
- return false;
- }
-
-#ifdef PROFILING
- scanTimer.stop();
- workTimer.start();
-#endif /* PROFILING */
-
- // Map tid to thread handle
- td_thrhandle_t thread_handle;
- if ((*td_ta_map_id2thr_fn)(_tdb_agent, num, &thread_handle) != TD_OK) {
- // fprintf(stderr, "Error mapping thread ID %d to thread handle\n", num);
- return false;
- }
-
- // Fetch register set
- prgregset_t reg_set;
- memset(reg_set, 0, sizeof(reg_set));
- td_err_e result = (*td_thr_getgregs_fn)(&thread_handle, reg_set);
- if ((result != TD_OK) && (result != TD_PARTIALREG)) {
- // fprintf(stderr, "Error fetching registers for thread handle %d: error = %d\n", num, result);
- return false;
- }
-
-#ifdef PROFILING
- workTimer.stop();
- writeTimer.start();
-#endif /* PROFILING */
-
-#if (defined(__sparc) || defined(__i386))
- myComm.writeInt(NPRGREG);
- myComm.writeSpace();
- for (int i = 0; i < NPRGREG; i++) {
- myComm.writeAddress((void *)reg_set[i]);
- if (i == NPRGREG - 1) {
- myComm.writeEOL();
- } else {
- myComm.writeSpace();
- }
- }
-#else
-#error Please port ServiceabilityAgentDbxModule::handleThrGRegs to your current platform
-#endif
-
- myComm.flush();
-
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
-
- return true;
-}
-
-//
-// Input routines
-//
-
-bool
-ServiceabilityAgentDbxModule::scanAddress(char** data, psaddr_t* addr) {
- *addr = 0;
-
- // Skip whitespace
- while ((**data != 0) && (isspace(**data))) {
- ++*data;
- }
-
- if (**data == 0) {
- return false;
- }
-
- if (strncmp(*data, "0x", 2) != 0) {
- return false;
- }
-
- *data += 2;
-
- while ((**data != 0) && (!isspace(**data))) {
- int val;
- bool res = charToNibble(**data, &val);
- if (!res) {
- return false;
- }
- *addr <<= 4;
- *addr |= val;
- ++*data;
- }
-
- return true;
-}
-
-bool
-ServiceabilityAgentDbxModule::scanUnsignedInt(char** data, unsigned int* num) {
- *num = 0;
-
- // Skip whitespace
- while ((**data != 0) && (isspace(**data))) {
- ++*data;
- }
-
- if (**data == 0) {
- return false;
- }
-
- while ((**data != 0) && (!isspace(**data))) {
- char cur = **data;
- if ((cur < '0') || (cur > '9')) {
- return false;
- }
- *num *= 10;
- *num += cur - '0';
- ++*data;
- }
-
- return true;
-}
-
-char*
-ServiceabilityAgentDbxModule::scanSymbol(char** data) {
- // Skip whitespace
- while ((**data != 0) && (isspace(**data))) {
- ++*data;
- }
-
- if (**data == 0) {
- return NULL;
- }
-
- // First count length
- int len = 1; // Null terminator
- char* tmpData = *data;
- while ((*tmpData != 0) && (!isspace(*tmpData))) {
- ++tmpData;
- ++len;
- }
- char* buf = new char[len];
- strncpy(buf, *data, len - 1);
- buf[len - 1] = 0;
- *data += len - 1;
- return buf;
-}
-
-bool
-ServiceabilityAgentDbxModule::charToNibble(char ascii, int* value) {
- if (ascii >= '0' && ascii <= '9') {
- *value = ascii - '0';
- return true;
- } else if (ascii >= 'A' && ascii <= 'F') {
- *value = 10 + ascii - 'A';
- return true;
- } else if (ascii >= 'a' && ascii <= 'f') {
- *value = 10 + ascii - 'a';
- return true;
- }
-
- return false;
-}
-
-
-char*
-ServiceabilityAgentDbxModule::readCStringFromProcess(psaddr_t addr) {
- char c;
- int num = 0;
- ps_prochandle* cur_proc = (ps_prochandle*) ps_get_prochandle2(1);
-
- // Search for null terminator
- do {
- if (ps_pread(cur_proc, addr + num, &c, 1) != PS_OK) {
- return NULL;
- }
- ++num;
- } while (c != 0);
-
- // Allocate string
- char* res = new char[num];
- if (ps_pread(cur_proc, addr, res, num) != PS_OK) {
- delete[] res;
- return NULL;
- }
- return res;
-}
-
-
-//--------------------------------------------------------------------------------
-// Class Timer
-//
-
-Timer::Timer() {
- reset();
-}
-
-Timer::~Timer() {
-}
-
-void
-Timer::start() {
- gettimeofday(&startTime, NULL);
-}
-
-void
-Timer::stop() {
- struct timeval endTime;
- gettimeofday(&endTime, NULL);
- totalMicroseconds += timevalDiff(&startTime, &endTime);
- ++counter;
-}
-
-long
-Timer::total() {
- return (totalMicroseconds / 1000);
-}
-
-long
-Timer::average() {
- return (long) ((double) total() / (double) counter);
-}
-
-void
-Timer::reset() {
- totalMicroseconds = 0;
- counter = 0;
-}
-
-long long
-Timer::timevalDiff(struct timeval* start, struct timeval* end) {
- long long secs = end->tv_sec - start->tv_sec;
- secs *= 1000000;
- long long usecs = end->tv_usec - start->tv_usec;
- return (secs + usecs);
-}
diff --git a/hotspot/agent/src/os/solaris/dbx/svc_agent_dbx.hpp b/hotspot/agent/src/os/solaris/dbx/svc_agent_dbx.hpp
deleted file mode 100644
index 0fbe8d0624e..00000000000
--- a/hotspot/agent/src/os/solaris/dbx/svc_agent_dbx.hpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "shell_imp.h"
-#include "IOBuf.hpp"
-#include
-#include
-
-typedef td_err_e td_init_fn_t();
-typedef td_err_e td_ta_new_fn_t(struct ps_prochandle *, td_thragent_t **);
-typedef td_err_e td_ta_delete_fn_t(td_thragent_t *);
-typedef td_err_e td_ta_map_id2thr_fn_t(const td_thragent_t *, thread_t, td_thrhandle_t *);
-typedef td_err_e td_thr_getgregs_fn_t(const td_thrhandle_t *, prgregset_t);
-
-class ServiceabilityAgentDbxModule {
-public:
- ServiceabilityAgentDbxModule(int major, int minor,
- shell_imp_interp_t interp, int argc, char *argv[]);
- ~ServiceabilityAgentDbxModule();
-
- bool install();
- bool uninstall();
-
- /* This is invoked through the dbx command interpreter. It listens
- on a socket for commands and does not return until it receives an
- "exit" command. At that point control is returned to dbx's main
- loop, at which point if the user sends an exit command to dbx's
- shell the dbx process will exit. Returns true if completed
- successfully, false if an error occurred while running (for
- example, unable to bind listening socket). */
- bool run();
-
-private:
-
- // This must be shared between the Java and C layers
- static const int PORT = 21928;
-
- // Command handlers
- bool handleAddressSize(char* data);
- bool handlePeekFailFast(char* data);
- bool handlePeek(char* data);
- bool handlePoke(char* data);
- bool handleMapped(char* data);
- bool handleLookup(char* data);
- bool handleThrGRegs(char* data);
-
- // Input routines
-
- // May mutate addr argument even if result is false
- bool scanAddress(char** data, psaddr_t* addr);
- // May mutate num argument even if result is false
- bool scanUnsignedInt(char** data, unsigned int* num);
- // Returns NULL if error occurred while scanning. Otherwise, returns
- // newly-allocated character array which must be freed with delete[].
- char* scanSymbol(char** data);
- // Helper routine: converts ASCII to 4-bit integer. Returns true if
- // character is in range, false otherwise.
- bool charToNibble(char ascii, int* value);
-
- // Output routines
-
- // Writes an int with no leading or trailing spaces
- bool writeInt(int val, int fd);
- // Writes an address in hex format with no leading or trailing
- // spaces
- bool writeAddress(psaddr_t addr, int fd);
- // Writes a register in hex format with no leading or trailing
- // spaces (addresses and registers might be of different size)
- bool writeRegister(prgreg_t reg, int fd);
- // Writes a space to given file descriptor
- bool writeSpace(int fd);
- // Writes carriage return to given file descriptor
- bool writeCR(int fd);
- // Writes a bool as [0|1]
- bool writeBoolAsInt(bool val, int fd);
- // Helper routine: converts low 4 bits to ASCII [0..9][A..F]
- char nibbleToChar(unsigned char nibble);
-
- // Base routine called by most of the above
- bool writeString(const char* str, int fd);
-
- // Writes a binary character
- bool writeBinChar(char val, int fd);
- // Writes a binary unsigned int in network (big-endian) byte order
- bool writeBinUnsignedInt(unsigned int val, int fd);
- // Writes a binary buffer
- bool writeBinBuf(char* buf, int size, int fd);
-
- // Routine to flush the socket
- bool flush(int client_socket);
-
- void cleanup(int client_socket);
-
- // The shell interpreter on which we can invoke commands (?)
- shell_imp_interp_t _interp;
-
- // The "command line" arguments passed to us by dbx (?)
- int _argc;
- char **_argv;
-
- // The installed command in the dbx shell
- shell_imp_command_t _command;
-
- // Access to libthread_db (dlsym'ed to be able to pick up the
- // version loaded by dbx)
- td_init_fn_t* td_init_fn;
- td_ta_new_fn_t* td_ta_new_fn;
- td_ta_delete_fn_t* td_ta_delete_fn;
- td_ta_map_id2thr_fn_t* td_ta_map_id2thr_fn;
- td_thr_getgregs_fn_t* td_thr_getgregs_fn;
-
- // Our "thread agent" -- access to libthread_db
- td_thragent_t* _tdb_agent;
-
- // Path to libthread.so in target process; free with delete[]
- char* libThreadName;
-
- // Handle to dlopen'ed libthread_db.so
- void* libThreadDB;
-
- // Helper callback for finding libthread_db.so
- friend int findLibThreadCB(const rd_loadobj_t* lo, void* data);
-
- // Support for reading C strings out of the target process (so we
- // can find the correct libthread_db). Returns newly-allocated char*
- // which must be freed with delete[], or null if the read failed.
- char* readCStringFromProcess(psaddr_t addr);
-
- IOBuf myComm;
-
- // Output buffer support (used by writeString, writeChar, flush)
- char* output_buffer;
- int output_buffer_size;
- int output_buffer_pos;
-
- // "Fail fast" flag
- bool peek_fail_fast;
-
- // Commands
- static const char* CMD_ADDRESS_SIZE;
- static const char* CMD_PEEK_FAIL_FAST;
- static const char* CMD_PEEK;
- static const char* CMD_POKE;
- static const char* CMD_MAPPED;
- static const char* CMD_LOOKUP;
- static const char* CMD_THR_GREGS;
- static const char* CMD_EXIT;
-};
-
-// For profiling. Times reported are in milliseconds.
-class Timer {
-public:
- Timer();
- ~Timer();
-
- void start();
- void stop();
- long total();
- long average();
- void reset();
-
-private:
- struct timeval startTime;
- long long totalMicroseconds; // stored internally in microseconds
- int counter;
- long long timevalDiff(struct timeval* startTime, struct timeval* endTime);
-};
diff --git a/hotspot/agent/src/os/win32/Buffer.cpp b/hotspot/agent/src/os/win32/Buffer.cpp
deleted file mode 100644
index 6c14b6a17dc..00000000000
--- a/hotspot/agent/src/os/win32/Buffer.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "Buffer.hpp"
-
-#include
-
-Buffer::Buffer(int bufSize) {
- buf = new char[bufSize];
- sz = bufSize;
- fill = 0;
- drain = 0;
-}
-
-Buffer::~Buffer() {
- delete[] buf;
-}
-
-char*
-Buffer::fillPos() {
- return buf + fill;
-}
-
-int
-Buffer::remaining() {
- return sz - fill;
-}
-
-int
-Buffer::size() {
- return sz;
-}
-
-bool
-Buffer::incrFillPos(int amt) {
- if (fill + amt >= sz) {
- return false;
- }
- fill += amt;
- return true;
-}
-
-int
-Buffer::readByte() {
- if (drain < fill) {
- return buf[drain++] & 0xFF;
- } else {
- return -1;
- }
-}
-
-int
-Buffer::readBytes(char* data, int len) {
- int numRead = 0;
- while (numRead < len) {
- int c = readByte();
- if (c < 0) break;
- data[numRead++] = (char) c;
- }
- return numRead;
-}
-
-char*
-Buffer::drainPos() {
- return buf + drain;
-}
-
-int
-Buffer::drainRemaining() {
- return fill - drain;
-}
-
-bool
-Buffer::incrDrainPos(int amt) {
- if (drainRemaining() < amt) {
- return false;
- }
- drain += amt;
- return true;
-}
-
-void
-Buffer::compact() {
- // Copy down data
- memmove(buf, buf + drain, fill - drain);
- // Adjust positions
- fill -= drain;
- drain = 0;
-}
diff --git a/hotspot/agent/src/os/win32/Buffer.hpp b/hotspot/agent/src/os/win32/Buffer.hpp
deleted file mode 100644
index c775a7ad6d7..00000000000
--- a/hotspot/agent/src/os/win32/Buffer.hpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _BUFFER_
-#define _BUFFER_
-
-// A Buffer is the backing store for the IOBuf abstraction and
-// supports producer-consumer filling and draining.
-
-class Buffer {
-public:
- Buffer(int bufSize);
- ~Buffer();
-
- char* fillPos(); // Position of the place where buffer should be filled
- int remaining(); // Number of bytes that can be placed starting at fillPos
- int size(); // Size of the buffer
- // Move up fill position by amount (decreases remaining()); returns
- // false if not enough space
- bool incrFillPos(int amt);
-
- // Read single byte (0..255); returns -1 if no data available.
- int readByte();
- // Read multiple bytes, non-blocking (this buffer does not define a
- // fill mechanism), into provided buffer. Returns number of bytes read.
- int readBytes(char* buf, int len);
-
- // Access to drain position. Be very careful using this.
- char* drainPos();
- int drainRemaining();
- bool incrDrainPos(int amt);
-
- // Compact buffer, removing already-consumed input. This must be
- // called periodically to yield the illusion of an infinite buffer.
- void compact();
-
-private:
- Buffer(const Buffer&);
- Buffer& operator=(const Buffer&);
-
- char* buf;
- int sz;
- int fill;
- int drain;
-};
-
-#endif // #defined _BUFFER_
diff --git a/hotspot/agent/src/os/win32/Dispatcher.cpp b/hotspot/agent/src/os/win32/Dispatcher.cpp
deleted file mode 100644
index ebb85e83a7d..00000000000
--- a/hotspot/agent/src/os/win32/Dispatcher.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include
-#include
-#include "dispatcher.hpp"
-
-const char* CMD_ASCII = "ascii";
-const char* CMD_UNICODE = "unicode";
-const char* CMD_PROCLIST = "proclist";
-const char* CMD_ATTACH = "attach";
-const char* CMD_DETACH = "detach";
-const char* CMD_LIBINFO = "libinfo";
-const char* CMD_PEEK = "peek";
-const char* CMD_POKE = "poke";
-const char* CMD_THREADLIST = "threadlist";
-const char* CMD_DUPHANDLE = "duphandle";
-const char* CMD_CLOSEHANDLE = "closehandle";
-const char* CMD_GETCONTEXT = "getcontext";
-const char* CMD_SETCONTEXT = "setcontext";
-const char* CMD_SELECTORENTRY = "selectorentry";
-const char* CMD_SUSPEND = "suspend";
-const char* CMD_RESUME = "resume";
-const char* CMD_POLLEVENT = "pollevent";
-const char* CMD_CONTINUEEVENT = "continueevent";
-const char* CMD_EXIT = "exit";
-
-// Uncomment the #define below to get messages on stderr
-// #define DEBUGGING
-
-void
-Dispatcher::dispatch(char* cmd, Handler* handler) {
- if (!strncmp(cmd, CMD_ASCII, strlen(CMD_ASCII))) {
- handler->ascii(cmd + strlen(CMD_ASCII));
-
- } else if (!strncmp(cmd, CMD_UNICODE, strlen(CMD_UNICODE))) {
- handler->unicode(cmd + strlen(CMD_UNICODE));
-
- } else if (!strncmp(cmd, CMD_PROCLIST, strlen(CMD_PROCLIST))) {
- handler->procList(cmd + strlen(CMD_PROCLIST));
-
- } else if (!strncmp(cmd, CMD_ATTACH, strlen(CMD_ATTACH))) {
- handler->attach(cmd + strlen(CMD_ATTACH));
-
- } else if (!strncmp(cmd, CMD_DETACH, strlen(CMD_DETACH))) {
- handler->detach(cmd + strlen(CMD_DETACH));
-
- } else if (!strncmp(cmd, CMD_LIBINFO, strlen(CMD_LIBINFO))) {
- handler->libInfo(cmd + strlen(CMD_LIBINFO));
-
- } else if (!strncmp(cmd, CMD_PEEK, strlen(CMD_PEEK))) {
- handler->peek(cmd + strlen(CMD_PEEK));
-
- } else if (!strncmp(cmd, CMD_POKE, strlen(CMD_POKE))) {
- handler->poke(cmd + strlen(CMD_POKE));
-
- } else if (!strncmp(cmd, CMD_THREADLIST, strlen(CMD_THREADLIST))) {
- handler->threadList(cmd + strlen(CMD_THREADLIST));
-
- } else if (!strncmp(cmd, CMD_DUPHANDLE, strlen(CMD_DUPHANDLE))) {
- handler->dupHandle(cmd + strlen(CMD_DUPHANDLE));
-
- } else if (!strncmp(cmd, CMD_CLOSEHANDLE, strlen(CMD_CLOSEHANDLE))) {
- handler->closeHandle(cmd + strlen(CMD_CLOSEHANDLE));
-
- } else if (!strncmp(cmd, CMD_GETCONTEXT, strlen(CMD_GETCONTEXT))) {
- handler->getContext(cmd + strlen(CMD_GETCONTEXT));
-
- } else if (!strncmp(cmd, CMD_SETCONTEXT, strlen(CMD_SETCONTEXT))) {
- handler->setContext(cmd + strlen(CMD_SETCONTEXT));
-
- } else if (!strncmp(cmd, CMD_SELECTORENTRY, strlen(CMD_SELECTORENTRY))) {
- handler->selectorEntry(cmd + strlen(CMD_SELECTORENTRY));
-
- } else if (!strncmp(cmd, CMD_SUSPEND, strlen(CMD_SUSPEND))) {
- handler->suspend(cmd + strlen(CMD_SUSPEND));
-
- } else if (!strncmp(cmd, CMD_RESUME, strlen(CMD_RESUME))) {
- handler->resume(cmd + strlen(CMD_RESUME));
-
- } else if (!strncmp(cmd, CMD_POLLEVENT, strlen(CMD_POLLEVENT))) {
- handler->pollEvent(cmd + strlen(CMD_POLLEVENT));
-
- } else if (!strncmp(cmd, CMD_CONTINUEEVENT, strlen(CMD_CONTINUEEVENT))) {
- handler->continueEvent(cmd + strlen(CMD_CONTINUEEVENT));
-
- } else if (!strcmp(cmd, CMD_EXIT)) {
- handler->exit(cmd + strlen(CMD_EXIT));
- }
-
-#ifdef DEBUGGING
- else fprintf(stderr, "Ignoring illegal command \"%s\"\n", cmd);
-#endif
-}
diff --git a/hotspot/agent/src/os/win32/Handler.hpp b/hotspot/agent/src/os/win32/Handler.hpp
deleted file mode 100644
index 0aa32c4a785..00000000000
--- a/hotspot/agent/src/os/win32/Handler.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _HANDLER_
-#define _HANDLER_
-
-/** An abstract base class encapsulating the handlers for all commands
- understood by the system. */
-class Handler {
-public:
- virtual void ascii(char* arg) = 0;
- virtual void unicode(char* arg) = 0;
- virtual void procList(char* arg) = 0;
- virtual void attach(char* arg) = 0;
- virtual void detach(char* arg) = 0;
- virtual void libInfo(char* arg) = 0;
- virtual void peek(char* arg) = 0;
- virtual void poke(char* arg) = 0;
- virtual void threadList(char* arg) = 0;
- virtual void dupHandle(char* arg) = 0;
- virtual void closeHandle(char* arg) = 0;
- virtual void getContext(char* arg) = 0;
- virtual void setContext(char* arg) = 0;
- virtual void selectorEntry(char* arg) = 0;
- virtual void suspend(char* arg) = 0;
- virtual void resume(char* arg) = 0;
- virtual void pollEvent(char* arg) = 0;
- virtual void continueEvent(char* arg) = 0;
- virtual void exit(char* arg) = 0;
-};
-
-#endif // #defined _HANDLER_
diff --git a/hotspot/agent/src/os/win32/IOBuf.cpp b/hotspot/agent/src/os/win32/IOBuf.cpp
deleted file mode 100644
index 08d29b1fada..00000000000
--- a/hotspot/agent/src/os/win32/IOBuf.cpp
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include
-
-// This file is currently used for os/solaris/agent too. At some point in time
-// the source will be reorganized to avoid these ifdefs.
-
-#ifdef __sun
- #include
- #include
- #include
-#endif
-
-#include "IOBuf.hpp"
-
-// Formats for printing pointers
-#ifdef _LP64
-# define INTPTR_FORMAT "0x%016lx"
-#else /* ! _LP64 */
-# define INTPTR_FORMAT "0x%08lx"
-#endif /* _LP64 */
-
-// Uncomment the #define below to get messages on stderr
-// #define DEBUGGING
-
-IOBuf::IOBuf(int inLen, int outLen) {
- inBuf = new Buffer(inLen);
- outBuf = new Buffer(outLen);
- fd = INVALID_SOCKET;
- outHandle = NULL;
- usingSocket = true;
- reset();
-}
-
-IOBuf::~IOBuf() {
- delete inBuf;
- delete outBuf;
-}
-
-void
-IOBuf::setSocket(SOCKET sock) {
- fd = sock;
- usingSocket = true;
-}
-
-// Reading/writing files is only needed and used on windows.
-#ifdef WIN32
-void
-IOBuf::setOutputFileHandle(HANDLE handle) {
- outHandle = handle;
- usingSocket = false;
-}
-#endif
-
-void
-IOBuf::reset() {
- gotDataLastTime = false;
- state = TEXT_STATE;
- binPos = 0;
- binLength = 0;
-}
-
-IOBuf::ReadLineResult
-IOBuf::tryReadLine() {
- return doReadLine(false);
-}
-
-char*
-IOBuf::readLine() {
- ReadLineResult rr = doReadLine(true);
- if (rr != RL_GOT_DATA) {
- return NULL;
- }
- return getLine();
-}
-
-IOBuf::ReadLineResult
-IOBuf::doReadLine(bool shouldWait) {
-
- if (!usingSocket) {
- return IOBuf::RL_ERROR;
- }
-
- if (gotDataLastTime) {
- curLine.clear();
- }
-
- int c;
- do {
- c = readChar(shouldWait);
- if (c >= 0) {
- Action act = processChar((char) c);
- if (act == GOT_LINE) {
- curLine.push_back('\0');
- gotDataLastTime = true;
- return IOBuf::RL_GOT_DATA;
- } else if (act == SKIP_EOL_CHAR) {
- // Do nothing
- } else {
- curLine.push_back((char) c);
- }
- }
- } while (shouldWait || c >= 0);
-
- gotDataLastTime = false;
- return IOBuf::RL_NO_DATA;
-}
-
-bool
-IOBuf::flushImpl(bool moreDataToCome) {
- int numWritten = 0;
-
-#ifdef WIN32
- // When running on Windows and using IOBufs for inter-process
- // communication, we need to write metadata into the stream
- // indicating how many bytes are coming down. Five bytes are written
- // per flush() call, four containing the integer number of bytes
- // coming (not including the five-byte header) and one (a 0 or 1)
- // indicating whether there is more data coming.
- if (!usingSocket) {
- int numToWrite = outBuf->drainRemaining();
- char moreToCome = (moreDataToCome ? 1 : 0);
- DWORD numBytesWritten;
- if (!WriteFile(outHandle, &numToWrite, sizeof(int), &numBytesWritten, NULL)) {
- return false;
- }
- if (numBytesWritten != sizeof(int)) {
- return false;
- }
- if (!WriteFile(outHandle, &moreToCome, 1, &numBytesWritten, NULL)) {
- return false;
- }
- if (numBytesWritten != 1) {
- return false;
- }
- }
-#endif
-
- while (outBuf->drainRemaining() != 0) {
-#ifdef DEBUGGING
- fprintf(stderr, "Flushing %d bytes\n", outBuf->drainRemaining());
-#endif
- if (usingSocket) {
- numWritten = send(fd, outBuf->drainPos(), outBuf->drainRemaining(), 0);
- } else {
-#ifdef WIN32
- DWORD numBytesWritten;
- if (!WriteFile(outHandle, outBuf->drainPos(), outBuf->drainRemaining(), &numBytesWritten, NULL)) {
- numWritten = -1;
- } else {
- numWritten = numBytesWritten;
- }
-#endif
- }
- if (numWritten != -1) {
-#ifdef DEBUGGING
- fprintf(stderr, "Flushed %d bytes\n", numWritten);
-#endif
- outBuf->incrDrainPos(numWritten);
- } else {
- return false;
- }
- }
-
- outBuf->compact();
-
- return true;
-}
-
-int
-IOBuf::readChar(bool block) {
- do {
- int c = inBuf->readByte();
- if (c >= 0) {
- return c;
- }
- // See whether we need to compact the input buffer
- if (inBuf->remaining() < inBuf->size() / 2) {
- inBuf->compact();
- }
- // See whether socket is ready
- fd_set fds;
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
- struct timeval timeout;
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- if (block || select(1 + fd, &fds, NULL, NULL, &timeout) > 0) {
- if (block || FD_ISSET(fd, &fds)) {
-#ifdef DEBUGGING
- int b = (block ? 1 : 0);
- fprintf(stderr, "calling recv: block = %d\n", b);
-#endif
- // Read data from socket
- int numRead = recv(fd, inBuf->fillPos(), inBuf->remaining(), 0);
- if (numRead < 0) {
-#ifdef DEBUGGING
- fprintf(stderr, "recv failed\n");
-#endif
- return -1;
- }
- inBuf->incrFillPos(numRead);
- }
- }
- } while (block);
-
- return inBuf->readByte();
-}
-
-char*
-IOBuf::getLine() {
-#ifdef DEBUGGING
- fprintf(stderr, "Returning (first 10 chars) \"%.10s\"\n", curLine.begin());
-#endif
- return curLine.begin();
-}
-
-bool
-IOBuf::flush() {
- return flushImpl(false);
-}
-
-bool
-IOBuf::writeString(const char* str) {
- int len = strlen(str);
-
- if (len > outBuf->size()) {
- return false;
- }
-
- if (len > outBuf->remaining()) {
- if (!flushImpl(true)) {
- return false;
- }
- }
-
- // NOTE we do not copy the null terminator of the string.
-
- strncpy(outBuf->fillPos(), str, len);
- outBuf->incrFillPos(len);
- return true;
-}
-
-bool
-IOBuf::writeInt(int val) {
- char buf[128];
- sprintf(buf, "%d", val);
- return writeString(buf);
-}
-
-bool
-IOBuf::writeUnsignedInt(unsigned int val) {
- char buf[128];
- sprintf(buf, "%u", val);
- return writeString(buf);
-}
-
-bool
-IOBuf::writeBoolAsInt(bool val) {
- if (val) {
- return writeString("1");
- } else {
- return writeString("0");
- }
-}
-
-bool
-IOBuf::writeAddress(void* val) {
- char buf[128];
- sprintf(buf, INTPTR_FORMAT, val);
- return writeString(buf);
-}
-
-bool
-IOBuf::writeSpace() {
- return writeString(" ");
-}
-
-bool
-IOBuf::writeEOL() {
- return writeString("\n\r");
-}
-
-bool
-IOBuf::writeBinChar(char c) {
- return writeBinBuf((char*) &c, sizeof(c));
-}
-
-bool
-IOBuf::writeBinUnsignedShort(unsigned short i) {
- i = htons(i);
- return writeBinBuf((char*) &i, sizeof(i));
-}
-
-bool
-IOBuf::writeBinUnsignedInt(unsigned int i) {
- i = htonl(i);
- return writeBinBuf((char*) &i, sizeof(i));
-}
-
-bool
-IOBuf::writeBinBuf(char* buf, int size) {
- while (size > 0) {
- int spaceRemaining = outBuf->remaining();
- if (spaceRemaining == 0) {
- if (!flushImpl(true)) {
- return false;
- }
- spaceRemaining = outBuf->remaining();
- }
- int toCopy = (size > spaceRemaining) ? spaceRemaining : size;
- memcpy(outBuf->fillPos(), buf, toCopy);
- outBuf->incrFillPos(toCopy);
- buf += toCopy;
- size -= toCopy;
- if (size > 0) {
- if (!flushImpl(true)) {
- return false;
- }
- }
- }
- return true;
-}
-
-#ifdef WIN32
-IOBuf::FillState
-IOBuf::fillFromFileHandle(HANDLE fh, DWORD* numBytesRead) {
- int totalToRead;
- char moreToCome;
-
- outBuf->compact();
-
- DWORD numRead;
- if (!ReadFile(fh, &totalToRead, sizeof(int), &numRead, NULL)) {
- return FAILED;
- }
- if (numRead != sizeof(int)) {
- return FAILED;
- }
- if (!ReadFile(fh, &moreToCome, 1, &numRead, NULL)) {
- return FAILED;
- }
- if (numRead != 1) {
- return FAILED;
- }
- if (outBuf->remaining() < totalToRead) {
- return FAILED;
- }
-
- int tmp = totalToRead;
-
- while (totalToRead > 0) {
- if (!ReadFile(fh, outBuf->fillPos(), totalToRead, &numRead, NULL)) {
- return FAILED;
- }
- outBuf->incrFillPos((int) numRead);
- totalToRead -= numRead;
- }
-
- *numBytesRead = tmp;
- return ((moreToCome == 0) ? DONE : MORE_DATA_PENDING);
-}
-#endif
-
-bool
-IOBuf::isBinEscapeChar(char c) {
- return (c == '|');
-}
-
-IOBuf::Action
-IOBuf::processChar(char c) {
- Action action = NO_ACTION;
- switch (state) {
- case TEXT_STATE: {
- // Looking for text char, bin escape char, or EOL
- if (isBinEscapeChar(c)) {
-#ifdef DEBUGGING
- fprintf(stderr, "[a: '%c'] ", inBuf[0]);
-#endif
- binPos = 0;
-#ifdef DEBUGGING
- fprintf(stderr, "[b: '%c'] ", inBuf[0]);
-#endif
- binLength = 0;
-#ifdef DEBUGGING
- fprintf(stderr, "[c: '%c'] ", inBuf[0]);
-#endif
- state = BIN_STATE;
-#ifdef DEBUGGING
- fprintf(stderr, "[d: '%c'] ", inBuf[0]);
-#endif
-#ifdef DEBUGGING
- fprintf(stderr, "\nSwitching to BIN_STATE\n");
-#endif
- } else if (isEOL(c)) {
- state = EOL_STATE;
- action = GOT_LINE;
-#ifdef DEBUGGING
- fprintf(stderr, "\nSwitching to EOL_STATE (GOT_LINE)\n");
-#endif
- }
-#ifdef DEBUGGING
- else {
- fprintf(stderr, "'%c' ", c);
- fflush(stderr);
- }
-#endif
- break;
- }
-
- case BIN_STATE: {
- // Seeking to finish read of input
- if (binPos < 4) {
- int cur = c & 0xFF;
- binLength <<= 8;
- binLength |= cur;
- ++binPos;
- } else {
-#ifdef DEBUGGING
- fprintf(stderr, "Reading binary byte %d of %d\n",
- binPos - 4, binLength);
-#endif
- ++binPos;
- if (binPos == 4 + binLength) {
- state = TEXT_STATE;
-#ifdef DEBUGGING
- fprintf(stderr, "Switching to TEXT_STATE\n");
-#endif
- }
- }
- break;
- }
-
- case EOL_STATE: {
- // More EOL characters just cause us to re-enter this state
- if (isEOL(c)) {
- action = SKIP_EOL_CHAR;
- } else if (isBinEscapeChar(c)) {
- binPos = 0;
- binLength = 0;
- state = BIN_STATE;
- } else {
- state = TEXT_STATE;
-#ifdef DEBUGGING
- fprintf(stderr, "'%c' ", c);
- fflush(stderr);
-#endif
- }
- break;
- }
-
- } // switch
-
- return action;
-}
-
-
-bool
-IOBuf::isEOL(char c) {
-#ifdef WIN32
- return ((c == '\n') || (c == '\r'));
-#elif defined(__sun)
- return c == '\n';
-#else
- #error Please port isEOL() to your platform
- return false;
-#endif
-}
diff --git a/hotspot/agent/src/os/win32/IOBuf.hpp b/hotspot/agent/src/os/win32/IOBuf.hpp
deleted file mode 100644
index 31ed391119e..00000000000
--- a/hotspot/agent/src/os/win32/IOBuf.hpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _IO_BUF_
-#define _IO_BUF_
-
-// This file is currently used for os/solaris/agent/ too. At some point in time
-// the source will be reorganized to avoid these ifdefs.
-// Note that this class can read/write from a file as well as a socket. This
-// file capability is only implemented on win32.
-
-#ifdef WIN32
- #include
-#else
- #include
- #include
- // These are from win32 winsock2.h
- typedef unsigned int SOCKET;
- typedef void * HANDLE;
- typedef unsigned long DWORD;
- #define INVALID_SOCKET (SOCKET)(~0)
-#endif
-
-#include
-#include "Buffer.hpp"
-
-/** Manages an input/output buffer pair for a socket or file handle. */
-class IOBuf {
-public:
- IOBuf(int inBufLen, int outBufLen);
- ~IOBuf();
-
- enum ReadLineResult {
- RL_GOT_DATA,
- RL_NO_DATA,
- RL_ERROR
- };
-
- /** Change the socket with which this buffer is associated */
- void setSocket(SOCKET sock);
-
- // Reading/writing files is only supported on windows.
-#ifdef WIN32
- /** Change the output file handle with which this buffer is
- associated. Currently IOBufs can not be used to read from a file
- handle. */
- void setOutputFileHandle(HANDLE handle);
-#endif
-
- /** Reset the input and output buffers, without flushing the output
- data to the socket */
- void reset();
-
- /** Try to read a line of data from the given socket without
- blocking. If was able to read a complete line of data, returns a
- character pointer to the beginning of the (null-terminated)
- string. If not, returns NULL, but maintains enough state that
- subsequent calls to tryReadLine() will not ignore the data
- already read. NOTE: this skips end-of-line characters (typically
- CR/LF) as defined by "isEOL()". When switching back and forth
- between binary and text modes, to be sure no data is lost, pad
- the beginning and end of the binary transmission with bytes
- which can not be confused with these characters. */
- ReadLineResult tryReadLine();
-
- /** Read a line of data from the given socket, blocking until a
- line, including EOL, appears. Return the line, or NULL if
- something goes wrong. */
- char *readLine();
-
- /** Get the pointer to the beginning of the (null-terminated) line.
- This should only be called if tryReadLine() has returned
- RL_GOT_DATA. This sets the "parsing cursor" to the beginning of
- the line. */
- char* getLine();
-
- // NOTE: any further data-acquisition routines must ALWAYS call
- // fixupData() at the beginning!
-
- //----------------------------------------------------------------------
- // Output routines
- //
-
- /** Flush the output buffer to the socket. Returns true if
- succeeded, false if write error occurred. */
- bool flush();
-
- /** Write the given string to the output buffer. May flush if output
- buffer becomes too full to store the data. Not guaranteed to
- work if string is longer than the size of the output buffer.
- Does not include the null terminator of the string. Returns true
- if succeeded, false if write error occurred. */
- bool writeString(const char* str);
-
- /** Write the given int to the output buffer. May flush if output
- buffer becomes too full to store the data. Returns true if
- succeeded, false if write error occurred. */
- bool writeInt(int val);
-
- /** Write the given unsigned int to the output buffer. May flush if
- output buffer becomes too full to store the data. Returns true
- if succeeded, false if write error occurred. */
- bool writeUnsignedInt(unsigned int val);
-
- /** Write the given boolean to the output buffer. May flush if
- output buffer becomes too full to store the data. Returns true
- if succeeded, false if write error occurred. */
- bool writeBoolAsInt(bool val);
-
- /** Write the given address to the output buffer. May flush if
- output buffer becomes too full to store the data. Returns true
- if succeeded, false if write error occurred. */
- bool writeAddress(void* val);
-
- /** Writes a space to the output buffer. May flush if output buffer
- becomes too full to store the data. Returns true if succeeded,
- false if write error occurred. */
- bool writeSpace();
-
- /** Writes an end-of-line sequence to the output buffer. May flush
- if output buffer becomes too full to store the data. Returns
- true if succeeded, false if write error occurred. */
- bool writeEOL();
-
- /** Writes a binary character to the output buffer. */
- bool writeBinChar(char c);
-
- /** Writes a binary unsigned short in network (big-endian) byte
- order to the output buffer. */
- bool writeBinUnsignedShort(unsigned short i);
-
- /** Writes a binary unsigned int in network (big-endian) byte order
- to the output buffer. */
- bool writeBinUnsignedInt(unsigned int i);
-
- /** Writes a binary buffer to the output buffer. */
- bool writeBinBuf(char* buf, int size);
-
-#ifdef WIN32
- enum FillState {
- DONE = 1,
- MORE_DATA_PENDING = 2,
- FAILED = 3
- };
-
- /** Very specialized routine; fill the output buffer from the given
- file handle. Caller is responsible for ensuring that there is
- data to be read on the file handle. */
- FillState fillFromFileHandle(HANDLE fh, DWORD* numRead);
-#endif
-
- /** Binary utility routine (for poke) */
- static bool isBinEscapeChar(char c);
-
-private:
- IOBuf(const IOBuf&);
- IOBuf& operator=(const IOBuf&);
-
- // Returns -1 if non-blocking and no data available
- int readChar(bool block);
- // Line-oriented reading
- std::vector curLine;
- bool gotDataLastTime;
-
- ReadLineResult doReadLine(bool);
-
- bool flushImpl(bool moreDataToCome);
-
- SOCKET fd;
- HANDLE outHandle;
- bool usingSocket;
-
- // Buffers
- Buffer* inBuf;
- Buffer* outBuf;
-
- // Simple finite-state machine to handle binary data
- enum State {
- TEXT_STATE,
- BIN_STATE,
- EOL_STATE
- };
- enum Action {
- NO_ACTION,
- GOT_LINE, // TEXT_STATE -> EOL_STATE transition
- SKIP_EOL_CHAR // EOL_STATE -> EOL_STATE transition
- };
-
- State state;
- Action processChar(char c);
-
- // Handling incoming binary buffers (poke command)
- int binPos; // Number of binary characters read so far;
- // total number to read is binLength + 4
- int binLength; // Number of binary characters in message;
- // not valid until binPos >= 4
-
- bool isEOL(char c);
-};
-
-#endif // #defined _IO_BUF_
diff --git a/hotspot/agent/src/os/win32/Makefile b/hotspot/agent/src/os/win32/Makefile
deleted file mode 100644
index 43d45072357..00000000000
--- a/hotspot/agent/src/os/win32/Makefile
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-#
-
-SERVER=SwDbgSrv.exe
-SUBPROCESS=SwDbgSub.exe
-
-SERVER_SOURCES = \
- Buffer.cpp \
- Dispatcher.cpp \
- initWinsock.cpp \
- IOBuf.cpp \
- ioUtils.cpp \
- isNT4.cpp \
- nt4internals.cpp \
- procList.cpp \
- Reaper.cpp \
- SwDbgSrv.cpp \
- serverLists.cpp \
- toolHelp.cpp
-
-SUBPROCESS_SOURCES = \
- SwDbgSub.cpp \
- Buffer.cpp \
- IOBuf.cpp \
- isNT4.cpp \
- libInfo.cpp \
- Monitor.cpp \
- nt4internals.cpp \
- toolHelp.cpp
-
-SERVER_OBJS = $(SERVER_SOURCES:.cpp=.obj)
-SUBPROCESS_OBJS = $(SUBPROCESS_SOURCES:.cpp=.obj)
-
-CPP=cl.exe
-LINK32=link.exe
-
-# These do not need to be optimized (don't run a lot of code) and it
-# will be useful to have the assertion checks in place
-
-CFLAGS=/nologo /MD /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-
-LIBS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib \
- ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib \
- winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib \
- odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386
-
-default: $(SERVER) $(SUBPROCESS)
-
-$(SERVER): $(SERVER_OBJS)
- $(LINK32) /out:$@ $(SERVER_OBJS) $(LIBS)
-
-$(SUBPROCESS): $(SUBPROCESS_OBJS)
- $(LINK32) /out:$@ $(SUBPROCESS_OBJS) $(LIBS)
-
-clean:
- rm -f *.obj *.idb *.pch *.pdb *.ncb *.opt *.plg *.exe *.ilk
-
-.cpp.obj:
- @ $(CPP) $(CFLAGS) /o $@ $<
diff --git a/hotspot/agent/src/os/win32/Message.hpp b/hotspot/agent/src/os/win32/Message.hpp
deleted file mode 100644
index 61c6bd0fd70..00000000000
--- a/hotspot/agent/src/os/win32/Message.hpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _MESSAGE_
-#define _MESSAGE_
-
-// These are the commands sent from the server to the child processes
-// over the child processes' stdin pipes. A subset of the commands
-// understood by the overall system, these require responses from the
-// child process. Having a data structure rather than sending text
-// simplifies parsing on the child side. The child replies by sending
-// back fully-formatted replies which are copied by the server process
-// to the clients' sockets.
-
-struct PeekArg {
- DWORD address;
- DWORD numBytes;
-};
-
-// NOTE: when sending a PokeArg to the child process, we handle the
-// buffer specially
-struct PokeArg {
- DWORD address;
- DWORD numBytes;
- void* data;
-};
-
-// Used for continueevent
-struct BoolArg {
- bool val;
-};
-
-// Used for duphandle, closehandle, and getcontext
-struct HandleArg {
- HANDLE handle;
-};
-
-// Used for setcontext
-const int NUM_REGS_IN_CONTEXT = 22;
-struct SetContextArg {
- HANDLE handle;
- DWORD Eax;
- DWORD Ebx;
- DWORD Ecx;
- DWORD Edx;
- DWORD Esi;
- DWORD Edi;
- DWORD Ebp;
- DWORD Esp;
- DWORD Eip;
- DWORD Ds;
- DWORD Es;
- DWORD Fs;
- DWORD Gs;
- DWORD Cs;
- DWORD Ss;
- DWORD EFlags;
- DWORD Dr0;
- DWORD Dr1;
- DWORD Dr2;
- DWORD Dr3;
- DWORD Dr6;
- DWORD Dr7;
-};
-
-// Used for selectorentry
-struct SelectorEntryArg {
- HANDLE handle;
- DWORD selector;
-};
-
-struct Message {
- typedef enum {
- ATTACH,
- DETACH,
- LIBINFO,
- PEEK,
- POKE,
- THREADLIST,
- DUPHANDLE,
- CLOSEHANDLE,
- GETCONTEXT,
- SETCONTEXT,
- SELECTORENTRY,
- SUSPEND,
- RESUME,
- POLLEVENT,
- CONTINUEEVENT
- } Type;
-
- Type type;
- union {
- PeekArg peekArg;
- PokeArg pokeArg;
- BoolArg boolArg;
- HandleArg handleArg;
- SetContextArg setContextArg;
- SelectorEntryArg selectorArg;
- };
-};
-
-#endif // #defined _MESSAGE_
diff --git a/hotspot/agent/src/os/win32/Monitor.cpp b/hotspot/agent/src/os/win32/Monitor.cpp
deleted file mode 100644
index 181c173bbb8..00000000000
--- a/hotspot/agent/src/os/win32/Monitor.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include
-#include
-#include "Monitor.hpp"
-
-Monitor::Monitor() {
- _lock_count = -1; // No threads have entered the critical section
- _owner = NULL;
- _lock_event = CreateEvent(NULL, false, false, NULL);
- _wait_event = CreateEvent(NULL, true, false, NULL);
- _counter = 0;
- _tickets = 0;
- _waiters = 0;
-}
-
-Monitor::~Monitor() {
- assert(_owner == NULL); // Otherwise, owned monitor being deleted
- assert(_lock_count == -1); // Otherwise, monitor being deleted with non -1 lock count
- CloseHandle(_lock_event);
- CloseHandle(_wait_event);
-}
-
-void
-Monitor::lock() {
- if (InterlockedIncrement(&_lock_count) == 0) {
- // Success, we now own the lock
- } else {
- DWORD dwRet = WaitForSingleObject((HANDLE)_lock_event, INFINITE);
- assert(dwRet == WAIT_OBJECT_0); // Unexpected return value from WaitForSingleObject
- }
- assert(owner() == NULL); // Otherwise, lock count and owner are inconsistent
- setOwner(GetCurrentThread());
-}
-
-void
-Monitor::unlock() {
- setOwner(NULL);
- if (InterlockedDecrement(&_lock_count) >= 0) {
- // Wake a waiting thread up
- DWORD dwRet = SetEvent(_lock_event);
- assert(dwRet != 0); // Unexpected return value from SetEvent
- }
-}
-
-bool
-Monitor::wait(long timeout) {
- assert(owner() != NULL);
- assert(owner() == GetCurrentThread());
-
- // 0 means forever. Convert to Windows specific code.
- DWORD timeout_value = (timeout == 0) ? INFINITE : timeout;
- DWORD which;
-
- long c = _counter;
- bool retry = false;
-
- _waiters++;
- // Loop until condition variable is signaled. The event object is
- // set whenever the condition variable is signaled, and tickets will
- // reflect the number of threads which have been notified. The counter
- // field is used to make sure we don't respond to notifications that
- // have occurred *before* we started waiting, and is incremented each
- // time the condition variable is signaled.
-
- while (true) {
-
- // Leave critical region
- unlock();
-
- // If this is a retry, let other low-priority threads have a chance
- // to run. Make sure that we sleep outside of the critical section.
- if (retry) {
- Sleep(1);
- } else {
- retry = true;
- }
-
- which = WaitForSingleObject(_wait_event, timeout_value);
- // Enter critical section
- lock();
-
- if (_tickets != 0 && _counter != c) break;
-
- if (which == WAIT_TIMEOUT) {
- --_waiters;
- return true;
- }
- }
- _waiters--;
-
- // If this was the last thread to be notified, then we need to reset
- // the event object.
- if (--_tickets == 0) {
- ResetEvent(_wait_event);
- }
-
- return false;
-}
-
-// Notify a single thread waiting on this monitor
-bool
-Monitor::notify() {
- assert(ownedBySelf()); // Otherwise, notify on unknown thread
-
- if (_waiters > _tickets) {
- if (!SetEvent(_wait_event)) {
- return false;
- }
- _tickets++;
- _counter++;
- }
-
- return true;
-}
-
-// Notify all threads waiting on this monitor
-bool
-Monitor::notifyAll() {
- assert(ownedBySelf()); // Otherwise, notifyAll on unknown thread
-
- if (_waiters > 0) {
- if (!SetEvent(_wait_event)) {
- return false;
- }
- _tickets = _waiters;
- _counter++;
- }
-
- return true;
-}
-
-HANDLE
-Monitor::owner() {
- return _owner;
-}
-
-void
-Monitor::setOwner(HANDLE owner) {
- if (owner != NULL) {
- assert(_owner == NULL); // Setting owner thread of already owned monitor
- assert(owner == GetCurrentThread()); // Else should not be doing this
- } else {
- HANDLE oldOwner = _owner;
- assert(oldOwner != NULL); // Removing the owner thread of an unowned mutex
- assert(oldOwner == GetCurrentThread());
- }
- _owner = owner;
-}
-
-bool
-Monitor::ownedBySelf() {
- return (_owner == GetCurrentThread());
-}
diff --git a/hotspot/agent/src/os/win32/README-commands.txt b/hotspot/agent/src/os/win32/README-commands.txt
deleted file mode 100644
index 0a1cb13a59f..00000000000
--- a/hotspot/agent/src/os/win32/README-commands.txt
+++ /dev/null
@@ -1,246 +0,0 @@
-This debug server uses a largely text-based protocol, except for
-certain bulk data transfer operations. All text is in single-byte
-US-ASCII except for the strings returned in "proclist".
-
-NOTE that the character '|' (vertical bar) is used as an escape
-character to switch the incoming data stream to the debug server into
-binary mode, so no text command may contain that character.
-
-Commands understood:
-
-ascii ::=
-
- Changes to ASCII mode. This affects all outgoing strings. At
- startup the system is in unicode mode.
-
-unicode ::=
-
- Changes to UNICODE mode. This affects all outgoing strings. This
- is the default mode upon startup.
-
-proclist ::=
- [ []...]...
-
- Returns integer indicating number of processes to follow, followed
- by (pid, name) pairs. Names are given by (charSize, numChars,
- [char_t]...) tuples; charSize indicates the size of each character
- in bytes, numChars the number of characters in the string, and
- name the raw data for the string. Each individual character of the
- string, if multi-byte, is transmitted in network byte order.
- numChars and name are guaranteed to be separated by precisely one
- US-ASCII space. If process list is not available because of
- limitations of the underlying operating system, number of
- processes returned is 0.
-
-attach ::=
-
- Attempts to attach to the specified process. Returns 1 if
- successful, 0 if not. Will fail if already attached or if the
- process ID does not exist. Attaching to a process causes the
- process to be suspended.
-
-detach ::=
-
- Detaches from the given process. Attaching and detaching multiple
- times during a debugging session is allowed. Detaching causes the
- process to resume execution.
-
-libinfo ::=
- [ []... ]...
-
- May only be called once attached and the target process must be
- suspended; otherwise, returns 0. Returns list of the full path
- names of all of the loaded modules (including the executable
- image) in the target process, as well as the base address at which
- each module was relocated. See proclist for format of strings, but
- NOTE that charSize is ALWAYS 1 for this particular routine,
- regardless of the setting of ASCII/UNICODE.
-
-peek ::=
- B
- [ []...]...
-
- NOTE that the binary portion of this message is prefixed by the
- uppercase US-ASCII letter 'B', allowing easier synchronization by
- clients. There is no data between the 'B' and the rest of the
- message.
-
- May only be called once attached. Reads the address space of the
- target process starting at the given address (see below for format
- specifications) and extending the given number of bytes. Whether
- the read succeeded is indicated by a single byte containing a 1 or
- 0 (success or failure). If successful, the return result is given
- in a sequence of ranges. _len_, the length of each range, is
- indicated by a 32-bit unsigned integer transmitted with big-endian
- byte ordering (i.e., most significant byte first). _isMapped_
- indicates whether the range is mapped or unmapped in the target
- process's address space, and will contain the value 1 or 0 for
- mapped or unmapped, respectively. If the range is mapped,
- _isMapped_ is followed by _data_, containing the raw binary data
- for the range. The sum of all ranges' lengths is guaranteed to be
- equivalent to the number of bytes requested.
-
-poke |[ []] ::=
-
-
- NOTE that the binary portion of this message is prefixed by the
- uppercase US-ASCII character '|' (vertical bar), allowing easier
- synchronization by the server. There is no data between the '|'
- and the rest of the message. ('B' is not used here because
- addresses can contain that letter; no alphanumeric characters are
- used because some of the parsing routines are used by the Solaris
- SA port, and in that port any alphanumeric character can show up
- as a part of a symbol being looked up.)
-
- May only be called once attached. Writes the address space of the
- target process starting at the given address (see below for format
- specifications), extending the given number of bytes, and
- containing the given data. The number of bytes is a 32-bit
- unsigned integer transmitted with big-endian byte ordering (i.e.,
- most significant byte first). This is followed by the raw binary
- data to be placed at that address. The number of bytes of data
- must match the number of bytes specified in the message.
-
- Returns true if the write succeeded; false if it failed, for
- example because a portion of the region was not mapped in the
- target address space.
-
-threadlist ::= [...]
-
- May only be called once attached and the target process must be
- suspended; otherwise, returns 0. If available, returns handles for
- all of the threads in the target process. These handles may be
- used as arguments to the getcontext and selectorentry
- commands. They do not need to be (and should not be) duplicated
- via the duphandle command and must not be closed via the
- closehandle command.
-
-duphandle ::=
- []
-
- Duplicates a HANDLE read from the target process's address space.
- HANDLE is a Windows construct (typically typedef'd to void *).
- The returned handle should ultimately be closed via the
- closehandle command; failing to do so can cause resource leaks.
-
- The purpose of this command is to allow the debugger to read the
- value of a thread handle from the target process and query its
- register set and thread selector entries via the getcontext and
- selectorentry commands, below; such use implies that the target
- program has its own notion of the thread list, and further, that
- the debugger has a way of locating that thread list.
-
-closehandle ::=
-
- Closes a handle retrieved via the duphandle command, above.
-
-getcontext ::= []
-
- Returns the context for the given thread. The handle must either
- be one of the handles returned from the threadlist command or the
- result of duplicating a thread handle out of the target process
- via the duphandle command. The target process must be suspended.
-
- The context is returned as a series of hex values which represent
- the following x86 registers in the following order:
- EAX, EBX, ECX, EDX, ESI, EDI, EBP, ESP, EIP, DS, ES, FS, GS,
- CS, SS, EFLAGS, DR0, DR1, DR2, DR3, DR6, DR7
-
- FIXME: needs to be generalized and/or specified for other
- architectures.
-
-setcontext ::=
-
- Sets the context of the given thread. The target process must be
- suspended. See the getcontext command for the ordering of the
- registers in the context.
-
- Even if the setcontext command succeeds, some of the bits in some
- of the registers (like the global enable bits in the debug
- registers) may be overridden by the operating system. To ensure
- the debugger's notion of the register set is up to date, it is
- recommended to follow up a setcontext with a getcontext.
-
-selectorentry ::=
-
- [
-
- ]
-
- Retrieves a descriptor table entry for the given thread and
- selector. This data structure allows conversion of a
- segment-relative address to a linear virtual address. It is most
- useful for locating the Thread Information Block for a given
- thread handle to be able to find that thread's ID, to be able to
- understand whether two different thread handles in fact refer to
- the same underlying thread.
-
- This command will only work on the X86 architecture and will
- return false for the success flag (with no additional information
- sent) on other architectures.
-
-suspend ::=
-
- Suspends the target process. Must be attached to a target process.
- A process is suspended when attached to via the attach command. If
- the target process is already suspended then this command has no
- effect.
-
-resume ::=
-
- Resumes the target process without detaching from it. Must be
- attached to a target process. After resuming a target process, the
- debugger client must be prepared to poll for events from the
- target process fairly frequently in order for execution in the
- target process to proceed normally. If the target process is
- already resumed then this command has no effect.
-
-pollevent ::=
- [ ]
-
- Additional entries in result for given eventCode:
-
- LOAD/UNLOAD_DLL_DEBUG_EVENT:
- EXCEPTION_DEBUG_EVENT:
-
- Additional entries for given exceptionCode:
-
- EXCEPTION_ACCESS_VIOLATION:
-
-
-
- Polls once to see whether a debug event has been generated by the
- target process. If none is present, returns 0 immediately.
- Otherwise, returns 1 along with a series of textual information
- about the event. The event is not cleared, and the thread resumed,
- until the continueevent command is sent, or the debugger client
- detaches from the target process.
-
- Typically a debugger client will suspend the target process upon
- reception of a debug event. Otherwise, it is not guaranteed that
- all threads will be suspended upon reception of a debug event, and
- any operations requiring that threads be suspended (including
- fetching the context for the thread which generated the event)
- will fail.
-
-continueevent ::=
-
- Indicates that the current debug event has been used by the
- debugger client and that the target process should be resumed. The
- passEventToClient flag indicates whether the event should be
- propagated to the target process. Breakpoint and single-step
- events should not be propagated to the target. Returns false if
- there was no pending event, true otherwise.
-
-exit
-
- Exits this debugger session.
-
-Format specifications:
-
-// Data formats and example values:
- ::= end of line (typically \n on Unix platforms, or \n\r on Windows)
- ::= 0x12345678[9ABCDEF0] /* up to 64-bit hex value */
- ::= 5 /* up to 32-bit integer number; no leading sign */
- ::= 1 /* ASCII '0' or '1' */
- ::= ...
diff --git a/hotspot/agent/src/os/win32/README.txt b/hotspot/agent/src/os/win32/README.txt
deleted file mode 100644
index e470b471bef..00000000000
--- a/hotspot/agent/src/os/win32/README.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-This is a "Simple Windows Debug Server" written for the purpose of
-enabling the Serviceability Agent on Win32. It has backends both for
-Windows NT 4.0 (using internal Windows APIs for a few routines) as
-well as for 95/98/ME/2000 via the Tool Help APIs.
-
-The reason this debug server is necessary is that the Win32 debug APIs
-by design tear down the target process when the debugger exits (see
-knowledge base article Q164205 on msdn.microsoft.com). On Solaris, one
-can attach to and detach from a process with no effect; this is key to
-allowing dbx and gcore to work.
-
-The Simple Windows Debug Server effectively implements attach/detach
-functionality for arbitrary debug clients. This allows the SA to
-attach non-destructively to a process, and will enable gcore for Win32
-to be written shortly. While the debugger (the "client" in all of the
-source code) is attached, the target process is suspended. (Note that
-the debug server could be extended to support resumption of the target
-process and transmission of debug events over to the debugger, but
-this has been left for the future.)
-
-The makefile (type "nmake") builds two executables: SwDbgSrv.exe,
-which is the server process, and SwDbgSub.exe, which is forked by the
-server and should not be directly invoked by the user.
-
-The intent is that these two executables can be installed into
-C:\WINNT\SYSTEM32 and SwDbgSrv installed to run as a service (on NT),
-for example using ServiceInstaller (http://www.kcmultimedia.com/smaster/).
-However, SwDbgSrv can also be run from the command line. It generates
-no text output unless the source code is changed to enable debugging
-printouts. As long as any processes which have been attached to by the
-SA are alive, the SwDbgSrv and any forked SwDbgSub processes must be
-left running. Terminating them will cause termination of the target
-processes.
-
-The debug server opens port 27000 and accepts incoming connections
-from localhost only. The security model assumes that if one can run a
-process on the given machine then one basically has access to most or
-all of the machine's facilities; this seems to be in line with the
-standard Windows security model. The protocol used is text-based, so
-one can debug the debug server using telnet. See README-commands.txt
-for documentation on the supported commands.
-
-Testing indicates that the performance impact of attaching to a
-process (and therefore permanently attaching a debugger) is minimal.
-Some serious performance problems had been seen which ultimately
-appeared to be a lack of physical memory on the machine running the
-system.
-
-Bugs:
-
-This debug server is fundamentally incompatible with the Visual C++
-debugger. Once the debug server is used to attach to a process, the
-Visual C++ IDE will not be able to attach to the same process (even if
-the debug server is "detached" from that process). Note that this
-system is designed to work with the same primitives that C and C++
-debuggers use (like "symbol lookup" and "read from process memory")
-and exposes these primitives to Java, so in the long term we could
-solve this problem by implementing platform-specific debug symbol
-parsing and a platform-independent C++ debugger in Java.
-
-Note:
-
-The files IOBuf.cpp and IOBuf.hpp are also used in
-building src/os/solaris/agent.
diff --git a/hotspot/agent/src/os/win32/Reaper.cpp b/hotspot/agent/src/os/win32/Reaper.cpp
deleted file mode 100644
index 13726c55eb7..00000000000
--- a/hotspot/agent/src/os/win32/Reaper.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include
-#include "Reaper.hpp"
-
-using namespace std;
-
-Reaper::Reaper(ReaperCB* cb) {
- InitializeCriticalSection(&crit);
- event = CreateEvent(NULL, TRUE, FALSE, NULL);
- this->cb = cb;
-
- active = false;
- shouldShutDown = false;
-}
-
-bool
-Reaper::start() {
- bool result = false;
-
- EnterCriticalSection(&crit);
-
- if (!active) {
- DWORD id;
- HANDLE reaper = CreateThread(NULL, 0, &Reaper::reaperThreadEntry,
- this, 0, &id);
- if (reaper != NULL) {
- result = true;
- }
- }
-
- LeaveCriticalSection(&crit);
-
- return result;
-}
-
-bool
-Reaper::stop() {
- bool result = false;
-
- EnterCriticalSection(&crit);
-
- if (active) {
- shouldShutDown = true;
- SetEvent(event);
- while (active) {
- Sleep(1);
- }
- shouldShutDown = false;
- result = true;
- }
-
- LeaveCriticalSection(&crit);
-
- return result;
-}
-
-void
-Reaper::registerProcess(HANDLE processHandle, void* userData) {
- ProcessInfo info;
-
- info.handle = processHandle;
- info.userData = userData;
-
- EnterCriticalSection(&crit);
-
- procInfo.push_back(info);
- SetEvent(event);
-
- LeaveCriticalSection(&crit);
-}
-
-void
-Reaper::reaperThread() {
- while (!shouldShutDown) {
- // Take atomic snapshot of the current process list and user data
- EnterCriticalSection(&crit);
-
- int num = procInfo.size();
- HANDLE* handleList = new HANDLE[1 + num];
- void** dataList = new void*[num];
- for (int i = 0; i < num; i++) {
- handleList[i] = procInfo[i].handle;
- dataList[i] = procInfo[i].userData;
- }
-
- LeaveCriticalSection(&crit);
-
- // Topmost handle becomes the event object, so other threads can
- // signal this one to notice differences in the above list (or
- // shut down)
- handleList[num] = event;
-
- // Wait for these objects
- DWORD idx = WaitForMultipleObjects(1 + num, handleList,
- FALSE, INFINITE);
- if ((idx >= WAIT_OBJECT_0) && (idx <= WAIT_OBJECT_0 + num)) {
- idx -= WAIT_OBJECT_0;
- if (idx < num) {
- // A process exited (i.e., it wasn't that we were woken up
- // just because the event went off)
- (*cb)(dataList[idx]);
- // Remove this process from the list (NOTE: requires that
- // ordering does not change, i.e., that all additions are to
- // the back of the process list)
- EnterCriticalSection(&crit);
-
- std::vector::iterator iter = procInfo.begin();
- iter += idx;
- procInfo.erase(iter);
-
- LeaveCriticalSection(&crit);
- } else {
- // Notification from other thread
- ResetEvent(event);
- }
- } else {
- // Unexpected return value. For now, warn.
- cerr << "Reaper::reaperThread(): unexpected return value "
- << idx << " from WaitForMultipleObjects" << endl;
- }
-
- // Clean up these lists
- delete[] handleList;
- delete[] dataList;
- }
-
- // Time to shut down
- active = false;
-}
-
-DWORD WINAPI
-Reaper::reaperThreadEntry(LPVOID data) {
- Reaper* reaper = (Reaper*) data;
- reaper->reaperThread();
- return 0;
-}
diff --git a/hotspot/agent/src/os/win32/Reaper.hpp b/hotspot/agent/src/os/win32/Reaper.hpp
deleted file mode 100644
index bee02192a1d..00000000000
--- a/hotspot/agent/src/os/win32/Reaper.hpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _REAPER_
-#define _REAPER_
-
-#include
-#include
-
-typedef void ReaperCB(void* userData);
-
-/** A Reaper maintains a thread which waits for child processes to
- terminate; upon termination it calls a user-specified ReaperCB to
- clean up resources associated with those child processes. */
-
-class Reaper {
-private:
- Reaper& operator=(const Reaper&);
- Reaper(const Reaper&);
-
-public:
- Reaper(ReaperCB*);
- ~Reaper();
-
- // Start the reaper thread.
- bool start();
-
- // Stop the reaper thread. This is called automatically in the
- // reaper's destructor. It is not thread safe and should be called
- // by at most one thread at a time.
- bool stop();
-
- // Register a given child process with the reaper. This should be
- // called by the application's main thread. When that process
- // terminates, the cleanup callback will be called with the
- // specified userData in the context of the reaper thread. Callbacks
- // are guaranteed to be called serially, so they can safely refer to
- // static data as well as the given user data.
- void registerProcess(HANDLE processHandle, void* userData);
-
-private:
- // For thread safety of register()
- CRITICAL_SECTION crit;
-
- ReaperCB* cb;
-
- // State variables
- volatile bool active;
- volatile bool shouldShutDown;
-
- struct ProcessInfo {
- HANDLE handle;
- void* userData;
- };
-
- // Bookkeeping
- std::vector procInfo;
-
- // Synchronization between application thread and reaper thread
- HANDLE event;
-
- // Entry point for reaper thread
- void reaperThread();
-
- // Static function which is actual thread entry point
- static DWORD WINAPI reaperThreadEntry(LPVOID data);
-};
-
-#endif // #defined _REAPER_
diff --git a/hotspot/agent/src/os/win32/SwDbgSrv.cpp b/hotspot/agent/src/os/win32/SwDbgSrv.cpp
deleted file mode 100644
index 7f49bae3e99..00000000000
--- a/hotspot/agent/src/os/win32/SwDbgSrv.cpp
+++ /dev/null
@@ -1,1266 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-// A Simple Windows Debug Server.
-//
-// This software provides a socket-based debug server which uses
-// mostly ASCII protocols to communicate with its clients. Since the
-// Windows security model is largely based around being able to run
-// programs on the machine, this server only accepts connections
-// coming from localhost.
-//
-// When run as a service (under Windows NT), this software provides
-// clients the ability to attach to and detach from processes without
-// killing those processes. Ordinarily this is forbidden by the
-// Windows debugging APIs (although more recent debugging environments
-// from Microsoft seem to have circumvented this restriction, perhaps
-// in a different way). This is achieved by forking a persistent
-// subprocess for each debugging session which remains alive as long
-// as the target process is.
-//
-// At this point the client can read information out of the target
-// process's address space. Future work includes exposing more
-// functionality like writing to the remote address space and
-// suspending and resuming threads.
-
-#include
-#include
-#include
-// Must come before everything else
-#include
-#include
-#include "Dispatcher.hpp"
-#include "Handler.hpp"
-#include "initWinsock.hpp"
-#include "ioUtils.hpp"
-#include "isNT4.hpp"
-#include "Message.hpp"
-#include "nt4internals.hpp"
-#include "ports.h"
-#include "procList.hpp"
-#include "serverLists.hpp"
-#include "Reaper.hpp"
-
-// Uncomment the #define below to get messages on stderr
-// #define DEBUGGING
-
-using namespace std;
-
-static ChildList childList;
-static ClientList clientList;
-static Reaper* reaper = NULL;
-
-// Needed prototypes
-void shutdownChild(ChildInfo* childInfo);
-void detachClient(ClientInfo* clientInfo);
-void shutdownClient(ClientInfo* clientInfo);
-
-char *
-longToDotFormat(long addr)
-{
- char *temp_s = new char[20];
-
- sprintf(temp_s, "%d.%d.%d.%d", ((addr & 0xff000000) >> 24),
- ((addr & 0x00ff0000) >> 16), ((addr & 0x0000ff00) >> 8),
- (addr & 0x000000ff));
-
- return temp_s;
-}
-
-// NOTE that we do this query every time. It is a bad idea to cache IP
-// addresses. For example, we might be hosted on a machine using DHCP
-// and the connection addresses might change over time. (Yes, this
-// actually happened.)
-bool
-isConnectionOkay(ULONG connAddr) {
- if (connAddr == INADDR_LOOPBACK) {
- return true;
- }
-
- const int MAXNAME = 1024;
- char myname[MAXNAME];
- gethostname(myname, MAXNAME);
- struct hostent* myInfo = gethostbyname(myname);
- if (myInfo == NULL) {
-#ifdef DEBUGGING
- cerr << "My host information was null" << endl;
-#endif
- } else {
- // Run down the list of IP addresses for myself
- assert(myInfo->h_length == sizeof(ULONG));
-#ifdef DEBUGGING
- cerr << "My known IP addresses: " << endl;
-#endif
- for (char** pp = myInfo->h_addr_list; *pp != NULL; pp++) {
- char* p = *pp;
- ULONG altAddr = ntohl(*((ULONG*) p));
-#ifdef DEBUGGING
- char* name = longToDotFormat(altAddr);
- cerr << name << endl;
- delete[] name;
-#endif
- if (altAddr == connAddr) {
-#ifdef DEBUGGING
- cerr << "FOUND" << endl;
-#endif
- return true;
- }
- }
-#ifdef DEBUGGING
- cerr << "Done." << endl;
-#endif
- }
-
- return false;
-}
-
-SOCKET
-setupListeningSocket(short port) {
- SOCKET listening = socket(AF_INET, SOCK_STREAM, 0);
- if (listening == INVALID_SOCKET) {
- cerr << "Error creating listening socket" << endl;
- exit(1);
- }
-
- int reuseAddress = 1;
- if (setsockopt(listening, SOL_SOCKET, SO_REUSEADDR,
- (char *)&reuseAddress, sizeof(reuseAddress)) == -1) {
- cerr << "Error reusing address" << endl;
- exit(1);
- }
-
- struct sockaddr_in serverInfo;
-
- memset((char *)&serverInfo, 0, sizeof(serverInfo));
- serverInfo.sin_addr.s_addr = INADDR_ANY;
- serverInfo.sin_family = AF_INET;
- serverInfo.sin_port = htons(port);
-
- if (bind(listening, (struct sockaddr *) &serverInfo, sizeof(serverInfo)) < 0) {
- cerr << "Error binding socket" << endl;
- exit(1);
- }
-
- if (listen(listening, 5) < 0) {
- cerr << "Error listening" << endl;
- exit(1);
- }
-
- return listening;
-}
-
-/** Accepts a connection from the given listening socket, but only if
- the connection came from localhost. Returns INVALID_SOCKET if the
- connection came from any other IP address or if an error occurred
- during the call to accept(). */
-SOCKET
-acceptFromLocalhost(SOCKET listening) {
- struct sockaddr_in peerAddr;
- int peerAddrLen = sizeof(peerAddr);
- SOCKET fd = accept(listening, (sockaddr*) &peerAddr, &peerAddrLen);
- if (fd == INVALID_SOCKET) {
- return fd;
- }
-
- if (!isConnectionOkay(ntohl(peerAddr.sin_addr.s_addr))) {
- // Reject connections from other machines for security purposes.
- // The Windows security model seems to assume one user per
- // machine, and that security is compromised if another user is
- // able to run executables on the given host. (If these
- // assumptions are not strict enough, we will have to change
- // this.)
- shutdown(fd, SD_BOTH);
- closesocket(fd);
- return INVALID_SOCKET;
- }
-
- // Disable TCP buffering on all sockets. We send small amounts of
- // data back and forth and don't want buffering.
- int buffer_val = 1;
- if (setsockopt(fd, IPPROTO_IP, TCP_NODELAY,
- (char *) &buffer_val, sizeof(buffer_val)) < 0) {
- shutdown(fd, SD_BOTH);
- closesocket(fd);
- }
-
- return fd;
-}
-
-void
-reapCB(void* arg) {
- ChildInfo* info = (ChildInfo*) arg;
- ListsLocker ll;
- DWORD pid = info->getPid();
- shutdownChild(info);
-#ifdef DEBUGGING
- cerr << "Reaped child for process " << pid << endl;
-#endif
-}
-
-/** Starts a child process with stdin and stdout redirected to pipes,
- handles to which are returned. auxHandle1 and auxHandle2 should be
- closed as well when the child process exits. Returns false if
- process creation failed. */
-bool
-startChildProcess(DWORD pidToDebug,
- DWORD childStdinBufSize,
- DWORD childStdoutBufSize,
- LPHANDLE childProcessHandle,
- LPHANDLE writeToStdinHandle,
- LPHANDLE readFromStdoutHandle,
- LPHANDLE auxHandle1,
- LPHANDLE auxHandle2) {
- // Code adapted from Microsoft example
- // "Creating a Child Process with Redirected Input and Output"
-
- SECURITY_ATTRIBUTES saAttr;
- BOOL fSuccess;
-
- HANDLE hChildStdinRd, hChildStdinWr, hChildStdinWrDup,
- hChildStdoutRd, hChildStdoutWr, hChildStdoutRdDup,
- hSaveStdin, hSaveStdout;
-
- // Set the bInheritHandle flag so pipe handles are inherited.
- saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
- saAttr.bInheritHandle = TRUE;
- saAttr.lpSecurityDescriptor = NULL;
-
- // The steps for redirecting child process's STDOUT:
- // 1. Save current STDOUT, to be restored later.
- // 2. Create anonymous pipe to be STDOUT for child process.
- // 3. Set STDOUT of the parent process to be write handle to
- // the pipe, so it is inherited by the child process.
- // 4. Create a noninheritable duplicate of the read handle and
- // close the inheritable read handle.
-
- // Save the handle to the current STDOUT.
- hSaveStdout = GetStdHandle(STD_OUTPUT_HANDLE);
- // Create a pipe for the child process's STDOUT.
- if (! CreatePipe(&hChildStdoutRd, &hChildStdoutWr, &saAttr, childStdoutBufSize)) {
- return false;
- }
- // Set a write handle to the pipe to be STDOUT.
- if (! SetStdHandle(STD_OUTPUT_HANDLE, hChildStdoutWr)) {
- return false;
- }
- // Create noninheritable read handle and close the inheritable read
- // handle.
- fSuccess = DuplicateHandle(GetCurrentProcess(), hChildStdoutRd,
- GetCurrentProcess(), &hChildStdoutRdDup,
- 0, FALSE,
- DUPLICATE_SAME_ACCESS);
- if( !fSuccess ) {
- return false;
- }
- CloseHandle(hChildStdoutRd);
-
- // The steps for redirecting child process's STDIN:
- // 1. Save current STDIN, to be restored later.
- // 2. Create anonymous pipe to be STDIN for child process.
- // 3. Set STDIN of the parent to be the read handle to the
- // pipe, so it is inherited by the child process.
- // 4. Create a noninheritable duplicate of the write handle,
- // and close the inheritable write handle.
- // Save the handle to the current STDIN.
- hSaveStdin = GetStdHandle(STD_INPUT_HANDLE);
- // Create a pipe for the child process's STDIN.
- if (! CreatePipe(&hChildStdinRd, &hChildStdinWr, &saAttr, childStdinBufSize)) {
- return false;
- }
- // Set a read handle to the pipe to be STDIN.
- if (! SetStdHandle(STD_INPUT_HANDLE, hChildStdinRd)) {
- return false;
- }
- // Duplicate the write handle to the pipe so it is not inherited.
- fSuccess = DuplicateHandle(GetCurrentProcess(), hChildStdinWr,
- GetCurrentProcess(), &hChildStdinWrDup, 0,
- FALSE, // not inherited
- DUPLICATE_SAME_ACCESS);
- if (! fSuccess) {
- return false;
- }
- CloseHandle(hChildStdinWr);
-
- // Create the child process
- char cmdLine[256];
- sprintf(cmdLine, "SwDbgSub.exe %u", pidToDebug);
- PROCESS_INFORMATION procInfo;
- STARTUPINFO startInfo;
- memset((char*) &startInfo, 0, sizeof(startInfo));
- startInfo.cb = sizeof(startInfo);
- BOOL res = CreateProcess(NULL,
- cmdLine,
- NULL,
- NULL,
- TRUE, // inherit handles: important
- 0,
- NULL,
- NULL,
- &startInfo,
- &procInfo);
- if (!res) {
- return false;
- }
- // After process creation, restore the saved STDIN and STDOUT.
- if (! SetStdHandle(STD_INPUT_HANDLE, hSaveStdin)) {
- return false;
- }
- if (! SetStdHandle(STD_OUTPUT_HANDLE, hSaveStdout)) {
- return false;
- }
-
- // hChildStdinWrDup can be used to write to the child's stdin
- // hChildStdoutRdDup can be used to read from the child's stdout
-
- // NOTE: example code closes hChildStdoutWr before reading from
- // hChildStdoutRdDup. "Close the write end of the pipe before
- // reading from the read end of the pipe"??? Looks like this is
- // example-specific.
-
- // Set up return arguments
- // hChildStdoutRd and hChildStdinWr are already closed at this point
- *childProcessHandle = procInfo.hProcess;
- *writeToStdinHandle = hChildStdinWrDup;
- *readFromStdoutHandle = hChildStdoutRdDup;
- *auxHandle1 = hChildStdinRd;
- *auxHandle2 = hChildStdoutWr;
- return true;
-}
-
-/** Clears the event and writes the message to the child process */
-bool
-sendMessage(ChildInfo* child, Message* message) {
- DWORD numBytesWritten;
- if (!WriteFile(child->getWriteToStdinHandle(),
- message, sizeof(Message), &numBytesWritten, NULL)) {
- return false;
- }
- if (numBytesWritten != sizeof(Message)) {
- return false;
- }
- // Follow up "poke" messages with the raw data
- if (message->type == Message::POKE) {
- if (!WriteFile(child->getWriteToStdinHandle(),
- message->pokeArg.data, message->pokeArg.numBytes, &numBytesWritten, NULL)) {
- return false;
- }
- if (numBytesWritten != message->pokeArg.numBytes) {
- return false;
- }
- }
- return true;
-}
-
-/** Copies data from child's stdout to the client's IOBuf and sends it
- along */
-bool
-forwardReplyToClient(ChildInfo* child, ClientInfo* client) {
- DWORD total = 0;
- IOBuf::FillState ret;
-
- do {
- DWORD temp;
- ret = client->getIOBuf()->fillFromFileHandle(child->getReadFromStdoutHandle(),
- &temp);
- if (ret == IOBuf::DONE || ret == IOBuf::MORE_DATA_PENDING) {
- if (!client->getIOBuf()->flush()) {
-#ifdef DEBUGGING
- cerr << "Forward failed because flush failed" << endl;
-#endif
- return false;
- }
- total += temp;
- }
- } while (ret == IOBuf::MORE_DATA_PENDING);
-
- return (ret == IOBuf::FAILED) ? false : true;
-}
-
-//----------------------------------------------------------------------
-// Server Handler
-//
-
-class ServerHandler : public Handler {
-public:
- ServerHandler();
-
- // Starts up in Unicode mode by default
- bool getASCII();
-
- void setIOBuf(IOBuf* ioBuf);
-
- void procList(char* arg);
-
- // Must be called before calling one of the routines below
- void setClientInfo(ClientInfo* info);
-
- // Indicates to outer loop that exit was called or that an error
- // occurred and that the client exited.
- bool exited();
- // Clears this state
- void clearExited();
-
- void ascii(char* arg);
- void unicode(char* arg);
- void attach(char* arg);
- void detach(char* arg);
- void libInfo(char* arg);
- void peek(char* arg);
- void poke(char* arg);
- void threadList(char* arg);
- void dupHandle(char* arg);
- void closeHandle(char* arg);
- void getContext(char* arg);
- void setContext(char* arg);
- void selectorEntry(char* arg);
- void suspend(char* arg);
- void resume(char* arg);
- void pollEvent(char* arg);
- void continueEvent(char* arg);
- void exit(char* arg);
-
- // This is pretty gross. Needed to make the target process know
- // about clients that have disconnected unexpectedly while attached.
- friend void shutdownClient(ClientInfo*);
-private:
- // Writes: charSize numChars
- // Handles both ASCII and UNICODE modes
- void writeString(USHORT len, WCHAR* str);
-
- // Handles only ASCII mode
- void writeString(USHORT len, char* str);
-
- ClientInfo* clientInfo;
- IOBuf* ioBuf;
- bool _exited;
- bool _ascii;
-};
-
-static ServerHandler* handler;
-
-ServerHandler::ServerHandler() {
- _exited = false;
- _ascii = false;
- ioBuf = NULL;
-}
-
-bool
-ServerHandler::getASCII() {
- return _ascii;
-}
-
-void
-ServerHandler::setIOBuf(IOBuf* buf) {
- ioBuf = buf;
-}
-
-void
-ServerHandler::setClientInfo(ClientInfo* info) {
- clientInfo = info;
-}
-
-bool
-ServerHandler::exited() {
- return _exited;
-}
-
-void
-ServerHandler::clearExited() {
- _exited = false;
-}
-
-void
-ServerHandler::ascii(char* arg) {
- _ascii = true;
-}
-
-void
-ServerHandler::unicode(char* arg) {
- _ascii = false;
-}
-
-void
-ServerHandler::procList(char* arg) {
-#ifdef DEBUGGING
- cerr << "proclist" << endl;
-#endif
-
- ProcEntryList processes;
- ::procList(processes);
-
- ioBuf->writeInt(processes.size());
-
- for (ProcEntryList::iterator iter = processes.begin();
- iter != processes.end(); iter++) {
- ProcEntry& entry = *iter;
- ioBuf->writeSpace();
- ioBuf->writeUnsignedInt(entry.getPid());
- ioBuf->writeSpace();
- writeString(entry.getNameLength(), entry.getName());
- }
-
- ioBuf->writeEOL();
- ioBuf->flush();
-}
-
-void
-ServerHandler::attach(char* arg) {
- // If the client is already attached to a process, fail.
- if (clientInfo->getTarget() != NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- // Try to get pid
- DWORD pid;
- if (!scanUnsignedLong(&arg, &pid)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- // See whether this pid is already forked
- ListsLocker ll;
- ChildInfo* childInfo = childList.getChildByPid(pid);
- if (childInfo != NULL) {
- // If this child already has a client, return false
- if (childInfo->getClient() != NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- // Otherwise, can associate this client with this child process
- childInfo->setClient(clientInfo);
- clientInfo->setTarget(childInfo);
-
- // Tell the child we are attaching so it can suspend the target
- // process
- Message msg;
- msg.type = Message::ATTACH;
- sendMessage(childInfo, &msg);
-
- ioBuf->writeBoolAsInt(true);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- } else {
- // Have to fork a new child subprocess
- HANDLE childProcessHandle;
- HANDLE writeToStdinHandle;
- HANDLE readFromStdoutHandle;
- HANDLE auxHandle1;
- HANDLE auxHandle2;
- if (!startChildProcess(pid,
- 32768,
- 131072,
- &childProcessHandle,
- &writeToStdinHandle,
- &readFromStdoutHandle,
- &auxHandle1,
- &auxHandle2)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- // See whether the child succeeded in attaching to the process
- char res;
- DWORD numRead;
- if (!ReadFile(readFromStdoutHandle,
- &res,
- sizeof(char),
- &numRead,
- NULL)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- if (!res) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- // OK, success.
- childInfo = new ChildInfo(pid, childProcessHandle,
- writeToStdinHandle, readFromStdoutHandle,
- auxHandle1, auxHandle2);
- childList.addChild(childInfo);
- reaper->registerProcess(childProcessHandle, childInfo);
- // Associate this client with this child process
- childInfo->setClient(clientInfo);
- clientInfo->setTarget(childInfo);
-
- // Tell the child process to actually suspend the target process
- Message msg;
- msg.type = Message::ATTACH;
- sendMessage(childInfo, &msg);
-
- // Write result to client
- ioBuf->writeBoolAsInt(true);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-}
-
-void
-ServerHandler::detach(char* arg) {
- // If the client is not attached, fail.
- if (clientInfo->getTarget() == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- detachClient(clientInfo);
-
- ioBuf->writeBoolAsInt(true);
- ioBuf->writeEOL();
- ioBuf->flush();
-}
-
-void
-ServerHandler::libInfo(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeInt(0);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::LIBINFO;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::peek(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeString("B");
- ioBuf->writeBinChar(0);
- ioBuf->flush();
- return;
- }
-
- // Try to get address
- DWORD address;
- if (!scanAddress(&arg, &address)) {
- ioBuf->writeString("B");
- ioBuf->writeBinChar(0);
- ioBuf->flush();
- return;
- }
-
- // Try to get number of bytes
- DWORD numBytes;
- if (!scanUnsignedLong(&arg, &numBytes)) {
- ioBuf->writeString("B");
- ioBuf->writeBinChar(0);
- ioBuf->flush();
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::PEEK;
- msg.peekArg.address = address;
- msg.peekArg.numBytes = numBytes;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::poke(char* arg) {
-#ifdef DEBUGGING
- cerr << "ServerHandler::poke" << endl;
-#endif
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get address
- DWORD address;
- if (!scanAddress(&arg, &address)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get number of bytes
- if (!scanAndSkipBinEscapeChar(&arg)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
- DWORD numBytes;
- if (!scanBinUnsignedLong(&arg, &numBytes)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Raw data is now in "arg"
- // Send message to child
- Message msg;
- msg.type = Message::POKE;
- msg.pokeArg.address = address;
- msg.pokeArg.numBytes = numBytes;
- msg.pokeArg.data = arg;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::threadList(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::THREADLIST;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::dupHandle(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get handle
- DWORD address;
- if (!scanAddress(&arg, &address)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::DUPHANDLE;
- msg.handleArg.handle = (HANDLE) address;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::closeHandle(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- return;
- }
-
- // Try to get handle
- DWORD address;
- if (!scanAddress(&arg, &address)) {
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::CLOSEHANDLE;
- msg.handleArg.handle = (HANDLE) address;
- sendMessage(child, &msg);
-
- // No reply
-}
-
-void
-ServerHandler::getContext(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get handle
- DWORD address;
- if (!scanAddress(&arg, &address)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::GETCONTEXT;
- msg.handleArg.handle = (HANDLE) address;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::setContext(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get handle
- DWORD address;
- if (!scanAddress(&arg, &address)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get context
- DWORD regs[NUM_REGS_IN_CONTEXT];
- for (int i = 0; i < NUM_REGS_IN_CONTEXT; i++) {
- if (!scanAddress(&arg, ®s[i])) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::SETCONTEXT;
- msg.setContextArg.handle = (HANDLE) address;
- msg.setContextArg.Eax = regs[0];
- msg.setContextArg.Ebx = regs[1];
- msg.setContextArg.Ecx = regs[2];
- msg.setContextArg.Edx = regs[3];
- msg.setContextArg.Esi = regs[4];
- msg.setContextArg.Edi = regs[5];
- msg.setContextArg.Ebp = regs[6];
- msg.setContextArg.Esp = regs[7];
- msg.setContextArg.Eip = regs[8];
- msg.setContextArg.Ds = regs[9];
- msg.setContextArg.Es = regs[10];
- msg.setContextArg.Fs = regs[11];
- msg.setContextArg.Gs = regs[12];
- msg.setContextArg.Cs = regs[13];
- msg.setContextArg.Ss = regs[14];
- msg.setContextArg.EFlags = regs[15];
- msg.setContextArg.Dr0 = regs[16];
- msg.setContextArg.Dr1 = regs[17];
- msg.setContextArg.Dr2 = regs[18];
- msg.setContextArg.Dr3 = regs[19];
- msg.setContextArg.Dr6 = regs[20];
- msg.setContextArg.Dr7 = regs[21];
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::selectorEntry(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get thread handle
- DWORD address;
- if (!scanAddress(&arg, &address)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get selector
- DWORD selector;
- if (!scanUnsignedLong(&arg, &selector)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::SELECTORENTRY;
- msg.selectorArg.handle = (HANDLE) address;
- msg.selectorArg.selector = selector;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::suspend(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::SUSPEND;
- sendMessage(child, &msg);
-
- // No reply
-}
-
-void
-ServerHandler::resume(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::RESUME;
- sendMessage(child, &msg);
-
- // No reply
-}
-
-void
-ServerHandler::pollEvent(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::POLLEVENT;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::continueEvent(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get bool arg
- int passEventToClient;
- if (!scanInt(&arg, &passEventToClient)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::CONTINUEEVENT;
- msg.boolArg.val = ((passEventToClient != 0) ? true : false);
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::exit(char* arg) {
- shutdownClient(clientInfo);
- _exited = true;
-}
-
-void
-ServerHandler::writeString(USHORT len, WCHAR* str) {
- if (_ascii) {
- char* cStr = new char[len + 1];
- sprintf(cStr, "%.*ls", len, str);
- writeString(len, cStr);
- delete[] cStr;
- } else {
- ioBuf->writeInt(sizeof(unsigned short));
- ioBuf->writeSpace();
- ioBuf->writeInt(len);
- ioBuf->writeSpace();
- for (int i = 0; i < len; i++) {
- ioBuf->writeBinUnsignedShort(str[i]);
- }
- }
-}
-
-void
-ServerHandler::writeString(USHORT len, char* str) {
- ioBuf->writeInt(1);
- ioBuf->writeSpace();
- ioBuf->writeInt(len);
- ioBuf->writeSpace();
- ioBuf->writeString(str);
-}
-
-//
-//----------------------------------------------------------------------
-
-//----------------------------------------------------------------------
-// Shutdown routines
-//
-
-void
-shutdownChild(ChildInfo* childInfo) {
- childList.removeChild(childInfo);
- childInfo->closeAll();
- if (childInfo->getClient() != NULL) {
- shutdownClient(childInfo->getClient());
- }
- delete childInfo;
-}
-
-void
-detachClient(ClientInfo* info) {
- ListsLocker ll;
- // May have been dissociated while not under cover of lock
- if (info->getTarget() == NULL) {
- return;
- }
-
- // Tell the child that we have detached to let the target process
- // continue running
- Message msg;
- msg.type = Message::DETACH;
- sendMessage(info->getTarget(), &msg);
-
- // Dissociate the client and the target
- info->getTarget()->setClient(NULL);
- info->setTarget(NULL);
-}
-
-void
-shutdownClient(ClientInfo* clientInfo) {
-#ifdef DEBUGGING
- cerr << "Shutting down client" << endl;
-#endif
-
- // If we're connected, inform the target process that we're
- // disconnecting
- detachClient(clientInfo);
-
- // Remove this client from the list and delete it
- clientList.removeClient(clientInfo);
- if (clientInfo->getTarget() != NULL) {
- clientInfo->getTarget()->setClient(NULL);
- }
- clientInfo->closeAll();
- delete clientInfo;
-}
-
-//
-//----------------------------------------------------------------------
-
-
-/** Main dispatcher for client commands. NOTE: do not refer to this
- clientInfo data structure after calling this routine, as it may be
- deleted internally. */
-void
-readAndDispatch(ClientInfo* clientInfo) {
- IOBuf::ReadLineResult res;
- IOBuf* ioBuf = clientInfo->getIOBuf();
- unsigned long howMany;
- ioctlsocket(clientInfo->getDataSocket(), FIONREAD, &howMany);
- if (howMany == 0) {
- // Client closed down.
- shutdownClient(clientInfo);
- return;
- }
- // Read and process as much data as possible
- do {
- res = ioBuf->tryReadLine();
- if (res == IOBuf::RL_ERROR) {
-#ifdef DEBUGGING
- cerr << "Error while reading line" << endl;
-#endif
- shutdownClient(clientInfo);
- return;
- } else if (res == IOBuf::RL_GOT_DATA) {
-#ifdef DEBUGGING
- cerr << "Got data: \"" << ioBuf->getLine() << "\"" << endl;
-#endif
- handler->setIOBuf(ioBuf);
- handler->setClientInfo(clientInfo);
- handler->clearExited();
- Dispatcher::dispatch(ioBuf->getLine(), handler);
- }
- } while (res == IOBuf::RL_GOT_DATA && (!handler->exited()));
-#ifdef DEBUGGING
- cerr << "Exiting readAndDispatch" << endl;
-#endif
-}
-
-int
-main(int argc, char **argv)
-{
- initWinsock();
-
- if (isNT4()) {
- loadPSAPIDLL(); // Will exit if not present
- }
-
- SOCKET clientListeningSock = setupListeningSocket(CLIENT_PORT);
-
- handler = new ServerHandler();
- Lists::init();
-
- reaper = new Reaper(&reapCB);
- if (!reaper->start()) {
- exit(1);
- }
-
- while (true) {
- // Select on all sockets:
- // - client listening socket
- // - sockets for all client connections
-
- // When one of the client connections closes, close its socket
- // handles.
-
- fd_set set;
- SOCKET maxSock = 0;
-
- // Set up fd_set
- {
- int i;
- FD_ZERO(&set);
- FD_SET(clientListeningSock, &set);
- if (clientListeningSock > maxSock) {
- maxSock = clientListeningSock;
- }
- for (i = 0; i < clientList.size(); i++) {
- ClientInfo* info = clientList.get(i);
- if (info->getDataSocket() > maxSock) {
- maxSock = info->getDataSocket();
- }
- FD_SET(info->getDataSocket(), &set);
- }
- }
- struct timeval timeout;
- timeout.tv_sec = 300; // 5 minutes
- timeout.tv_usec = 0;
- int res = select(maxSock, &set, NULL, NULL, &timeout);
- if (res > 0) {
-
- ////////////////
- // New client //
- ////////////////
- if (FD_ISSET(clientListeningSock, &set)) {
- SOCKET fd = acceptFromLocalhost(clientListeningSock);
- if (fd != INVALID_SOCKET) {
- // Create new client information object
- ClientInfo* info = new ClientInfo(fd);
- // Add to list of clients
- clientList.addClient(info);
-#ifdef DEBUGGING
- cerr << "New client" << endl;
-#endif
- }
- }
-
- ///////////////////////////
- // Commands from clients //
- ///////////////////////////
- ClientInfo* clientInfo;
- if (clientList.isAnyDataSocketSet(&set, &clientInfo)) {
- readAndDispatch(clientInfo);
- }
- } else if (res < 0) {
- // Looks like one of the clients was killed. Try to figure out which one.
- bool found = false;
- fd_set set;
- struct timeval timeout;
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- for (int i = 0; i < clientList.size(); i++) {
- ClientInfo* info = clientList.get(i);
- FD_ZERO(&set);
- FD_SET(info->getDataSocket(), &set);
- if (select(1 + info->getDataSocket(), &set, NULL, NULL, &timeout) < 0) {
- found = true;
- clientList.removeClient(info);
- info->closeAll();
- delete info;
- break;
- }
- }
- if (!found) {
- // This indicates trouble -- one of our listening sockets died.
- exit(1);
- }
- }
- }
-
- return 0;
-}
diff --git a/hotspot/agent/src/os/win32/SwDbgSrv.dsp b/hotspot/agent/src/os/win32/SwDbgSrv.dsp
deleted file mode 100644
index 4257278704c..00000000000
--- a/hotspot/agent/src/os/win32/SwDbgSrv.dsp
+++ /dev/null
@@ -1,146 +0,0 @@
-# Microsoft Developer Studio Project File - Name="SwDbgSrv" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=SwDbgSrv - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "SwDbgSrv.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "SwDbgSrv.mak" CFG="SwDbgSrv - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "SwDbgSrv - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "SwDbgSrv - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "SwDbgSrv - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# 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 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 /subsystem:console /machine:I386
-# 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 ws2_32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "SwDbgSrv - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "SwDbgSrv___Win32_Debug"
-# PROP BASE Intermediate_Dir "SwDbgSrv___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# 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 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 /subsystem:console /debug /machine:I386 /pdbtype:sept
-# 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 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "SwDbgSrv - Win32 Release"
-# Name "SwDbgSrv - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\Buffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Dispatcher.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\initWinsock.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\IOBuf.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\ioUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\isNT4.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\nt4internals.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\procList.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Reaper.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\serverLists.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\SwDbgSrv.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\toolHelp.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/hotspot/agent/src/os/win32/SwDbgSrv.dsw b/hotspot/agent/src/os/win32/SwDbgSrv.dsw
deleted file mode 100644
index a1570e459c3..00000000000
--- a/hotspot/agent/src/os/win32/SwDbgSrv.dsw
+++ /dev/null
@@ -1,41 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "SwDbgSrv"=.\SwDbgSrv.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "SwDbgSub"=.\SwDbgSub.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/hotspot/agent/src/os/win32/SwDbgSub.cpp b/hotspot/agent/src/os/win32/SwDbgSub.cpp
deleted file mode 100644
index 7acae51e9ab..00000000000
--- a/hotspot/agent/src/os/win32/SwDbgSub.cpp
+++ /dev/null
@@ -1,883 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-// This is the source code for the subprocess forked by the Simple
-// Windows Debug Server. It assumes most of the responsibility for the
-// debug session, and processes all of the commands sent by clients.
-
-// Disable too-long symbol warnings
-#pragma warning ( disable : 4786 )
-
-#include
-#include
-#include
-#include
-// Must come before windows.h
-#include
-#include
-#include "IOBuf.hpp"
-#include "libInfo.hpp"
-#include "LockableList.hpp"
-#include "Message.hpp"
-#include "Monitor.hpp"
-#include "nt4internals.hpp"
-
-// Uncomment the #define below to get messages on stderr
-// #define DEBUGGING
-
-using namespace std;
-
-DWORD pid;
-HANDLE procHandle;
-IOBuf* ioBuf;
-
-// State flags indicating whether the attach to the remote process
-// definitively succeeded or failed
-volatile bool attachFailed = false;
-volatile bool attachSucceeded = false;
-
-// State flag indicating whether the target process is suspended.
-// Modified by suspend()/resume(), viewed by debug thread, but only
-// under cover of the threads lock.
-volatile bool suspended = false;
-
-// State flags indicating whether we are considered to be attached to
-// the target process and are therefore queuing up events to be sent
-// back to the debug server. These flags are only accessed and
-// modified under the cover of the eventLock.
-Monitor* eventLock;
-// The following is set to true when a client is attached to this process
-volatile bool generateDebugEvents = false;
-// Pointer to current debug event; non-NULL indicates a debug event is
-// waiting to be sent to the client. Main thread sets this to NULL to
-// indicate that the event has been consumed; also sets
-// passEventToClient, below.
-volatile DEBUG_EVENT* curDebugEvent = NULL;
-// Set by main thread to indicate whether the most recently posted
-// debug event should be passed on to the target process.
-volatile bool passEventToClient = true;
-
-void conditionalPostDebugEvent(DEBUG_EVENT* ev, DWORD* continueOrNotHandledFlag) {
- // FIXME: make it possible for the client to enable and disable
- // certain types of events (have to do so in a platform-independent
- // manner)
- switch (ev->dwDebugEventCode) {
- case EXCEPTION_DEBUG_EVENT:
- switch (ev->u.Exception.ExceptionRecord.ExceptionCode) {
- case EXCEPTION_BREAKPOINT: break;
- case EXCEPTION_SINGLE_STEP: break;
- case EXCEPTION_ACCESS_VIOLATION: break;
- default: return;
- }
- }
- eventLock->lock();
- if (generateDebugEvents) {
- curDebugEvent = ev;
- while (curDebugEvent != NULL) {
- eventLock->wait();
- }
- if (passEventToClient) {
- *continueOrNotHandledFlag = DBG_EXCEPTION_NOT_HANDLED;
- } else {
- *continueOrNotHandledFlag = DBG_CONTINUE;
- }
- }
- eventLock->unlock();
-}
-
-
-//----------------------------------------------------------------------
-// Module list
-//
-
-vector libs;
-
-//----------------------------------------------------------------------
-// Thread list
-//
-
-struct ThreadInfo {
- DWORD tid;
- HANDLE thread;
-
- ThreadInfo(DWORD tid, HANDLE thread) {
- this->tid = tid;
- this->thread = thread;
- }
-};
-
-class ThreadList : public LockableList {
-public:
- bool removeByThreadID(DWORD tid) {
- for (InternalListType::iterator iter = internalList.begin();
- iter != internalList.end(); iter++) {
- if ((*iter).tid == tid) {
- internalList.erase(iter);
- return true;
- }
- }
- return false;
- }
- HANDLE threadIDToHandle(DWORD tid) {
- for (InternalListType::iterator iter = internalList.begin();
- iter != internalList.end(); iter++) {
- if ((*iter).tid == tid) {
- return (*iter).thread;
- }
- }
- return NULL;
- }
-};
-
-ThreadList threads;
-
-//----------------------------------------------------------------------
-// INITIALIZATION AND TERMINATION
-//
-
-void
-printError(const char* prefix) {
- DWORD detail = GetLastError();
- LPTSTR message;
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM,
- 0,
- detail,
- 0,
- (LPTSTR) &message,
- 1,
- NULL);
- // FIXME: This is signaling an error: "The handle is invalid." ?
- // Do I have to do all of my WaitForDebugEvent calls from the same thread?
- cerr << prefix << ": " << message << endl;
- LocalFree(message);
-}
-
-void
-endProcess(bool waitForProcess = true) {
- NT4::unloadNTDLL();
- if (waitForProcess) {
- // Though we're exiting because of an error, do not tear down the
- // target process.
- WaitForSingleObject(procHandle, INFINITE);
- }
- CloseHandle(procHandle);
- exit(0);
-}
-
-DWORD WINAPI
-debugThreadEntry(void*) {
-#ifdef DEBUGGING
- DWORD lastMsgId = 0;
- int count = 0;
-#endif
-
- if (!DebugActiveProcess(pid)) {
- attachFailed = true;
- return 0;
- }
-
- // Wait for debug events. We keep the information from some of these
- // on the side in anticipation of later queries by the client. NOTE
- // that we leave the process running. The main thread is responsible
- // for suspending and resuming all currently-active threads upon
- // client attach and detach.
-
- while (true) {
- DEBUG_EVENT ev;
- if (!WaitForDebugEvent(&ev, INFINITE)) {
-#ifdef DEBUGGING
- if (++count < 10) {
- // FIXME: This is signaling an error: "The handle is invalid." ?
- // Do I have to do all of my WaitForDebugEvent calls from the same thread?
- printError("WaitForDebugEvent failed");
- }
-#endif
- } else {
-
-#ifdef DEBUGGING
- if (ev.dwDebugEventCode != lastMsgId) {
- lastMsgId = ev.dwDebugEventCode;
- count = 0;
- cerr << "Debug thread received event " << ev.dwDebugEventCode << endl;
- } else {
- if (++count < 10) {
- cerr << "Debug thread received event " << ev.dwDebugEventCode << endl;
- }
- }
-#endif
-
- DWORD dbgContinueMode = DBG_CONTINUE;
-
- switch (ev.dwDebugEventCode) {
- case LOAD_DLL_DEBUG_EVENT:
- conditionalPostDebugEvent(&ev, &dbgContinueMode);
- break;
-
- case UNLOAD_DLL_DEBUG_EVENT:
- conditionalPostDebugEvent(&ev, &dbgContinueMode);
- break;
-
- case CREATE_PROCESS_DEBUG_EVENT:
- threads.lock();
- // FIXME: will this deal properly with child processes? If
- // not, is it possible to make it do so?
-#ifdef DEBUGGING
- cerr << "CREATE_PROCESS_DEBUG_EVENT " << ev.dwThreadId
- << " " << ev.u.CreateProcessInfo.hThread << endl;
-#endif
- if (ev.u.CreateProcessInfo.hThread != NULL) {
- threads.add(ThreadInfo(ev.dwThreadId, ev.u.CreateProcessInfo.hThread));
- }
- threads.unlock();
- break;
-
- case CREATE_THREAD_DEBUG_EVENT:
- threads.lock();
-#ifdef DEBUGGING
- cerr << "CREATE_THREAD_DEBUG_EVENT " << ev.dwThreadId
- << " " << ev.u.CreateThread.hThread << endl;
-#endif
- if (suspended) {
- // Suspend this thread before adding it to the thread list
- SuspendThread(ev.u.CreateThread.hThread);
- }
- threads.add(ThreadInfo(ev.dwThreadId, ev.u.CreateThread.hThread));
- threads.unlock();
- break;
-
- case EXIT_THREAD_DEBUG_EVENT:
- threads.lock();
-#ifdef DEBUGGING
- cerr << "EXIT_THREAD_DEBUG_EVENT " << ev.dwThreadId << endl;
-#endif
- threads.removeByThreadID(ev.dwThreadId);
- threads.unlock();
- break;
-
- case EXCEPTION_DEBUG_EVENT:
- // cerr << "EXCEPTION_DEBUG_EVENT" << endl;
- switch (ev.u.Exception.ExceptionRecord.ExceptionCode) {
- case EXCEPTION_BREAKPOINT:
- // cerr << "EXCEPTION_BREAKPOINT" << endl;
- if (!attachSucceeded && !attachFailed) {
- attachSucceeded = true;
- }
- break;
-
- default:
- dbgContinueMode = DBG_EXCEPTION_NOT_HANDLED;
- break;
- }
- conditionalPostDebugEvent(&ev, &dbgContinueMode);
- break;
-
- case EXIT_PROCESS_DEBUG_EVENT:
- endProcess(false);
- // NOT REACHED
- break;
-
- default:
-#ifdef DEBUGGING
- cerr << "Received debug event " << ev.dwDebugEventCode << endl;
-#endif
- break;
- }
-
- ContinueDebugEvent(ev.dwProcessId, ev.dwThreadId, dbgContinueMode);
- }
- }
-}
-
-bool
-attachToProcess() {
- // Create event lock
- eventLock = new Monitor();
-
- // Get a process handle for later
- procHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
- if (procHandle == NULL) {
- return false;
- }
-
- // Start up the debug thread
- DWORD debugThreadId;
- if (CreateThread(NULL, 0, &debugThreadEntry, NULL, 0, &debugThreadId) == NULL) {
- // Failed to make background debug thread. Fail.
- return false;
- }
-
- while ((!attachSucceeded) && (!attachFailed)) {
- Sleep(1);
- }
-
- if (attachFailed) {
- return false;
- }
-
- assert(attachSucceeded);
-
- return true;
-}
-
-bool
-readMessage(Message* msg) {
- DWORD numRead;
- if (!ReadFile(GetStdHandle(STD_INPUT_HANDLE),
- msg,
- sizeof(Message),
- &numRead,
- NULL)) {
- return false;
- }
- if (numRead != sizeof(Message)) {
- return false;
- }
- // For "poke" messages, must follow up by reading raw data
- if (msg->type == Message::POKE) {
- char* dataBuf = new char[msg->pokeArg.numBytes];
- if (dataBuf == NULL) {
- return false;
- }
- if (!ReadFile(GetStdHandle(STD_INPUT_HANDLE),
- dataBuf,
- msg->pokeArg.numBytes,
- &numRead,
- NULL)) {
- delete[] dataBuf;
- return false;
- }
- if (numRead != msg->pokeArg.numBytes) {
- delete[] dataBuf;
- return false;
- }
- msg->pokeArg.data = (void *) dataBuf;
- }
- return true;
-}
-
-void
-handlePeek(Message* msg) {
-#ifdef DEBUGGING
- cerr << "Entering handlePeek()" << endl;
-#endif
-
- char* memBuf = new char[msg->peekArg.numBytes];
- if (memBuf == NULL) {
- ioBuf->writeString("B");
- ioBuf->writeBinChar(0);
- ioBuf->flush();
- delete[] memBuf;
- return;
- }
-
- // Try fast case first
- DWORD numRead;
- BOOL res = ReadProcessMemory(procHandle,
- (LPCVOID) msg->peekArg.address,
- memBuf,
- msg->peekArg.numBytes,
- &numRead);
- if (res && (numRead == msg->peekArg.numBytes)) {
-
- // OK, complete success. Phew.
-#ifdef DEBUGGING
- cerr << "Peek success case" << endl;
-#endif
- ioBuf->writeString("B");
- ioBuf->writeBinChar(1);
- ioBuf->writeBinUnsignedInt(numRead);
- ioBuf->writeBinChar(1);
- ioBuf->writeBinBuf(memBuf, numRead);
- } else {
-#ifdef DEBUGGING
- cerr << "*** Peek slow case ***" << endl;
-#endif
-
- ioBuf->writeString("B");
- ioBuf->writeBinChar(1);
-
- // Use VirtualQuery to speed things up a bit
- DWORD numLeft = msg->peekArg.numBytes;
- char* curAddr = (char*) msg->peekArg.address;
- while (numLeft > 0) {
- MEMORY_BASIC_INFORMATION memInfo;
- VirtualQueryEx(procHandle, curAddr, &memInfo, sizeof(memInfo));
- DWORD numToRead = memInfo.RegionSize;
- if (numToRead > numLeft) {
- numToRead = numLeft;
- }
- DWORD numRead;
- if (memInfo.State == MEM_COMMIT) {
- // Read the process memory at this address for this length
- // FIXME: should check the result of this read
- ReadProcessMemory(procHandle, curAddr, memBuf,
- numToRead, &numRead);
- // Write this out
-#ifdef DEBUGGING
- cerr << "*** Writing " << numToRead << " bytes as mapped ***" << endl;
-#endif
- ioBuf->writeBinUnsignedInt(numToRead);
- ioBuf->writeBinChar(1);
- ioBuf->writeBinBuf(memBuf, numToRead);
- } else {
- // Indicate region is free
-#ifdef DEBUGGING
- cerr << "*** Writing " << numToRead << " bytes as unmapped ***" << endl;
-#endif
- ioBuf->writeBinUnsignedInt(numToRead);
- ioBuf->writeBinChar(0);
- }
- curAddr += numToRead;
- numLeft -= numToRead;
- }
- }
-
- ioBuf->flush();
- delete[] memBuf;
-#ifdef DEBUGGING
- cerr << "Exiting handlePeek()" << endl;
-#endif
-}
-
-void
-handlePoke(Message* msg) {
-#ifdef DEBUGGING
- cerr << "Entering handlePoke()" << endl;
-#endif
- DWORD numWritten;
- BOOL res = WriteProcessMemory(procHandle,
- (LPVOID) msg->pokeArg.address,
- msg->pokeArg.data,
- msg->pokeArg.numBytes,
- &numWritten);
- if (res && (numWritten == msg->pokeArg.numBytes)) {
- // Success
- ioBuf->writeBoolAsInt(true);
-#ifdef DEBUGGING
- cerr << " (Succeeded)" << endl;
-#endif
- } else {
- // Failure
- ioBuf->writeBoolAsInt(false);
-#ifdef DEBUGGING
- cerr << " (Failed)" << endl;
-#endif
- }
- ioBuf->writeEOL();
- ioBuf->flush();
- // We clean up the data
- char* dataBuf = (char*) msg->pokeArg.data;
- delete[] dataBuf;
-#ifdef DEBUGGING
- cerr << "Exiting handlePoke()" << endl;
-#endif
-}
-
-bool
-suspend() {
- if (suspended) {
- return false;
- }
- // Before we suspend, we must take a snapshot of the loaded module
- // names and base addresses, since acquiring this snapshot requires
- // starting and exiting a thread in the remote process (at least on
- // NT 4).
- libs.clear();
-#ifdef DEBUGGING
- cerr << "Starting suspension" << endl;
-#endif
- libInfo(pid, libs);
-#ifdef DEBUGGING
- cerr << " Got lib info" << endl;
-#endif
- threads.lock();
-#ifdef DEBUGGING
- cerr << " Got thread lock" << endl;
-#endif
- suspended = true;
- int j = 0;
- for (int i = 0; i < threads.size(); i++) {
- j++;
- SuspendThread(threads.get(i).thread);
- }
-#ifdef DEBUGGING
- cerr << "Suspended " << j << " threads" << endl;
-#endif
- threads.unlock();
- return true;
-}
-
-bool
-resume() {
- if (!suspended) {
- return false;
- }
- threads.lock();
- suspended = false;
- for (int i = 0; i < threads.size(); i++) {
- ResumeThread(threads.get(i).thread);
- }
- threads.unlock();
-#ifdef DEBUGGING
- cerr << "Resumed process" << endl;
-#endif
- return true;
-}
-
-int
-main(int argc, char **argv)
-{
- if (argc != 2) {
- // Should only be used by performing CreateProcess within SwDbgSrv
- exit(1);
- }
-
- if (sscanf(argv[1], "%u", &pid) != 1) {
- exit(1);
- }
-
- // Try to attach to process
- if (!attachToProcess()) {
- // Attach failed. Notify parent by writing result to stdout file
- // handle.
- char res = 0;
- DWORD numBytes;
- WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), &res, sizeof(res),
- &numBytes, NULL);
- exit(1);
- }
-
- // Server is expecting success result back.
- char res = 1;
- DWORD numBytes;
- WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), &res, sizeof(res),
- &numBytes, NULL);
-
- // Initialize our I/O buffer
- ioBuf = new IOBuf(32768, 131072);
- ioBuf->setOutputFileHandle(GetStdHandle(STD_OUTPUT_HANDLE));
-
- // At this point we are attached. Enter our main loop which services
- // requests from the server. Note that in order to handle attach/
- // detach properly (i.e., resumption of process upon "detach") we
- // will need another thread which handles debug events.
- while (true) {
- // Read a message from the server
- Message msg;
- if (!readMessage(&msg)) {
- endProcess();
- }
-
-#ifdef DEBUGGING
- cerr << "Main thread read message: " << msg.type << endl;
-#endif
-
- switch (msg.type) {
- // ATTACH and DETACH messages MUST come in pairs
- case Message::ATTACH:
- suspend();
- eventLock->lock();
- generateDebugEvents = true;
- eventLock->unlock();
- break;
-
- case Message::DETACH:
- eventLock->lock();
- generateDebugEvents = false;
- // Flush remaining event if any
- if (curDebugEvent != NULL) {
- curDebugEvent = NULL;
- eventLock->notifyAll();
- }
- eventLock->unlock();
- resume();
- break;
-
- case Message::LIBINFO:
- {
- if (!suspended) {
- ioBuf->writeInt(0);
- } else {
- // Send back formatted text
- ioBuf->writeInt(libs.size());
- for (int i = 0; i < libs.size(); i++) {
- ioBuf->writeSpace();
- ioBuf->writeInt(1);
- ioBuf->writeSpace();
- ioBuf->writeInt(libs[i].name.size());
- ioBuf->writeSpace();
- ioBuf->writeString(libs[i].name.c_str());
- ioBuf->writeSpace();
- ioBuf->writeAddress(libs[i].base);
- }
- }
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
- }
-
- case Message::PEEK:
- handlePeek(&msg);
- break;
-
- case Message::POKE:
- handlePoke(&msg);
- break;
-
- case Message::THREADLIST:
- {
- if (!suspended) {
- ioBuf->writeInt(0);
- } else {
- threads.lock();
- ioBuf->writeInt(threads.size());
- for (int i = 0; i < threads.size(); i++) {
- ioBuf->writeSpace();
- ioBuf->writeAddress((void*) threads.get(i).thread);
- }
- threads.unlock();
- }
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
- }
-
- case Message::DUPHANDLE:
- {
- HANDLE dup;
- if (DuplicateHandle(procHandle,
- msg.handleArg.handle,
- GetCurrentProcess(),
- &dup,
- 0,
- FALSE,
- DUPLICATE_SAME_ACCESS)) {
- ioBuf->writeBoolAsInt(true);
- ioBuf->writeSpace();
- ioBuf->writeAddress((void*) dup);
- } else {
- ioBuf->writeBoolAsInt(false);
- }
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
- }
-
- case Message::CLOSEHANDLE:
- {
- CloseHandle(msg.handleArg.handle);
- break;
- }
-
- case Message::GETCONTEXT:
- {
- if (!suspended) {
- ioBuf->writeBoolAsInt(false);
- } else {
- CONTEXT context;
- context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
- if (GetThreadContext(msg.handleArg.handle, &context)) {
- ioBuf->writeBoolAsInt(true);
- // EAX, EBX, ECX, EDX, ESI, EDI, EBP, ESP, EIP, DS, ES, FS, GS,
- // CS, SS, EFLAGS, DR0, DR1, DR2, DR3, DR6, DR7
- // See README-commands.txt
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Eax);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Ebx);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Ecx);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Edx);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Esi);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Edi);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Ebp);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Esp);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Eip);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.SegDs);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.SegEs);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.SegFs);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.SegGs);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.SegCs);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.SegSs);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.EFlags);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Dr0);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Dr1);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Dr2);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Dr3);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Dr6);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Dr7);
- } else {
- ioBuf->writeBoolAsInt(false);
- }
- }
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
- }
-
- case Message::SETCONTEXT:
- {
- if (!suspended) {
- ioBuf->writeBoolAsInt(false);
- } else {
- CONTEXT context;
- context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
- context.Eax = msg.setContextArg.Eax;
- context.Ebx = msg.setContextArg.Ebx;
- context.Ecx = msg.setContextArg.Ecx;
- context.Edx = msg.setContextArg.Edx;
- context.Esi = msg.setContextArg.Esi;
- context.Edi = msg.setContextArg.Edi;
- context.Ebp = msg.setContextArg.Ebp;
- context.Esp = msg.setContextArg.Esp;
- context.Eip = msg.setContextArg.Eip;
- context.SegDs = msg.setContextArg.Ds;
- context.SegEs = msg.setContextArg.Es;
- context.SegFs = msg.setContextArg.Fs;
- context.SegGs = msg.setContextArg.Gs;
- context.SegCs = msg.setContextArg.Cs;
- context.SegSs = msg.setContextArg.Ss;
- context.EFlags = msg.setContextArg.EFlags;
- context.Dr0 = msg.setContextArg.Dr0;
- context.Dr1 = msg.setContextArg.Dr1;
- context.Dr2 = msg.setContextArg.Dr2;
- context.Dr3 = msg.setContextArg.Dr3;
- context.Dr6 = msg.setContextArg.Dr6;
- context.Dr7 = msg.setContextArg.Dr7;
- if (SetThreadContext(msg.setContextArg.handle, &context)) {
- ioBuf->writeBoolAsInt(true);
- } else {
- ioBuf->writeBoolAsInt(false);
- }
- }
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
- }
-
- case Message::SELECTORENTRY:
- {
- LDT_ENTRY entry;
-
- if (GetThreadSelectorEntry(msg.selectorArg.handle,
- msg.selectorArg.selector,
- &entry)) {
- ioBuf->writeBoolAsInt(true);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) entry.LimitLow);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) entry.BaseLow);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) entry.HighWord.Bytes.BaseMid);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) entry.HighWord.Bytes.Flags1);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) entry.HighWord.Bytes.Flags2);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) entry.HighWord.Bytes.BaseHi);
- } else {
- ioBuf->writeBoolAsInt(false);
- }
-
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
- }
-
- case Message::SUSPEND:
- suspend();
- break;
-
- case Message::RESUME:
- resume();
- break;
-
- case Message::POLLEVENT:
- eventLock->lock();
- if (curDebugEvent == NULL) {
- ioBuf->writeBoolAsInt(false);
- } else {
- ioBuf->writeBoolAsInt(true);
- ioBuf->writeSpace();
- threads.lock();
- ioBuf->writeAddress((void*) threads.threadIDToHandle(curDebugEvent->dwThreadId));
- threads.unlock();
- ioBuf->writeSpace();
- ioBuf->writeUnsignedInt(curDebugEvent->dwDebugEventCode);
- // Figure out what else to write
- switch (curDebugEvent->dwDebugEventCode) {
- case LOAD_DLL_DEBUG_EVENT:
- ioBuf->writeSpace();
- ioBuf->writeAddress(curDebugEvent->u.LoadDll.lpBaseOfDll);
- break;
-
- case UNLOAD_DLL_DEBUG_EVENT:
- ioBuf->writeSpace();
- ioBuf->writeAddress(curDebugEvent->u.UnloadDll.lpBaseOfDll);
- break;
-
- case EXCEPTION_DEBUG_EVENT:
- {
- DWORD code = curDebugEvent->u.Exception.ExceptionRecord.ExceptionCode;
- ioBuf->writeSpace();
- ioBuf->writeUnsignedInt(code);
- ioBuf->writeSpace();
- ioBuf->writeAddress(curDebugEvent->u.Exception.ExceptionRecord.ExceptionAddress);
- switch (curDebugEvent->u.Exception.ExceptionRecord.ExceptionCode) {
- case EXCEPTION_ACCESS_VIOLATION:
- ioBuf->writeSpace();
- ioBuf->writeBoolAsInt(curDebugEvent->u.Exception.ExceptionRecord.ExceptionInformation[0] != 0);
- ioBuf->writeSpace();
- ioBuf->writeAddress((void*) curDebugEvent->u.Exception.ExceptionRecord.ExceptionInformation[1]);
- break;
-
- default:
- break;
- }
- break;
- }
-
- default:
- break;
- }
- }
- eventLock->unlock();
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
-
- case Message::CONTINUEEVENT:
- eventLock->lock();
- if (curDebugEvent == NULL) {
- ioBuf->writeBoolAsInt(false);
- } else {
- curDebugEvent = NULL;
- passEventToClient = msg.boolArg.val;
- ioBuf->writeBoolAsInt(true);
- eventLock->notify();
- }
- eventLock->unlock();
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
- }
- }
-
- endProcess();
-
- // NOT REACHED
- return 0;
-}
diff --git a/hotspot/agent/src/os/win32/SwDbgSub.dsp b/hotspot/agent/src/os/win32/SwDbgSub.dsp
deleted file mode 100644
index a918a66845c..00000000000
--- a/hotspot/agent/src/os/win32/SwDbgSub.dsp
+++ /dev/null
@@ -1,130 +0,0 @@
-# Microsoft Developer Studio Project File - Name="SwDbgSub" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=SwDbgSub - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "SwDbgSub.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "SwDbgSub.mak" CFG="SwDbgSub - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "SwDbgSub - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "SwDbgSub - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "SwDbgSub - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# 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 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 /subsystem:console /machine:I386
-# 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 ws2_32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "SwDbgSub - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "SwDbgSub___Win32_Debug"
-# PROP BASE Intermediate_Dir "SwDbgSub___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# 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 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 /subsystem:console /debug /machine:I386 /pdbtype:sept
-# 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 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "SwDbgSub - Win32 Release"
-# Name "SwDbgSub - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\Buffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\IOBuf.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\isNT4.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\libInfo.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Monitor.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\nt4internals.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\SwDbgSub.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\toolHelp.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/hotspot/agent/src/os/win32/initWinsock.cpp b/hotspot/agent/src/os/win32/initWinsock.cpp
deleted file mode 100644
index 42e481fbf05..00000000000
--- a/hotspot/agent/src/os/win32/initWinsock.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include
-#include