Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Steps "randomly" in debug mode...(Would be nice if it stepped line by line instead)
Steps "randomly" in debug mode... [message #487439] Wed, 23 September 2009 09:37 Go to next message
Jonas Arvidsson is currently offline Jonas ArvidssonFriend
Messages: 27
Registered: September 2009
Junior Member
Ubuntu 9.04, Ecplise Build ID: 20090619-0625

When I use step (F5 and F6) while debugging a project in Eclipse, it doesn't step line by line. Instead it jumps backwards and forwards, totally by it's own decisions. I suppose it has to do with how the code actually are compiled/run, but it's still frustrating. Is there any way to avoid this?
Re: Steps "randomly" in debug mode... [message #487467 is a reply to message #487439] Wed, 23 September 2009 11:15 Go to previous messageGo to next message
Derek is currently offline DerekFriend
Messages: 60
Registered: July 2009
Member
On 23/09/2009 10:37, Jonas Arvidsson wrote:
> Ubuntu 9.04, Ecplise Build ID: 20090619-0625
>
> When I use step (F5 and F6) while debugging a project in Eclipse, it
> doesn't step line by line. Instead it jumps backwards and forwards,
> totally by it's own decisions. I suppose it has to do with how the code
> actually are compiled/run, but it's still frustrating. Is there any way
> to avoid this?
You most probably have a high level of optimization on your debug build.
Suggest you use -O0 which will stop the compiler optimising your code.

--
Derek
Re: Steps "randomly" in debug mode... [message #487483 is a reply to message #487439] Wed, 23 September 2009 12:00 Go to previous messageGo to next message
Jonas Arvidsson is currently offline Jonas ArvidssonFriend
Messages: 27
Registered: September 2009
Junior Member
I started with Eclipse only a week ago, have been using IAR Embeddedb Workbench mostly before.

Where to I add this optimization turn off line? And just to be sure, it is first a "O" like in "Orion" and then a zero?
Re: Steps "randomly" in debug mode... [message #487488 is a reply to message #487483] Wed, 23 September 2009 12:15 Go to previous messageGo to next message
Derek is currently offline DerekFriend
Messages: 60
Registered: July 2009
Member
On 23/09/2009 13:00, Jonas Arvidsson wrote:
> I started with Eclipse only a week ago, have been using IAR Embeddedb
> Workbench mostly before.
> Where to I add this optimization turn off line? And just to be sure, it
> is first a "O" like in "Orion" and then a zero?
Assuming you are letting Eclipse manage your projects,
Project->Properties
C/C++/Settings
'Compiler'
Optimization (here you will find a drop down)

If you are using Makefiles, you need to add -O0 to the compiler command
line.

Yes, 'O' as in Optimization and '0' as in zero. You can also have 1, 2,
3, s, t for optimzation levels.

--
Derek
Re: Steps "randomly" in debug mode... [message #487678 is a reply to message #487439] Thu, 24 September 2009 06:59 Go to previous messageGo to next message
Jonas Arvidsson is currently offline Jonas ArvidssonFriend
Messages: 27
Registered: September 2009
Junior Member
Seems like we have different versions of Eclipse? Because I can't find such setting

http://www.flickr.com/photos/42861164@N06/3950114432/

Edit: Can't even get the screen shot that show my settings to show in this message, please visit the link!

[Updated on: Thu, 24 September 2009 07:00]

Report message to a moderator

Re: Steps "randomly" in debug mode... [message #487817 is a reply to message #487678] Thu, 24 September 2009 13:55 Go to previous messageGo to next message
Derek is currently offline DerekFriend
Messages: 60
Registered: July 2009
Member
On 24/09/2009 07:59, Jonas Arvidsson wrote:
> Seems like we have different versions of Eclipse? Because I can't find
> such setting
>
Nope. Thats in every version (barring some slight variation in names).

If you don't see it, that implies you have a "Makefile" project, meaning
you wrote and are supplying the makefile. In which case you need to add
the -O0 switch to the compiler.

--
Derek
Re: Steps "randomly" in debug mode... [message #488410 is a reply to message #487439] Mon, 28 September 2009 14:57 Go to previous messageGo to next message
Jonas Arvidsson is currently offline Jonas ArvidssonFriend
Messages: 27
Registered: September 2009
Junior Member
I see... Replaced -O2 with -O0, but the debugger still jumps which makes it pretty difficult to debug properly.
Re: Steps "randomly" in debug mode... [message #488415 is a reply to message #488410] Mon, 28 September 2009 15:10 Go to previous messageGo to next message
Derek is currently offline DerekFriend
Messages: 60
Registered: July 2009
Member
On 28/09/2009 15:57, Jonas Arvidsson wrote:
> I see... Replaced -O2 with -O0, but the debugger still jumps which makes
> it pretty difficult to debug properly.
I suspect that you are not debugging with the change. Delete all the
executables and objects and rebuild.

--
Derek
Re: Steps "randomly" in debug mode... [message #488595 is a reply to message #488415] Tue, 29 September 2009 11:56 Go to previous message
Jonas Arvidsson is currently offline Jonas ArvidssonFriend
Messages: 27
Registered: September 2009
Junior Member
Hm, tried that as well now, but it still jumps a little bit strange, like in this piece of code:

dataToSend[dataLength++] = GetReturnValue(element.ReturnValue);
dataToSend[dataLength++] = 'S';
dataToSend[dataLength++] = 'T';

I have a breakpoint on the first line. When I press F6 i jumps to the next line. Then I press F5, and are now on the third line. But when I press F5 again, it jumps back to the first line, and does not proceed further on until I press F5 again.
Previous Topic:Cannot update/install on clean Linux 64 installation
Next Topic:Change, undo changes, still the program behaves different than before?!?
Goto Forum:
  


Current Time: Thu Mar 28 10:56:37 GMT 2024

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

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

Back to the top