Re: Problems (again) with stop_follower

From: Mathew Earle Reuther (graymere@zipcon.net)
Date: 10/04/02


Sorry for the self-reply, but I figured I'd send out a bit more info,
since I was digging through the archives for a while looking for past gdb
conversations. :)

***

Ok, back with more data on my problem from using the non-GUI interface
(sans core files, as I don't generate them).  Bear with me, I really have
never used gdb before, so I'm trying hard to get usable data.  I know that
doing a bt is good, so I started with that and continued on giving
commands that I saw requested before:

Program received signal SIGSEGV, Segmentation fault.
0x004d4cc8 in stop_follower (ch=0x10274e18) at utils.c:448
448       if (ch->master->followers->follower == ch) {  /* Head of
follower-list
? */
(gdb) bt
#0  0x004d4cc8 in stop_follower (ch=0x10274e18) at utils.c:448
#1  0x004d4d70 in die_follower (ch=0x10274e18) at utils.c:485
#2  0x004910f6 in extract_char_final (ch=0x10274e18) at handler.c:977
#3  0x004914c1 in extract_pending_chars () at handler.c:1134
#4  0x00444ed9 in heartbeat (heart_pulse=120) at comm.c:883
#5  0x00444cdd in game_loop (mother_desc=3) at comm.c:815
#6  0x00443df9 in init_game (port=4000) at comm.c:386
#7  0x00443c17 in main (argc=1, argv=0x100314f8) at comm.c:331
#8  0x61005b8e in _libkernel32_a_iname ()
#9  0x61005e2c in _libkernel32_a_iname ()
#10 0x0052c232 in cygwin_crt0 ()
#11 0x0040103c in mainCRTStartup ()
#12 0x77e992a6 in _libkernel32_a_iname ()
(gdb) l
443         act("You stop following $N.", FALSE, ch, 0, ch->master,
TO_CHAR);
444         act("$n stops following $N.", TRUE, ch, 0, ch->master,
TO_NOTVICT);
445         act("$n stops following you.", TRUE, ch, 0, ch->master,
TO_VICT);
446       }
447
448       if (ch->master->followers->follower == ch) {  /* Head of
follower-list ? */
449         k = ch->master->followers;
450         ch->master->followers = k->next;
451         free(k);
452       } else {                      /* locate follower who is not head
of list */
(gdb) frame 1
#1  0x004d4d70 in die_follower (ch=0x10274e18) at utils.c:485
485         stop_follower(ch);
(gdb) l
480     void die_follower(struct char_data *ch)
481     {
482       struct follow_type *j, *k;
483
484       if (ch->master)
485         stop_follower(ch);
486
487       for (k = ch->followers; k; k = j) {
488         j = k->next;
489         stop_follower(k->follower);
(gdb) frame 2
#2  0x004910f6 in extract_char_final (ch=0x10274e18) at handler.c:977
977         die_follower(ch);
(gdb) l
972       }
973
974       /* On with the character's assets... */
975
976       if (ch->followers || ch->master)
977         die_follower(ch);
978
979       if (RIDING(ch) || RIDDEN_BY(ch))
980         dismount_char(ch);
981
(gdb) frame 3
#3  0x004914c1 in extract_pending_chars () at handler.c:1134
1134        extract_char_final(vict);
(gdb) l
1129          /* Last non-free'd character to continue chain from. */
1130          prev_vict = vict;
1131          continue;
1132        }
1133
1134        extract_char_final(vict);
1135        extractions_pending--;
1136
1137        if (prev_vict)
1138          prev_vict->next = next_vict;

So, there's what appears to be a listing of each of the function calls in
this ugly chain.  Plus a bunch of numbers of which I'm not sure of their
meaning. :)  Welcor had mentioned something about a "dereferenced null"
when I posted about this the last time.  I'm not sure what that means, all
I know is that these pieces of code which are having a problem are stock
circle which I've never touched, so I don't really have much to go on.
I'm assuming that they're not written to handle some of the other things
I've changed in my code and thus are having a problem now.  I'm betting,
as I said, on it being related to combat occurring between NPCs.  The
stock areas are written in a manner which will cause some fighting (which
is definitely good for testing this, right?), and until I get a lot more
of my engine done, I'm using the stock areas to test.

If anyone has some suggestions of extra checks to throw in, or ways to
prevent this ugliness from happening, please let me know.  Also, any
additional commands you want me to run from gdb, I'll be happy to.

-Mathew

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT