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

VSC, Can't connect to IDA and attach a debugger. #27

Closed haowayne closed 3 years ago

haowayne commented 3 years ago

Hi. I can connect to IDA to run my script, but I can't use the function "connect and attach". Here is the error message displayed in IDA. image

ioncodes commented 3 years ago

Are you using the release build or a copy of the master branch?

ioncodes commented 3 years ago

Ah, I think I know what the issue is. I missed it at first. It seems that debugpy 1.0.0rc2 doesn't support that config yet, this also explains the differences between my old tests and issue #23. Can you try to upgrade debugpy to the latest version?

If that works for you I'll update the README!

haowayne commented 3 years ago

Many Thanks, it works better, the IDA says the debug server is listening on 7066! But seems that it still can't get my breakpoint when I use the command "Connect and attach". Here is the display of my Vscode and IDA.

image

image

ioncodes commented 3 years ago

Can you follow the following steps to be extra sure (I tried locally and it seemed to work fine for me):

  1. Restart your PC
  2. Enable LOGGING in settings.py
  3. Start IDA
  4. Launch the IDACode server in IDA
  5. Start VS Code
  6. Make sure you are on the latest version of IDACode and the settings are set up correctly (host and port specifically)
  7. Open the command palette and hit "Connect and attach"

It's important you try this on a fresh startup as I had an issue before where a debugpy process wouldn't die correctly and I'm not quite sure how to find that specific process anymore.

The connection seems fine in your case so I really doubt that's the issue. If those steps did not help, try to connect back using VS Code's remote debugger manually (use the host & debug port information specified in the settings).

To do that hit "Run and Debug" in the debugger pane, then hit "Remote Attach". Enter "127.0.0.1" and for the port "7066" (unless you changed the debug port).

If that still doesn't work please send me the debugpy.*.log files and I'll check it out myself!

haowayne commented 3 years ago

Everything works! It turns out I forgot to ctrl + s to make it execute. TAT . Many Thanks Again! Please to update the README about the debugpy version.

Best wishes

ioncodes commented 3 years ago

Cheers! 🎉