Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Debugger fails to start but gdb works fine(debugger settings or behavior)
Debugger fails to start but gdb works fine [message #1101589] Wed, 04 September 2013 17:10 Go to next message
Andrew Falanga is currently offline Andrew Falanga
Messages: 2
Registered: September 2013
Junior Member
Hi,

Quite new to using Eclipse for C/C++ development and especially debugging. My teams project is now supported on Linux (formerly Windows only). I'm investigating Eclipse for debugging. While familiarizing myself with the tools I've run into a rather weird problem for which I'm not sure how to proceed.

In order to become familiar with the Eclipse debugger, and editor, I started Kepler and made the "Hello World" project to try few things. I have the following source for EclipseTest.cpp:

#include <iostream>
#include <vector>
#include <string>

// mainly seeing how the debugger handles nested stl types
int main() {
	std::cout << "!!!Hello World!!!" << std::endl; // prints !!!Hello World!!!

	std::vector<int> intv;
	std::vector<std::string> strings;
	std::vector<std::vector<std::string> > manyStrings;
	intv.push_back(44);
	strings.push_back("The first string");
	strings.push_back("The second string");

	//manyStrings.push_back(std::vector<std::string>());
	//manyStrings.back().push_back("This string is in the first vector");
	//manyStrings.push_back(std::vector<std::string>());
	//manyStrings.back().push_back("This string is in the second vector");

	//std::cout << manyStrings[0].back() << std::endl;
	//std::cout << manyStrings[1].back() << std::endl;

	return 0;
}


With the code as above, I can start the debugger just fine in Eclipse. However, if I uncomment the commented lines inside of main(), the debugger starts up and promptly stops complaining, "<terminated, exit value -1> gdb". This happens before even breaking at main().

Considering the simplicity of the code, this seemed strange. I went to the command line and started gdb manually, adding the directory for my sources to the search paths, and stepped my way through the code just fine. I can also run the program from the command line with no problems. However, the debugger is choking. Can anyone explain why? What am I doing wrong?

If it's important, I'm using Eclipse Kepler on CentOS 6.2 32-bit. I downloaded the Eclipse tarball which had the CDT perspective.

Thanks for any help,
Andy
Re: Debugger fails to start but gdb works fine [message #1101658 is a reply to message #1101589] Wed, 04 September 2013 19:36 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc Khouzam
Messages: 278
Registered: July 2009
Senior Member
Could be that GDB crashed. You can look at the gdb traces in eclipse to see if something bad happened:
http://wiki.eclipse.org/CDT/User/FAQ#I.27ve_been_asked_for_.27gdb_traces.27.2C_where_can_I_find_them.3F

Marc
Re: Debugger fails to start but gdb works fine [message #1111870 is a reply to message #1101658] Wed, 18 September 2013 21:16 Go to previous messageGo to next message
Andrew Falanga is currently offline Andrew Falanga
Messages: 2
Registered: September 2013
Junior Member
I'm quite sorry for my tardiness. I've been pulled in many different directions at work over the last couple of weeks (.. can't believe it's been that long). Thank you for the suggestion for gdb traces. I've figured out how to get them (thanks for the link). However, what am I looking for? So far, nothing seems to jump out as a problem.
Re: Debugger fails to start but gdb works fine [message #1112902 is a reply to message #1111870] Fri, 20 September 2013 10:38 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc Khouzam
Messages: 278
Registered: July 2009
Senior Member
I'd compare your working case 'gdb traces' with the ones from the broken case. If the 'gdb traces' abruptly stop very early, it would seem to indicate a gdb crash.
Re: Debugger fails to start but gdb works fine [message #1112904 is a reply to message #1112902] Fri, 20 September 2013 10:39 Go to previous message
Marc Khouzam is currently offline Marc Khouzam
Messages: 278
Registered: July 2009
Senior Member
Oh, and you can then use the 'gdb traces' to try to reproduce the gdb crash directly from the command line. Sometimes a gdb crash happens because Eclipse is doing more advanced things than a user would do from the gdb command-line
Previous Topic:C/C++ Remote Application Debugging
Next Topic:Problem with linking static library
Goto Forum:
  


Current Time: Wed Oct 01 20:25:10 GMT 2014

Powered by FUDForum. Page generated in 0.03952 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software