Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old November 17, 2013, 12:20   #1
LostTemplar
Knight
 
Join Date: Aug 2009
Posts: 670
LostTemplar is on a distinguished road
Debug question.

Question to C veterans.
How to debug a bug, that only appears with -O2 option.
GDB only works without optimization, but in this case there is no bug.

Also the bug is old, it appears not after code change, but after GCC and clib version upgrade.
LostTemplar is offline   Reply With Quote
Old November 17, 2013, 17:14   #2
debo
Veteran
 
debo's Avatar
 
Join Date: Oct 2011
Location: Toronto, Canada
Posts: 2,371
debo is on a distinguished road
So, this is awful, and I have dealt with it differently at different times. I've had some luck with using valgrind in some cases, although sometimes the instrumentation it does ends up quashing the bug. Sometimes i've also used the -fno-X switches to turn off optimizations one at a time, to see if I can get some idea of why it might be happening.

I've heard people say on Windows that this isn't as hard, but I've never written C/C++ that wasn't gcc before
__________________
Glaurung, Father of the Dragons says, 'You cannot avoid the ballyhack.'
debo is offline   Reply With Quote
Old November 17, 2013, 18:13   #3
LostTemplar
Knight
 
Join Date: Aug 2009
Posts: 670
LostTemplar is on a distinguished road
Actually fixed, but it was a nice experience, how such a bug could exist for so long unnoticed and finally cause a problems after compiler update. Code was simply accessing a wrong array.
LostTemplar is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Debug commands buzzkill Development 14 August 29, 2012 11:06
Debug question (artifacts) strad Vanilla 1 April 16, 2012 15:45
Quick(?) debug assist request (JBand) PaulBlay Development 2 June 17, 2009 22:21
Unangband debug commands? Donald Jonker Variants 3 March 5, 2009 04:08
Calling all maintainers: Debug command wishlist CunningGabe Vanilla 6 January 27, 2009 23:38


All times are GMT +1. The time now is 18:56.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.