#exult@irc.freenode.net logs for 14 Dec 2010 (GMT)

Archive Today Yesterday Tomorrow
Exult homepage


[01:08:52] <-- Dominus has left IRC (Quit: Leaving.)
[03:42:37] <-- Malignant_Manor has left IRC (Quit: ChatZilla 0.9.86 [Firefox 3.6.13/20101203075014])
[04:42:49] <-- Kirben has left IRC (Ping timeout: 276 seconds)
[04:45:22] <-- shazza has left IRC (*.net *.split)
[04:45:22] <-- RadoS has left IRC (*.net *.split)
[04:45:23] <-- Sevalecan has left IRC (*.net *.split)
[04:45:24] <-- ettin has left IRC (*.net *.split)
[04:45:25] <-- wjp has left IRC (*.net *.split)
[04:45:26] <-- Colourless has left IRC (*.net *.split)
[04:45:26] <-- ParuCodex has left IRC (*.net *.split)
[04:45:27] <-- Rottingbeef has left IRC (*.net *.split)
[04:45:27] <-- Morde has left IRC (*.net *.split)
[04:45:27] <-- servus has left IRC (*.net *.split)
[04:45:27] <-- Dark-Star has left IRC (*.net *.split)
[04:53:37] --> ettin has joined #exult
[04:53:37] --> Sevalecan has joined #exult
[04:54:20] --> shazza has joined #exult
[04:55:14] --> Kirben_ has joined #exult
[04:55:14] --> Dark-Star has joined #exult
[04:55:39] --> RadoS has joined #exult
[04:55:45] --> Rottingbeef has joined #exult
[04:55:45] --> ParuCodex has joined #exult
[04:55:45] --> Morde has joined #exult
[04:55:45] --> servus has joined #exult
[04:55:45] --> Colourless has joined #exult
[04:55:45] --> wjp has joined #exult
[04:57:22] <-- wjp has left IRC (*.net *.split)
[04:57:24] <-- Colourless has left IRC (*.net *.split)
[04:57:24] <-- ParuCodex has left IRC (*.net *.split)
[04:57:26] <-- Rottingbeef has left IRC (*.net *.split)
[04:57:26] <-- Morde has left IRC (*.net *.split)
[04:57:26] <-- servus has left IRC (*.net *.split)
[04:58:33] --> Rottingbeef has joined #exult
[04:58:33] --> ParuCodex has joined #exult
[04:58:33] --> Morde has joined #exult
[04:58:33] --> servus has joined #exult
[04:58:33] --> Colourless has joined #exult
[04:58:33] --> wjp has joined #exult
[06:10:18] <-- shazza has left IRC (*.net *.split)
[06:10:50] --> shazza has joined #exult
[06:54:14] <-- Rottingbeef has left IRC ()
[06:54:56] --- Kirben_ is now known as Kirben
[07:18:49] <-- shazza has left IRC ()
[07:43:32] --> Rottingbeef has joined #exult
[08:46:13] <-- Sevalecan has left IRC (Ping timeout: 272 seconds)
[08:53:01] --> Sevalecan has joined #exult
[09:17:30] --> SiENcE has joined #exult
[10:02:23] --> Dominus has joined #exult
[10:02:23] --- ChanServ gives channel operator status to Dominus
[11:02:22] --> Dominus1 has joined #exult
[11:03:33] <-- Dominus has left IRC (Ping timeout: 250 seconds)
[11:07:55] --- Dominus1 is now known as Dominus
[11:07:56] --- ChanServ gives channel operator status to Dominus
[12:36:25] <-- Kirben has left IRC ()
[17:11:55] <-- servus has left IRC (Ping timeout: 245 seconds)
[17:15:05] <-- SiENcE has left IRC (Quit: @all: cya)
[17:45:10] --> servus has joined #exult
[18:54:35] --> Marzo has joined #exult
[19:35:26] --> Malignant_Manor has joined #exult
[21:17:52] <Dominus> wjp, any pointers on how to work with valgrind? We have an endless combat loop identified but when I try to run it with valgrind Exult slows down to a degree that the loop doesn't trigger :)
[21:19:13] <Malignant_Manor> Why the heck would the original game have training people target themselves?
[21:20:11] <Dominus> is this what is causing the in-party fight after training?
[21:20:38] <Malignant_Manor> Yes
[21:22:15] <Dominus> but if I remember correctly from testing the original that somehow didn't happen (the in party fight)
[21:28:38] * Dominus guesses that wjp is much more busy in evenings these days... he usually has a much higher reaction time :)
[22:18:58] --> Kirben has joined #exult
[22:18:58] --- ChanServ gives channel operator status to Kirben
[22:32:18] <wjp> Dominus: sometimes :-)
[22:32:33] <Dominus> hi :)
[22:35:08] <wjp> valgrind is not the first tool I'd try with infinite loops
[22:35:34] <wjp> I'd try a regular debugger first and see where it's looping
[22:35:56] <wjp> valgrind is more for the "weird" semi-random stuff
[22:36:05] <Dominus> ok
[22:36:54] <Dominus> with gdb *nothing* happens until I stop the exult process and then the bt shows kind of random reasons
[22:38:02] <wjp> what I usually do for infinite loops is get a few backtraces (i.e., bt, cont, ctrl-c, bt, cont, ctrl-c, ...) and see what the lowest function they have in common is, and then see if it's looping in there
[22:38:05] <Dominus> http://sourceforge.net/tracker/?func=detail&aid=3131920&group_id=2335&atid=102335 is the bug report and two bt
[22:39:00] <wjp> if you're lucky it's a simple loop in Exult; if you're unlucky it's a more complex loop involving scripts and such
[22:39:24] <Dominus> hmm, I can try that - up to now I've always been more or less been guided by your when it invloved more than typing bt
[22:39:47] <wjp> sf still loading...
[22:40:09] <Dominus> now that I can more or less trigger everytime I might be able to do that with a couple of bt
[22:41:12] <wjp> you should do the bt's in the same infinite loop
[22:41:20] <wjp> without restarting or anything
[22:41:56] <wjp> "cont[inue]" resumes running exult if you're in gdb after a ctrl-c
[22:42:48] <wjp> oh, how do you "stop the exult process"? Pressing ctrl-c in gdb is probably best
[22:43:43] <Dominus> ah... I've stopped it outside of gdb (really need to read up on gdb it seems - you normally gave me all the commands :))
[22:44:11] <Dominus> two bt http://pastebin.com/Sbxmi5PL http://pastebin.com/YkMF6u8z
[22:44:49] <Dominus> they pretty much meet at chunks.cc:792 and follow the same path downwards
[22:45:41] <wjp> right; those two are both in Game_object::compare
[22:46:49] <Dominus> but those two are not from the way you described to do it, these are the old ones when I stopped exult from outside gdb
[22:47:36] <wjp> that function doesn't seem to have a loop, though, but the parent Map_chunk::add_dependencies does
[22:47:56] <wjp> do you want to try some gdb now, or some other time? (It's getting late-ish)
[22:48:29] <Dominus> if it's getting to late for you, we can do this some other time
[22:48:41] <Dominus> I'll try this now a bit and will add to the bug report
[22:48:53] <wjp> I'll still be around for a little while
[22:49:09] <Dominus> ok, then I'll post my progress here
[22:49:11] <Dominus> :)
[22:55:16] <Dominus> grr, need to recompile, my debug bnary and the o files were not in sync anymore...
[22:55:29] <Dominus> ok, here we go
[22:57:45] <Dominus> all the bt point at objs.cc:1397
[22:57:55] <Dominus> doing one more and then pastebin them
[22:58:59] <Dominus> http://pastebin.com/CtA1wWSq
[22:59:29] <wjp> ok, next step :-)
[23:00:01] <wjp> are you still in this same location, or did you already continue in gdb?
[23:00:18] <Dominus> I'm still in this last bt there
[23:00:25] <wjp> ok
[23:00:36] <wjp> do:
[23:00:37] <wjp> frame 2
[23:00:38] <wjp> finish
[23:01:04] <Dominus> Run till exit from #2 0x00000001002a68b9 in Map_chunk::add_dependencies (this=0x112873eb0, newobj=0x1168f7ce0, newinfo=@0x7fff5fbfe190) at chunks.cc:792
[23:01:38] <wjp> hm, that was #3 in that paste
[23:01:42] <Dominus> (frame 2 gives #2 0x00000001002a68b9 in Map_chunk::add_dependencies (this=0x112873eb0, newobj=0x1168f7ce0, newinfo=@0x7fff5fbfe190) at chunks.cc:792
[23:01:43] <Dominus> 792 int newcmp = Game_object::compare(newinfo, obj);
[23:01:58] <wjp> does it run now or did it give another prompt?
[23:02:20] <Dominus> "runs" (frozen)
[23:02:32] <wjp> ok, so it's looping inside add_dependencies
[23:02:33] <Dominus> actually I have a prompt
[23:02:40] <wjp> oh?
[23:02:55] <Dominus> nah, not a real prompt
[23:03:34] <Dominus> in the terminal I can type but I'm not at the Real gdb prompt
[23:03:47] <wjp> ok
[23:04:02] <Dominus> so it seems to continue with it endless loop
[23:04:17] <wjp> "finish" means: run until you return from this function
[23:04:34] <wjp> so if it doesn't give a prompt, it doesn't return from this function, so it's looping in here
[23:04:39] <wjp> ctrl-c it again
[23:04:54] <Dominus> k, bt?
[23:05:19] <wjp> is #0 Game_object::compare now?
[23:05:49] <wjp> (i.e., does it say 'in Game_object::compare' directly after hitting ctrl-c?)
[23:06:07] <Dominus> no it did say Program received signal SIGINT, Interrupt.
[23:06:08] <Dominus> Ordering_info::init (this=0x7fff5fbfdfe0, obj=0x1168f7ce0) at ordinfo.h:46
[23:06:08] <Dominus> 46 int frnum = obj->get_framenum();
[23:07:00] <wjp> ok, do 'up' twice
[23:07:19] <wjp> then it should
[23:07:41] <Dominus> I did a bt already. bad?
[23:07:53] <Dominus> and up you mean arrow up or typed up?
[23:08:16] <wjp> bt's don't "do" anything, so that doesn't matter
[23:08:19] <wjp> "up"
[23:08:37] <wjp> (the word, not the arrow)
[23:08:53] <Dominus> ok, yes game object::compare now
[23:09:16] <wjp> now "finish" again
[23:09:37] <Dominus> Run till exit from #2 0x00000001002b927c in Game_object::compare (inf1=@0x7fff5fbfe190, obj2=0x1168f7ce0) at objs.cc:1397
[23:09:38] <Dominus> 0x00000001002a68b9 in Map_chunk::add_dependencies (this=0x112873eb0, newobj=0x1168f7ce0, newinfo=@0x7fff5fbfe190) at chunks.cc:792
[23:09:38] <Dominus> 792 int newcmp = Game_object::compare(newinfo, obj);
[23:09:38] <Dominus> Value returned is $1 = 0
[23:09:41] <Dominus> and got a prompt
[23:10:31] <wjp> ok
[23:11:00] <wjp> so the infinite loop is really in Map::add_dependencies
[23:11:45] <wjp> can you do a 'print *obj' ?
[23:12:09] <Dominus> in gdb?
[23:12:29] * wjp nods
[23:13:18] <Dominus> http://pastebin.com/YhYymKDA
[23:14:10] <wjp> BG or SI?
[23:14:39] <Dominus> that's SI (and actually SI fixes)
[23:15:08] <wjp> so this is Iolo
[23:16:06] <wjp> and "print *newobj" ?
[23:16:18] <Dominus> yes, I've thpought it is him, the loop seemed to be triggered on him I hought
[23:16:59] <Dominus> http://pastebin.com/jreJ1Tmz
[23:17:07] <wjp> also Iolo
[23:17:08] <wjp> hmm
[23:17:37] <wjp> can you do "next" a few times until you're at line 792 again?
[23:18:21] <Dominus> hmm, I'm going down, first next brought me to 793, then 794
[23:18:34] <wjp> you're following program execution now
[23:18:43] <wjp> so down is the natural direction :-)
[23:18:51] <Dominus> oh, until it lops to 792 again...
[23:19:04] <wjp> the infinite loop in action :-)
[23:19:10] <Dominus> ok, back at it
[23:19:21] <wjp> another "print *obj"?
[23:19:30] <wjp> or actually just check if shapenum = 465 again
[23:19:32] <Dominus> looped from 799 to 788
[23:19:41] <wjp> that sounds right
[23:19:56] <Dominus> yes 465
[23:20:25] <wjp> ok, so that's pretty screwed up
[23:20:47] <wjp> it should be looping over all objects in the chunk here, but it's stuck on Iolo
[23:21:54] <wjp> so "print obj" and "print obj->next" should both return the same?
[23:22:39] <Dominus> yes
[23:23:33] <wjp> ok, enough gdb for now
[23:24:04] <wjp> time for some assert()s
[23:24:16] <wjp> in objs/objlist.h
[23:24:48] <wjp> there are a number of lines that look like "X->next = Y;", for some X and Y
[23:25:16] <wjp> the reason for the infinite loop is that obj->next was equal to obj, so we can add an assert() to check and trigger when that happens
[23:25:43] <Dominus> yes (following)
[23:26:01] <wjp> hm
[23:27:22] <wjp> except that it's a bit annoying that that's valid if there's only one object
[23:28:02] <wjp> ah, but that's easy to work around
[23:28:06] <wjp> ok, so :-)
[23:28:19] <wjp> line 85: nobj->next = first;
[23:28:34] <wjp> before that, add a "assert(nobj != first);"
[23:28:50] <Dominus> k
[23:29:01] <Dominus> all?
[23:29:04] <wjp> and a "assert(first->prev != nobj);"
[23:29:18] <wjp> line 99 (then): nobj->next = before;
[23:29:47] <wjp> before that, add "assert(nobj != before);" and "assert(before->prev != nobj);"
[23:30:16] <Dominus> k
[23:30:21] <wjp> then recompile and try to trigger the loop again
[23:30:32] <wjp> _hopefully_ this assert will trigger just before that
[23:30:39] <wjp> (oh, and run it in gdb :-) )
[23:31:12] <Dominus> oh, that's pulling in a lot to recompile...
[23:31:16] * Dominus waits
[23:32:32] <Dominus> ok, on 2nd try it triggered again
[23:32:52] <wjp> the assert?
[23:33:01] <Dominus> th eone in line 99
[23:33:12] <Dominus> assert(nobj != before);
[23:33:21] <wjp> ok, excellent
[23:33:22] <wjp> bt?
[23:33:45] <Dominus> http://pastebin.com/j2tWzge9
[23:35:33] <wjp> hmmm
[23:36:26] * Dominus is always worried when wjp does the "hmmm" <- makes the sound you don't want to hear the doctor make
[23:37:30] <wjp> hmmmmmmm
[23:38:30] * Dominus likes the "ah" sound more
[23:39:34] <wjp> time to call it a day I'm afraid
[23:39:45] <Dominus> ok
[23:39:56] <wjp> oh, are you still in gdb? one last thing
[23:40:02] <Dominus> yes
[23:40:25] <wjp> "up" until you reach Map_chunk::add
[23:40:44] <wjp> and then "print objects.get_first()" and "print first_nonflat"
[23:41:07] <wjp> and "print newobj" and "print newobj->shapenum"
[23:42:08] <Dominus> $1 = (Game_object *) 0x118d96200
[23:42:17] <Dominus> $2 = (Game_object *) 0x1168c7d60
[23:42:24] <Dominus> $3 = (Game_object *) 0x1168c7d60
[23:42:32] <Dominus> $4 = 465
[23:44:28] <wjp> and "print newobj->chunk" and "print this" ?
[23:44:39] <wjp> and then it's either "ah" or bedtime :-)
[23:44:58] <Dominus> $5 = (Map_chunk *) 0x116675b30
[23:45:10] <Dominus> $6 = (Map_chunk * const) 0x116675b30
[23:46:04] <wjp> oh, wait, that wasn't surprising
[23:46:25] <wjp> it has reset newobj->chunk already anyway here
[23:48:09] <wjp> one more assert, to start from next time: at the start of Map_chunk:add (chunks.cc line 837) add "assert(newobj->chunk != this);" (right before "newobj->chunk = this;")
[23:49:16] <Dominus> ok
[23:49:26] <Dominus> but I guess you go to bed now?
[23:50:54] <Dominus> the one in objslit.h triggewrs first
[23:51:01] <Dominus> or should I get trid of those
[23:51:03] <wjp> oh?
[23:51:11] <wjp> that's interesting
[23:51:47] <Dominus> (and I checked I *did* make the change before recompiling :))
[23:52:27] <wjp> one more assert for that same location: "assert(!first_nonflat || first_nonflat->chunk == this);"
[23:52:39] <wjp> (order of the two asserts doesn't matter)
[23:53:49] <Dominus> that one triggered it
[23:54:09] <Dominus> http://pastebin.com/sq2c5YmM
[23:54:21] <wjp> aha
[23:54:53] <wjp> now how did that happen...
[23:55:15] <wjp> but I'm really leaving now :-)
[23:55:18] <wjp> good night
[23:55:26] <Dominus> good night
[23:55:40] <Dominus> (I'll try to trigger it in "real" SI in the meantime)
[23:55:55] <Dominus> thanks so far