简体   繁体   中英

Debugging in Eclipse with remote GDB

I have a Linux machine which is set up to cross-compile programs for an AVR target. It's easy to run and debug programs locally:

  1. Run the program with simavr (acts as GDB server)
  2. Run GDB ( avr-gdb ) and connect it to simavr

I'd like to to recreate this flow remotely from Eclipse on a Windows machine. The Windows machine isn't really set up for development — it has Eclipse installed and the source code for my project, but it doesn't have any local C/C++ dev tools like GDB. I'd ideally like to visually debug using the local copy of the source, but by interacting with the remote GDB over SSH.

This Eclipse plugin seems to be the recommended tool for the job. Unfortunately I can't get this working. Here's what I've done:

  1. Created a new "C/C++ Remote Application" debug configuration.
  2. Set the "Preferred Launcher" to "Direct Remote Debugging Launcher".
  3. Pointed "Remote C/C++ exe file path" to the location of the binary on the remote machine
  4. Pointed "Remote workspace directory" to the location of the project source on the remote machine

This does not seem to work. When I attempt to debug with this configuration, I get this error:

Error with command: gdb --version
  Cannot run program "gdb": Launching failed

This error makes sense. If I look in the "Debugger" tab of my debug configuration, the "GDB debugger" is set to gdb . If I open the file browser for the debugger, it only shows files on my local Windows machine. It looks like the configuration is set up to execute gdb on my machine.

I thought the point of the plugin was the launch GDB on a remote machine, but I can't find a way to make a debug configuration that actually does that. Any help would be appreciated.

We use the package called GDB Hardware Debugger which lets you specify which GDB you want to use and how you want to launch it. We keep its eclipse configuration as empty as possible, with the minimum required, and continue configuring GDB through its scripting option -x which offers finer-grained control. That way, you are not required to understand how and when are those eclipse fields used to run GDB. For example, we needed to perform some extra GDB settings before connecting while this plugin connects first and then uses the provided GDB script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM