ioncodes / idacode

An integration for IDA and VS Code which connects both to easily execute and debug IDAPython scripts.
725 stars 77 forks source link

Does setting breakpoint from vsc supported ? #16

Open puppywang opened 4 years ago

puppywang commented 4 years ago

Thanks for this wonderful extension ,it do make wrting ida python script much faster, I can step in, step out code, one strange thing I found is that I can't make break point from vsc, it said can't find the break point line, but I can make breakpoint inside idacode_utils, is there something with my config ? Thanks

ioncodes commented 4 years ago

To break in the code make sure to call breakpoint before you attempt to break on VS Code's "dots". https://github.com/ioncodes/idacode#debugging

ioncodes commented 4 years ago

I'll close this for now, if there's still an issue feel free to reopen the issue!

puppywang commented 4 years ago

To break in the code make sure to call breakpoint before you attempt to break on VS Code's "dots". https://github.com/ioncodes/idacode#debugging

@ioncodes I did add breakpoint first, and then create dot breakpoint on VSC, but those breakpoint turn gray immediately, I found that I can set breakpoint outside call to execfile, but not the code inside execfile. I am using python 2.7 shipped with IDA 7.0, I attach the debugpy log, thanks.

debugpy.server-34804.log debugpy.adapter-44868.log

ioncodes commented 4 years ago

Are you debugging an IDA plugin? Can you show me parts of the source code?

ioncodes commented 4 years ago

From the adapter logs:

             Client[1] <-- {
                 "seq": 6, 
                 "type": "response", 
                 "request_seq": 3, 
                 "success": true, 
                 "command": "setBreakpoints", 
                 "body": {
                     "breakpoints": [
                         {
                             "source": {
                                 "path": "D:\\idacode\\objc2_xrefs_helper.py", 
                                 "name": "d:\\idacode\\objc2_xrefs_helper.py", 
                                 "sourceReference": 1
                             }, 
                             "message": "Breakpoint in file that does not exist.", 
                             "verified": false, 
                             "line": 568
                         }
                     ]
                 }
             }

Is the path in that JSON correct?

puppywang commented 4 years ago

I just create a directory named idacode, not debug plugin code, here is the files in that directory, please check.

idacode.zip

Yes, I can confirm that the directory is correct on windows, thanks.

ioncodes commented 4 years ago

I just tried this on IDA 7.5 with Python 3, where did you put the "breakpoint" line?

image

puppywang commented 4 years ago

I put the same line as yours, but it is not working, maybe something todo with python version? I use python2.7 shipped with IDA 7.0.

ioncodes commented 4 years ago

It may indeed be an issue with Python 2.7 and IDA 7.0. I'll check whether it works for me on that version.

ioncodes commented 4 years ago

How did you load the plugin in that version of IDA? I placed the files in the plugin directory but it isn't being loaded.

puppywang commented 4 years ago

Place it in plugin folder, and change some code due to python 2.7 don't have asyncio. You can find the change here: https://github.com/ioncodes/idacode/pull/13/files/0319005853db6e2b126fd0b731abdf8380f438ae

wallds commented 3 years ago

Same to me, Python 3.8.10 and IDA 7.5.

Screenshot 2021-11-09 105853