cutter icon indicating copy to clipboard operation
cutter copied to clipboard

GDB Server gets EOF from Cutter

Open rgnter opened this issue 4 years ago • 3 comments

Environment information

  • Operating System: windows 10
  • Cutter version: 2.0.3
  • File format:
  • Arch: x64
  • Type: exe

Describe the bug Communication with gdb server fails(due to protocol error?) and cutter tries to proceed with debugging but runs into segfault.

Gdb server from winbuilds(arch x64) ran with command gdbserver --remote-debug 127.0.0.1:53535 file.exe (target executable arch is x32)

outputs following:

Listening on port 53535
Remote debugging from host 127.0.0.1
readchar: Got EOF
[getpkt: discarding char ' ']
Remote side has terminated connection.  GDBserver will reopen the connection.

To Reproduce Steps to reproduce the behavior:

  1. Setup cutter project(with analyzed binary)
  2. Setup gdb server (run with elevation)
  3. Connect to gdb server from cutter

Expected behavior Debugger should successfuly connect and proceed with debugging.

Additional context Dump: crash.zip

rgnter avatar Nov 21 '21 10:11 rgnter

@rgnter could you please retry with the 2.0.4-rc2 prerelease? There were some important GDB fixes in it. There is a chance it is fixed. https://github.com/rizinorg/cutter/releases/tag/v2.0.4-rc2

XVilka avatar Nov 21 '21 10:11 XVilka

Does not work with version you have provided me with.

I have compiled cutter and found the issue: The DebugActions::onAttachedRemoteDebugger is for some unknown reason to me, being called twice.

  • When called the first time DebugActions::remoteDialog is nullptr(and the destructor has not been called), causing crash.
  • When called second time the remoteDialog is not nullptr, as expected.

A simple null check in the function fixes everything. image

Fixed in PR #2830

rgnter avatar Nov 21 '21 14:11 rgnter

The issue still occurs for me:

Remote debugging from host 127.0.0.1
[remote] readchar: readchar: Got EOF
[remote] getpkt: [getpkt: discarding char '�']
Remote side has terminated connection.  GDBserver will reopen the connection.

Kyllingene avatar May 16 '22 16:05 Kyllingene