Strange crash with missing data

Posted by Zeno on Wed 25 Jun 2008 06:04 PM — 2 posts, 13,240 views.

USA #0
I haven't seen this in years. I thought it was fixed.

(gdb) bt
#0  0x00000000004d86a6 in get_trust (ch=0x20b8070) at handler.c:142
#1  0x0000000000404c86 in to_channel (argument=0x7fff92ed5af0 "Kyoshiro dropped &RA broken piece of ruby&d in room 4484.",
    channel=14, verb=0x5fc8ea "Surveillance", level=101) at act_comm.c:770
#2  0x0000000000436cf6 in do_drop (ch=0x20b91e0, argument=0x7fff92ed8078 "") at act_obj.c:1295
#3  0x00000000004ecd48 in interpret (ch=0x20b91e0, argument=0x7fff92ed8075 "all") at interp.c:598
#4  0x000000000049f49f in game_loop () at comm.c:1278
#5  0x000000000049e0ba in main (argc=2, argv=0x7fff92eda648) at comm.c:626


(gdb) f 3
#3  0x00000000004ecd48 in interpret (ch=0x20b91e0, argument=0x7fff92ed8075 "all") at interp.c:598
598         (*cmd->do_fun) ( ch, argument );
(gdb) p ch->name
$18 = 0x1fed960 "Kyoshiro"
(gdb) p ch->pcdata
$19 = (PC_DATA *) 0x20bf320
(gdb) f 2
#2  0x0000000000436cf6 in do_drop (ch=0x20b91e0, argument=0x7fff92ed8078 "") at act_obj.c:1295
1295                 to_channel( buf, CHANNEL_SURVEILLANCE, "Surveillance", LEVEL_IMMORTAL );
(gdb) p ch->name
$20 = 0x1fed960 "Kyoshiro"
(gdb) p ch->pcdata
$21 = (PC_DATA *) 0x20bf320
(gdb) f 1
#1  0x0000000000404c86 in to_channel (argument=0x7fff92ed5af0 "Kyoshiro dropped &RA broken piece of ruby&d in room 4484.",
    channel=14, verb=0x5fc8ea "Surveillance", level=101) at act_comm.c:770
770             if ( !IS_IMMORTAL(vch)
(gdb) list
765             och = d->original ? d->original : d->character;
766             vch = d->character;
767
768             if ( !och || !vch )
769               continue;
770             if ( !IS_IMMORTAL(vch)
771             || ( get_trust(vch) < sysdata.build_level && channel == CHANNEL_BUILD )
772             || ( get_trust(vch) < sysdata.log_level
773             && ( channel == CHANNEL_LOG ||  channel == CHANNEL_CONTACT ||channel == CHANNEL_COMM) ) )
774               continue;
(gdb) p vch->name
$22 = 0x0
(gdb) p d->character->name
$27 = 0x0
(gdb) p vch->pcdata
$23 = (PC_DATA *) 0x0

So it looks like here is where we had issues. What happened to the character data?

(gdb) f 0
#0  0x00000000004d86a6 in get_trust (ch=0x20b8070) at handler.c:142
142         if ( ch->desc && ch->desc->original )
(gdb) p ch
$24 = (CHAR_DATA *) 0x20b8070
(gdb) p ch->desc
$25 = (DESCRIPTOR_DATA *) 0x697261762065726f
(gdb) p ch->desc->original
Cannot access memory at address 0x697261762065728f
(gdb)

The crash was obviously due to the issue with original.

But the question is, how was it corrupted?

[EDIT] Oh, it doesn't look like Kyoshiro was the issue. It was looping through the descs in f1. So we had a corrupt desc...

Valgrind won't be catching this seeing as how it rarely happens.

Can I print all the desc's in gdb? I can do first_descriptor->next but I hit a null one at the 3rd one and can't do another ->next
Amended on Wed 25 Jun 2008 06:10 PM by Zeno
Australia Forum Administrator #1
Well my gdb post showed how you can iterate through a list (I did inventory I think) but if the list is corrupted, there isn't much you can do.