Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to attach IDA Pro to Visual Studio #93

Open
ymgh96 opened this issue Sep 23, 2020 · 5 comments
Open

Unable to attach IDA Pro to Visual Studio #93

ymgh96 opened this issue Sep 23, 2020 · 5 comments

Comments

@ymgh96
Copy link

ymgh96 commented Sep 23, 2020

I put ptvsd_enable.py in the IDA plugins directory and, it opens without error. But when I want to attach IDA Pro to Visual Studio I get an error with this sentence "Unable to attach to the process. General Exception". Both process are running with administrator privilege.
Screenshot (108)
How I should solve this problem?

@marce9
Copy link

marce9 commented Jan 10, 2021

Same problem here. Any solution?

@RolfRolles
Copy link

Same. ptvsd version 4.3.2, IDA (64-bit) 7.6. Attaching to the IDA process hangs for about 10 seconds, and then produces the same message box from the screenshot above.

@tmr232
Copy link
Owner

tmr232 commented May 2, 2021

Sorry for the very delayed response everyone...

So it seems that https://github.com/Microsoft/ptvsd has been deprecated in favor of https://github.com/microsoft/debugpy/

Trying to call debugpy.listen(5678) from IDA shows an error message. I did not have the time to dig into that yet.

@RolfRolles
Copy link

I wound up using IDACode through VSCode. It took me a few hours to get it working. After enabling logging, I found an issue with the code, which I solved with a one-line patch here.

Here are the steps I used:

  1. Install Visual Studio Code, and the official Python language extension for it.
  2. Install the IDACode VSCode extension.
  3. pip install debugpy tornado
  4. After editing settings.py, and also applying the two one-line patches from above, copy the IDACode Python files to your %IDA%\plugins directory.
  5. In VSCode, open the directory with the file you want to debug, and open the file itself.
  6. Run IDA, open a database, and invoke IDACode through the Edit->Plugins menu.
  7. In VSCode, CTRL-SHIFT-P to bring up the command palette. Use IDACode: Connect and attach a debugger to IDA.
  8. After it connects, VSCode will prompt you for the script working directory, which defaults to the directory you opened. You can just press ENTER.
  9. To execute the script that you currently have open, use the IDACode: Execute script command.
  10. You can set breakpoints through the VSCode window, and you can also programmatically insert them into your code via the breakpoint() function.

@empty2fill
Copy link

empty2fill commented Mar 28, 2022

Sorry for the very delayed response everyone...

So it seems that Microsoft/ptvsd has been deprecated in favor of microsoft/debugpy

Trying to call debugpy.listen(5678) from IDA shows an error message. I did not have the time to dig into that yet.

Use the legacy debugger
Visual Studio 2017 versions 15.8 and later use a debugger based on ptvsd version 4.1+. Visual Studio 2019 versions 16.5 and later use a debugger based on debugpy.
refs : https://docs.microsoft.com/en-us/visualstudio/python/debugging-python-in-visual-studio?view=vs-2017

Use the legacy debugger not work for me. For debugpy no need to call debugpy.listen(5678) explicitly.
Otherwise ensure debugpy.listen(...) can only be called once in the initial process. It seems that ida call once more...
refs: microsoft/debugpy#325 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants