This gdb results kinda has me baffled. Any help would be appreciated. Only happens once in a blue moon, so not easy to reproduce with Valgrind.
Program terminated with signal 11, Segmentation fault. #0 0x0000000000492644 in act (AType=18, format=0x582c17 "$n has entered the game.", ch=0x1060df0, arg1=0x0, arg2=0x0, type=5) at comm.c:4117 4117 if(HAS_PROG(to->in_room, ACT_PROG)) (gdb) bt #0 0x0000000000492644 in act (AType=18, format=0x582c17 "$n has entered the game.", ch=0x1060df0, arg1=0x0, arg2=0x0, type=5) at comm.c:4117 #1 0x00000000004978e4 in nanny (d=0x130e040, argument=0x7fff2f598581 "") at comm.c:3464 #2 0x0000000000498641 in game_loop () at comm.c:1309 #3 0x000000000049ac32 in main (argc=<value optimized out>, argv=<value optimized out>) at comm.c:874 (gdb) frame 0 #0 0x0000000000492644 in act (AType=18, format=0x582c17 "$n has entered the game.", ch=0x1060df0, arg1=0x0, arg2=0x0, type=5) at comm.c:4117 4117 if(HAS_PROG(to->in_room, ACT_PROG)) (gdb) frame 1 #1 0x00000000004978e4 in nanny (d=0x130e040, argument=0x7fff2f598581 "") at comm.c:3464 3464 act(AT_ACTION, "$n has entered the game.", ch, NULL, NULL, TO_CANSEE); (gdb) frame 2 #2 0x0000000000498641 in game_loop () at comm.c:1309 1309 nanny(d, cmdline);
I'm not all that sure, but it looks like you might have some null values being passes. if I'm not mistaken 0x0 is NULL. Although, At 1:30 in the morning, having been up since 8 AM with a migraine, I wouldn't be surprised if I was wrong though.
The problem is 'to->room' , to is an invalid pointer.
Or room is the invalid pointer. Best way to find out, Vlad, is to use gdb's 'print' command. "print to" will show the value, and if that shows as valid data, try "print to->in_room"
Well checking what you guys wrote today, and trying gdb, I found there was a different crash today…. However, it involved the to->room thing again.
#0 0x0000000000492644 in act (AType=18, format=0x582c17 "a class: ", ch=0x1060df0, arg1=0x0, arg2=0x0, type=5) at comm.c:4119 4119 for(to_obj = to->in_room->first_content; to_obj; to_obj = to_obj->next_content) (gdb) bt #0 0x0000000000492644 in act (AType=18, format=0x582c17 "a class: ", ch=0x1060df0, arg1=0x0, arg2=0x0, type=5) at comm.c:4119 #1 0x00000000004978e4 in nanny (d=0x130e040, argument=0x7fff2f598581 "") at comm.c:3469 #2 0x0000000000498641 in game_loop () at comm.c:1316 #3 0x000000000049ac32 in main (argc=<value optimized out>, argv=<value optimized out>) at comm.c:908 (gdb) frame 0 #0 0x0000000000492644 in act (AType=18, format=0x582c17 "a class: ", ch=0x1060df0, arg1=0x0, arg2=0x0, type=5) at comm.c:4119 4119 for(to_obj = to->in_room->first_content; to_obj; to_obj = to_obj->next_content) (gdb) print to $1 = (CHAR_DATA *) 0x12fe320 (gdb) print to->in_room $2 = (ROOM_INDEX_DATA *) 0x0 (gdb)
I guess to->in_room is an invalid pointer then? I'm not sure how to fix that or why to->in_room would be invalid. I think it's wrapped into the code in piles of functions. What would be the best way to handle this?
No char_from_room before that in Nanny function, but… Smaugfuss doesn't have it either, so I didn't think that was the problem. Furthermore, what is boggling me is it wasn't just has entered the game that caused a crash, if you look up a few posts you'll see I had another post on to->in_room with a different function.
08 Nov, 2007, David Haley wrote in the 11th comment:
Votes: 0
Well it seems like one way or another your room lists have gotten corrupted; if you can, I would go look at the changes you made recently. (Are you using version control? :smile:) And if it's hard to run it in Valgrind, well, it might be worth it to just try and see what happens, and just run it for a while. Not a lot of time now, will write more later probably.
What do all these redirects mean when valgrind is running?
Thu Nov 8 16:25:46 2007 :: 6 Dragons ready at address crondonia.arthmoor.com on port 4000. –15754– REDIR: 0x37AFE78440 (memset) redirected to 0x4A06A20 (memset) Thu Nov 8 16:25:47 2007 :: IMC: Standard Authentication completed. Thu Nov 8 16:25:47 2007 :: IMC: Connected to Server02. Network ID: MudBytes –15754– REDIR: 0x37AFE73C70 (realloc) redirected to 0x4A059C5 (realloc) Thu Nov 8 16:26:19 2007 :: Preloading player data for: Muxa Thu Nov 8 16:26:21 2007 :: Loading player data for Muxa (8K) Thu Nov 8 16:26:21 2007 :: Muxa@12.345.678.910 has connected. –15754– REDIR: 0x37AFE77330 (strncat) redirected to 0x4A070E0 (strncat)
09 Nov, 2007, David Haley wrote in the 13th comment:
Votes: 0
I suspect that Valgrind is intercepting calls to certain library functions and using its own (esp. for the memory functions), but I'm not sure. Either way, I think it's harmless.
Well checking what you guys wrote today, and trying gdb, I found there was a different crash today…. However, it involved the to->room thing again.
#0 0x0000000000492644 in act (AType=18, format=0x582c17 "a class: ", ch=0x1060df0, arg1=0x0, arg2=0x0, type=5) at comm.c:4119 4119 for(to_obj = to->in_room->first_content; to_obj; to_obj = to_obj->next_content) (gdb) bt #0 0x0000000000492644 in act (AType=18, format=0x582c17 "a class: ", ch=0x1060df0, arg1=0x0, arg2=0x0, type=5) at comm.c:4119 #1 0x00000000004978e4 in nanny (d=0x130e040, argument=0x7fff2f598581 "") at comm.c:3469 #2 0x0000000000498641 in game_loop () at comm.c:1316 #3 0x000000000049ac32 in main (argc=<value optimized out>, argv=<value optimized out>) at comm.c:908 (gdb) frame 0 #0 0x0000000000492644 in act (AType=18, format=0x582c17 "a class: ", ch=0x1060df0, arg1=0x0, arg2=0x0, type=5) at comm.c:4119 4119 for(to_obj = to->in_room->first_content; to_obj; to_obj = to_obj->next_content) (gdb) print to $1 = (CHAR_DATA *) 0x12fe320 (gdb) print to->in_room $2 = (ROOM_INDEX_DATA *) 0x0 (gdb)
I guess to->in_room is an invalid pointer then? I'm not sure how to fix that or why to->in_room would be invalid. I think it's wrapped into the code in piles of functions. What would be the best way to handle this?
Vladaar
This backtrace is crashing in a different spot. Also, the 'to' variable isn't represented by the 'ch' passed to it. 'to' are the people it's sending the message to. Find out who it's crashing on. Next time, 'print to->name' and see what it shows you.
Program terminated with signal 11, Segmentation fault.
#0 0x0000000000492644 in act (AType=18, format=0x582c17 "$n has entered the game.", ch=0x1060df0, arg1=0x0, arg2=0x0,
type=5) at comm.c:4117
4117 if(HAS_PROG(to->in_room, ACT_PROG))
(gdb) bt
#0 0x0000000000492644 in act (AType=18, format=0x582c17 "$n has entered the game.", ch=0x1060df0, arg1=0x0, arg2=0x0,
type=5) at comm.c:4117
#1 0x00000000004978e4 in nanny (d=0x130e040, argument=0x7fff2f598581 "") at comm.c:3464
#2 0x0000000000498641 in game_loop () at comm.c:1309
#3 0x000000000049ac32 in main (argc=<value optimized out>, argv=<value optimized out>) at comm.c:874
(gdb) frame 0
#0 0x0000000000492644 in act (AType=18, format=0x582c17 "$n has entered the game.", ch=0x1060df0, arg1=0x0, arg2=0x0,
type=5) at comm.c:4117
4117 if(HAS_PROG(to->in_room, ACT_PROG))
(gdb) frame 1
#1 0x00000000004978e4 in nanny (d=0x130e040, argument=0x7fff2f598581 "") at comm.c:3464
3464 act(AT_ACTION, "$n has entered the game.", ch, NULL, NULL, TO_CANSEE);
(gdb) frame 2
#2 0x0000000000498641 in game_loop () at comm.c:1309
1309 nanny(d, cmdline);