Author Topic: Embedded development with gdbserver and cross compiled gdb  (Read 891 times)

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1253
  • Hero Points: 120
Re: Embedded development with gdbserver and cross compiled gdb
« Reply #15 on: February 06, 2020, 10:30:32 pm »
One question, in the logs I see the gdbserver host and port as localhost:2331.  That doesn't sound right for a remote device, does that match what you entered in for the host and port in the attach dialog?

smartin

  • Senior Community Member
  • Posts: 102
  • Hero Points: 3
Re: Embedded development with gdbserver and cross compiled gdb
« Reply #16 on: February 07, 2020, 08:48:00 am »
@patrick: As I said, I am using a SEGGER JLink JTAG debugger with JLinkGDBServer. This is a USB device that allows me to debug code running on an ARM device. The GDBServer runs locally and then talks to the ARM processor via a USB JTAG device.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1253
  • Hero Points: 120
Re: Embedded development with gdbserver and cross compiled gdb
« Reply #17 on: February 07, 2020, 02:57:48 pm »
Thanks.   I thought I had found a problem yesterday, but I was trying to connect to a system unreachable from my network, so user error on my part. There proxy that appears to be shutting down early does some logging, but it's not getting saved, so I may need to make some changes and rebuild the proxy and send it to you to actually get the logging.   I'll let you know.

The most likely (but not only) candidates for things that make the proxy not intialize is not being able to connect to the gdbserver port, or not being able to listen on port 8002.  I doubt there's a problem connecting, so you can connect to the gdbserver normally otherwise.  It's not impossible that firewall rules could be a problem, but usually you'd get a popup if the windows firewall blocked vs-gdb-proxy.exe from listening.

The proxy can be disabled in the debugger settings.  So try disabling it, and attaching the debugger.  That could tell us if the proxy is the entire problem, or a side effect of something else going wrong.



SlickEdit Support

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 309
  • Hero Points: 26
Re: Embedded development with gdbserver and cross compiled gdb
« Reply #18 on: February 07, 2020, 09:43:11 pm »
PM sent.

smartin

  • Senior Community Member
  • Posts: 102
  • Hero Points: 3
Re: Embedded development with gdbserver and cross compiled gdb
« Reply #19 on: February 10, 2020, 09:25:34 am »
Thanks.
I downloaded the vs-gdb-proxy.exe and it didn't generate any output. Here's a screencast: https://screencast-o-matic.com/watch/cYn6QrwZxU
I also attach an image of the SlickEdit directory showing the modified vs-gdb-proxy.exe
Additionally I found that the "Project->New...->C/C++->Cross Platform C++ Wizard" just creates a Visual Studio project.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1253
  • Hero Points: 120
Re: Embedded development with gdbserver and cross compiled gdb
« Reply #20 on: February 10, 2020, 03:11:57 pm »
You have to use Debug -> Attach Debugger -> Attach to running process (GDB).   That's the only way to attach to a gdbserver, where you can give the address and port for the gdb server. 

Debug -> Start tries to run the process under the debugger, which won't work in your case.  Debug -> Attach Debugger -> Debug Executable (GDB) does the same thing as Debug -> Start, but allows you to specify a different executable than the project's default executable - say for a library project that doesn't have an executable.



smartin

  • Senior Community Member
  • Posts: 102
  • Hero Points: 3
Re: Embedded development with gdbserver and cross compiled gdb
« Reply #21 on: February 10, 2020, 03:21:59 pm »
Debug -> Attach Debugger -> Attach to Running Process (GDB) isn't applicable to me as this just shows me a list of running processes on my PC to connect to.
Debug -> Attach Debugger -> Attach to Remote Process (GDB) goes into debug mode, however I cannot load my code onto the remote.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1253
  • Hero Points: 120
Re: Embedded development with gdbserver and cross compiled gdb
« Reply #22 on: February 10, 2020, 03:30:47 pm »
I should have said "Attach to remote process (GDB)", not running process.   You're right that we don't need to look at PIDs.

The debug logging is supposed to help figure out why the attach is not working.  We could see for the attach logs you sent in previously that it was failing to get connect to the GDB proxy, but not why.  So it's not even getting to the point where it's connecting to your gdbserver, and that's one of the questions the extra logging is supposed to help answer.

See if you get the logging in %TEMP%/logs when you "Attach to remote process (GDB)" and give it the host and port information for your gdbserver.