PyV8 debugger not properly handling break events
Open
Nobody has claimed this yet.
auto-migrated
OpSys-All
Priority-Medium
Type-Enhancement
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
While playing with PyV8 debugger I identified an issue. As you can easily
realize from the attached test code, the command line argument is used to
enable/disable the Debugger onMessage method. If the code is executed with
onMessage method disabled, nothing happens after the BeforeCompile/AfterCompile
events. This should be a bug because a break event is generated but not handled
by the Debugger class methods.
buffer@alnitak ~ $ python DebuggerTest.py 0
BeforeCompile event:
{"seq":0,"type":"event","event":"beforeCompile","success":true,"body":{"script":
{"handle":1,"type":"script","id":17,"lineOffset":0,"columnOffset":0,"lineCount":
14,"sourceStart":"\nfunction my_func(t)\n{\n\tvar s = \"foo\";\n\tvar i =
0;\n\n\tfor (i = 0; i < 3; i++)
{\n\t","sourceLength":120,"scriptType":2,"compilationType":0,"context":{"ref":0}
,"text":" (lines:
14)"}},"refs":[{"handle":0,"type":"context","text":"#<ContextMirror>"}],"running
":true}
AfterCompile event:
{"seq":2,"type":"event","event":"afterCompile","success":true,"body":{"script":{
"handle":1,"type":"script","id":17,"lineOffset":0,"columnOffset":0,"lineCount":1
4,"sourceStart":"\nfunction my_func(t)\n{\n\tvar s = \"foo\";\n\tvar i =
0;\n\n\tfor (i = 0; i < 3; i++)
{\n\t","sourceLength":120,"scriptType":2,"compilationType":0,"context":{"ref":0}
,"text":" (lines:
14)"}},"refs":[{"handle":0,"type":"context","text":"#<ContextMirror>"}],"running
":true}
[hanging here]
Taking a look at what happens when the onMessage is enabled, we can see that
the break event is properly generated so it seems not to be handled as stated
before.
buffer@alnitak ~ $ python DebuggerTest.py 1
BeforeCompile event:
{"seq":0,"type":"event","event":"beforeCompile","success":true,"body":{"script":
{"handle":1,"type":"script","id":17,"lineOffset":0,"columnOffset":0,"lineCount":
14,"sourceStart":"\nfunction my_func(t)\n{\n\tvar s = \"foo\";\n\tvar i =
0;\n\n\tfor (i = 0; i < 3; i++)
{\n\t","sourceLength":120,"scriptType":2,"compilationType":0,"context":{"ref":0}
,"text":" (lines:
14)"}},"refs":[{"handle":0,"type":"context","text":"#<ContextMirror>"}],"running
":true}
Debug message: {u'body': {u'script': {u'columnOffset': 0, u'handle': 1,
u'compilationType': 0, u'text': u' (lines: 14)', u'sourceLength': 120,
u'sourceStart': u'\nfunction my_func(t)\n{\n\tvar s = "foo";\n\tvar i =
0;\n\n\tfor (i = 0; i < 3; i++) {\n\t', u'lineCount': 14, u'scriptType': 2,
u'lineOffset': 0, u'context': {u'ref': 0}, u'type': u'script', u'id': 17}},
u'seq': 1, u'success': True, u'refs': [{u'type': u'context', u'handle': 0,
u'text': u'#<ContextMirror>'}], u'running': True, u'type': u'event', u'event':
u'afterCompile'}
AfterCompile event:
{"seq":2,"type":"event","event":"afterCompile","success":true,"body":{"script":{
"handle":1,"type":"script","id":17,"lineOffset":0,"columnOffset":0,"lineCount":1
4,"sourceStart":"\nfunction my_func(t)\n{\n\tvar s = \"foo\";\n\tvar i =
0;\n\n\tfor (i = 0; i < 3; i++)
{\n\t","sourceLength":120,"scriptType":2,"compilationType":0,"context":{"ref":0}
,"text":" (lines:
14)"}},"refs":[{"handle":0,"type":"context","text":"#<ContextMirror>"}],"running
":true}
Debug message: {u'body': {u'invocationText': u'[anonymous]()', u'script':
{u'lineCount': 14, u'columnOffset': 0, u'id': 17, u'lineOffset': 0, u'name':
u''}, u'sourceLineText': u'', u'sourceColumn': 0, u'sourceLine': 0}, u'type':
u'event', u'event': u'break', u'seq': 3}
[hanging here]
Regards,
Angelo
Original issue reported on code.google.com by angelo.d...@gmail.com on 13 Jun 2011 at 2:11
Attachments:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached DebuggerTest.py and run it with command-line arguments 0 and 1 to reproduce the different behavior around BeforeCompile and AfterCompile. Trace the Debugger onMessage path and the Debugger class methods for the generated break event. Done means the break event is handled when onMessage is disabled and the test no longer hangs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100