rizin icon indicating copy to clipboard operation
rizin copied to clipboard

Unable to connect to a GDB server

Open caribpa opened this issue 4 years ago • 7 comments

Work environment

Questions Answers
OS/arch/bits (mandatory) Arch Linux x64
File format of the file you reverse (mandatory) ELF
Architecture/bits of the file (mandatory) x86/64
rizin -v full output, not truncated (mandatory) rizin 0.2.0-git @ linux-x86-64, package: 0.2.0.r25701.639fe1170-git (AUR) commit: 639fe1170b33ec361f204c0a914fcd7a71c240c9, build: 2021-02-11__15:55:00

Expected behavior

Connecting to a gdb server using Rizin works.

Actual behavior

Connecting to a gdb server using Rizin doesn't work.

Steps to reproduce the behavior

Using the built-in gdb server

  • Server: rz -q -c '=g 9090 /bin/rizin' -
  • Client: rz gdb://localhost:9090/
  • 💔 - The client disconnects right after connecting and the server enters in a loop printing: read_packet: read failed

Using gdbserver

  • Server: gdbserver localhost:9090 /bin/rizin
  • Client: rz gdb://localhost:9090/
  • 💔 - The client disconnects with error: gdbr: Failed to attach to PID 0

This issue is also present in the 0.1.0 static build and radare2.

caribpa avatar Feb 11 '21 15:02 caribpa

Forgot to say that it also doesn't work when trying to connect to the Rizin's gdb server from gdb:

  • Server: rz -q -c '=g 9090 /bin/rizin' -
  • Client: gdb -ex 'target remote localhost:9090'
  • 💔

Whereas gdb connects to the gdbserver without issues:

  • Server: gdbserver localhost:9090 /bin/rizin
  • Client: gdb -ex 'target remote localhost:9090'
  • 🎉

caribpa avatar Feb 11 '21 15:02 caribpa

cc @yossizap

ret2libc avatar Feb 11 '21 16:02 ret2libc

The code in shlr/gdb/gdbserver isn't really maintained and the gdb protocol implementation there lacks a lot of features, it will need more work to actually work with gdb/rizin. If you're interested in fixing it I can point you to documentation / other examples.

yossizap avatar Feb 11 '21 22:02 yossizap

Honestly, I can't remember of ever using the built-in gdb server.

I'd propose to follow the same course of action that was done with the Projects feature (before the full rework): Remove the built-in gdb server (or just remove the =g command option), until a re-implementation is performed (if ever).

caribpa avatar Feb 12 '21 10:02 caribpa

This issue has been automatically marked as stale because it has not had recent activity. Considering a lot has probably changed since its creation, we kindly ask you to check again if the issue you reported is still relevant in the current version of rizin. If it is, update this issue with a comment, otherwise it will be automatically closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 21 '21 08:12 stale[bot]

Still an issue

ret2libc avatar Dec 21 '21 09:12 ret2libc

This issue has been automatically marked as stale because it has not had recent activity. Considering a lot has probably changed since its creation, we kindly ask you to check again if the issue you reported is still relevant in the current version of rizin. If it is, update this issue with a comment, otherwise it will be automatically closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 25 '22 18:06 stale[bot]

This issue has been automatically closed because marked as stale and it has not been updated since then. If the issue is still relevant, feel free to re-open it or open a new one.

stale[bot] avatar Aug 31 '22 05:08 stale[bot]