Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Weird debug perspective behaviour (buggy GDB console/variables view)
Weird debug perspective behaviour (buggy GDB console/variables view) [message #1728485] Mon, 04 April 2016 19:28 Go to next message
Nicolas Rochette is currently offline Nicolas RochetteFriend
Messages: 3
Registered: April 2016
Junior Member
Hello all,

I have been struggling for hours with a serious bug in the debug perspective. I have not been able to find any related posts, here or elsewhere, and I would very much appreciate any help to resolve it. I would much rather solve it than have to go back to GDB's command line mode, as Eclipse's interface is so nice.

I am using a fresh Eclipse 4.5 "Mars" & CDT 8.7 installation, along with GCC 5.2.1 and GDB 7.10, under Ubuntu 15.10.

Overall everything works fine, except that I run into the following unrecoverable state (attached screenshot) when setting a breakpoint in "main()" :

  • Variables are not displayed properly : the Variables panel comprises an unpredictable number of blank (but existing and selectable) lines, and trying to explore non-blank containers (if any) only lead to more blank lines (see screenshot).
  • The GDB console is unresponsive, i.e. typing "print argc", "info locals" or any other command does not seem to do anything.
  • The thread is unresponsive. The "Restart" and "Terminate" buttons are unresponsive (they become shaded on click but do not seem to do anything).
  • Terminating the application (same button, but on the "application" line and not the "thread" line) works after a little while.
  • Debug-unrelated Eclipse functions otherwise work normally.

The issue seems to be specific to "main()". i.e. as long as I do not put breakpoints in "main()" everything appears to works fine.

Importantly, I have tried using GDB from the command line but as far as I can tell, the behaviour was normal. I also do not thing there is anything remarkably fancy with my program, and the version used to reproduce the bug works and is publicly released and used.

I attach the GDB trace. I did not find any error that might explain this behaviour but I must admit that I am not used to this format.

Thanks a lot,

Nicolas
  • Attachment: CDT_debug.png
    (Size: 389.90KB, Downloaded 557 times)
  • Attachment: gdb_trace
    (Size: 93.50KB, Downloaded 204 times)

[Updated on: Tue, 05 April 2016 14:41]

Report message to a moderator

Re: Weird debug perspective behaviour (buggy GDB console/variables view) [message #1728594 is a reply to message #1728485] Tue, 05 April 2016 17:05 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Annoying isn't it? This seems to happen when Eclipse is trying to get the variable values. Sometimes all that's needed is to wait. There may be an issue with losing communication with GDB also because sometimes the wait is way too long as if it will never terminate. When this happens, I usually kill Eclipse. Really annoying when the program has run for 20 minutes to get to the breakpoint.

You seem to have a workaround that I often use: skip over the problem point using breakpoints. The other that I use is to not look at the variables page at all but use the expressions page where the number of requests can be limited. Doesn't always avoid the problem though.

I've never submitted a bug report for this. It's difficult to reproduce and I don't want to share the code when it is predictable.

My pet peeve with the Eclipse GDB interface is that, for whatever reason, breakpoints get moved. Sometimes this is understandable, say, after an edit but there are times when there seems to be no reason at all. Happens a lot but this too is difficult to reproduce. However, this is a different topic.
Re: Weird debug perspective behaviour (buggy GDB console/variables view) [message #1728609 is a reply to message #1728594] Tue, 05 April 2016 19:46 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
Registered: July 2009
Senior Member
First, there is a serious bug using GDB 7.10 (or 7.11) with CDT 8.7. I highly recommend upgrading to CDT 8.8 (or downgrading to GDB 7.9). Bottom line is that CDT thinks it is GDB 7.1 instead of 7.10.

That being said, I don't think this is your problem.
I believe the problem is in the fact you are trying to print the content of an un-initiatlized set "empty_list". CDT uses pretty-printers to nicely display STL structures like Map, Set, List, etc. But when the struct is not initialized, the pretty-printer can take a _very_ long time, or even never return.

You could modify your program to initialize those variables from the start. Or you could turn off pretty-printing. To turn off pretty-printing go to Preferences->C/C++->Debug->GDB and uncheck "Unable pretty printers in variable/expression tree" which you will find the bottom of that preference page.

Marc
Re: Weird debug perspective behaviour (buggy GDB console/variables view) [message #1728708 is a reply to message #1728609] Wed, 06 April 2016 14:47 Go to previous messageGo to next message
Nicolas Rochette is currently offline Nicolas RochetteFriend
Messages: 3
Registered: April 2016
Junior Member
Thank you both for your answers. I am going to try these options within the next couple days & I will let you know about the results.
Re: Weird debug perspective behaviour (buggy GDB console/variables view) [message #1729510 is a reply to message #1728708] Thu, 14 April 2016 22:05 Go to previous message
Nicolas Rochette is currently offline Nicolas RochetteFriend
Messages: 3
Registered: April 2016
Junior Member
Hi again,

So either (1) disabling "pretty printers in variable/expression tree" in Prefs/C++/Debug/GDB or (2) moving the variable declarations to the beginning of the block indeed restored a sane behavior. I guess I will go with solution (1) then. Although it is still unsatisfying, the console still works and has pretty printing, and being able to set breakpoints through eclipse is still great. Solution (2) is of course out of the question...

Interestingly the issue seems to be restricted to std::set -- in particular, std::map does not seem to be affected. The template type doesn't seem to matter : at least set<int> and set<string> cause the problem.

As far as my testing goes :

map<int,int> foo;
set<int> bar;
//break

// (works)
set<int> bar;
//break
map<int,int> foo;

// (works)
map<int,int> foo;
//break
set<int> bar;

// (bugs)


Also, I could reproduce the problem in functions other than main() by declaring unused set<int> variables.

Thanks again for the hints.

p.s. This is with "Eclipse IDE for C/C++ developers" 4.5.2 and CDT 8.8.1. See attached "Installation details" screenshot for other pieces.

[Updated on: Thu, 14 April 2016 22:16]

Report message to a moderator

Previous Topic:Breakpoints are not set in remote attach launcher configuration
Next Topic:Eclipse Debug Settings : GDB
Goto Forum:
  


Current Time: Fri Apr 26 12:32:35 GMT 2024

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

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

Back to the top