avatar2
avatar2 copied to clipboard
Exception: GDBProtocol was unable to connect
When I try to run python3 test_pyperipheral.py
, I run into the following problem:
2022-04-19 06:33:03,450 | avatar.INFO | Initialized Avatar. Output directory is /tmp/avatar
2022-04-19 06:33:03,456 | avatar.targets.QemuTarget0.INFO | QEMU process running
2022-04-19 06:33:08,531 | avatar.targets.QemuTarget0.GDBProtocol.CRITICAL | GDBProtocol was unable to connect to remote target
Traceback (most recent call last):
File "test_pyperipheral.py", line 121, in
Heya. The tests are sensitive to the directory they are run from - all of them are expected to be run from the top-level directory, so it should be: python3 tests/test_gdbprotocol.py
That being said, on my local machine, I run into some problems regarding the unix socket version of gdb protocol, but I believe that is currently local to my machine.
thank you very much! I haven't noticed the directory problem.
Heya. The tests are sensitive to the directory they are run from - all of them are expected to be run from the top-level directory, so it should be:
python3 tests/test_gdbprotocol.py
That being said, on my local machine, I run into some problems regarding the unix socket version of gdb protocol, but I believe that is currently local to my machine.
It seems that the reason for this error is not just the path problem. I found that if the configuration of avatar is wrong, the exception "GDBProtocol was unable to connect" will also be generated. Hmm~, I'm curious how the entry point in the sample is determined? I tried to unzip the .bin file but it didn't work.
I've recently come across this issue and narrowed it down to a hard-coded timeout value in protocols/gdb.py
. When connecting to a gdbserver instance the client downloads the running binaries from the server which can take longer than 5 seconds. Due to the function _sync_request()
having a hard-coded timeout value of 5
an exception can be thrown when downloading the binaries from the server due to the timeout being hit.
Command that can take longer than 5 seconds: https://github.com/avatartwo/avatar2/blob/main/avatar2/protocols/gdb.py#L377 Hard-coded argument value: https://github.com/avatartwo/avatar2/blob/main/avatar2/protocols/gdb.py#L304
I changed my timeout
value to 30
and it worked perfectly. I hope this helps :crossed_fingers: