Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old May 21, 2009, 07:40   #1
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 927
Donated: $10
will_asher is on a distinguished road
frustrating crash bug

I want to get DaJAngband 1.0.98 released, but I've introduced a crash bug somehow and I just can't figure out what's causing it. And I've been real stupid not to make backups of my code often. I'm getting really frustrated with this bug because I've been trying to figure it out for three days now.
So far I've figure out that it seems to only happen in the town, and I'm pretty sure it's some part of update_stuff, redraw_stuff or window_stuff. I tried to look at everywhere it refers to the monster level or player depth to be sure it's not dividing by 0 and didn't find anywhere it did that.
I put
#if isthisit
#endif
around suspect recent pieces of my code, but that didn't help.
I wrote a little function that looks like this:
Code:
void did_it_crash_yet(int where)
{
     /* I know it's crashing in the town */
     if (p_ptr->depth) return;

     msg_format("crash yet? %d", where);
     save_player();
}
to try to find out where it's crashing but that didn't help. I've tried deleting the .o files and recompiling. I even tried restarting my computer. I wish my compiler would tell me what's causing the crash.

</venting>
__________________
Will_Asher

Play DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home
will_asher is offline   Reply With Quote
Old May 21, 2009, 08:25   #2
PaulBlay
Knight
 
Join Date: Jan 2009
Posts: 657
PaulBlay is on a distinguished road
Quote:
Originally Posted by will_asher View Post
And I've been real stupid not to make backups of my code often.
I've been there. At least with a subversion repository you can 'downgrade' to the last working version and then slowly add in the changes you made.
__________________
Currently turning (Angband) Japanese.
PaulBlay is offline   Reply With Quote
Old May 21, 2009, 08:57   #3
Psi
Knight
 
Join Date: Apr 2007
Location: Surrey, UK
Age: 45
Posts: 870
Psi is on a distinguished road
Is it frequent enough that you can create a reproducible case by saving often until it happens and then using the last savegame to reproduce the problem each time?

Once you can reproduce it, it should be a lot easier to track down.
Psi is offline   Reply With Quote
Old May 21, 2009, 09:26   #4
andrewdoull
Unangband maintainer
 
andrewdoull's Avatar
 
Join Date: Apr 2007
Location: Sydney, Australia
Age: 45
Posts: 872
andrewdoull is on a distinguished road
Quote:
Originally Posted by will_asher View Post
I want to get DaJAngband 1.0.98 released, but I've introduced a crash bug somehow and I just can't figure out what's causing it.
I suspect you need to install and learn how to use a debugger. That'll allow you to examine the program at the point of the crash, and then determine which line of code the crash is actually occuring in.

I recommend gdb (although I've not spent the time figuring out how to get it installed and running on my Vista platform) but this depends really on how you're compiling the code.
__________________
The Roflwtfzomgbbq Quylthulg summons L33t Paladins -more-
In UnAngband, the level dives you.
ASCII Dreams: http://roguelikedeveloper.blogspot.com
Unangband: http://unangband.blogspot.com
andrewdoull is offline   Reply With Quote
Old May 21, 2009, 10:32   #5
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 55
Posts: 8,460
Donated: $60
Nick will become famous soon enough
Quote:
Originally Posted by will_asher View Post
So far I've figure out that it seems to only happen in the town, and I'm pretty sure it's some part of update_stuff, redraw_stuff or window_stuff. I tried to look at everywhere it refers to the monster level or player depth to be sure it's not dividing by 0 and didn't find anywhere it did that.
Some things you might try looking at are monster generation in the town, and the day/night change. You have some good advice already, too.
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old May 21, 2009, 18:21   #6
zaimoni
Knight
 
zaimoni's Avatar
 
Join Date: Apr 2007
Posts: 590
zaimoni is on a distinguished road
Quote:
Originally Posted by will_asher View Post
I want to get DaJAngband 1.0.98 released, but I've introduced a crash bug somehow and I just can't figure out what's causing it. And I've been real stupid not to make backups of my code often. I'm getting really frustrated with this bug because I've been trying to figure it out for three days now.
So far I've figure out that it seems to only happen in the town, and I'm pretty sure it's some part of update_stuff, redraw_stuff or window_stuff. ....
around suspect recent pieces of my code, ....[/code]
My experience is that if my intuition of what pieces of code were suspect was working for a crash bug, then the crash bug wouldn't exist.

z-util.h declares plog. Once you have a save that reliably crashes on the very next move:
* saturate something that calls the suspect function with plog. I'd start with dungeon(), as otherwise I might have to move up the call graph when the suspect function always completes normally.
* note which plog is right before the crash. Something between that and the next one is calling the actual suspect.
* Once down to a single statement: remove the old plogs. If the target is another function call, saturate that function with plog ; otherwise, you've found the buggy statement....

For ISO console applications, you'd normally use printf instead of plog.
zaimoni is offline   Reply With Quote
Old May 21, 2009, 18:27   #7
PaulBlay
Knight
 
Join Date: Jan 2009
Posts: 657
PaulBlay is on a distinguished road
Quote:
Originally Posted by zaimoni View Post
z-util.h declares plog.
Where does plog dump its output? (In Windows, that is)

Personally I'd rather everything from \Angband stayed in \Angband (if you know what I mean) but I seem to recall it was in some folder off in
\Documents and Settings\[User Name] or something annoying like that.
__________________
Currently turning (Angband) Japanese.
PaulBlay is offline   Reply With Quote
Old May 21, 2009, 18:36   #8
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,947
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by PaulBlay View Post
Where does plog dump its output? (In Windows, that is)

Personally I'd rather everything from \Angband stayed in \Angband (if you know what I mean) but I seem to recall it was in some folder off in
\Documents and Settings\[User Name] or something annoying like that.
It goes to the screen in a message box (see main-win.c:4391).
__________________
takkaria whispers something about options. -more-
takkaria is offline   Reply With Quote
Old May 21, 2009, 18:39   #9
PaulBlay
Knight
 
Join Date: Jan 2009
Posts: 657
PaulBlay is on a distinguished road
Quote:
Originally Posted by takkaria View Post
It goes to the screen in a message box (see main-win.c:4391).
Thanks. I must have been thinking of an entirely different message logging thing.
__________________
Currently turning (Angband) Japanese.
PaulBlay is offline   Reply With Quote
Old May 21, 2009, 22:33   #10
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 927
Donated: $10
will_asher is on a distinguished road
When I try putting a bunch of plogs, it seems to crash in a different place each time.
I tried downloading gdb, but I can't figure out how to use it. There's no executible and the readme file says to type 'configure' then 'make' neither of which do anything. (Is there maybe a debugger that's easier to use?)
__________________
Will_Asher

Play DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home
will_asher 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
[FA] Crash Bug Zikke Variants 8 February 19, 2009 04:20
r1264 bug: crash at prompt (Windows) Colbey Vanilla 11 February 13, 2009 16:39
Entro crash Zikke Variants 2 February 2, 2009 20:08
Elemental attacks destroying inventory items - challenging or frustrating? hugorune Vanilla 24 January 28, 2009 08:23
YASD - the most frustrating death in the world Big Al AAR 13 February 2, 2008 18:31


All times are GMT +1. The time now is 23:45.


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