Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
29017aa3
Commit
29017aa3
authored
Apr 19, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
547cde90
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
go/neo/py/pyruntraced
go/neo/py/pyruntraced
+16
-7
No files found.
go/neo/py/pyruntraced
View file @
29017aa3
...
@@ -154,7 +154,10 @@ class Tracer(object):
...
@@ -154,7 +154,10 @@ class Tracer(object):
#
#
# it sends the event to tracer and awaits commands from it to either
# it sends the event to tracer and awaits commands from it to either
# inspect current state or continue execution.
# inspect current state or continue execution.
def
trace1
(
self
,
eventname
,
event
):
#
# globals/locals are the mapping used in eval, if driver asks to inspect
# program state.
def
trace1
(
self
,
eventname
,
event
,
globals
,
locals
):
# send trace event
# send trace event
evstr
=
json
.
dumps
(
event
)
evstr
=
json
.
dumps
(
event
)
assert
'
\
n
'
not
in
evstr
assert
'
\
n
'
not
in
evstr
...
@@ -172,14 +175,20 @@ class Tracer(object):
...
@@ -172,14 +175,20 @@ class Tracer(object):
return
# probe finishes - continue execution of original code
return
# probe finishes - continue execution of original code
# eval python in context of probed function
# eval python in context of probed function
# g = ...
# l = ...
try
:
try
:
r
=
eval
(
line
[
1
:],
g
,
l
)
# FIXME context wrong
r
=
eval
(
line
[
1
:],
g
lobals
,
locals
)
except
Exception
as
e
:
except
Exception
as
e
:
self
.
_send
(
'E %s'
%
json
.
dumps
(
str
(
e
)
))
reply
=
'E %s'
%
json
.
dumps
(
str
(
e
))
else
:
else
:
self
.
_send
(
'R %s'
%
json
.
dumps
(
r
))
try
:
reply
=
'R %s'
%
json
.
dumps
(
r
)
except
Exception
as
e
:
# some types are not json-serializable
# XXX ok to play such games here?
# XXX too many objects are not JSON-serializable.
reply
=
'E %s'
%
json
.
dumps
(
str
(
e
))
self
.
_send
(
reply
)
# RxQueue represents receive queue for 1 thread
# RxQueue represents receive queue for 1 thread
...
@@ -215,7 +224,7 @@ def trace_entry(func, eventname):
...
@@ -215,7 +224,7 @@ def trace_entry(func, eventname):
@
wraps
(
func
)
@
wraps
(
func
)
def
probe
(
self
,
*
args
,
**
kw
):
def
probe
(
self
,
*
args
,
**
kw
):
event
=
f
(
self
,
*
args
,
**
kw
)
event
=
f
(
self
,
*
args
,
**
kw
)
gtracer
.
trace1
(
eventname
,
event
)
gtracer
.
trace1
(
eventname
,
event
,
func
.
func_globals
,
{
'self'
:
self
,
'args'
:
args
,
'kw'
:
kw
}
)
return
func
(
self
,
*
args
,
**
kw
)
return
func
(
self
,
*
args
,
**
kw
)
setattr
(
klass
,
fname
,
probe
)
setattr
(
klass
,
fname
,
probe
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment