eukreign / python-v8

Apache License 2.0
12 stars 6 forks source link

PyV8 debugger not properly handling break events #4

Open eukreign opened 10 years ago

eukreign commented 10 years ago

From angelo.d...@gmail.com on June 13, 2011 10:11:25

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":"#"}],"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":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":"#"}],"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":"#"}],"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'#'}], 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":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":"#"}],"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

Attachment: DebuggerTest.py

Original issue: http://code.google.com/p/pyv8/issues/detail?id=89

eukreign commented 10 years ago

From flier...@gmail.com on June 13, 2011 18:45:00

In fact, the debugger is not ready for release, I will focus on it before v1.0 release :)

Status: Accepted
Labels: OpSys-All

eukreign commented 10 years ago

From flier...@gmail.com on June 13, 2011 18:45:01

In fact, the debugger is not ready for release, I will focus on it before v1.0 release :)

eukreign commented 10 years ago

From gabriel....@gmail.com on January 04, 2012 17:29:40

I'm seeing this also. Is there some known issue that has been thought out but not implemented yet? or is there investigation necessary to figure out whats up with this? I'm willing to put some elbow grease in to getting this fixed i just dont want to redo work that has already been done.

eukreign commented 10 years ago

From flier...@gmail.com on January 05, 2012 06:04:41

Sorry, the debugger feature was broken months ago, I think I will focus on it later :)

Labels: -Type-Defect Type-Enhancement

eukreign commented 10 years ago

From angelo.d...@gmail.com on February 20, 2012 02:57:19

Any news about this issue? I should have spare time to contribute if needed and would love to see the debugging feature in PyV8 in order to use it in a low-interaction honeyclient project I'm going to publicly release in the next days.

eukreign commented 10 years ago

From l...@damoti.com on April 14, 2014 18:48:53

Any updates on this issue? If someone understands the problem or what needs to be done maybe they could provide direction for others to make this work. I'm willing to put in effort on this if I can get some general high level explanation of why it's not working.