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

How to debug plugins? #18

Open
kruxmeier opened this issue Oct 3, 2020 · 7 comments
Open

How to debug plugins? #18

kruxmeier opened this issue Oct 3, 2020 · 7 comments

Comments

@kruxmeier
Copy link

When it's trying to set the workspace to the plugins dir it fails with only one usage of each socket address allowed.

[IDACode] Listening on 127.0.0.1:7065
[INFO] 101 GET /ws (127.0.0.1) 15.00ms	(web:log_request)
[IDACode] Client connected
[IDACode] Set workspace folder to .....\plugins
[ERROR] Uncaught exception GET /ws (127.0.0.1)
HTTPServerRequest(protocol='http', host='127.0.0.1:7065', method='GET', uri='/ws', version='HTTP/1.1', remote_ip='127.0.0.1')	(web:log_exception)
Traceback (most recent call last):
  File "C:\python27-x64\lib\site-packages\tornado\websocket.py", line 546, in _run_callback
    result = callback(*args, **kwargs)
  File "...../plugins\idacode_utils\socket_handler.py", line 36, in on_message
    start_debug_server()
  File "...../plugins\idacode_utils\socket_handler.py", line 21, in start_debug_server
    debugpy.listen((settings.HOST, settings.DEBUG_PORT))
  File "C:\python27-x64\lib\site-packages\debugpy\__init__.py", line 113, in listen
    return api.listen(address)
  File "C:\python27-x64\lib\site-packages\debugpy\server\api.py", line 143, in debug
    log.reraise_exception("{0}() failed:", func.__name__, level="info")
  File "C:\python27-x64\lib\site-packages\debugpy\server\api.py", line 141, in debug
    return func(address, settrace_kwargs, **kwargs)
  File "C:\python27-x64\lib\site-packages\debugpy\server\api.py", line 234, in listen
    raise RuntimeError(str(endpoints["error"]))
RuntimeError: Can't listen for client connections: [Errno 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted
[IDACode] Client disconnected
@ioncodes
Copy link
Owner

ioncodes commented Oct 4, 2020

That means something is already using that port. Perhaps it's being used by another software or it's a reserved port. Can you test out a simple idapy script (not a plugin) after a fresh reboot?

@kruxmeier
Copy link
Author

kruxmeier commented Oct 4, 2020

Well running the idacode server succeeds but when running connect and attach debugger from the client side this error pops up.
ptvsd otoh is able to connect and does show the redirected stdout but breakpoints don't work.

@ioncodes
Copy link
Owner

ioncodes commented Oct 4, 2020

I see, I wrongly assumed you guys force reloaded IDACode or something.

Have you tried using a different folder? It may be some sort of path issue to the plugins folder. As IDAs internals are doing some path hackery, I have to do some hackish stuff myself to get the debugger to work properly, and referencing to IDAs root (or the plugins subfolder) may cause unexpected issues.

If the breakpoints don't work, make sure you have at least one call to breakpoint() before a line of code. That will activate breakpoints for the session.

@ioncodes
Copy link
Owner

ioncodes commented Oct 4, 2020

Either way, which IDA version are you on? I can try it out locally next week.

@kruxmeier
Copy link
Author

Tested on 7.3

@ghost
Copy link

ghost commented Oct 28, 2020

Hello, I have some errors when I use idacode. When IDA 7.0 calls breakpoint() in the script, IDA prompts me to "can't find input file 'C:" users \ * * \ appdata / roaming / Python / python27 / site packages / debug / adapter'

Can you tell me why? Thank you

@bahlaivlad
Copy link

Hello, I have some errors when I use idacode. When IDA 7.0 calls breakpoint() in the script, IDA prompts me to "can't find input file 'C:" users \ * * \ appdata / roaming / Python / python27 / site packages / debug / adapter'

Can you tell me why? Thank you

Had the same issue: #19

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

3 participants