eww stuck

Posted by Rob Harper on Mon 22 Dec 2003 09:36 AM — 5 posts, 18,348 views.

#0
ahh, hey again, seems whenever I type mstat self the mud crashes..cant figure this out....

when I gdb I get this.

Core was generated by `smaug'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libcrypt.so.2...done.
Reading symbols from /usr/lib/libc.so.4...done.
Reading symbols from /usr/libexec/ld-elf.so.1...done.
#0 0x28235528 in strcat () from /usr/lib/libc.so.4
(gdb) bt
#0 0x28235528 in strcat () from /usr/lib/libc.so.4
#1 0x81acbc0 in buf.22 ()
#2 0x8069993 in do_mstat (ch=0x8272c00, argument=0xbfbff6ce "self")
at act_wiz.c:2066
#3 0x80d22be in interpret (ch=0x8272c00, argument=0xbfbff6ce "self")
at interp.c:732
#4 0x809f600 in game_loop () at comm.c:638
#5 0x809ee2c in main (argc=2, argv=0xbfbffbdc) at comm.c:289
(gdb)



At act_wiz.c line 2066 I have this,

pager_printf_color( ch, "&cTimerRecentfight: &R%d\n\r",
get_timer( victim, TIMER_RECENTFIGHT ) );
if ( get_timer( victim, TIMER_ASUPRESSED ) )
pager_printf_color( ch, "&cTimerAsupressed: &R%d\n\r",
get_timer( victim, TIMER_ASUPRESSED ) );
if ( IS_NPC( victim ) )
pager_printf_color( ch, "&cAct Flags : &w%s\n\r", ext_flag_string(&victim->act, act_flags) );
else
{
pager_printf_color( ch, "&cPlayerFlags: &w%s\n\r", ext_flag_string( &victim->act, plr_flags ) );
pager_printf_color( ch, "&cPcflags : &w%s\n\r", flag_string( victim->pcdata->flags, pc_flags ) );
if ( victim->pcdata->nuisance )
{


I dont see anything out of the odinary there any ideas?



Thanks rob
USA #1
Well, I'm looking at these lines:
pager_printf_color( ch, "&cAct Flags : &w%s\n\r", ext_flag_string(&victim->act, act_flags) );
else
{
pager_printf_color( ch, "&cPlayerFlags: &w%s\n\r", ext_flag_string( &victim->act, plr_flags ) );
pager_printf_color( ch, "&cPcflags : &w%s\n\r", flag_string( victim->pcdata->flags, pc_flags ) );


I can't help but see that the first two, victim->act, are taking the address of the flag... (that's what the & is doing), whereas the second one is just taking the flag itself (as I believe it should be doing.) Both flags are just ints (or perhaps long longs) but in any case I see no reason to dereference it. Unless, of course, your ext_flag_string function needs a pointer or something? But why would it want a pointer?

Other than that, I don't really see anything that catches my eye. It's odd because the problem comes from strcat, with "buf.22" in the middle - what's buf.22? Which line exactly in those you gave is the trouble line?
USA #2
ext_flag_string is supposed to take the address as its first argument. Those 3 lines are all correct.

I don't see anything wrong with the code shown here, but perhaps one of the flags has no corresponding entry in the text arrays that the flag_string functions call from? Check to be sure that any recently added flags have entries in build.c that match them in the text arrays.
#3
Ahh thanks I'll check into that, I have added more then a few flags lately.
#4
Thanks guys, samson you were right I neglected to add the flags counter parts.