├── docs
├── _static
│ ├── custom.css
│ ├── up.png
│ ├── down.png
│ ├── file.png
│ ├── minus.png
│ ├── plus.png
│ ├── comment.png
│ ├── ajax-loader.gif
│ ├── up-pressed.png
│ ├── comment-close.png
│ ├── down-pressed.png
│ ├── comment-bright.png
│ ├── fonts
│ │ ├── Lato-Bold.ttf
│ │ ├── Lato-Regular.ttf
│ │ ├── RobotoSlab-Bold.ttf
│ │ ├── Inconsolata-Bold.ttf
│ │ ├── Inconsolata-Regular.ttf
│ │ ├── RobotoSlab-Regular.ttf
│ │ ├── fontawesome-webfont.eot
│ │ ├── fontawesome-webfont.ttf
│ │ └── fontawesome-webfont.woff
│ ├── css
│ │ └── badge_only.css
│ ├── pygments.css
│ ├── js
│ │ ├── theme.js
│ │ └── modernizr.min.js
│ ├── doctools.js
│ ├── underscore.js
│ ├── alabaster.css
│ ├── basic.css
│ └── searchtools.js
├── search.html
├── py-modindex.html
├── event_modifiers.html
├── index.html
└── transport.html
├── README.txt
├── pyspresso
├── __init__.py
├── event_modifiers.py
├── constants.py
├── samples
│ └── javajournal.py
├── events.py
└── transport.py
├── PKG-INFO
└── setup.py
/docs/_static/custom.css:
--------------------------------------------------------------------------------
1 | /* This file intentionally left blank. */
2 |
--------------------------------------------------------------------------------
/docs/_static/up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/up.png
--------------------------------------------------------------------------------
/docs/_static/down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/down.png
--------------------------------------------------------------------------------
/docs/_static/file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/file.png
--------------------------------------------------------------------------------
/docs/_static/minus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/minus.png
--------------------------------------------------------------------------------
/docs/_static/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/plus.png
--------------------------------------------------------------------------------
/docs/_static/comment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/comment.png
--------------------------------------------------------------------------------
/docs/_static/ajax-loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/ajax-loader.gif
--------------------------------------------------------------------------------
/docs/_static/up-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/up-pressed.png
--------------------------------------------------------------------------------
/docs/_static/comment-close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/comment-close.png
--------------------------------------------------------------------------------
/docs/_static/down-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/down-pressed.png
--------------------------------------------------------------------------------
/docs/_static/comment-bright.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/comment-bright.png
--------------------------------------------------------------------------------
/docs/_static/fonts/Lato-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/fonts/Lato-Bold.ttf
--------------------------------------------------------------------------------
/docs/_static/fonts/Lato-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/fonts/Lato-Regular.ttf
--------------------------------------------------------------------------------
/docs/_static/fonts/RobotoSlab-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/fonts/RobotoSlab-Bold.ttf
--------------------------------------------------------------------------------
/README.txt:
--------------------------------------------------------------------------------
1 | The pyspresso package is a Python-based framework for debugging Java.
2 |
3 | Please see docs/index.html for more information.
--------------------------------------------------------------------------------
/docs/_static/fonts/Inconsolata-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/fonts/Inconsolata-Bold.ttf
--------------------------------------------------------------------------------
/docs/_static/fonts/Inconsolata-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/fonts/Inconsolata-Regular.ttf
--------------------------------------------------------------------------------
/docs/_static/fonts/RobotoSlab-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/fonts/RobotoSlab-Regular.ttf
--------------------------------------------------------------------------------
/docs/_static/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/docs/_static/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/docs/_static/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CrowdStrike/pyspresso/HEAD/docs/_static/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/pyspresso/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | ## @file __init__.py
3 | # @brief pyspresso __init__ file.
4 | # @author Jason Geffner
5 | # @copyright CrowdStrike, Inc. 2016
6 |
7 | __version__ = "0.1"
--------------------------------------------------------------------------------
/PKG-INFO:
--------------------------------------------------------------------------------
1 | Metadata-Version: 1.1
2 | Name: pyspresso
3 | Version: 0.1
4 | Summary: Python-based framework for debugging Java
5 | Home-page: https://github.com/CrowdStrike/pyspresso/
6 | Author: Jason Geffner
7 | Author-email: jason@malwareanalysis.com
8 | License: GNU General Public License v3 or later (GPLv3+)
9 | Description: Python-based framework for debugging Java
10 | Platform: Android
11 | Platform: Linux
12 | Platform: MacOS
13 | Platform: Windows
14 | Classifier: Development Status :: 3 - Alpha
15 | Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
16 | Classifier: Natural Language :: English
17 | Classifier: Operating System :: Android
18 | Classifier: Operating System :: MacOS
19 | Classifier: Operating System :: Microsoft :: Windows
20 | Classifier: Operating System :: POSIX :: Linux
21 | Classifier: Programming Language :: Python
22 | Classifier: Topic :: Software Development :: Debuggers
23 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | from distutils.core import setup
2 | from pyspresso.__init__ import __version__
3 |
4 | setup(
5 | name="pyspresso",
6 | version=__version__,
7 | author="Jason Geffner",
8 | author_email="jason@malwareanalysis.com",
9 | url="https://github.com/CrowdStrike/pyspresso/",
10 | description="Python-based framework for debugging Java",
11 | long_description="Python-based framework for debugging Java",
12 | packages=["pyspresso",],
13 | platforms="Android, Linux, MacOS, Windows",
14 | license="GNU General Public License v3 or later (GPLv3+)",
15 | classifiers=["Development Status :: 3 - Alpha",
16 | "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
17 | "Natural Language :: English",
18 | "Operating System :: Android",
19 | "Operating System :: MacOS",
20 | "Operating System :: Microsoft :: Windows",
21 | "Operating System :: POSIX :: Linux",
22 | "Programming Language :: Python",
23 | "Topic :: Software Development :: Debuggers"],
24 | )
--------------------------------------------------------------------------------
/pyspresso/event_modifiers.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | ## @file event_modifiers.py
3 | # @brief JDWP event modifiers.
4 | # @author Jason Geffner
5 | # @copyright CrowdStrike, Inc. 2016
6 |
7 | from pyspresso.constants import EventModifier
8 |
9 |
10 | class Count:
11 | def __init__(self, count=0):
12 | self.mod_kind = EventModifier.COUNT
13 | self.count = count
14 |
15 | class Conditional:
16 | def __init__(self, expr_id=0):
17 | self.mod_kind = EventModifier.CONDITIONAL
18 | self.expr_id = expr_id
19 |
20 | class ThreadOnly:
21 | def __init__(self, thread=0):
22 | self.mod_kind = EventModifier.THREAD_ONLY
23 | self.thread = thread
24 |
25 | class ClassOnly:
26 | def __init__(self, class_=0):
27 | self.mod_kind = EventModifier.CONDITIONAL
28 | self.class_ = class_
29 |
30 | class ClassMatch:
31 | def __init__(self, class_pattern=""):
32 | self.mod_kind = EventModifier.CLASS_MATCH
33 | self.class_pattern = class_pattern
34 |
35 | class ClassExclude:
36 | def __init__(self, class_pattern=""):
37 | self.mod_kind = EventModifier.CLASS_EXCLUDE
38 | self.class_pattern = class_pattern
39 |
40 | class LocationOnly:
41 | def __init__(self, loc=None):
42 | self.mod_kind = EventModifier.LOCATION_ONLY
43 | self.loc = loc
44 |
45 | class ExceptionOnly:
46 | def __init__(self, exception_or_null=0, caught=False, uncaught=False):
47 | self.mod_kind = EventModifier.EXCEPTION_ONLY
48 | self.exception_or_null = exception_or_null
49 | self.caught = caught
50 | self.uncaught = uncaught
51 |
52 | class FieldOnly:
53 | def __init__(self, declaring=0, field_id=0):
54 | self.mod_kind = EventModifier.FIELD_ONLY
55 | self.declaring = declaring
56 | self.field_id = field_id
57 |
58 | class Step:
59 | def __init__(self, thread=0, size=0, depth=0):
60 | self.mod_kind = EventModifier.STEP
61 | self.thread = thread
62 | self.size = size
63 | self.depth = depth
64 |
65 | class InstanceOnly:
66 | def __init__(self, instance=0):
67 | self.mod_kind = EventModifier.INSTANCE_ONLY
68 | self.instance = instance
69 |
70 | class SourceNameMatch:
71 | def __init__(self, source_name_pattern=""):
72 | self.mod_kind = EventModifier.SOURCE_NAME_MATCH
73 | self.source_name_pattern = source_name_pattern
74 |
--------------------------------------------------------------------------------
/docs/_static/css/badge_only.css:
--------------------------------------------------------------------------------
1 | .fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-weight:normal;font-style:normal;src:url("../font/fontawesome_webfont.eot");src:url("../font/fontawesome_webfont.eot?#iefix") format("embedded-opentype"),url("../font/fontawesome_webfont.woff") format("woff"),url("../font/fontawesome_webfont.ttf") format("truetype"),url("../font/fontawesome_webfont.svg#FontAwesome") format("svg")}.fa:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa{display:inline-block;text-decoration:inherit}li .fa{display:inline-block}li .fa-large:before,li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.fas li .fa{width:0.8em}ul.fas li .fa-large:before,ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before{content:""}.icon-book:before{content:""}.fa-caret-down:before{content:""}.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.icon-caret-up:before{content:""}.fa-caret-left:before{content:""}.icon-caret-left:before{content:""}.fa-caret-right:before{content:""}.icon-caret-right:before{content:""}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;border-top:solid 10px #343131;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980B9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}img{width:100%;height:auto}}
2 | /*# sourceMappingURL=badge_only.css.map */
3 |
--------------------------------------------------------------------------------
/docs/_static/pygments.css:
--------------------------------------------------------------------------------
1 | .highlight .hll { background-color: #ffffcc }
2 | .highlight { background: #eeffcc; }
3 | .highlight .c { color: #408090; font-style: italic } /* Comment */
4 | .highlight .err { border: 1px solid #FF0000 } /* Error */
5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */
6 | .highlight .o { color: #666666 } /* Operator */
7 | .highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */
8 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
9 | .highlight .cp { color: #007020 } /* Comment.Preproc */
10 | .highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */
11 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
12 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
13 | .highlight .gd { color: #A00000 } /* Generic.Deleted */
14 | .highlight .ge { font-style: italic } /* Generic.Emph */
15 | .highlight .gr { color: #FF0000 } /* Generic.Error */
16 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
17 | .highlight .gi { color: #00A000 } /* Generic.Inserted */
18 | .highlight .go { color: #333333 } /* Generic.Output */
19 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
20 | .highlight .gs { font-weight: bold } /* Generic.Strong */
21 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
22 | .highlight .gt { color: #0044DD } /* Generic.Traceback */
23 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
24 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
25 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
26 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */
27 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
28 | .highlight .kt { color: #902000 } /* Keyword.Type */
29 | .highlight .m { color: #208050 } /* Literal.Number */
30 | .highlight .s { color: #4070a0 } /* Literal.String */
31 | .highlight .na { color: #4070a0 } /* Name.Attribute */
32 | .highlight .nb { color: #007020 } /* Name.Builtin */
33 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
34 | .highlight .no { color: #60add5 } /* Name.Constant */
35 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
36 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
37 | .highlight .ne { color: #007020 } /* Name.Exception */
38 | .highlight .nf { color: #06287e } /* Name.Function */
39 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
40 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
41 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
42 | .highlight .nv { color: #bb60d5 } /* Name.Variable */
43 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
44 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */
45 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */
46 | .highlight .mf { color: #208050 } /* Literal.Number.Float */
47 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */
48 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */
49 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */
50 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
51 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */
52 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
53 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */
54 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
55 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
56 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
57 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */
58 | .highlight .sr { color: #235388 } /* Literal.String.Regex */
59 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */
60 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */
61 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
62 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
63 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
64 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
65 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */
--------------------------------------------------------------------------------
/docs/search.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Search — pyspresso 0.1 documentation
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 | pyspresso
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 | Docs »
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 | Please activate JavaScript to enable the search
132 | functionality.
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
197 |
198 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
--------------------------------------------------------------------------------
/docs/_static/js/theme.js:
--------------------------------------------------------------------------------
1 | require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o");
77 |
78 | // Add expand links to all parents of nested ul
79 | $('.wy-menu-vertical ul').not('.simple').siblings('a').each(function () {
80 | var link = $(this);
81 | expand = $(' ');
82 | expand.on('click', function (ev) {
83 | self.toggleCurrent(link);
84 | ev.stopPropagation();
85 | return false;
86 | });
87 | link.prepend(expand);
88 | });
89 | };
90 |
91 | nav.reset = function () {
92 | // Get anchor from URL and open up nested nav
93 | var anchor = encodeURI(window.location.hash);
94 | if (anchor) {
95 | try {
96 | var link = $('.wy-menu-vertical')
97 | .find('[href="' + anchor + '"]');
98 | $('.wy-menu-vertical li.toctree-l1 li.current')
99 | .removeClass('current');
100 | link.closest('li.toctree-l2').addClass('current');
101 | link.closest('li.toctree-l3').addClass('current');
102 | link.closest('li.toctree-l4').addClass('current');
103 | }
104 | catch (err) {
105 | console.log("Error expanding nav for anchor", err);
106 | }
107 | }
108 | };
109 |
110 | nav.onScroll = function () {
111 | this.winScroll = false;
112 | var newWinPosition = this.win.scrollTop(),
113 | winBottom = newWinPosition + this.winHeight,
114 | navPosition = this.navBar.scrollTop(),
115 | newNavPosition = navPosition + (newWinPosition - this.winPosition);
116 | if (newWinPosition < 0 || winBottom > this.docHeight) {
117 | return;
118 | }
119 | this.navBar.scrollTop(newNavPosition);
120 | this.winPosition = newWinPosition;
121 | };
122 |
123 | nav.onResize = function () {
124 | this.winResize = false;
125 | this.winHeight = this.win.height();
126 | this.docHeight = $(document).height();
127 | };
128 |
129 | nav.hashChange = function () {
130 | this.linkScroll = true;
131 | this.win.one('hashchange', function () {
132 | this.linkScroll = false;
133 | });
134 | };
135 |
136 | nav.toggleCurrent = function (elem) {
137 | var parent_li = elem.closest('li');
138 | parent_li.siblings('li.current').removeClass('current');
139 | parent_li.siblings().find('li.current').removeClass('current');
140 | parent_li.find('> ul li.current').removeClass('current');
141 | parent_li.toggleClass('current');
142 | }
143 |
144 | return nav;
145 | };
146 |
147 | module.exports.ThemeNav = ThemeNav();
148 |
149 | if (typeof(window) != 'undefined') {
150 | window.SphinxRtdTheme = { StickyNav: module.exports.ThemeNav };
151 | }
152 |
153 | },{"jquery":"jquery"}]},{},["sphinx-rtd-theme"]);
154 |
--------------------------------------------------------------------------------
/docs/py-modindex.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Python Module Index — pyspresso 0.1 documentation
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 | pyspresso
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 | Docs »
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
Python Module Index
135 |
136 |
139 |
140 |
176 |
177 |
178 |
179 |
180 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
232 |
233 |
234 |
235 |
--------------------------------------------------------------------------------
/docs/_static/doctools.js:
--------------------------------------------------------------------------------
1 | /*
2 | * doctools.js
3 | * ~~~~~~~~~~~
4 | *
5 | * Sphinx JavaScript utilities for all documentation.
6 | *
7 | * :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 | /**
13 | * select a different prefix for underscore
14 | */
15 | $u = _.noConflict();
16 |
17 | /**
18 | * make the code below compatible with browsers without
19 | * an installed firebug like debugger
20 | if (!window.console || !console.firebug) {
21 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir",
22 | "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace",
23 | "profile", "profileEnd"];
24 | window.console = {};
25 | for (var i = 0; i < names.length; ++i)
26 | window.console[names[i]] = function() {};
27 | }
28 | */
29 |
30 | /**
31 | * small helper function to urldecode strings
32 | */
33 | jQuery.urldecode = function(x) {
34 | return decodeURIComponent(x).replace(/\+/g, ' ');
35 | };
36 |
37 | /**
38 | * small helper function to urlencode strings
39 | */
40 | jQuery.urlencode = encodeURIComponent;
41 |
42 | /**
43 | * This function returns the parsed url parameters of the
44 | * current request. Multiple values per key are supported,
45 | * it will always return arrays of strings for the value parts.
46 | */
47 | jQuery.getQueryParameters = function(s) {
48 | if (typeof s == 'undefined')
49 | s = document.location.search;
50 | var parts = s.substr(s.indexOf('?') + 1).split('&');
51 | var result = {};
52 | for (var i = 0; i < parts.length; i++) {
53 | var tmp = parts[i].split('=', 2);
54 | var key = jQuery.urldecode(tmp[0]);
55 | var value = jQuery.urldecode(tmp[1]);
56 | if (key in result)
57 | result[key].push(value);
58 | else
59 | result[key] = [value];
60 | }
61 | return result;
62 | };
63 |
64 | /**
65 | * highlight a given string on a jquery object by wrapping it in
66 | * span elements with the given class name.
67 | */
68 | jQuery.fn.highlightText = function(text, className) {
69 | function highlight(node) {
70 | if (node.nodeType == 3) {
71 | var val = node.nodeValue;
72 | var pos = val.toLowerCase().indexOf(text);
73 | if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) {
74 | var span = document.createElement("span");
75 | span.className = className;
76 | span.appendChild(document.createTextNode(val.substr(pos, text.length)));
77 | node.parentNode.insertBefore(span, node.parentNode.insertBefore(
78 | document.createTextNode(val.substr(pos + text.length)),
79 | node.nextSibling));
80 | node.nodeValue = val.substr(0, pos);
81 | }
82 | }
83 | else if (!jQuery(node).is("button, select, textarea")) {
84 | jQuery.each(node.childNodes, function() {
85 | highlight(this);
86 | });
87 | }
88 | }
89 | return this.each(function() {
90 | highlight(this);
91 | });
92 | };
93 |
94 | /*
95 | * backward compatibility for jQuery.browser
96 | * This will be supported until firefox bug is fixed.
97 | */
98 | if (!jQuery.browser) {
99 | jQuery.uaMatch = function(ua) {
100 | ua = ua.toLowerCase();
101 |
102 | var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
103 | /(webkit)[ \/]([\w.]+)/.exec(ua) ||
104 | /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
105 | /(msie) ([\w.]+)/.exec(ua) ||
106 | ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
107 | [];
108 |
109 | return {
110 | browser: match[ 1 ] || "",
111 | version: match[ 2 ] || "0"
112 | };
113 | };
114 | jQuery.browser = {};
115 | jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
116 | }
117 |
118 | /**
119 | * Small JavaScript module for the documentation.
120 | */
121 | var Documentation = {
122 |
123 | init : function() {
124 | this.fixFirefoxAnchorBug();
125 | this.highlightSearchWords();
126 | this.initIndexTable();
127 |
128 | },
129 |
130 | /**
131 | * i18n support
132 | */
133 | TRANSLATIONS : {},
134 | PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; },
135 | LOCALE : 'unknown',
136 |
137 | // gettext and ngettext don't access this so that the functions
138 | // can safely bound to a different name (_ = Documentation.gettext)
139 | gettext : function(string) {
140 | var translated = Documentation.TRANSLATIONS[string];
141 | if (typeof translated == 'undefined')
142 | return string;
143 | return (typeof translated == 'string') ? translated : translated[0];
144 | },
145 |
146 | ngettext : function(singular, plural, n) {
147 | var translated = Documentation.TRANSLATIONS[singular];
148 | if (typeof translated == 'undefined')
149 | return (n == 1) ? singular : plural;
150 | return translated[Documentation.PLURALEXPR(n)];
151 | },
152 |
153 | addTranslations : function(catalog) {
154 | for (var key in catalog.messages)
155 | this.TRANSLATIONS[key] = catalog.messages[key];
156 | this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')');
157 | this.LOCALE = catalog.locale;
158 | },
159 |
160 | /**
161 | * add context elements like header anchor links
162 | */
163 | addContextElements : function() {
164 | $('div[id] > :header:first').each(function() {
165 | $('').
166 | attr('href', '#' + this.id).
167 | attr('title', _('Permalink to this headline')).
168 | appendTo(this);
169 | });
170 | $('dt[id]').each(function() {
171 | $('').
172 | attr('href', '#' + this.id).
173 | attr('title', _('Permalink to this definition')).
174 | appendTo(this);
175 | });
176 | },
177 |
178 | /**
179 | * workaround a firefox stupidity
180 | * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075
181 | */
182 | fixFirefoxAnchorBug : function() {
183 | if (document.location.hash)
184 | window.setTimeout(function() {
185 | document.location.href += '';
186 | }, 10);
187 | },
188 |
189 | /**
190 | * highlight the search words provided in the url in the text
191 | */
192 | highlightSearchWords : function() {
193 | var params = $.getQueryParameters();
194 | var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
195 | if (terms.length) {
196 | var body = $('div.body');
197 | if (!body.length) {
198 | body = $('body');
199 | }
200 | window.setTimeout(function() {
201 | $.each(terms, function() {
202 | body.highlightText(this.toLowerCase(), 'highlighted');
203 | });
204 | }, 10);
205 | $('' + _('Hide Search Matches') + '
')
207 | .appendTo($('#searchbox'));
208 | }
209 | },
210 |
211 | /**
212 | * init the domain index toggle buttons
213 | */
214 | initIndexTable : function() {
215 | var togglers = $('img.toggler').click(function() {
216 | var src = $(this).attr('src');
217 | var idnum = $(this).attr('id').substr(7);
218 | $('tr.cg-' + idnum).toggle();
219 | if (src.substr(-9) == 'minus.png')
220 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
221 | else
222 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
223 | }).css('display', '');
224 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) {
225 | togglers.click();
226 | }
227 | },
228 |
229 | /**
230 | * helper function to hide the search marks again
231 | */
232 | hideSearchWords : function() {
233 | $('#searchbox .highlight-link').fadeOut(300);
234 | $('span.highlighted').removeClass('highlighted');
235 | },
236 |
237 | /**
238 | * make the url absolute
239 | */
240 | makeURL : function(relativeURL) {
241 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL;
242 | },
243 |
244 | /**
245 | * get the current relative url
246 | */
247 | getCurrentURL : function() {
248 | var path = document.location.pathname;
249 | var parts = path.split(/\//);
250 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
251 | if (this == '..')
252 | parts.pop();
253 | });
254 | var url = parts.join('/');
255 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
256 | },
257 |
258 | initOnKeyListeners: function() {
259 | $(document).keyup(function(event) {
260 | var activeElementType = document.activeElement.tagName;
261 | // don't navigate when in search box or textarea
262 | if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') {
263 | switch (event.keyCode) {
264 | case 37: // left
265 | var prevHref = $('link[rel="prev"]').prop('href');
266 | if (prevHref) {
267 | window.location.href = prevHref;
268 | return false;
269 | }
270 | case 39: // right
271 | var nextHref = $('link[rel="next"]').prop('href');
272 | if (nextHref) {
273 | window.location.href = nextHref;
274 | return false;
275 | }
276 | }
277 | }
278 | });
279 | }
280 | };
281 |
282 | // quick alias for translations
283 | _ = Documentation.gettext;
284 |
285 | $(document).ready(function() {
286 | Documentation.init();
287 | });
--------------------------------------------------------------------------------
/docs/event_modifiers.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | pyspresso.event_modifiers — pyspresso 0.1 documentation
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 | pyspresso
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 | Docs »
121 |
122 | pyspresso.event_modifiers
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
pyspresso.event_modifiers
136 |
140 |
141 |
142 | class pyspresso.event_modifiers.ClassExclude( class_pattern='' )
143 |
144 |
145 |
146 |
147 | class pyspresso.event_modifiers.ClassMatch( class_pattern='' )
148 |
149 |
150 |
151 |
152 | class pyspresso.event_modifiers.ClassOnly( class_=0 )
153 |
154 |
155 |
156 |
157 | class pyspresso.event_modifiers.Conditional( expr_id=0 )
158 |
159 |
160 |
161 |
162 | class pyspresso.event_modifiers.Count( count=0 )
163 |
164 |
165 |
166 |
167 | class pyspresso.event_modifiers.ExceptionOnly( exception_or_null=0 , caught=False , uncaught=False )
168 |
169 |
170 |
171 |
172 | class pyspresso.event_modifiers.FieldOnly( declaring=0 , field_id=0 )
173 |
174 |
175 |
176 |
177 | class pyspresso.event_modifiers.InstanceOnly( instance=0 )
178 |
179 |
180 |
181 |
182 | class pyspresso.event_modifiers.LocationOnly( loc=None )
183 |
184 |
185 |
186 |
187 | class pyspresso.event_modifiers.SourceNameMatch( source_name_pattern='' )
188 |
189 |
190 |
191 |
192 | class pyspresso.event_modifiers.Step( thread=0 , size=0 , depth=0 )
193 |
194 |
195 |
196 |
197 | class pyspresso.event_modifiers.ThreadOnly( thread=0 )
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
266 |
267 |
268 |
269 |
--------------------------------------------------------------------------------
/pyspresso/constants.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | ## @file constants.py
3 | # @brief JDWP debug constants.
4 | # @author Jason Geffner
5 | # @copyright CrowdStrike, Inc. 2016
6 |
7 |
8 | class Command:
9 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html """
10 | class VirtualMachine:
11 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_VirtualMachine """
12 | Version = (1, 1)
13 | ClassesBySignature = (1, 2)
14 | AllClasses = (1, 3)
15 | AllThreads = (1, 4)
16 | TopLevelThreadGroups = (1, 5)
17 | Dispose = (1, 6)
18 | IDSizes = (1, 7)
19 | Suspend = (1, 8)
20 | Resume = (1, 9)
21 | Exit = (1, 10)
22 | CreateString = (1, 11)
23 | Capabilities = (1, 12)
24 | ClassPaths = (1, 13)
25 | DisposeObjects = (1, 14)
26 | HoldEvents = (1, 15)
27 | ReleaseEvents = (1, 16)
28 | CapabilitiesNew = (1, 17)
29 | RedefineClasses = (1, 18)
30 | SetDefaultStratum = (1, 19)
31 | AllClassesWithGeneric = (1, 20)
32 | InstanceCounts = (1, 21)
33 | class ReferenceType:
34 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_ReferenceType """
35 | Signature = (2, 1)
36 | ClassLoader = (2, 2)
37 | Modifiers = (2, 3)
38 | Fields = (2, 4)
39 | Methods = (2, 5)
40 | GetValues = (2, 6)
41 | SourceFile = (2, 7)
42 | NestedTypes = (2, 8)
43 | Status = (2, 9)
44 | Interfaces = (2, 10)
45 | ClassObject = (2, 11)
46 | SourceDebugExtension = (2, 12)
47 | SignatureWithGeneric = (2, 13)
48 | FieldsWithGeneric = (2, 14)
49 | MethodsWithGeneric = (2, 15)
50 | Instances = (2, 16)
51 | ClassFileVersion = (2, 17)
52 | ConstantPool = (2, 18)
53 | class ClassType:
54 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_ClassType """
55 | Superclass = (3, 1)
56 | SetValues = (3, 2)
57 | InvokeMethod = (3, 3)
58 | NewInstance = (3, 4)
59 | class ArrayType:
60 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_ArrayType """
61 | NewInstance = (4, 1)
62 | class InterfaceType:
63 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_InterfaceType """
64 | InvokeMethod = (5, 1)
65 | class Method:
66 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_Method """
67 | LineTable = (6, 1)
68 | VariableTable = (6, 2)
69 | Bytecodes = (6, 3)
70 | IsObsolete = (6, 4)
71 | VariableTableWithGeneric = (6, 5)
72 | class Field:
73 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_Field """
74 | pass
75 | class ObjectReference:
76 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_ObjectReference """
77 | ReferenceType = (9, 1)
78 | GetValues = (9, 2)
79 | SetValues = (9, 3)
80 | MonitorInfo = (9, 5)
81 | InvokeMethod = (9, 6)
82 | DisableCollection = (9, 7)
83 | EnableCollection = (9, 8)
84 | IsCollected = (9, 9)
85 | ReferringObjects = (9, 10)
86 | class StringReference:
87 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_StringReference """
88 | Value = (10, 1)
89 | class ThreadReference:
90 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_ThreadReference """
91 | Name = (11, 1)
92 | Suspend = (11, 2)
93 | Resume = (11, 3)
94 | Status = (11, 4)
95 | ThreadGroup = (11, 5)
96 | Frames = (11, 6)
97 | FrameCount = (11, 7)
98 | OwnedMonitors = (11, 8)
99 | CurrentContendedMonitor = (11, 9)
100 | Stop = (11, 10)
101 | Interrupt = (11, 11)
102 | SuspendCount = (11, 12)
103 | OwnedMonitorsStackDepthInfo = (11, 13)
104 | ForceEarlyReturn = (11, 14)
105 | class ThreadGroupReference:
106 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_ThreadGroupReference """
107 | Name = (12, 1)
108 | Parent = (12, 2)
109 | Children = (12, 3)
110 | class ArrayReference:
111 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_ArrayReference """
112 | Length = (13, 1)
113 | GetValues = (13, 2)
114 | SetValues = (13, 3)
115 | class ClassLoaderReference:
116 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_ClassLoaderReference """
117 | VisibleClasses = (14, 1)
118 | class EventRequest:
119 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_EventRequest """
120 | Set = (15, 1)
121 | Clear = (15, 2)
122 | ClearAllBreakpoints = (15, 3)
123 | class StackFrame:
124 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_StackFrame """
125 | GetValues = (16, 1)
126 | SetValues = (16, 2)
127 | ThisObject = (16, 3)
128 | PopFrames = (16, 4)
129 | class ClassObjectReference:
130 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_ClassObjectReference """
131 | ReflectedType = (17, 1)
132 | class Event:
133 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_Event """
134 | Composite = (64, 100)
135 |
136 | class Error:
137 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_Error """
138 | NONE = 0
139 | INVALID_THREAD = 10
140 | INVALID_THREAD_GROUP = 11
141 | INVALID_PRIORITY = 12
142 | THREAD_NOT_SUSPENDED = 13
143 | THREAD_SUSPENDED = 14
144 | THREAD_NOT_ALIVE = 15
145 | INVALID_OBJECT = 20
146 | INVALID_CLASS = 21
147 | CLASS_NOT_PREPARED = 22
148 | INVALID_METHODID = 23
149 | INVALID_LOCATION = 24
150 | INVALID_FIELDID = 25
151 | INVALID_FRAMEID = 30
152 | NO_MORE_FRAMES = 31
153 | OPAQUE_FRAME = 32
154 | NOT_CURRENT_FRAME = 33
155 | TYPE_MISMATCH = 34
156 | INVALID_SLOT = 35
157 | DUPLICATE = 40
158 | NOT_FOUND = 41
159 | INVALID_MONITOR = 50
160 | NOT_MONITOR_OWNER = 51
161 | INTERRUPT = 52
162 | INVALID_CLASS_FORMAT = 60
163 | CIRCULAR_CLASS_DEFINITION = 61
164 | FAILS_VERIFICATION = 62
165 | ADD_METHOD_NOT_IMPLEMENTED = 63
166 | SCHEMA_CHANGE_NOT_IMPLEMENTED = 64
167 | INVALID_TYPESTATE = 65
168 | HIERARCHY_CHANGE_NOT_IMPLEMENTED = 66
169 | DELETE_METHOD_NOT_IMPLEMENTED = 67
170 | UNSUPPORTED_VERSION = 68
171 | NAMES_DONT_MATCH = 69
172 | CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED = 70
173 | METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED = 71
174 | NOT_IMPLEMENTED = 99
175 | NULL_POINTER = 100
176 | ABSENT_INFORMATION = 101
177 | INVALID_EVENT_TYPE = 102
178 | ILLEGAL_ARGUMENT = 103
179 | OUT_OF_MEMORY = 110
180 | ACCESS_DENIED = 111
181 | VM_DEAD = 112
182 | INTERNAL = 113
183 | UNATTACHED_THREAD = 115
184 | INVALID_TAG = 500
185 | ALREADY_INVOKING = 502
186 | INVALID_INDEX = 503
187 | INVALID_LENGTH = 504
188 | INVALID_STRING = 506
189 | INVALID_CLASS_LOADER = 507
190 | INVALID_ARRAY = 508
191 | TRANSPORT_LOAD = 509
192 | TRANSPORT_INIT = 510
193 | NATIVE_METHOD = 511
194 | INVALID_COUNT = 512
195 |
196 | class EventKind:
197 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_EventKind """
198 | SINGLE_STEP = 1
199 | BREAKPOINT = 2
200 | FRAME_POP = 3
201 | EXCEPTION = 4
202 | USER_DEFINED = 5
203 | THREAD_START = 6
204 | THREAD_DEATH = 7
205 | THREAD_END = 7
206 | CLASS_PREPARE = 8
207 | CLASS_UNLOAD = 9
208 | CLASS_LOAD = 10
209 | FIELD_ACCESS = 20
210 | FIELD_MODIFICATION = 21
211 | EXCEPTION_CATCH = 30
212 | METHOD_ENTRY = 40
213 | METHOD_EXIT = 41
214 | METHOD_EXIT_WITH_RETURN_VALUE = 42
215 | MONITOR_CONTENDED_ENTER = 43
216 | MONITOR_CONTENDED_ENTERED = 44
217 | MONITOR_WAIT = 45
218 | MONITOR_WAITED = 46
219 | VM_START = 90
220 | VM_INIT = 90
221 | VM_DEATH = 99
222 | VM_DISCONNECTED = 100
223 |
224 | class ThreadStatus:
225 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_ThreadStatus """
226 | ZOMBIE = 0
227 | RUNNING = 1
228 | SLEEPING = 2
229 | MONITOR = 3
230 | WAIT = 4
231 |
232 | class SuspendStatus:
233 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_SuspendStatus """
234 | SUSPEND_STATUS_SUSPENDED = 1
235 |
236 | class ClassStatus:
237 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_ClassStatus """
238 | VERIFIED = 1
239 | PREPARED = 2
240 | INITIALIZED = 4
241 | ERROR = 8
242 |
243 | class TypeTag:
244 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_TypeTag """
245 | CLASS = 1
246 | INTERFACE = 2
247 | ARRAY = 3
248 |
249 | class Tag:
250 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_Tag """
251 | ARRAY = 91
252 | BYTE = 66
253 | CHAR = 67
254 | OBJECT = 76
255 | FLOAT = 70
256 | DOUBLE = 68
257 | INT = 73
258 | LONG = 74
259 | SHORT = 83
260 | VOID = 86
261 | BOOLEAN = 90
262 | STRING = 115
263 | THREAD = 116
264 | THREAD_GROUP = 103
265 | CLASS_LOADER = 108
266 | CLASS_OBJECT = 99
267 |
268 | class StepDepth:
269 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_StepDepth """
270 | INTO = 0
271 | OVER = 1
272 | OUT = 2
273 |
274 | class StepSize:
275 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_StepSize """
276 | MIN = 0
277 | LINE = 1
278 |
279 | class SuspendPolicy:
280 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_SuspendPolicy """
281 | NONE = 0
282 | EVENT_THREAD = 1
283 | ALL = 2
284 |
285 | class InvokeOptions:
286 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_InvokeOptions """
287 | INVOKE_SINGLE_THREADED = 1
288 | INVOKE_NONVIRTUAL = 2
289 |
290 | class AccessFlags:
291 | """ https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6 """
292 | PUBLIC = 0x0001
293 | PRIVATE = 0x0002
294 | PROTECTED = 0x0004
295 | STATIC = 0x0008
296 | FINAL = 0x0010
297 | SYNCHRONIZED = 0x0020
298 | BRIDGE = 0x0040
299 | VARARGS = 0x0080
300 | NATIVE = 0x0100
301 | ABSTRACT = 0x0400
302 | STRICT = 0x0800
303 | SYNTHETIC = 0x1000
304 |
305 | class EventModifier:
306 | """ http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_EventRequest_Set """
307 | COUNT = 1
308 | CONDITIONAL = 2
309 | THREAD_ONLY = 3
310 | CLASS_ONLY = 4
311 | CLASS_MATCH = 5
312 | CLASS_EXCLUDE = 6
313 | LOCATION_ONLY = 7
314 | EXCEPTION_ONLY = 8
315 | FIELD_ONLY = 9
316 | STEP = 10
317 | INSTANCE_ONLY = 11
318 | SOURCE_NAME_MATCH = 12
319 |
--------------------------------------------------------------------------------
/docs/_static/underscore.js:
--------------------------------------------------------------------------------
1 | // Underscore.js 1.3.1
2 | // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
3 | // Underscore is freely distributable under the MIT license.
4 | // Portions of Underscore are inspired or borrowed from Prototype,
5 | // Oliver Steele's Functional, and John Resig's Micro-Templating.
6 | // For all details and documentation:
7 | // http://documentcloud.github.com/underscore
8 | (function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==
9 | c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,
10 | h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each=
11 | b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a==
12 | null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=
13 | function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e=
14 | e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=
15 | function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,
17 | c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}};
24 | b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments,
25 | 1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};
26 | b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};
27 | b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e /g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a),
28 | function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+
29 | u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]=
30 | function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=
31 | true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);
32 |
--------------------------------------------------------------------------------
/docs/_static/alabaster.css:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | @import url("basic.css");
19 |
20 | /* -- page layout ----------------------------------------------------------- */
21 |
22 | body {
23 | font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro', serif;
24 | font-size: 17px;
25 | background-color: white;
26 | color: #000;
27 | margin: 0;
28 | padding: 0;
29 | }
30 |
31 |
32 | div.document {
33 | width: 940px;
34 | margin: 30px auto 0 auto;
35 | }
36 |
37 | div.documentwrapper {
38 | float: left;
39 | width: 100%;
40 | }
41 |
42 | div.bodywrapper {
43 | margin: 0 0 0 220px;
44 | }
45 |
46 | div.sphinxsidebar {
47 | width: 220px;
48 | font-size: 14px;
49 | line-height: 1.5;
50 | }
51 |
52 | hr {
53 | border: 1px solid #B1B4B6;
54 | }
55 |
56 | div.body {
57 | background-color: #ffffff;
58 | color: #3E4349;
59 | padding: 0 30px 0 30px;
60 | }
61 |
62 | div.body > .section {
63 | text-align: left;
64 | }
65 |
66 | div.footer {
67 | width: 940px;
68 | margin: 20px auto 30px auto;
69 | font-size: 14px;
70 | color: #888;
71 | text-align: right;
72 | }
73 |
74 | div.footer a {
75 | color: #888;
76 | }
77 |
78 | p.caption {
79 | font-family: ;
80 | font-size: inherit;
81 | }
82 |
83 |
84 | div.relations {
85 | display: none;
86 | }
87 |
88 |
89 | div.sphinxsidebar a {
90 | color: #444;
91 | text-decoration: none;
92 | border-bottom: 1px dotted #999;
93 | }
94 |
95 | div.sphinxsidebar a:hover {
96 | border-bottom: 1px solid #999;
97 | }
98 |
99 | div.sphinxsidebarwrapper {
100 | padding: 18px 10px;
101 | }
102 |
103 | div.sphinxsidebarwrapper p.logo {
104 | padding: 0;
105 | margin: -10px 0 0 0px;
106 | text-align: center;
107 | }
108 |
109 | div.sphinxsidebarwrapper h1.logo {
110 | margin-top: -10px;
111 | text-align: center;
112 | margin-bottom: 5px;
113 | text-align: left;
114 | }
115 |
116 | div.sphinxsidebarwrapper h1.logo-name {
117 | margin-top: 0px;
118 | }
119 |
120 | div.sphinxsidebarwrapper p.blurb {
121 | margin-top: 0;
122 | font-style: normal;
123 | }
124 |
125 | div.sphinxsidebar h3,
126 | div.sphinxsidebar h4 {
127 | font-family: 'Garamond', 'Georgia', serif;
128 | color: #444;
129 | font-size: 24px;
130 | font-weight: normal;
131 | margin: 0 0 5px 0;
132 | padding: 0;
133 | }
134 |
135 | div.sphinxsidebar h4 {
136 | font-size: 20px;
137 | }
138 |
139 | div.sphinxsidebar h3 a {
140 | color: #444;
141 | }
142 |
143 | div.sphinxsidebar p.logo a,
144 | div.sphinxsidebar h3 a,
145 | div.sphinxsidebar p.logo a:hover,
146 | div.sphinxsidebar h3 a:hover {
147 | border: none;
148 | }
149 |
150 | div.sphinxsidebar p {
151 | color: #555;
152 | margin: 10px 0;
153 | }
154 |
155 | div.sphinxsidebar ul {
156 | margin: 10px 0;
157 | padding: 0;
158 | color: #000;
159 | }
160 |
161 | div.sphinxsidebar ul li.toctree-l1 > a {
162 | font-size: 120%;
163 | }
164 |
165 | div.sphinxsidebar ul li.toctree-l2 > a {
166 | font-size: 110%;
167 | }
168 |
169 | div.sphinxsidebar input {
170 | border: 1px solid #CCC;
171 | font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro', serif;
172 | font-size: 1em;
173 | }
174 |
175 | div.sphinxsidebar hr {
176 | border: none;
177 | height: 1px;
178 | color: #AAA;
179 | background: #AAA;
180 |
181 | text-align: left;
182 | margin-left: 0;
183 | width: 50%;
184 | }
185 |
186 | /* -- body styles ----------------------------------------------------------- */
187 |
188 | a {
189 | color: #004B6B;
190 | text-decoration: underline;
191 | }
192 |
193 | a:hover {
194 | color: #6D4100;
195 | text-decoration: underline;
196 | }
197 |
198 | div.body h1,
199 | div.body h2,
200 | div.body h3,
201 | div.body h4,
202 | div.body h5,
203 | div.body h6 {
204 | font-family: 'Garamond', 'Georgia', serif;
205 | font-weight: normal;
206 | margin: 30px 0px 10px 0px;
207 | padding: 0;
208 | }
209 |
210 | div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }
211 | div.body h2 { font-size: 180%; }
212 | div.body h3 { font-size: 150%; }
213 | div.body h4 { font-size: 130%; }
214 | div.body h5 { font-size: 100%; }
215 | div.body h6 { font-size: 100%; }
216 |
217 | a.headerlink {
218 | color: #DDD;
219 | padding: 0 4px;
220 | text-decoration: none;
221 | }
222 |
223 | a.headerlink:hover {
224 | color: #444;
225 | background: #EAEAEA;
226 | }
227 |
228 | div.body p, div.body dd, div.body li {
229 | line-height: 1.4em;
230 | }
231 |
232 | div.admonition {
233 | margin: 20px 0px;
234 | padding: 10px 30px;
235 | background-color: #FCC;
236 | border: 1px solid #FAA;
237 | }
238 |
239 | div.admonition tt.xref, div.admonition a tt {
240 | border-bottom: 1px solid #fafafa;
241 | }
242 |
243 | dd div.admonition {
244 | margin-left: -60px;
245 | padding-left: 60px;
246 | }
247 |
248 | div.admonition p.admonition-title {
249 | font-family: 'Garamond', 'Georgia', serif;
250 | font-weight: normal;
251 | font-size: 24px;
252 | margin: 0 0 10px 0;
253 | padding: 0;
254 | line-height: 1;
255 | }
256 |
257 | div.admonition p.last {
258 | margin-bottom: 0;
259 | }
260 |
261 | div.highlight {
262 | background-color: white;
263 | }
264 |
265 | dt:target, .highlight {
266 | background: #FAF3E8;
267 | }
268 |
269 | div.note {
270 | background-color: #EEE;
271 | border: 1px solid #CCC;
272 | }
273 |
274 | div.seealso {
275 | background-color: #EEE;
276 | border: 1px solid #CCC;
277 | }
278 |
279 | div.topic {
280 | background-color: #eee;
281 | }
282 |
283 | p.admonition-title {
284 | display: inline;
285 | }
286 |
287 | p.admonition-title:after {
288 | content: ":";
289 | }
290 |
291 | pre, tt, code {
292 | font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
293 | font-size: 0.9em;
294 | }
295 |
296 | .hll {
297 | background-color: #FFC;
298 | margin: 0 -12px;
299 | padding: 0 12px;
300 | display: block;
301 | }
302 |
303 | img.screenshot {
304 | }
305 |
306 | tt.descname, tt.descclassname, code.descname, code.descclassname {
307 | font-size: 0.95em;
308 | }
309 |
310 | tt.descname, code.descname {
311 | padding-right: 0.08em;
312 | }
313 |
314 | img.screenshot {
315 | -moz-box-shadow: 2px 2px 4px #eee;
316 | -webkit-box-shadow: 2px 2px 4px #eee;
317 | box-shadow: 2px 2px 4px #eee;
318 | }
319 |
320 | table.docutils {
321 | border: 1px solid #888;
322 | -moz-box-shadow: 2px 2px 4px #eee;
323 | -webkit-box-shadow: 2px 2px 4px #eee;
324 | box-shadow: 2px 2px 4px #eee;
325 | }
326 |
327 | table.docutils td, table.docutils th {
328 | border: 1px solid #888;
329 | padding: 0.25em 0.7em;
330 | }
331 |
332 | table.field-list, table.footnote {
333 | border: none;
334 | -moz-box-shadow: none;
335 | -webkit-box-shadow: none;
336 | box-shadow: none;
337 | }
338 |
339 | table.footnote {
340 | margin: 15px 0;
341 | width: 100%;
342 | border: 1px solid #EEE;
343 | background: #FDFDFD;
344 | font-size: 0.9em;
345 | }
346 |
347 | table.footnote + table.footnote {
348 | margin-top: -15px;
349 | border-top: none;
350 | }
351 |
352 | table.field-list th {
353 | padding: 0 0.8em 0 0;
354 | }
355 |
356 | table.field-list td {
357 | padding: 0;
358 | }
359 |
360 | table.field-list p {
361 | margin-bottom: 0.8em;
362 | }
363 |
364 | table.footnote td.label {
365 | width: .1px;
366 | padding: 0.3em 0 0.3em 0.5em;
367 | }
368 |
369 | table.footnote td {
370 | padding: 0.3em 0.5em;
371 | }
372 |
373 | dl {
374 | margin: 0;
375 | padding: 0;
376 | }
377 |
378 | dl dd {
379 | margin-left: 30px;
380 | }
381 |
382 | blockquote {
383 | margin: 0 0 0 30px;
384 | padding: 0;
385 | }
386 |
387 | ul, ol {
388 | /* Matches the 30px from the narrow-screen "li > ul" selector below */
389 | margin: 10px 0 10px 30px;
390 | padding: 0;
391 | }
392 |
393 | pre {
394 | background: #EEE;
395 | padding: 7px 30px;
396 | margin: 15px 0px;
397 | line-height: 1.3em;
398 | }
399 |
400 | dl pre, blockquote pre, li pre {
401 | margin-left: 0;
402 | padding-left: 30px;
403 | }
404 |
405 | dl dl pre {
406 | margin-left: -90px;
407 | padding-left: 90px;
408 | }
409 |
410 | tt, code {
411 | background-color: #ecf0f3;
412 | color: #222;
413 | /* padding: 1px 2px; */
414 | }
415 |
416 | tt.xref, code.xref, a tt {
417 | background-color: #FBFBFB;
418 | border-bottom: 1px solid white;
419 | }
420 |
421 | a.reference {
422 | text-decoration: none;
423 | border-bottom: 1px dotted #004B6B;
424 | }
425 |
426 | /* Don't put an underline on images */
427 | a.image-reference, a.image-reference:hover {
428 | border-bottom: none;
429 | }
430 |
431 | a.reference:hover {
432 | border-bottom: 1px solid #6D4100;
433 | }
434 |
435 | a.footnote-reference {
436 | text-decoration: none;
437 | font-size: 0.7em;
438 | vertical-align: top;
439 | border-bottom: 1px dotted #004B6B;
440 | }
441 |
442 | a.footnote-reference:hover {
443 | border-bottom: 1px solid #6D4100;
444 | }
445 |
446 | a:hover tt, a:hover code {
447 | background: #EEE;
448 | }
449 |
450 |
451 | @media screen and (max-width: 870px) {
452 |
453 | div.sphinxsidebar {
454 | display: none;
455 | }
456 |
457 | div.document {
458 | width: 100%;
459 |
460 | }
461 |
462 | div.documentwrapper {
463 | margin-left: 0;
464 | margin-top: 0;
465 | margin-right: 0;
466 | margin-bottom: 0;
467 | }
468 |
469 | div.bodywrapper {
470 | margin-top: 0;
471 | margin-right: 0;
472 | margin-bottom: 0;
473 | margin-left: 0;
474 | }
475 |
476 | ul {
477 | margin-left: 0;
478 | }
479 |
480 | li > ul {
481 | /* Matches the 30px from the "ul, ol" selector above */
482 | margin-left: 30px;
483 | }
484 |
485 | .document {
486 | width: auto;
487 | }
488 |
489 | .footer {
490 | width: auto;
491 | }
492 |
493 | .bodywrapper {
494 | margin: 0;
495 | }
496 |
497 | .footer {
498 | width: auto;
499 | }
500 |
501 | .github {
502 | display: none;
503 | }
504 |
505 |
506 |
507 | }
508 |
509 |
510 |
511 | @media screen and (max-width: 875px) {
512 |
513 | body {
514 | margin: 0;
515 | padding: 20px 30px;
516 | }
517 |
518 | div.documentwrapper {
519 | float: none;
520 | background: white;
521 | }
522 |
523 | div.sphinxsidebar {
524 | display: block;
525 | float: none;
526 | width: 102.5%;
527 | margin: 50px -30px -20px -30px;
528 | padding: 10px 20px;
529 | background: #333;
530 | color: #FFF;
531 | }
532 |
533 | div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p,
534 | div.sphinxsidebar h3 a {
535 | color: white;
536 | }
537 |
538 | div.sphinxsidebar a {
539 | color: #AAA;
540 | }
541 |
542 | div.sphinxsidebar p.logo {
543 | display: none;
544 | }
545 |
546 | div.document {
547 | width: 100%;
548 | margin: 0;
549 | }
550 |
551 | div.footer {
552 | display: none;
553 | }
554 |
555 | div.bodywrapper {
556 | margin: 0;
557 | }
558 |
559 | div.body {
560 | min-height: 0;
561 | padding: 0;
562 | }
563 |
564 | .rtd_doc_footer {
565 | display: none;
566 | }
567 |
568 | .document {
569 | width: auto;
570 | }
571 |
572 | .footer {
573 | width: auto;
574 | }
575 |
576 | .footer {
577 | width: auto;
578 | }
579 |
580 | .github {
581 | display: none;
582 | }
583 | }
584 |
585 |
586 | /* misc. */
587 |
588 | .revsys-inline {
589 | display: none!important;
590 | }
591 |
592 | /* Make nested-list/multi-paragraph items look better in Releases changelog
593 | * pages. Without this, docutils' magical list fuckery causes inconsistent
594 | * formatting between different release sub-lists.
595 | */
596 | div#changelog > div.section > ul > li > p:only-child {
597 | margin-bottom: 0;
598 | }
599 |
600 | /* Hide fugly table cell borders in ..bibliography:: directive output */
601 | table.docutils.citation, table.docutils.citation td, table.docutils.citation th {
602 | border: none;
603 | /* Below needed in some edge cases; if not applied, bottom shadows appear */
604 | -moz-box-shadow: none;
605 | -webkit-box-shadow: none;
606 | box-shadow: none;
607 | }
--------------------------------------------------------------------------------
/docs/_static/basic.css:
--------------------------------------------------------------------------------
1 | /*
2 | * basic.css
3 | * ~~~~~~~~~
4 | *
5 | * Sphinx stylesheet -- basic theme.
6 | *
7 | * :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 | /* -- main layout ----------------------------------------------------------- */
13 |
14 | div.clearer {
15 | clear: both;
16 | }
17 |
18 | /* -- relbar ---------------------------------------------------------------- */
19 |
20 | div.related {
21 | width: 100%;
22 | font-size: 90%;
23 | }
24 |
25 | div.related h3 {
26 | display: none;
27 | }
28 |
29 | div.related ul {
30 | margin: 0;
31 | padding: 0 0 0 10px;
32 | list-style: none;
33 | }
34 |
35 | div.related li {
36 | display: inline;
37 | }
38 |
39 | div.related li.right {
40 | float: right;
41 | margin-right: 5px;
42 | }
43 |
44 | /* -- sidebar --------------------------------------------------------------- */
45 |
46 | div.sphinxsidebarwrapper {
47 | padding: 10px 5px 0 10px;
48 | }
49 |
50 | div.sphinxsidebar {
51 | float: left;
52 | width: 230px;
53 | margin-left: -100%;
54 | font-size: 90%;
55 | word-wrap: break-word;
56 | overflow-wrap : break-word;
57 | }
58 |
59 | div.sphinxsidebar ul {
60 | list-style: none;
61 | }
62 |
63 | div.sphinxsidebar ul ul,
64 | div.sphinxsidebar ul.want-points {
65 | margin-left: 20px;
66 | list-style: square;
67 | }
68 |
69 | div.sphinxsidebar ul ul {
70 | margin-top: 0;
71 | margin-bottom: 0;
72 | }
73 |
74 | div.sphinxsidebar form {
75 | margin-top: 10px;
76 | }
77 |
78 | div.sphinxsidebar input {
79 | border: 1px solid #98dbcc;
80 | font-family: sans-serif;
81 | font-size: 1em;
82 | }
83 |
84 | div.sphinxsidebar #searchbox input[type="text"] {
85 | width: 170px;
86 | }
87 |
88 | div.sphinxsidebar #searchbox input[type="submit"] {
89 | width: 30px;
90 | }
91 |
92 | img {
93 | border: 0;
94 | max-width: 100%;
95 | }
96 |
97 | /* -- search page ----------------------------------------------------------- */
98 |
99 | ul.search {
100 | margin: 10px 0 0 20px;
101 | padding: 0;
102 | }
103 |
104 | ul.search li {
105 | padding: 5px 0 5px 20px;
106 | background-image: url(file.png);
107 | background-repeat: no-repeat;
108 | background-position: 0 7px;
109 | }
110 |
111 | ul.search li a {
112 | font-weight: bold;
113 | }
114 |
115 | ul.search li div.context {
116 | color: #888;
117 | margin: 2px 0 0 30px;
118 | text-align: left;
119 | }
120 |
121 | ul.keywordmatches li.goodmatch a {
122 | font-weight: bold;
123 | }
124 |
125 | /* -- index page ------------------------------------------------------------ */
126 |
127 | table.contentstable {
128 | width: 90%;
129 | }
130 |
131 | table.contentstable p.biglink {
132 | line-height: 150%;
133 | }
134 |
135 | a.biglink {
136 | font-size: 1.3em;
137 | }
138 |
139 | span.linkdescr {
140 | font-style: italic;
141 | padding-top: 5px;
142 | font-size: 90%;
143 | }
144 |
145 | /* -- general index --------------------------------------------------------- */
146 |
147 | table.indextable {
148 | width: 100%;
149 | }
150 |
151 | table.indextable td {
152 | text-align: left;
153 | vertical-align: top;
154 | }
155 |
156 | table.indextable dl, table.indextable dd {
157 | margin-top: 0;
158 | margin-bottom: 0;
159 | }
160 |
161 | table.indextable tr.pcap {
162 | height: 10px;
163 | }
164 |
165 | table.indextable tr.cap {
166 | margin-top: 10px;
167 | background-color: #f2f2f2;
168 | }
169 |
170 | img.toggler {
171 | margin-right: 3px;
172 | margin-top: 3px;
173 | cursor: pointer;
174 | }
175 |
176 | div.modindex-jumpbox {
177 | border-top: 1px solid #ddd;
178 | border-bottom: 1px solid #ddd;
179 | margin: 1em 0 1em 0;
180 | padding: 0.4em;
181 | }
182 |
183 | div.genindex-jumpbox {
184 | border-top: 1px solid #ddd;
185 | border-bottom: 1px solid #ddd;
186 | margin: 1em 0 1em 0;
187 | padding: 0.4em;
188 | }
189 |
190 | /* -- general body styles --------------------------------------------------- */
191 |
192 | div.body p, div.body dd, div.body li, div.body blockquote {
193 | -moz-hyphens: auto;
194 | -ms-hyphens: auto;
195 | -webkit-hyphens: auto;
196 | hyphens: auto;
197 | }
198 |
199 | a.headerlink {
200 | visibility: hidden;
201 | }
202 |
203 | h1:hover > a.headerlink,
204 | h2:hover > a.headerlink,
205 | h3:hover > a.headerlink,
206 | h4:hover > a.headerlink,
207 | h5:hover > a.headerlink,
208 | h6:hover > a.headerlink,
209 | dt:hover > a.headerlink,
210 | caption:hover > a.headerlink,
211 | p.caption:hover > a.headerlink,
212 | div.code-block-caption:hover > a.headerlink {
213 | visibility: visible;
214 | }
215 |
216 | div.body p.caption {
217 | text-align: inherit;
218 | }
219 |
220 | div.body td {
221 | text-align: left;
222 | }
223 |
224 | .field-list ul {
225 | padding-left: 1em;
226 | }
227 |
228 | .first {
229 | margin-top: 0 !important;
230 | }
231 |
232 | p.rubric {
233 | margin-top: 30px;
234 | font-weight: bold;
235 | }
236 |
237 | img.align-left, .figure.align-left, object.align-left {
238 | clear: left;
239 | float: left;
240 | margin-right: 1em;
241 | }
242 |
243 | img.align-right, .figure.align-right, object.align-right {
244 | clear: right;
245 | float: right;
246 | margin-left: 1em;
247 | }
248 |
249 | img.align-center, .figure.align-center, object.align-center {
250 | display: block;
251 | margin-left: auto;
252 | margin-right: auto;
253 | }
254 |
255 | .align-left {
256 | text-align: left;
257 | }
258 |
259 | .align-center {
260 | text-align: center;
261 | }
262 |
263 | .align-right {
264 | text-align: right;
265 | }
266 |
267 | /* -- sidebars -------------------------------------------------------------- */
268 |
269 | div.sidebar {
270 | margin: 0 0 0.5em 1em;
271 | border: 1px solid #ddb;
272 | padding: 7px 7px 0 7px;
273 | background-color: #ffe;
274 | width: 40%;
275 | float: right;
276 | }
277 |
278 | p.sidebar-title {
279 | font-weight: bold;
280 | }
281 |
282 | /* -- topics ---------------------------------------------------------------- */
283 |
284 | div.topic {
285 | border: 1px solid #ccc;
286 | padding: 7px 7px 0 7px;
287 | margin: 10px 0 10px 0;
288 | }
289 |
290 | p.topic-title {
291 | font-size: 1.1em;
292 | font-weight: bold;
293 | margin-top: 10px;
294 | }
295 |
296 | /* -- admonitions ----------------------------------------------------------- */
297 |
298 | div.admonition {
299 | margin-top: 10px;
300 | margin-bottom: 10px;
301 | padding: 7px;
302 | }
303 |
304 | div.admonition dt {
305 | font-weight: bold;
306 | }
307 |
308 | div.admonition dl {
309 | margin-bottom: 0;
310 | }
311 |
312 | p.admonition-title {
313 | margin: 0px 10px 5px 0px;
314 | font-weight: bold;
315 | }
316 |
317 | div.body p.centered {
318 | text-align: center;
319 | margin-top: 25px;
320 | }
321 |
322 | /* -- tables ---------------------------------------------------------------- */
323 |
324 | table.docutils {
325 | border: 0;
326 | border-collapse: collapse;
327 | }
328 |
329 | table caption span.caption-number {
330 | font-style: italic;
331 | }
332 |
333 | table caption span.caption-text {
334 | }
335 |
336 | table.docutils td, table.docutils th {
337 | padding: 1px 8px 1px 5px;
338 | border-top: 0;
339 | border-left: 0;
340 | border-right: 0;
341 | border-bottom: 1px solid #aaa;
342 | }
343 |
344 | table.field-list td, table.field-list th {
345 | border: 0 !important;
346 | }
347 |
348 | table.footnote td, table.footnote th {
349 | border: 0 !important;
350 | }
351 |
352 | th {
353 | text-align: left;
354 | padding-right: 5px;
355 | }
356 |
357 | table.citation {
358 | border-left: solid 1px gray;
359 | margin-left: 1px;
360 | }
361 |
362 | table.citation td {
363 | border-bottom: none;
364 | }
365 |
366 | /* -- figures --------------------------------------------------------------- */
367 |
368 | div.figure {
369 | margin: 0.5em;
370 | padding: 0.5em;
371 | }
372 |
373 | div.figure p.caption {
374 | padding: 0.3em;
375 | }
376 |
377 | div.figure p.caption span.caption-number {
378 | font-style: italic;
379 | }
380 |
381 | div.figure p.caption span.caption-text {
382 | }
383 |
384 |
385 | /* -- other body styles ----------------------------------------------------- */
386 |
387 | ol.arabic {
388 | list-style: decimal;
389 | }
390 |
391 | ol.loweralpha {
392 | list-style: lower-alpha;
393 | }
394 |
395 | ol.upperalpha {
396 | list-style: upper-alpha;
397 | }
398 |
399 | ol.lowerroman {
400 | list-style: lower-roman;
401 | }
402 |
403 | ol.upperroman {
404 | list-style: upper-roman;
405 | }
406 |
407 | dl {
408 | margin-bottom: 15px;
409 | }
410 |
411 | dd p {
412 | margin-top: 0px;
413 | }
414 |
415 | dd ul, dd table {
416 | margin-bottom: 10px;
417 | }
418 |
419 | dd {
420 | margin-top: 3px;
421 | margin-bottom: 10px;
422 | margin-left: 30px;
423 | }
424 |
425 | dt:target, .highlighted {
426 | background-color: #fbe54e;
427 | }
428 |
429 | dl.glossary dt {
430 | font-weight: bold;
431 | font-size: 1.1em;
432 | }
433 |
434 | .field-list ul {
435 | margin: 0;
436 | padding-left: 1em;
437 | }
438 |
439 | .field-list p {
440 | margin: 0;
441 | }
442 |
443 | .optional {
444 | font-size: 1.3em;
445 | }
446 |
447 | .sig-paren {
448 | font-size: larger;
449 | }
450 |
451 | .versionmodified {
452 | font-style: italic;
453 | }
454 |
455 | .system-message {
456 | background-color: #fda;
457 | padding: 5px;
458 | border: 3px solid red;
459 | }
460 |
461 | .footnote:target {
462 | background-color: #ffa;
463 | }
464 |
465 | .line-block {
466 | display: block;
467 | margin-top: 1em;
468 | margin-bottom: 1em;
469 | }
470 |
471 | .line-block .line-block {
472 | margin-top: 0;
473 | margin-bottom: 0;
474 | margin-left: 1.5em;
475 | }
476 |
477 | .guilabel, .menuselection {
478 | font-family: sans-serif;
479 | }
480 |
481 | .accelerator {
482 | text-decoration: underline;
483 | }
484 |
485 | .classifier {
486 | font-style: oblique;
487 | }
488 |
489 | abbr, acronym {
490 | border-bottom: dotted 1px;
491 | cursor: help;
492 | }
493 |
494 | /* -- code displays --------------------------------------------------------- */
495 |
496 | pre {
497 | overflow: auto;
498 | overflow-y: hidden; /* fixes display issues on Chrome browsers */
499 | }
500 |
501 | td.linenos pre {
502 | padding: 5px 0px;
503 | border: 0;
504 | background-color: transparent;
505 | color: #aaa;
506 | }
507 |
508 | table.highlighttable {
509 | margin-left: 0.5em;
510 | }
511 |
512 | table.highlighttable td {
513 | padding: 0 0.5em 0 0.5em;
514 | }
515 |
516 | div.code-block-caption {
517 | padding: 2px 5px;
518 | font-size: small;
519 | }
520 |
521 | div.code-block-caption code {
522 | background-color: transparent;
523 | }
524 |
525 | div.code-block-caption + div > div.highlight > pre {
526 | margin-top: 0;
527 | }
528 |
529 | div.code-block-caption span.caption-number {
530 | padding: 0.1em 0.3em;
531 | font-style: italic;
532 | }
533 |
534 | div.code-block-caption span.caption-text {
535 | }
536 |
537 | div.literal-block-wrapper {
538 | padding: 1em 1em 0;
539 | }
540 |
541 | div.literal-block-wrapper div.highlight {
542 | margin: 0;
543 | }
544 |
545 | code.descname {
546 | background-color: transparent;
547 | font-weight: bold;
548 | font-size: 1.2em;
549 | }
550 |
551 | code.descclassname {
552 | background-color: transparent;
553 | }
554 |
555 | code.xref, a code {
556 | background-color: transparent;
557 | font-weight: bold;
558 | }
559 |
560 | h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
561 | background-color: transparent;
562 | }
563 |
564 | .viewcode-link {
565 | float: right;
566 | }
567 |
568 | .viewcode-back {
569 | float: right;
570 | font-family: sans-serif;
571 | }
572 |
573 | div.viewcode-block:target {
574 | margin: -1px -10px;
575 | padding: 0 10px;
576 | }
577 |
578 | /* -- math display ---------------------------------------------------------- */
579 |
580 | img.math {
581 | vertical-align: middle;
582 | }
583 |
584 | div.body div.math p {
585 | text-align: center;
586 | }
587 |
588 | span.eqno {
589 | float: right;
590 | }
591 |
592 | /* -- printout stylesheet --------------------------------------------------- */
593 |
594 | @media print {
595 | div.document,
596 | div.documentwrapper,
597 | div.bodywrapper {
598 | margin: 0 !important;
599 | width: 100%;
600 | }
601 |
602 | div.sphinxsidebar,
603 | div.related,
604 | div.footer,
605 | #top-link {
606 | display: none;
607 | }
608 | }
--------------------------------------------------------------------------------
/pyspresso/samples/javajournal.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | ## @file javajournal.py
3 | # @brief Traces Java method calls.
4 | # @author Jason Geffner
5 | # @copyright CrowdStrike, Inc. 2016
6 |
7 | import socket
8 | import argparse
9 | import thread
10 | import re
11 | import os
12 | import subprocess
13 |
14 | from pyspresso.debug_interface import DebugInterface
15 | import pyspresso.event_modifiers as Modifier
16 | import pyspresso.events as Event
17 | from pyspresso.constants import *
18 |
19 |
20 | class JavaJournal:
21 | """ Our Java method call tracer. """
22 |
23 | di = None
24 | """ A :any:`DebugInterface` object. """
25 |
26 | jar = ""
27 |
28 | classpath = ""
29 |
30 | class_ = ""
31 |
32 | # File path of the directory in which to store log files.
33 | _log_dir = ""
34 |
35 | # Don't begin logging until a method from this class is called.
36 | _begin = ""
37 |
38 | # List of Java classes to include in logging.
39 | _include = []
40 |
41 | # List of Java classes to exclude from logging.
42 | _exclude = []
43 |
44 | # Mapping of thread numbers to log files.
45 | _log_files = {}
46 |
47 |
48 | def __init__(self, jar="", classpath="", class_="", log_dir="", begin="",
49 | include=[], exclude=[]):
50 | if jar == "" and classpath == "":
51 | raise Exception("You must specify a jar or a classpath")
52 |
53 | if jar != "" and classpath != "":
54 | raise Exception("You must specify a jar OR a classpath, not both")
55 |
56 | if classpath != "" and class_ == "":
57 | raise Exception("If specifying a classpath, you must also " +
58 | "specify a class")
59 |
60 | self.jar = jar
61 | self.classpath = classpath
62 | self.class_ = class_
63 |
64 | if not os.path.isdir(log_dir):
65 | raise Exception("Invalid log directory")
66 | self._log_dir = log_dir
67 |
68 | self._begin = begin
69 |
70 | if len(include) != 0 and len(exclude) != 0:
71 | raise Exception("Arguments exclude and include are mutually " +
72 | "exclusive; you may use one or the other but not" +
73 | "both")
74 | self._include = include
75 | self._exclude = exclude
76 |
77 |
78 | def set_break_on_method_entry_and_method_exit(self):
79 | """ Set "breakpoints" on Java method entries and exits. """
80 |
81 | for event_kind in (
82 | EventKind.METHOD_ENTRY, EventKind.METHOD_EXIT_WITH_RETURN_VALUE):
83 | if len(self._exclude) != 0:
84 | modifiers = []
85 | for pattern in self._exclude:
86 | modifiers.append(Modifier.ClassExclude(pattern))
87 | self.di.event_request.set(event_kind, SuspendPolicy.ALL,
88 | modifiers)
89 | elif len(self._include) != 0:
90 | for pattern in self._include:
91 | self.di.event_request.set(event_kind, SuspendPolicy.ALL,
92 | [Modifier.ClassMatch(pattern)])
93 | else:
94 | self.di.event_request.set(event_kind)
95 |
96 |
97 | #
98 | # Print and log to file the method entry/exit event.
99 | #
100 | def _log_method(self, entry, thread_id, frame_count, s):
101 | # Remove BEL and new-line characters for logging.
102 | s = s.replace("\x07", "").replace("\r", "").replace("\n", "")
103 |
104 | line = " "*(frame_count - 1) + ("" if entry else "^ ") + s
105 | print line
106 | if thread_id not in self._log_files:
107 | self._log_files[thread_id] = open(os.path.join(
108 | self._log_dir, "thread_" + str(thread_id) + ".txt"), "w")
109 | self._log_files[thread_id].write(line + "\n")
110 |
111 | #
112 | # Print and log to file the method entry event.
113 | #
114 | def log_method_entry(self, thread_id, frame_count, s):
115 | self._log_method(True, thread_id, frame_count, s)
116 |
117 | #
118 | # Print and log to file the method exit event.
119 | #
120 | def log_method_exit(self, thread_id, frame_count, s):
121 | self._log_method(False, thread_id, frame_count, s)
122 |
123 | #
124 | # Run the tracer.
125 | #
126 | def run(self):
127 |
128 | # Create a DebugInterface object.
129 | self.di = DebugInterface()
130 |
131 | #
132 | # Run the target in a new console. Usage of the "-Xdebug" argument will
133 | # cause the JVM to start in a suspended state.
134 | #
135 |
136 | args = ["java.exe", "-Xdebug", self.di.xdebug_arg]
137 |
138 | if self.jar != "":
139 | args += ["-jar", self.jar]
140 | else:
141 | args += ["-classpath", self.classpath, self.class_]
142 |
143 | subprocess.Popen(args, creationflags=subprocess.CREATE_NEW_CONSOLE)
144 |
145 |
146 | #
147 | # Attach our debugger to the process created with our DebugInterface's
148 | # xdebug_arg parameter above.
149 | #
150 | self.di.utils.attach()
151 |
152 |
153 | #
154 | # Set initial breakpoint(s).
155 | #
156 |
157 | if self._begin != "":
158 | # Set a breakpoint on the first method called in the _begin class.
159 | begin_request_id = self.di.event_request.set(
160 | EventKind.METHOD_ENTRY,
161 | SuspendPolicy.ALL,
162 | [Modifier.ClassMatch(self._begin)])
163 | else:
164 | # Set breakpoints on general method calls.
165 | self.set_break_on_method_entry_and_method_exit()
166 |
167 |
168 | #
169 | # Wait for and handle incoming debug events.
170 | #
171 |
172 | while True:
173 | # Get the next event packet from the event queue.
174 | event_packet = self.di.utils.wait_for_event()
175 |
176 | # Extract the suspend policy and all events from the packet.
177 | (events, suspend_policy) = self.di.utils.parse_events(
178 | event_packet.data)
179 |
180 | # Iterate over each event.
181 | for event in events:
182 | if isinstance(event, Event.MethodEntry):
183 | if self._begin != "":
184 | #
185 | # Remove our initial "breakpoint" and start logging
186 | # general method calls.
187 | #
188 | self.di.event_request.clear(
189 | EventKind.METHOD_ENTRY,
190 | begin_request_id)
191 | self._begin = ""
192 | self.set_break_on_method_entry_and_method_exit()
193 |
194 | # Get the method's class's name.
195 | class_name = re.search(
196 | "L([^;]*)",
197 | self.di.reference_type.get_signature(
198 | event.location.class_id)).groups()[0]
199 | class_name = class_name.replace("/", ".")
200 |
201 | # Get the method's details.
202 | method = self.di.utils.get_method(event.location.class_id,
203 | event.location.method_id)
204 |
205 | # Get the method's arguments.
206 | arguments = self.di.utils.get_method_arguments(
207 | event.thread,
208 | self.di.utils.parse_jni(method.signature)[0],
209 | method.mod_bits)
210 |
211 | # Get the thread's frame count (call-stack depth).
212 | frame_count = self.di.thread_reference.get_frame_count(
213 | event.thread)
214 |
215 | # Log the event.
216 | self.log_method_entry(
217 | event.thread,
218 | frame_count,
219 | class_name + "." + method.name +
220 | "(" + ", ".join(arguments) + ")")
221 |
222 | elif isinstance(event, Event.MethodExitWithReturnValue):
223 | # Get the thread's frame count (call-stack depth).
224 | frame_count = self.di.thread_reference.get_frame_count(
225 | event.thread)
226 |
227 | # Log the event.
228 | self.log_method_exit(
229 | event.thread,
230 | frame_count,
231 | self.di.utils.get_string_representation_of_value(
232 | event.value))
233 |
234 | elif isinstance(event, Event.VMDeath):
235 | return
236 |
237 | # Resume the VM as necessary.
238 | if suspend_policy == SuspendPolicy.EVENT_THREAD:
239 | self.di.thread_reference.resume(event.thread)
240 | elif suspend_policy == SuspendPolicy.ALL:
241 | self.di.virtual_machine.resume()
242 |
243 |
244 | if __name__ == "__main__":
245 | #
246 | # Parse command line arguments.
247 | #
248 |
249 | class ArgParser(argparse.ArgumentParser):
250 | def error(self, message):
251 | print "Error: " + message
252 | print
253 | print self.format_help().replace("usage:", "Usage:")
254 | self.exit(0)
255 | parser = ArgParser(
256 | add_help=False,
257 | description="Traces Java method calls using Java Debug Wire Protocol.",
258 | formatter_class=argparse.RawDescriptionHelpFormatter,
259 | epilog=r"""
260 | You must specify either -jar or both -classpath and -class.
261 |
262 | Examples:
263 | %(prog)s -jar C:\malware.jar
264 | %(prog)s -classpath C:\malware.jar -class evil.Destruction -begin evil.Destruction -include evil.*
265 | %(prog)s -exclude java.lang.String;java.lang.System;java.util.concurrent.*
266 | """)
267 |
268 | args = parser.add_argument_group("Arguments")
269 | args.add_argument("-jar", metavar="", required=False, default="", help="File path of the target JAR file")
270 | args.add_argument("-classpath", metavar="", required=False, default="", help="Class search path of directories and ZIP/JAR files")
271 | args.add_argument("-class", metavar="", required=False, default="", help="Full name of class to execute")
272 | args.add_argument("-log", metavar="", required=False, default=os.getcwd(), help="Directory in which to store method trace log files (default is current directory)")
273 | args.add_argument("-begin", metavar="", required=False, default="", help="Don't begin logging until a method from this class is called (default is to begin logging at JVM initialization)")
274 | args.add_argument("-exclude", metavar="", required=False, default="", help="Java classes to exclude from logging (each entry can begin or end with \"*\"); can be the file path of a text file containing list of classes (one per line), or a semicolon-separated list of classes specified in the command line")
275 | args.add_argument("-include", metavar="", required=False, default="", help="Java classes to include in logging (methods from all other classes will be excluded) (each entry can begin or end with \"*\"); can be the file path of a text file containing list of classes (one per line), or a semicolon-separated list of classes specified in the command line")
276 | for arg in [action.dest for action in parser._actions]:
277 | globals()["arg_" + arg] = getattr(parser.parse_args(), arg)
278 |
279 | #
280 | # Validate command line arguments.
281 | #
282 |
283 | if arg_jar != "":
284 | if arg_classpath != "":
285 | parser.error("You must choose -jar OR -classpath, not both.")
286 | elif arg_classpath != "":
287 | if arg_class == "":
288 | parser.error("If specifying a -classpath, you must also specify" +
289 | " the -class.")
290 | else:
291 | parser.error("You must specify a jar or a classpath.")
292 |
293 | if not os.path.isdir(arg_log):
294 | parser.error("You must specify a valid -log directory.")
295 |
296 | if arg_exclude != "" and arg_include != "":
297 | parser.error(
298 | "Arguments -exclude and -include are mutually exclusive; you may" +
299 | " use one or the other but not both.")
300 |
301 | for v in ("include", "exclude"):
302 | if globals()["arg_" + v] == "":
303 | globals()[v + "_classes"] = []
304 | continue
305 | if os.path.isfile(globals()["arg_" + v]):
306 | with open(globals()["arg_" + v]) as f:
307 | globals()[v + "_classes"] = f.read().splitlines()
308 | continue
309 | globals()[v + "_classes"] = globals()["arg_" + v].split(";")
310 |
311 |
312 | # Initialize and run the tracer.
313 | JavaJournal(arg_jar, arg_classpath, arg_class, arg_log, arg_begin,
314 | include_classes, exclude_classes).run()
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | pyspresso — pyspresso 0.1 documentation
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | pyspresso
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 | Docs »
118 |
119 | pyspresso
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
pyspresso
133 |
A Python-based framework for debugging Java.
134 |
135 |
136 |
Modules
137 |
156 |
157 |
158 |
Basic Usage
159 |
The DebugInterface is the primary interface for interacting with the
160 | debugged Java process.
161 |
To begin, create a DebugInterface object. The constructor for this class
162 | allows you to specify a "memory" - or "socket" -based transport and a file
163 | mapping name or network address, respectively.
164 |
The next step is to run your target Java program with the created
165 | DebugInterface object’s xdebug_arg field value as the value for
166 | Java’s -Xdebug command line argument:
167 |
di = pyspresso . debug_interface . DebugInterface ()
168 | args = [ "java.exe" , "-Xdebug" , di . xdebug_arg , "-jar" , "example.jar" ]
169 | subprocess . Popen ( args )
170 |
171 |
172 |
Launching Java with the -Xdebug command line argument causes the target
173 | program to begin in a suspended state.
174 |
The next step is to attach the DebugInterface object to the created
175 | process. The call below to DebugInterface.Utilities.attach identifies the
176 | correct target process based on the unique address in xdebug_arg :
177 |
180 |
Now that pyspresso’s DebugInterface is attached to the suspended process,
181 | you may issue any DebugInterface commands you like, such as setting
182 | breakpoints, querying the JVM, etc.
183 |
Once you’ve finished your initialization steps, you can write your debug loop.
184 | The debug loop consists of receiving a packet from the debuggee, parsing the
185 | packet’s pyspresso.Event values, handling each
186 | pyspresso.Event as you see fit, and then resuming the JVM:
187 |
while True :
188 | # Get the next event from the event queue.
189 | event_packet = di . utils . wait_for_event ()
190 |
191 | # Extract the suspend policy and all events from the packet.
192 | ( events , suspend_policy ) = di . utils . parse_events ( event_packet . data )
193 |
194 | # Iterate over each event.
195 | for event in events :
196 | ...
197 |
198 | # Resume the VM as necessary.
199 | if suspend_policy == pyspresso . constants . SuspendPolicy . EVENT_THREAD :
200 | di . thread_reference . resume ( event . thread )
201 | elif suspend_policy == pyspresso . constants . SuspendPolicy . ALL :
202 | di . virtual_machine . resume ()
203 |
204 |
205 |
See the included JavaJournal sample for more details.
206 |
207 |
213 |
214 |
215 |
216 |
217 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
276 |
277 |
278 |
279 |
--------------------------------------------------------------------------------
/docs/_static/js/modernizr.min.js:
--------------------------------------------------------------------------------
1 | /* Modernizr 2.6.2 (Custom Build) | MIT & BSD
2 | * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
3 | */
4 | ;window.Modernizr=function(a,b,c){function D(a){j.cssText=a}function E(a,b){return D(n.join(a+";")+(b||""))}function F(a,b){return typeof a===b}function G(a,b){return!!~(""+a).indexOf(b)}function H(a,b){for(var d in a){var e=a[d];if(!G(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function I(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:F(f,"function")?f.bind(d||b):f}return!1}function J(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return F(b,"string")||F(b,"undefined")?H(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),I(e,b,c))}function K(){e.input=function(c){for(var d=0,e=c.length;d',a,""].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},z=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return y("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},A=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=F(e[d],"function"),F(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),B={}.hasOwnProperty,C;!F(B,"undefined")&&!F(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&F(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e}),s.flexbox=function(){return J("flexWrap")},s.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},s.canvastext=function(){return!!e.canvas&&!!F(b.createElement("canvas").getContext("2d").fillText,"function")},s.webgl=function(){return!!a.WebGLRenderingContext},s.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:y(["@media (",n.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},s.geolocation=function(){return"geolocation"in navigator},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!J("indexedDB",a)},s.hashchange=function(){return A("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},s.rgba=function(){return D("background-color:rgba(150,255,150,.5)"),G(j.backgroundColor,"rgba")},s.hsla=function(){return D("background-color:hsla(120,40%,100%,.5)"),G(j.backgroundColor,"rgba")||G(j.backgroundColor,"hsla")},s.multiplebgs=function(){return D("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},s.backgroundsize=function(){return J("backgroundSize")},s.borderimage=function(){return J("borderImage")},s.borderradius=function(){return J("borderRadius")},s.boxshadow=function(){return J("boxShadow")},s.textshadow=function(){return b.createElement("div").style.textShadow===""},s.opacity=function(){return E("opacity:.55"),/^0.55$/.test(j.opacity)},s.cssanimations=function(){return J("animationName")},s.csscolumns=function(){return J("columnCount")},s.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return D((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),G(j.backgroundImage,"gradient")},s.cssreflections=function(){return J("boxReflect")},s.csstransforms=function(){return!!J("transform")},s.csstransforms3d=function(){var a=!!J("perspective");return a&&"webkitPerspective"in g.style&&y("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},s.csstransitions=function(){return J("transition")},s.fontface=function(){var a;return y('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a},s.generatedcontent=function(){var a;return y(["#",h,"{font:0/0 a}#",h,':after{content:"',l,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},s.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},s.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},s.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},s.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}},s.webworkers=function(){return!!a.Worker},s.applicationcache=function(){return!!a.applicationCache},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect},s.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML=" ",(a.firstChild&&a.firstChild.namespaceURI)==r.svg},s.smil=function(){return!!b.createElementNS&&/SVGAnimate/.test(m.call(b.createElementNS(r.svg,"animate")))},s.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(m.call(b.createElementNS(r.svg,"clipPath")))};for(var L in s)C(s,L)&&(x=L.toLowerCase(),e[x]=s[L](),v.push((e[x]?"":"no-")+x));return e.input||K(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)C(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},D(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.mq=z,e.hasEvent=A,e.testProp=function(a){return H([a])},e.testAllProps=J,e.testStyles=y,e.prefixed=function(a,b,c){return b?J(a,b,c):J(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | pyspresso.transport — pyspresso 0.1 documentation
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 | pyspresso
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 | Docs »
121 |
122 | pyspresso.transport
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
pyspresso.transport
136 |
140 |
141 |
142 | class pyspresso.transport.CommandPacket( id , command , data='' , flags=0 )
143 | A JDWP Command Packet , as defined at
144 | http://docs.oracle.com/javase/8/docs/technotes/guides/jpda/jdwp-spec.html
145 |
146 |
147 | command = 0
148 | Packet’s command.
149 |
150 |
151 |
152 |
153 | command_set = 0
154 | Packet’s command set.
155 |
156 |
157 |
158 |
159 |
160 |
161 | class pyspresso.transport.DebugTransport( transport='dt_shmem' , server=False , address=None )
162 | The DebugTransport class defines JDWP transports for both
163 | shared-memory-based transport and socket-based transport.
164 | The DebugTransport constructor initializes member variables
165 | and binds transport-specific functions.
166 | The transport value should be "dt_shmem" for shared-memory-based
167 | transport or "dt_socket" for socket-based transport.
168 | If the server value is True then the debugger acts as the server
169 | and the debuggee acts as the client. Otherwise, the debuggee acts as
170 | the server and the debugger acts as the client.
171 | The address value should be in the format "hostname:port" for
172 | socket-based transport, or should be the shared file mapping name for
173 | shared-memory-based transport.
174 |
175 |
176 | class AtomicCounter
177 | Atomic “fetch and increment” class for packet IDs.
178 |
179 |
180 | next( )
181 | Return the next 32-bit packet ID.
182 |
183 |
184 |
185 |
186 |
187 |
188 | class DebugTransport.Mutex( handle )
189 | Mutex class to support Python’s with statement.
190 |
191 |
192 |
193 |
194 | DebugTransport.attach( )
195 | Attach to the debuggee.
196 |
197 |
198 |
199 |
200 | DebugTransport.handshake( )
201 | Perform the initial handshake with the debuggee.
202 |
203 |
204 |
205 |
206 | DebugTransport.make_packet( command , data='' )
207 | Create a JDWP CommandPacket .
208 |
209 |
210 |
211 |
212 | DebugTransport.recv( count )
213 | Receive bytes from the debuggee.
214 |
215 |
216 |
217 |
218 | DebugTransport.recv_packet( )
219 | Receive the next CommandPacket or ReplyPacket from
220 | the debuggee.
221 |
222 |
223 |
224 |
225 | DebugTransport.send( bytes )
226 | Send bytes to the debuggee.
227 |
228 |
229 |
230 |
231 | DebugTransport.send_packet( packet )
232 | Decode and send a JDWP CommandPacket to the debuggee.
233 |
234 |
235 |
236 |
237 |
238 |
239 | class pyspresso.transport.Packet
240 | Abstract class for a JDWP packet, as defined at
241 | http://docs.oracle.com/javase/8/docs/technotes/guides/jpda/jdwp-spec.html
242 |
243 |
244 | data = ''
245 | Command data or reply data.
246 |
247 |
248 |
249 |
250 | flags = 0
251 | Packet flags.
252 |
253 |
254 |
255 |
256 | id = 0
257 | Command/reply packet ID.
258 |
259 |
260 |
261 |
262 | length = 0
263 | Length of the packet.
264 |
265 |
266 |
267 |
268 |
269 |
270 | class pyspresso.transport.ReplyPacket( id , error_code , data='' , flags=128 )
271 | A JDWP Reply Packet , as defined at
272 | http://docs.oracle.com/javase/8/docs/technotes/guides/jpda/jdwp-spec.html
273 |
274 |
275 | error_code = 0
276 | Packet’s error response code.
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
347 |
348 |
349 |
350 |
--------------------------------------------------------------------------------
/docs/_static/searchtools.js:
--------------------------------------------------------------------------------
1 | /*
2 | * searchtools.js_t
3 | * ~~~~~~~~~~~~~~~~
4 | *
5 | * Sphinx JavaScript utilities for the full-text search.
6 | *
7 | * :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 |
13 | /* Non-minified version JS is _stemmer.js if file is provided */
14 | /**
15 | * Porter Stemmer
16 | */
17 | var Stemmer = function() {
18 |
19 | var step2list = {
20 | ational: 'ate',
21 | tional: 'tion',
22 | enci: 'ence',
23 | anci: 'ance',
24 | izer: 'ize',
25 | bli: 'ble',
26 | alli: 'al',
27 | entli: 'ent',
28 | eli: 'e',
29 | ousli: 'ous',
30 | ization: 'ize',
31 | ation: 'ate',
32 | ator: 'ate',
33 | alism: 'al',
34 | iveness: 'ive',
35 | fulness: 'ful',
36 | ousness: 'ous',
37 | aliti: 'al',
38 | iviti: 'ive',
39 | biliti: 'ble',
40 | logi: 'log'
41 | };
42 |
43 | var step3list = {
44 | icate: 'ic',
45 | ative: '',
46 | alize: 'al',
47 | iciti: 'ic',
48 | ical: 'ic',
49 | ful: '',
50 | ness: ''
51 | };
52 |
53 | var c = "[^aeiou]"; // consonant
54 | var v = "[aeiouy]"; // vowel
55 | var C = c + "[^aeiouy]*"; // consonant sequence
56 | var V = v + "[aeiou]*"; // vowel sequence
57 |
58 | var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
59 | var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
60 | var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
61 | var s_v = "^(" + C + ")?" + v; // vowel in stem
62 |
63 | this.stemWord = function (w) {
64 | var stem;
65 | var suffix;
66 | var firstch;
67 | var origword = w;
68 |
69 | if (w.length < 3)
70 | return w;
71 |
72 | var re;
73 | var re2;
74 | var re3;
75 | var re4;
76 |
77 | firstch = w.substr(0,1);
78 | if (firstch == "y")
79 | w = firstch.toUpperCase() + w.substr(1);
80 |
81 | // Step 1a
82 | re = /^(.+?)(ss|i)es$/;
83 | re2 = /^(.+?)([^s])s$/;
84 |
85 | if (re.test(w))
86 | w = w.replace(re,"$1$2");
87 | else if (re2.test(w))
88 | w = w.replace(re2,"$1$2");
89 |
90 | // Step 1b
91 | re = /^(.+?)eed$/;
92 | re2 = /^(.+?)(ed|ing)$/;
93 | if (re.test(w)) {
94 | var fp = re.exec(w);
95 | re = new RegExp(mgr0);
96 | if (re.test(fp[1])) {
97 | re = /.$/;
98 | w = w.replace(re,"");
99 | }
100 | }
101 | else if (re2.test(w)) {
102 | var fp = re2.exec(w);
103 | stem = fp[1];
104 | re2 = new RegExp(s_v);
105 | if (re2.test(stem)) {
106 | w = stem;
107 | re2 = /(at|bl|iz)$/;
108 | re3 = new RegExp("([^aeiouylsz])\\1$");
109 | re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
110 | if (re2.test(w))
111 | w = w + "e";
112 | else if (re3.test(w)) {
113 | re = /.$/;
114 | w = w.replace(re,"");
115 | }
116 | else if (re4.test(w))
117 | w = w + "e";
118 | }
119 | }
120 |
121 | // Step 1c
122 | re = /^(.+?)y$/;
123 | if (re.test(w)) {
124 | var fp = re.exec(w);
125 | stem = fp[1];
126 | re = new RegExp(s_v);
127 | if (re.test(stem))
128 | w = stem + "i";
129 | }
130 |
131 | // Step 2
132 | re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
133 | if (re.test(w)) {
134 | var fp = re.exec(w);
135 | stem = fp[1];
136 | suffix = fp[2];
137 | re = new RegExp(mgr0);
138 | if (re.test(stem))
139 | w = stem + step2list[suffix];
140 | }
141 |
142 | // Step 3
143 | re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
144 | if (re.test(w)) {
145 | var fp = re.exec(w);
146 | stem = fp[1];
147 | suffix = fp[2];
148 | re = new RegExp(mgr0);
149 | if (re.test(stem))
150 | w = stem + step3list[suffix];
151 | }
152 |
153 | // Step 4
154 | re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
155 | re2 = /^(.+?)(s|t)(ion)$/;
156 | if (re.test(w)) {
157 | var fp = re.exec(w);
158 | stem = fp[1];
159 | re = new RegExp(mgr1);
160 | if (re.test(stem))
161 | w = stem;
162 | }
163 | else if (re2.test(w)) {
164 | var fp = re2.exec(w);
165 | stem = fp[1] + fp[2];
166 | re2 = new RegExp(mgr1);
167 | if (re2.test(stem))
168 | w = stem;
169 | }
170 |
171 | // Step 5
172 | re = /^(.+?)e$/;
173 | if (re.test(w)) {
174 | var fp = re.exec(w);
175 | stem = fp[1];
176 | re = new RegExp(mgr1);
177 | re2 = new RegExp(meq1);
178 | re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
179 | if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
180 | w = stem;
181 | }
182 | re = /ll$/;
183 | re2 = new RegExp(mgr1);
184 | if (re.test(w) && re2.test(w)) {
185 | re = /.$/;
186 | w = w.replace(re,"");
187 | }
188 |
189 | // and turn initial Y back to y
190 | if (firstch == "y")
191 | w = firstch.toLowerCase() + w.substr(1);
192 | return w;
193 | }
194 | }
195 |
196 |
197 |
198 | /**
199 | * Simple result scoring code.
200 | */
201 | var Scorer = {
202 | // Implement the following function to further tweak the score for each result
203 | // The function takes a result array [filename, title, anchor, descr, score]
204 | // and returns the new score.
205 | /*
206 | score: function(result) {
207 | return result[4];
208 | },
209 | */
210 |
211 | // query matches the full name of an object
212 | objNameMatch: 11,
213 | // or matches in the last dotted part of the object name
214 | objPartialMatch: 6,
215 | // Additive scores depending on the priority of the object
216 | objPrio: {0: 15, // used to be importantResults
217 | 1: 5, // used to be objectResults
218 | 2: -5}, // used to be unimportantResults
219 | // Used when the priority is not in the mapping.
220 | objPrioDefault: 0,
221 |
222 | // query found in title
223 | title: 15,
224 | // query found in terms
225 | term: 5
226 | };
227 |
228 |
229 | /**
230 | * Search Module
231 | */
232 | var Search = {
233 |
234 | _index : null,
235 | _queued_query : null,
236 | _pulse_status : -1,
237 |
238 | init : function() {
239 | var params = $.getQueryParameters();
240 | if (params.q) {
241 | var query = params.q[0];
242 | $('input[name="q"]')[0].value = query;
243 | this.performSearch(query);
244 | }
245 | },
246 |
247 | loadIndex : function(url) {
248 | $.ajax({type: "GET", url: url, data: null,
249 | dataType: "script", cache: true,
250 | complete: function(jqxhr, textstatus) {
251 | if (textstatus != "success") {
252 | document.getElementById("searchindexloader").src = url;
253 | }
254 | }});
255 | },
256 |
257 | setIndex : function(index) {
258 | var q;
259 | this._index = index;
260 | if ((q = this._queued_query) !== null) {
261 | this._queued_query = null;
262 | Search.query(q);
263 | }
264 | },
265 |
266 | hasIndex : function() {
267 | return this._index !== null;
268 | },
269 |
270 | deferQuery : function(query) {
271 | this._queued_query = query;
272 | },
273 |
274 | stopPulse : function() {
275 | this._pulse_status = 0;
276 | },
277 |
278 | startPulse : function() {
279 | if (this._pulse_status >= 0)
280 | return;
281 | function pulse() {
282 | var i;
283 | Search._pulse_status = (Search._pulse_status + 1) % 4;
284 | var dotString = '';
285 | for (i = 0; i < Search._pulse_status; i++)
286 | dotString += '.';
287 | Search.dots.text(dotString);
288 | if (Search._pulse_status > -1)
289 | window.setTimeout(pulse, 500);
290 | }
291 | pulse();
292 | },
293 |
294 | /**
295 | * perform a search for something (or wait until index is loaded)
296 | */
297 | performSearch : function(query) {
298 | // create the required interface elements
299 | this.out = $('#search-results');
300 | this.title = $('' + _('Searching') + ' ').appendTo(this.out);
301 | this.dots = $(' ').appendTo(this.title);
302 | this.status = $('
').appendTo(this.out);
303 | this.output = $('').appendTo(this.out);
304 |
305 | $('#search-progress').text(_('Preparing search...'));
306 | this.startPulse();
307 |
308 | // index already loaded, the browser was quick!
309 | if (this.hasIndex())
310 | this.query(query);
311 | else
312 | this.deferQuery(query);
313 | },
314 |
315 | /**
316 | * execute search (requires search index to be loaded)
317 | */
318 | query : function(query) {
319 | var i;
320 | var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"];
321 |
322 | // stem the searchterms and add them to the correct list
323 | var stemmer = new Stemmer();
324 | var searchterms = [];
325 | var excluded = [];
326 | var hlterms = [];
327 | var tmp = query.split(/\s+/);
328 | var objectterms = [];
329 | for (i = 0; i < tmp.length; i++) {
330 | if (tmp[i] !== "") {
331 | objectterms.push(tmp[i].toLowerCase());
332 | }
333 |
334 | if ($u.indexOf(stopwords, tmp[i].toLowerCase()) != -1 || tmp[i].match(/^\d+$/) ||
335 | tmp[i] === "") {
336 | // skip this "word"
337 | continue;
338 | }
339 | // stem the word
340 | var word = stemmer.stemWord(tmp[i].toLowerCase());
341 | var toAppend;
342 | // select the correct list
343 | if (word[0] == '-') {
344 | toAppend = excluded;
345 | word = word.substr(1);
346 | }
347 | else {
348 | toAppend = searchterms;
349 | hlterms.push(tmp[i].toLowerCase());
350 | }
351 | // only add if not already in the list
352 | if (!$u.contains(toAppend, word))
353 | toAppend.push(word);
354 | }
355 | var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" "));
356 |
357 | // console.debug('SEARCH: searching for:');
358 | // console.info('required: ', searchterms);
359 | // console.info('excluded: ', excluded);
360 |
361 | // prepare search
362 | var terms = this._index.terms;
363 | var titleterms = this._index.titleterms;
364 |
365 | // array of [filename, title, anchor, descr, score]
366 | var results = [];
367 | $('#search-progress').empty();
368 |
369 | // lookup as object
370 | for (i = 0; i < objectterms.length; i++) {
371 | var others = [].concat(objectterms.slice(0, i),
372 | objectterms.slice(i+1, objectterms.length));
373 | results = results.concat(this.performObjectSearch(objectterms[i], others));
374 | }
375 |
376 | // lookup as search terms in fulltext
377 | results = results.concat(this.performTermsSearch(searchterms, excluded, terms, titleterms));
378 |
379 | // let the scorer override scores with a custom scoring function
380 | if (Scorer.score) {
381 | for (i = 0; i < results.length; i++)
382 | results[i][4] = Scorer.score(results[i]);
383 | }
384 |
385 | // now sort the results by score (in opposite order of appearance, since the
386 | // display function below uses pop() to retrieve items) and then
387 | // alphabetically
388 | results.sort(function(a, b) {
389 | var left = a[4];
390 | var right = b[4];
391 | if (left > right) {
392 | return 1;
393 | } else if (left < right) {
394 | return -1;
395 | } else {
396 | // same score: sort alphabetically
397 | left = a[1].toLowerCase();
398 | right = b[1].toLowerCase();
399 | return (left > right) ? -1 : ((left < right) ? 1 : 0);
400 | }
401 | });
402 |
403 | // for debugging
404 | //Search.lastresults = results.slice(); // a copy
405 | //console.info('search results:', Search.lastresults);
406 |
407 | // print the results
408 | var resultCount = results.length;
409 | function displayNextItem() {
410 | // results left, load the summary and display it
411 | if (results.length) {
412 | var item = results.pop();
413 | var listItem = $(' ');
414 | if (DOCUMENTATION_OPTIONS.FILE_SUFFIX === '') {
415 | // dirhtml builder
416 | var dirname = item[0] + '/';
417 | if (dirname.match(/\/index\/$/)) {
418 | dirname = dirname.substring(0, dirname.length-6);
419 | } else if (dirname == 'index/') {
420 | dirname = '';
421 | }
422 | listItem.append($(' ').attr('href',
423 | DOCUMENTATION_OPTIONS.URL_ROOT + dirname +
424 | highlightstring + item[2]).html(item[1]));
425 | } else {
426 | // normal html builders
427 | listItem.append($(' ').attr('href',
428 | item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
429 | highlightstring + item[2]).html(item[1]));
430 | }
431 | if (item[3]) {
432 | listItem.append($(' (' + item[3] + ') '));
433 | Search.output.append(listItem);
434 | listItem.slideDown(5, function() {
435 | displayNextItem();
436 | });
437 | } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
438 | $.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[0] + '.txt',
439 | dataType: "text",
440 | complete: function(jqxhr, textstatus) {
441 | var data = jqxhr.responseText;
442 | if (data !== '' && data !== undefined) {
443 | listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
444 | }
445 | Search.output.append(listItem);
446 | listItem.slideDown(5, function() {
447 | displayNextItem();
448 | });
449 | }});
450 | } else {
451 | // no source available, just display title
452 | Search.output.append(listItem);
453 | listItem.slideDown(5, function() {
454 | displayNextItem();
455 | });
456 | }
457 | }
458 | // search finished, update title and status message
459 | else {
460 | Search.stopPulse();
461 | Search.title.text(_('Search Results'));
462 | if (!resultCount)
463 | Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.'));
464 | else
465 | Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
466 | Search.status.fadeIn(500);
467 | }
468 | }
469 | displayNextItem();
470 | },
471 |
472 | /**
473 | * search for object names
474 | */
475 | performObjectSearch : function(object, otherterms) {
476 | var filenames = this._index.filenames;
477 | var objects = this._index.objects;
478 | var objnames = this._index.objnames;
479 | var titles = this._index.titles;
480 |
481 | var i;
482 | var results = [];
483 |
484 | for (var prefix in objects) {
485 | for (var name in objects[prefix]) {
486 | var fullname = (prefix ? prefix + '.' : '') + name;
487 | if (fullname.toLowerCase().indexOf(object) > -1) {
488 | var score = 0;
489 | var parts = fullname.split('.');
490 | // check for different match types: exact matches of full name or
491 | // "last name" (i.e. last dotted part)
492 | if (fullname == object || parts[parts.length - 1] == object) {
493 | score += Scorer.objNameMatch;
494 | // matches in last name
495 | } else if (parts[parts.length - 1].indexOf(object) > -1) {
496 | score += Scorer.objPartialMatch;
497 | }
498 | var match = objects[prefix][name];
499 | var objname = objnames[match[1]][2];
500 | var title = titles[match[0]];
501 | // If more than one term searched for, we require other words to be
502 | // found in the name/title/description
503 | if (otherterms.length > 0) {
504 | var haystack = (prefix + ' ' + name + ' ' +
505 | objname + ' ' + title).toLowerCase();
506 | var allfound = true;
507 | for (i = 0; i < otherterms.length; i++) {
508 | if (haystack.indexOf(otherterms[i]) == -1) {
509 | allfound = false;
510 | break;
511 | }
512 | }
513 | if (!allfound) {
514 | continue;
515 | }
516 | }
517 | var descr = objname + _(', in ') + title;
518 |
519 | var anchor = match[3];
520 | if (anchor === '')
521 | anchor = fullname;
522 | else if (anchor == '-')
523 | anchor = objnames[match[1]][1] + '-' + fullname;
524 | // add custom score for some objects according to scorer
525 | if (Scorer.objPrio.hasOwnProperty(match[2])) {
526 | score += Scorer.objPrio[match[2]];
527 | } else {
528 | score += Scorer.objPrioDefault;
529 | }
530 | results.push([filenames[match[0]], fullname, '#'+anchor, descr, score]);
531 | }
532 | }
533 | }
534 |
535 | return results;
536 | },
537 |
538 | /**
539 | * search for full-text terms in the index
540 | */
541 | performTermsSearch : function(searchterms, excluded, terms, titleterms) {
542 | var filenames = this._index.filenames;
543 | var titles = this._index.titles;
544 |
545 | var i, j, file;
546 | var fileMap = {};
547 | var scoreMap = {};
548 | var results = [];
549 |
550 | // perform the search on the required terms
551 | for (i = 0; i < searchterms.length; i++) {
552 | var word = searchterms[i];
553 | var files = [];
554 | var _o = [
555 | {files: terms[word], score: Scorer.term},
556 | {files: titleterms[word], score: Scorer.title}
557 | ];
558 |
559 | // no match but word was a required one
560 | if ($u.every(_o, function(o){return o.files === undefined;})) {
561 | break;
562 | }
563 | // found search word in contents
564 | $u.each(_o, function(o) {
565 | var _files = o.files;
566 | if (_files === undefined)
567 | return
568 |
569 | if (_files.length === undefined)
570 | _files = [_files];
571 | files = files.concat(_files);
572 |
573 | // set score for the word in each file to Scorer.term
574 | for (j = 0; j < _files.length; j++) {
575 | file = _files[j];
576 | if (!(file in scoreMap))
577 | scoreMap[file] = {}
578 | scoreMap[file][word] = o.score;
579 | }
580 | });
581 |
582 | // create the mapping
583 | for (j = 0; j < files.length; j++) {
584 | file = files[j];
585 | if (file in fileMap)
586 | fileMap[file].push(word);
587 | else
588 | fileMap[file] = [word];
589 | }
590 | }
591 |
592 | // now check if the files don't contain excluded terms
593 | for (file in fileMap) {
594 | var valid = true;
595 |
596 | // check if all requirements are matched
597 | if (fileMap[file].length != searchterms.length)
598 | continue;
599 |
600 | // ensure that none of the excluded terms is in the search result
601 | for (i = 0; i < excluded.length; i++) {
602 | if (terms[excluded[i]] == file ||
603 | titleterms[excluded[i]] == file ||
604 | $u.contains(terms[excluded[i]] || [], file) ||
605 | $u.contains(titleterms[excluded[i]] || [], file)) {
606 | valid = false;
607 | break;
608 | }
609 | }
610 |
611 | // if we have still a valid result we can add it to the result list
612 | if (valid) {
613 | // select one (max) score for the file.
614 | // for better ranking, we should calculate ranking by using words statistics like basic tf-idf...
615 | var score = $u.max($u.map(fileMap[file], function(w){return scoreMap[file][w]}));
616 | results.push([filenames[file], titles[file], '', null, score]);
617 | }
618 | }
619 | return results;
620 | },
621 |
622 | /**
623 | * helper function to return a node containing the
624 | * search summary for a given text. keywords is a list
625 | * of stemmed words, hlwords is the list of normal, unstemmed
626 | * words. the first one is used to find the occurrence, the
627 | * latter for highlighting it.
628 | */
629 | makeSearchSummary : function(text, keywords, hlwords) {
630 | var textLower = text.toLowerCase();
631 | var start = 0;
632 | $.each(keywords, function() {
633 | var i = textLower.indexOf(this.toLowerCase());
634 | if (i > -1)
635 | start = i;
636 | });
637 | start = Math.max(start - 120, 0);
638 | var excerpt = ((start > 0) ? '...' : '') +
639 | $.trim(text.substr(start, 240)) +
640 | ((start + 240 - text.length) ? '...' : '');
641 | var rv = $('
').text(excerpt);
642 | $.each(hlwords, function() {
643 | rv = rv.highlightText(this, 'highlighted');
644 | });
645 | return rv;
646 | }
647 | };
648 |
649 | $(document).ready(function() {
650 | Search.init();
651 | });
--------------------------------------------------------------------------------
/pyspresso/transport.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | ## @file transport.py
3 | # @brief Debug transports for the Java Debug Wire Protocol
4 | # (http://docs.oracle.com/javase/8/docs/technotes/guides/jpda/jdwp-spec.html)
5 | # @author Jason Geffner
6 | # @copyright CrowdStrike, Inc. 2016
7 |
8 | import socket
9 | import time
10 | import struct
11 | import os
12 | import mmap
13 | import ctypes
14 | import threading
15 | import itertools
16 | import array
17 |
18 |
19 | class DebugTransport:
20 | """ The :any:`DebugTransport` class defines JDWP transports for both
21 | shared-memory-based transport and socket-based transport.
22 | """
23 |
24 | class AtomicCounter:
25 | """ Atomic "fetch and increment" class for packet IDs. """
26 | def __init__(self):
27 | self._counter = itertools.count()
28 | self._lock = threading.Lock()
29 | def next(self):
30 | """ Return the next 32-bit packet ID. """
31 | with self._lock:
32 | return self._counter.next() & 0xFFFFFFFF
33 |
34 |
35 | def __init__(self, transport="dt_shmem", server=False, address=None):
36 | """ The :any:`DebugTransport` constructor initializes member variables
37 | and binds transport-specific functions.
38 |
39 | The *transport* value should be ``"dt_shmem"`` for shared-memory-based
40 | transport or ``"dt_socket"`` for socket-based transport.
41 |
42 | If the *server* value is ``True`` then the debugger acts as the server
43 | and the debuggee acts as the client. Otherwise, the debuggee acts as
44 | the server and the debugger acts as the client.
45 |
46 | The *address* value should be in the format ``"hostname:port"`` for
47 | socket-based transport, or should be the shared file mapping name for
48 | shared-memory-based transport.
49 | """
50 |
51 | self._address = address
52 | self._id = self.AtomicCounter()
53 |
54 | if server:
55 | raise Exception("Debug server not yet implemented")
56 |
57 | if transport == "dt_shmem":
58 | if os.name != "nt":
59 | raise Exception("Shared memory transport is only available on Windows")
60 | elif transport != "dt_socket":
61 | raise Exception("Invalid transport type")
62 |
63 | if address is None:
64 | if transport == "dt_shmem":
65 | self._address = "javadebug"
66 | else:
67 | raise Exception("address required for dt_socket")
68 |
69 | # Bind transport-specific functions.
70 | for method in ("attach", "send", "send_packet", "recv", "recv_packet"):
71 | setattr(self, method, getattr(self, "_" + method + "_" + transport[3:]))
72 |
73 | def attach(self):
74 | """ Attach to the debuggee. """
75 | raise Exception("Abstract method called")
76 |
77 | def send(self, bytes):
78 | """ Send bytes to the debuggee. """
79 | raise Exception("Abstract method called")
80 |
81 | def send_packet(self, packet):
82 | """ Decode and send a JDWP :any:`CommandPacket` to the debuggee. """
83 | raise Exception("Abstract method called")
84 |
85 | def recv(self, count):
86 | """ Receive bytes from the debuggee. """
87 | raise Exception("Abstract method called")
88 |
89 | def recv_packet(self):
90 | """ Receive the next :any:`CommandPacket` or :any:`ReplyPacket` from
91 | the debuggee.
92 | """
93 | raise Exception("Abstract method called")
94 |
95 | def handshake(self):
96 | """ Perform the initial handshake with the debuggee. """
97 | h = "JDWP-Handshake"
98 | self.send(h)
99 | if self.recv(len(h)) != h:
100 | raise Exception("Unexpected handshake response")
101 |
102 | def make_packet(self, command, data=""):
103 | """ Create a JDWP :any:`CommandPacket`. """
104 | return CommandPacket(self._id.next(), command, data)
105 |
106 |
107 | #
108 | # Shared-memory-based transport. Currently only implemented for Windows.
109 | #
110 | # Based on:
111 | # http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/tip/src/share/transport/shmem/shmemBase.c
112 | # http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/tip/src/windows/transport/shmem/shmem_md.c
113 | #
114 |
115 | class Mutex():
116 | """ Mutex class to support Python's ``with`` statement. """
117 |
118 | def __init__(self, handle):
119 | if handle == 0:
120 | raise WindowsError("Invalid mutex handle")
121 | self.handle = handle
122 | def __enter__(self):
123 | # Wait on mutex.
124 | return ctypes.windll.kernel32.WaitForSingleObject(self.handle, -1)
125 | def __exit__(self, type, value, traceback):
126 | # Release the mutex.
127 | ctypes.windll.kernel32.ReleaseMutex(self.handle)
128 |
129 |
130 | def _wait_for_object(self, object_handle):
131 | wait_value = ctypes.windll.kernel32.WaitForMultipleObjects(
132 | 2,
133 | (ctypes.wintypes.HANDLE * 2)(self.debuggee_handle, object_handle),
134 | False,
135 | -1)
136 | if wait_value == 0:
137 | raise WindowsError("Remote process terminated")
138 | elif wait_value == 1:
139 | return
140 | else:
141 | raise WindowsError("Error while waiting for a synchronization object")
142 |
143 | def _attach_shmem(self):
144 | #
145 | # Initialize ctypes values.
146 | #
147 |
148 | import ctypes.wintypes
149 |
150 | FILE_MAP_READ = 4
151 | SYNCHRONIZE = 0x00100000
152 | EVENT_MODIFY_STATE = 2
153 | ctypes.windll.kernel32.OpenFileMappingW.argtypes = [ctypes.wintypes.DWORD, ctypes.wintypes.BOOL, ctypes.wintypes.LPCWSTR]
154 | ctypes.windll.kernel32.CloseHandle.argtypes = [ctypes.wintypes.HANDLE]
155 | ctypes.windll.kernel32.OpenProcess.argtypes = [ctypes.wintypes.DWORD, ctypes.wintypes.BOOL, ctypes.wintypes.DWORD]
156 | ctypes.windll.kernel32.WaitForSingleObject.argtypes = [ctypes.wintypes.HANDLE, ctypes.wintypes.DWORD]
157 | ctypes.windll.kernel32.WaitForMultipleObjects.argtypes = [ctypes.wintypes.DWORD, ctypes.POINTER(ctypes.wintypes.HANDLE), ctypes.wintypes.BOOL, ctypes.wintypes.DWORD]
158 | ctypes.windll.kernel32.ReleaseMutex.argtypes = [ctypes.wintypes.HANDLE]
159 | ctypes.windll.kernel32.OpenMutexW.argtypes = [ctypes.wintypes.DWORD, ctypes.wintypes.BOOL, ctypes.wintypes.LPCWSTR]
160 | ctypes.windll.kernel32.OpenEventW.argtypes = [ctypes.wintypes.DWORD, ctypes.wintypes.BOOL, ctypes.wintypes.LPCWSTR]
161 | ctypes.windll.kernel32.SetEvent.argtypes = [ctypes.wintypes.HANDLE]
162 |
163 | #
164 | # Notify the client that we're attaching.
165 | #
166 |
167 | class SharedListener(ctypes.Structure):
168 | _fields_ = [("mutexName", ctypes.c_char * 75),
169 | ("acceptEventName", ctypes.c_char * 75),
170 | ("attachEventName", ctypes.c_char * 75),
171 | ("isListening", ctypes.c_bool),
172 | ("isAccepted", ctypes.c_bool),
173 | ("acceptingPID", ctypes.c_longlong),
174 | ("attachingPID", ctypes.c_longlong)]
175 |
176 | # Wait until the mapping exists.
177 | handle = 0
178 | while handle == 0:
179 | handle = ctypes.windll.kernel32.OpenFileMappingW(FILE_MAP_READ, False, self._address)
180 | time.sleep(.01)
181 | ctypes.windll.kernel32.CloseHandle(handle)
182 |
183 | # Open SharedListener memory map.
184 | shared_listener = SharedListener.from_buffer(mmap.mmap(
185 | 0,
186 | ctypes.sizeof(SharedListener),
187 | self._address))
188 |
189 | self.debuggee_handle = ctypes.windll.kernel32.OpenProcess(
190 | SYNCHRONIZE, False, shared_listener.acceptingPID)
191 | if self.debuggee_handle == 0:
192 | raise WindowsError("Could not open handle to process ID " +
193 | str(shared_listener.acceptingPID))
194 |
195 | # Get SharedListener mutex and event handles.
196 | with self.Mutex(ctypes.windll.kernel32.OpenMutexW(SYNCHRONIZE, False, shared_listener.mutexName)):
197 | accept_event = ctypes.windll.kernel32.OpenEventW(
198 | SYNCHRONIZE | EVENT_MODIFY_STATE,
199 | False,
200 | shared_listener.acceptEventName)
201 | if accept_event == 0:
202 | raise WindowsError("Could not open event " +
203 | shared_listener.acceptEventName)
204 |
205 | attach_event = ctypes.windll.kernel32.OpenEventW(
206 | SYNCHRONIZE | EVENT_MODIFY_STATE,
207 | False,
208 | shared_listener.attachEventName)
209 | if attach_event == 0:
210 | raise WindowsError("Could not open event " +
211 | shared_listener.attachEventName)
212 |
213 | shared_listener.attachingPID = os.getpid()
214 |
215 | # Signal the attach event.
216 | if ctypes.windll.kernel32.SetEvent(attach_event) == 0:
217 | raise WindowsError("Could not set event " +
218 | shared_listener.attachEventName)
219 |
220 | # Wait for the accept event.
221 | self._wait_for_object(accept_event)
222 |
223 |
224 | #
225 | # Initialize incoming and outgoing data streams.
226 | #
227 |
228 | class SharedStream(ctypes.Structure):
229 | _fields_ = [("mutexName", ctypes.c_char * 75),
230 | ("hasDataEventName", ctypes.c_char * 75),
231 | ("hasSpaceEventName", ctypes.c_char * 75),
232 | ("readOffset", ctypes.c_int),
233 | ("writeOffset", ctypes.c_int),
234 | ("isFull", ctypes.c_bool),
235 | ("buffer", ctypes.c_byte * 5000)]
236 |
237 | class SharedMemory(ctypes.Structure):
238 | _fields_ = [("incoming", SharedStream),
239 | ("outgoing", SharedStream)]
240 |
241 | self._streams = type("", (), {})
242 |
243 | # Open SharedMemory memory map.
244 | self._shared_memory = SharedMemory.from_buffer(mmap.mmap(
245 | 0,
246 | ctypes.sizeof(SharedMemory),
247 | self._address + "." + str(os.getpid())))
248 |
249 | for stream_name in ("incoming", "outgoing"):
250 | # Get a reference to the mapped stream's data.
251 | shared_stream = getattr(self._shared_memory, stream_name)
252 |
253 |
254 | #
255 | # Get a handle to the stream's mutex and events.
256 | #
257 |
258 | stream = type("", (), {})
259 |
260 | stream.mutex = ctypes.windll.kernel32.OpenMutexW(
261 | SYNCHRONIZE,
262 | False,
263 | shared_stream.mutexName)
264 | if stream.mutex == 0:
265 | raise WindowsError("Could not open mutex " + shared_stream.mutexName)
266 |
267 | stream.hasData = ctypes.windll.kernel32.OpenEventW(
268 | SYNCHRONIZE | EVENT_MODIFY_STATE,
269 | False,
270 | shared_stream.hasDataEventName)
271 | if stream.hasData == 0:
272 | raise WindowsError("Could not open event " + shared_stream.hasDataEventName)
273 |
274 | stream.hasSpace = ctypes.windll.kernel32.OpenEventW(
275 | SYNCHRONIZE | EVENT_MODIFY_STATE,
276 | False,
277 | shared_stream.hasSpaceEventName)
278 | if stream.hasSpace == 0:
279 | raise WindowsError("Could not open event " + shared_stream.hasSpaceEventName)
280 |
281 | # Save the stream's handles.
282 | setattr(self._streams, stream_name, stream)
283 |
284 | def _send_shmem(self, bytes):
285 | # Use the outgoing stream and the outgoing shared memory.
286 | stream = self._streams.outgoing
287 | shared_memory = self._shared_memory.outgoing
288 |
289 | index = 0
290 |
291 | # Send bytes via circular buffer.
292 | with self.Mutex(stream.mutex) as mutex:
293 | while index < len(bytes):
294 | while shared_memory.isFull:
295 | if ctypes.windll.kernel32.ReleaseMutex(stream.mutex) == 0:
296 | raise WindowsError("Could not release mutex")
297 | self._wait_for_object(stream.hasSpace)
298 | self._wait_for_object(stream.mutex)
299 |
300 | fragment_start = shared_memory.writeOffset
301 | max_length = (shared_memory.readOffset if fragment_start < shared_memory.readOffset else 5000)- fragment_start
302 | fragment_length = min(max_length, len(bytes) - index)
303 | ctypes.memmove(ctypes.addressof(shared_memory.buffer) + fragment_start, bytes[index:index+fragment_length], fragment_length)
304 | shared_memory.writeOffset = (fragment_start + fragment_length) % 5000
305 | index += fragment_length
306 | shared_memory.isFull = (shared_memory.readOffset == shared_memory.writeOffset)
307 | if ctypes.windll.kernel32.SetEvent(stream.hasData) == 0:
308 | raise WindowsError("Could not set event")
309 |
310 | def _send_packet_shmem(self, packet):
311 | # Send a packet using native-system byte ordering.
312 | self.send(struct.pack("=IBBBI", packet.id, packet.flags,
313 | packet.command_set, packet.command,
314 | len(packet.data)) + packet.data)
315 |
316 | def _recv_shmem(self, count):
317 | # Use the incoming stream and the incoming shared memory.
318 | stream = self._streams.incoming
319 | shared_memory = self._shared_memory.incoming
320 |
321 | bytes = [None] * count
322 | index = 0
323 |
324 | # Receive bytes via circular buffer.
325 | with self.Mutex(stream.mutex) as mutex:
326 | while index < count:
327 | while shared_memory.writeOffset == shared_memory.readOffset and not shared_memory.isFull:
328 | if ctypes.windll.kernel32.ReleaseMutex(stream.mutex) == 0:
329 | raise WindowsError("Could not release mutex")
330 | self._wait_for_object(stream.hasData)
331 | self._wait_for_object(stream.mutex)
332 |
333 | fragment_start = shared_memory.readOffset
334 | max_length = (shared_memory.writeOffset if fragment_start < shared_memory.writeOffset else 5000)- fragment_start
335 | fragment_length = min(max_length, count - index)
336 | bytes[index:index+fragment_length] = shared_memory.buffer[fragment_start:fragment_start+fragment_length]
337 | shared_memory.readOffset = (fragment_start + fragment_length) % 5000
338 | index += fragment_length
339 | shared_memory.isFull = False
340 | if ctypes.windll.kernel32.SetEvent(stream.hasSpace) == 0:
341 | raise WindowsError("Could not set event")
342 |
343 | # Convert the byte array into a Python string.
344 | return array.array("b", bytes).tostring()
345 |
346 | def _recv_packet_shmem(self):
347 | #
348 | # Command Packet:
349 | # - Header:
350 | # - id (4 bytes)
351 | # - flags (1 byte)
352 | # - command set (1 byte)
353 | # - command (1 byte)
354 | # - data length (4 bytes)
355 | # - data (variable)
356 | #
357 | # Reply Packet:
358 | # - Header
359 | # - id (4 bytes)
360 | # - flags (1 byte)
361 | # - error code (2 bytes)
362 | # - data length (4 bytes)
363 | # - data (variable)
364 | #
365 | #
366 | # Note that the structures above are different from what's formally
367 | # documented in the JDWP spec.
368 | #
369 |
370 | try:
371 | # Read header.
372 | header = self.recv(11)
373 | if len(header) == 0:
374 | return None
375 |
376 | # Unpack common header.
377 | packet = Packet()
378 | packet.id, packet.flags = struct.unpack_from("=IB", header)
379 |
380 | # Parse the packet as a Reply Packet or a Command (Event) Packet.
381 | if packet.flags & 0x80 != 0:
382 | error_code, data_length = struct.unpack_from("=HI", header, 5)
383 | else:
384 | command_set, command, data_length = struct.unpack_from("=BBI", header, 5)
385 |
386 | # Read variable-length data.
387 | if data_length > 0:
388 | data = self.recv(data_length)
389 | if len(data) == 0:
390 | return None
391 | else:
392 | data = ""
393 |
394 | # Parse the packet as a Reply Packet or a Command (Event) Packet.
395 | if packet.flags & 0x80 != 0:
396 | return ReplyPacket(packet.id, error_code, data, packet.flags)
397 | else:
398 | return CommandPacket(packet.id, (command_set, command), data, packet.flags)
399 | except WindowsError:
400 | return None
401 |
402 |
403 | #
404 | # Socket-based transport.
405 | #
406 |
407 | def _attach_socket(self):
408 | if ":" in self._address:
409 | host, port = self._address.split(":")
410 | port = int(port)
411 | else:
412 | host = "localhost"
413 | port = self._address
414 |
415 | self._socket = socket.socket()
416 | self._socket.connect((host, port))
417 |
418 | def _send_socket(self, bytes):
419 | self._socket.sendall(bytes)
420 |
421 | def _send_packet_socket(self, packet):
422 | # Send a Command Packet using big-endian byte ordering.
423 | self.send(struct.pack(">IIBBB", packet.length, packet.id, packet.flags,
424 | packet.command_set, packet.command) + packet.data)
425 |
426 | def _recv_socket(self, count):
427 | data = ""
428 | remaining = count
429 | while remaining > 0:
430 | try:
431 | bytes = self._socket.recv(remaining)
432 | except socket.error:
433 | bytes = ""
434 | if len(bytes) == 0:
435 | break
436 | data += bytes
437 | remaining -= len(bytes)
438 | if len(data) < count:
439 | return ""
440 | return data
441 |
442 | def _recv_packet_socket(self):
443 | #
444 | # Command Packet:
445 | # - Header:
446 | # - length (4 bytes)
447 | # - id (4 bytes)
448 | # - flags (1 byte)
449 | # - command set (1 byte)
450 | # - command (1 byte)
451 | # - data (variable)
452 | #
453 | # Reply Packet:
454 | # - Header
455 | # - length (4 bytes)
456 | # - id (4 bytes)
457 | # - flags (1 byte)
458 | # - error code (2 bytes)
459 | # - data (variable)
460 | #
461 |
462 | # Read header.
463 | header = self.recv(11)
464 | if len(header) == 0:
465 | return None
466 |
467 | # Unpack common header.
468 | packet = Packet()
469 | packet.length, packet.id, packet.flags = struct.unpack_from(">IIB", header)
470 |
471 | # Read variable-length data.
472 | if packet.length > 11:
473 | packet.data = self.recv(packet.length - 11)
474 | if len(packet.data) == 0:
475 | return None
476 |
477 | # Parse the packet as a Reply Packet or a Command (Event) Packet.
478 | if packet.flags & 0x80 != 0:
479 | return ReplyPacket(packet.id, struct.unpack_from(">H", header, 9)[0], packet.data, packet.flags)
480 | else:
481 | return CommandPacket(packet.id, struct.unpack_from(">BB", header, 9), packet.data, packet.flags)
482 |
483 |
484 | class Packet:
485 | """ Abstract class for a JDWP packet, as defined at
486 | http://docs.oracle.com/javase/8/docs/technotes/guides/jpda/jdwp-spec.html
487 | """
488 |
489 | length = 0
490 | """ Length of the packet. """
491 |
492 | id = 0
493 | """ Command/reply packet ID. """
494 |
495 | flags = 0
496 | """ Packet flags. """
497 |
498 | data = ""
499 | """ Command data or reply data. """
500 |
501 |
502 | class CommandPacket(Packet):
503 | """ A JDWP Command :any:`Packet`, as defined at
504 | http://docs.oracle.com/javase/8/docs/technotes/guides/jpda/jdwp-spec.html
505 | """
506 |
507 | command_set = 0
508 | """ Packet's command set. """
509 |
510 | command = 0
511 | """ Packet's command. """
512 |
513 | def __init__(self, id, command, data="", flags=0):
514 | self.length = len(data) + 11
515 | self.id = id
516 | self.flags = flags
517 | self.command_set = command[0]
518 | self.command = command[1]
519 | self.data = data
520 |
521 |
522 | class ReplyPacket(Packet):
523 | """ A JDWP Reply :any:`Packet`, as defined at
524 | http://docs.oracle.com/javase/8/docs/technotes/guides/jpda/jdwp-spec.html
525 | """
526 |
527 | error_code = 0
528 | """ Packet's error response code. """
529 |
530 | def __init__(self, id, error_code, data="", flags=0x80):
531 | self.length = len(data) + 11
532 | self.id = id
533 | self.flags = flags
534 | self.error_code = error_code
535 | self.data = data
536 |
--------------------------------------------------------------------------------