Trouble debugging C++ using Eclipse Galileo on Mac

2019-02-18 12:56发布

I am trying to debug C++ code using Eclipse Galileo on my MacBook Pro running Mac OS X v10.5 (Leopard). It's my first time trying this. I have a complicated C++ program I'd like to debug, but to test things out, I just tried to debug and step through the following:

#include <iostream>
using namespace std;

int main()
{
  int x = 0;
  cout << x << endl;

  x = 54;
  cout << x << endl;

  return 0;
}

I clicked the debug icon, told it to use GDB (DSF) Create Process Launcher and started to step through the code. I wanted to be able to monitor the value of x, so I opened up the Variables window and watched. Initially, it was 4096 - presumably some garbage value. As soon as I hit the next line, where it had shown the value, it now shows the following error:

Failed to execute MI command:
-var-update 1 var1
Error message from debugger back end:
Variable object not found

I can't seem to figure this out or get around it. And a few Google searches turned up bone dry without even the hint of a lead.


Solution: As drhirsch pointed out below, use the Standard Create Process Launcher instead of the GDB Create Process Launcher. (This is actually a workaround and not a true solution, but it worked for at least two of us.)

8条回答
可以哭但决不认输i
2楼-- · 2019-02-18 13:47

In my experience the gdb/dsf launcher is still quite unusable. I can't get it to show variables too, it seems still very buggy.

Did you try the Standard Create Process Launcher? For me this works fine.

查看更多
混吃等死
3楼-- · 2019-02-18 13:56

Update to the released version of Eclipse 3.6 (Helios) and use the DSF/GDB Create Launcher. There was a lot of work done to bring the feature parity of the DSF/GDB framework up to usable levels for Eclipse 3.6 (Helios). Debugging now works just fine on OS X 10.5 and 10.6 using Eclipse CDT 3.6 Helios.

查看更多
登录 后发表回答