Caugh in a loop?

Posted by Zeno on Sat 13 Aug 2005 04:27 AM — 3 posts, 15,646 views.

USA #0
Well the MUD freezes (has happened twice), and I attach gdb to see this:
#0  0x00400402 in ?? ()
#1  0x00210826 in gettimeofday () from /lib/libc.so.6
#2  0x080e600f in start_timer (stime=0xbfa3eb04) at interp.c:1039
#3  0x080e5474 in interpret (ch=0x8f46150, argument=0xbfa3fb42 "") at interp.c:584
#4  0x0810a606 in mprog_do_command (cmnd=0xbfa40814 "  east", mob=0x8f46150, actor=0x8f477d0, obj=0x0, vo=0x0,
    rndm=0x8f477d0, ignore=0 '\0', ignore_ors=0 '\0') at mud_prog.c:2464
#5  0x0810a0dd in mprog_driver (
    com_list=0x8ece4c0 "if istransformed($n)\n\r  say ALIEN!!!\n\r  scream\n\r  west\n\r  east\n\r  south\n\r  north\n\rendif\n\r", mob=0x8f46150, actor=0x8f477d0, obj=0x0, vo=0x0, single_step=0 '\0') at mud_prog.c:2162
#6  0x0810ae14 in mprog_percent_check (mob=0x8f46150, actor=0x8f477d0, obj=0x0, vo=0x0, type=7) at mud_prog.c:2676
#7  0x0810b3d2 in mprog_greet_trigger (ch=0x8f477d0) at mud_prog.c:2929
#8  0x080615be in move_char (ch=0x8f477d0, pexit=0x8edd070, fall=0, running=0 '\0') at act_move.c:1351
#9  0x080617ef in do_east (ch=0x8f477d0, argument=0xbfa43575 "") at act_move.c:1389
#10 0x080e5486 in interpret (ch=0x8f477d0, argument=0xbfa43575 "") at interp.c:585
#11 0x080b8cd2 in game_loop () at comm.c:972
#12 0x080b8073 in main (argc=2, argv=0xbfa44ad4) at comm.c:340


[EDIT] Here's a better gdb:
#0  0x0810ac41 in mprog_wordlist_check (arg=0xbfa3fb42 "ALIEN!!! SOMEONE HELP ME!!!", mob=0x8f42b38, actor=0x8f44da0,
    obj=0x0, vo=0x0, type=1) at mud_prog.c:2626
#1  0x0810b546 in mprog_speech_trigger (txt=0xbfa3fb42 "ALIEN!!! SOMEONE HELP ME!!!", actor=0x8f44da0) at mud_prog.c:2983
#2  0x0804ba35 in do_say (ch=0x8f44da0, argument=0xbfa3fb42 "ALIEN!!! SOMEONE HELP ME!!!") at act_comm.c:1043
#3  0x080e5486 in interpret (ch=0x8f44da0, argument=0xbfa3fb42 "ALIEN!!! SOMEONE HELP ME!!!") at interp.c:585
#4  0x0810a606 in mprog_do_command (cmnd=0xbfa407f2 "  say ALIEN!!! SOMEONE HELP ME!!!", mob=0x8f44da0, actor=0x8f477d0,
    obj=0x0, vo=0x0, rndm=0x8f477d0, ignore=0 '\0', ignore_ors=0 '\0') at mud_prog.c:2464
#5  0x0810a0dd in mprog_driver (
    com_list=0x8ece770 "if istransformed($n)\n\r  say ALIEN!!! SOMEONE HELP ME!!!\n\r  scream\n\r  west\n\r  east\n\r  south\n\r  north\n\rendif\n\r", mob=0x8f44da0, actor=0x8f477d0, obj=0x0, vo=0x0, single_step=0 '\0') at mud_prog.c:2162
#6  0x0810ae14 in mprog_percent_check (mob=0x8f44da0, actor=0x8f477d0, obj=0x0, vo=0x0, type=7) at mud_prog.c:2676
#7  0x0810b3d2 in mprog_greet_trigger (ch=0x8f477d0) at mud_prog.c:2929
#8  0x080615be in move_char (ch=0x8f477d0, pexit=0x8edd070, fall=0, running=0 '\0') at act_move.c:1351
#9  0x080617ef in do_east (ch=0x8f477d0, argument=0xbfa43575 "") at act_move.c:1389
#10 0x080e5486 in interpret (ch=0x8f477d0, argument=0xbfa43575 "") at interp.c:585
#11 0x080b8cd2 in game_loop () at comm.c:972
#12 0x080b8073 in main (argc=2, argv=0xbfa44ad4) at comm.c:340


(gdb) f 0
#0  0x0810ac41 in mprog_wordlist_check (arg=0xbfa3fb42 "ALIEN!!! SOMEONE HELP ME!!!", mob=0x8f42b38, actor=0x8f44da0,
    obj=0x0, vo=0x0, type=1) at mud_prog.c:2626
2626            for ( i = 0; i < strlen( dupl ); i++ )


Both loops had the same gdb. I have no clue at all. Plus why is frame 0 "??"... The latest thing I added was qbits/abits.

Is it possible to cause a loop by a prog?

Here's the prog:
>greet_prog 100
if istransformed($n)
  say ALIEN!!! SOMEONE HELP ME!!!
  scream
  west
  east
  south
  north
endif


istransformed checks for a char flag.
Amended on Sat 13 Aug 2005 04:32 AM by Zeno
Canada #1
what is the value of dupl? Is it some rediculously high number? Only thing that pops out from this.
Amended on Sat 13 Aug 2005 05:29 AM by Greven
USA #2
If I'm not mistaken, a frame of ?? means you're in library code somewhere where gdb doesn't have access to the symbols. This is corroborated by the fact that you got to "??" from the gettimeofday library function.

Another thing to check about dupl is that it might be a bad pointer and so point to a very long sequence of bytes before reaching a null. This would lead to the ridiculously high number Greven mentioned.