Author Topic: Remote debugging with gdbserver failed  (Read 208 times)

Bwana The Bigg

  • Community Member
  • Posts: 11
  • Hero Points: 0
Remote debugging with gdbserver failed
« on: January 10, 2023, 10:57:06 am »
Hello!
I am running gdbserver on a remote computer with my program:
> $ gdbserver 192.168.10.24:1436 ./server 1426
> Process ./server created; pid = 1045784
> Listening on port 1436
Then I try to connect to it from slickedit using pulldown Debug>>Attach Debugger>>Attach to Remote Process (GDB). gdbserver reports:
> Remote debugging from host 192.168.10.24, port 44974
slickedit freezes and after a while displays a window with the message:
> Error starting debugger. GDB returned an error attaching to the remote process
> "ptrace: No such process"
The behavior is the same when selecting both the "built-in" gdb and the one installed in the system.
If I run gdb from the command line everything works as it should

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3788
  • Hero Points: 497
Re: Remote debugging with gdbserver failed
« Reply #1 on: January 10, 2023, 03:29:11 pm »
You have it listening on port 1436, but you try to attach to port 44974 ?

Bwana The Bigg

  • Community Member
  • Posts: 11
  • Hero Points: 0
Re: Remote debugging with gdbserver failed
« Reply #2 on: January 13, 2023, 08:52:21 am »
Port 1436 is the port that the gdbserver is listening on. If it accepts a connection, and it does accept it, then the new socket and port (44974) for the session communication is returned to the debugger from the connection request. gdbserver also reports it to stdout. However, the slickedit debugger doesn't get a socket, hangs waiting for connect() to return, and exits  by timeout. "Regular" gdb from the command line connects and works fine, unlike

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3788
  • Hero Points: 497
Re: Remote debugging with gdbserver failed
« Reply #3 on: January 13, 2023, 01:48:40 pm »
Which port are you putting gin the "Attach to Remote Process (GDB)" dialog?  It should be 1436.  I do not see how you make the jump from 1436 to 44974 otherwise.

Bwana The Bigg

  • Community Member
  • Posts: 11
  • Hero Points: 0
Re: Remote debugging with gdbserver failed
« Reply #4 on: January 17, 2023, 12:56:42 pm »
Yes, I enter 1436 in the panel you are asking about.
The exchange involves two parties -- gdbserver and gdb. gdbserver is started remotely and listens on port 1436. This port is entered on the gdb side in the panel you are talking about and I enter exactly it -- 1436.

(@) Connect via socket
  Host [192.168.10.1]
  Port [1436]
« Last Edit: January 17, 2023, 01:15:11 pm by Bwana The Bigg »

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3788
  • Hero Points: 497
Re: Remote debugging with gdbserver failed
« Reply #5 on: January 17, 2023, 01:11:12 pm »
We have a logging subsystem for the GDB integration.  So try this:

1) Macro > Set Macro Variable... > def_debug_logging = 1

2) Debug > Attach debugger > Attach to Remote Process (GDB)... (like you have done)

3) Let it do it's thing

4) Macro > Set Macro Variable... > def_debug_logging = 0

5) The trace will be in your slickedit configuration directory:  <config>/logs/debug.log

6) Attach that here and I'll look it over.