Program received signal SIGSEGV, Segmentation fault.
get_obj_number (obj=0x6f20626f) at handler.c:3588
3588 if (obj->item_type == ITEM_CONTAINER || obj->item_type == ITEM_MONEY
(gdb) bt
#0 get_obj_number (obj=0x6f20626f) at handler.c:3588
#1 0x080d86b1 in get_obj_number (obj=0x6f20626f) at handler.c:3595
#2 0x080d6d80 in obj_to_char (obj=0xb6f04348, ch=0xb6f00894) at handler.c:2423
#3 0x08082071 in do_oload (ch=0xb6f00894, argument=0xb6f00800 "") at act_wiz.c:3291
#4 0x080e2eeb in do_function (ch=0xb6f00800, do_fun=0x8081e5a <do_oload>, argument=0xb6f00800 "") at interp.c:922
#5 0x08081cc6 in do_load (ch=0xb6f00894, argument=0xbf9068e9 "305") at act_wiz.c:3197
#6 0x080e2eba in interpret (ch=0xb6f00894, argument=0xbf9068e5 "obj 305") at interp.c:907
#7 0x0810faed in redit (ch=0xb6f00894, argument=0xb6efc02a "obj 305") at olc.c:684
#8 0x0810f0b6 in run_olc_editor (d=0xb6f00800) at olc.c:50
#9 0x0809cb7d in game_loop_unix (control=7) at comm.c:873
#10 0x0809c68d in main (argc=2, argv=0xbf908694) at comm.c:464
/*
* Return # of objects which an object counts as.
* Thanks to Tony Chamberlain for the correct recursive code here.
*/
int get_obj_number( OBJ_DATA *obj )
{
int number;
if (obj->item_type == ITEM_CONTAINER || obj->item_type == ITEM_MONEY
|| obj->item_type == ITEM_GEM || obj->item_type == ITEM_JEWELRY)
number = 0;
else
number = 1;
for ( obj = obj->contains; obj != NULL; obj = obj->next_content )
number += get_obj_number( obj );
return number;
}
Thu Mar 27 19:53:56 2008 :: Log Diablos: load obj 300
==18131==
==18131== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==18131== Access not within mapped region at address 0x6E612067
==18131== at 0x80D7B6A: extract_obj (handler.c:3000)
==18131== by 0x8082119: do_purge (act_wiz.c:3327)
==18131== by 0x80E2EB9: interpret (interp.c:907)
==18131== by 0x805EB88: substitute_alias (act_info.c:6424)
==18131== by 0x809CB92: game_loop_unix (comm.c:874)
==18131== by 0x809C68C: main (comm.c:464)
==18131==
==18131== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Segmentation fault
Thu Mar 27 19:55:12 2008 :: Loading Ssolvarain.
==21652==
==21652== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==21652== Access not within mapped region at address 0x6E6120AB
==21652== at 0x80D8672: get_obj_number (handler.c:3588)
==21652== by 0x80D86B0: get_obj_number (handler.c:3595)
==21652== by 0x80D6D7F: obj_to_char (handler.c:2423)
==21652== by 0x813AA3D: fread_obj (save.c:2437)
==21652== by 0x8136315: load_char_obj (save.c:824)
==21652== by 0x809F157: nanny (comm.c:2140)
==21652== by 0x809CBA6: game_loop_unix (comm.c:877)
==21652== by 0x809C68C: main (comm.c:464)
==21652==
==21652== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Segmentation fault
==25812== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==25812== Access not within mapped region at address 0x5420202E
==25812== at 0x8182989: obj_update (update.c:2086)
==25812== by 0x8183510: update_handler (update.c:2582)
==25812== by 0x809CBC0: game_loop_unix (comm.c:890)
==25812== by 0x809C68C: main (comm.c:464)
==25812==
==25812== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Segmentation fault
void save_area( AREA_DATA *pArea )
{
FILE *fp;
fclose( fpReserve );
if ( !( fp = fopen( pArea->file_name, "w" ) ) )
{
bug( "Open_area: fopen", 0 );
perror( pArea->file_name );
}
fprintf( fp, "#AREADATA\n" );
fprintf( fp, "Name %s~\n", pArea->name );
fprintf( fp, "Builders %s~\n", fix_string( pArea->builders ) );
fprintf( fp, "VNUMs %ld %ld\n", pArea->min_vnum, pArea->max_vnum );
fprintf( fp, "Credits %s~\n", pArea->credits );
fprintf( fp, "Security %d\n", pArea->security );
fprintf( fp, "Authors %s~\n", fix_string( pArea->authors ) );
fprintf( fp, "Game %s~\n", fix_string( pArea->game ) );
fprintf( fp, "Levels %d %d\n", pArea->low_range, pArea->high_range );
fprintf( fp, "End\n\n\n\n" );
save_mobiles( fp, pArea );
save_objects( fp, pArea );
save_rooms( fp, pArea );
save_specials( fp, pArea );
save_resets( fp, pArea );
save_shops( fp, pArea );
save_mobprogs( fp, pArea );
save_objprogs( fp, pArea );
save_roomprogs( fp, pArea );
if ( pArea->helps && pArea->helps->first )
{
save_helps();
}
fprintf( fp, "#$\n" );
fclose( fp );
fpReserve = fopen( NULL_FILE, "r" );
return;
}
void save_objects( FILE *fp, AREA_DATA *pArea )
{
int i;
OBJ_INDEX_DATA *pObj;
fprintf( fp, "#OBJECTS\n" );
for ( i = pArea->min_vnum; i <= pArea->max_vnum; i++ )
{
if ( (pObj = get_obj_index( i )) )
save_object( fp, pObj );
}
fprintf( fp, "#0\n\n\n\n" );
return;
}
void save_object( FILE *fp, OBJ_INDEX_DATA *pObjIndex )
{
char letter;
AFFECT_DATA *pAf;
EXTRA_DESCR_DATA *pEd;
char buf[MAX_STRING_LENGTH];
PROG_LIST *pOprog;
fprintf( fp, "#%ld\n", pObjIndex->vnum );
fprintf( fp, "%s~\n", pObjIndex->name );
fprintf( fp, "%s~\n", pObjIndex->short_descr );
fprintf( fp, "%s~\n", fix_string( pObjIndex->description ) );
fprintf( fp, "%s~\n", fix_string( pObjIndex->full_descr ) );
fprintf( fp, "%s ", material_table[pObjIndex->material_type].name);
fprintf( fp, "%s ", item_name(pObjIndex->item_type));
fprintf( fp, "%s ", fwrite_flag( pObjIndex->extra_flags, buf ) );
fprintf( fp, "%s ", fwrite_flag( pObjIndex->race_flags, buf ) );
fprintf( fp, "%s~\n", pObjIndex->oclass );
fprintf( fp, "%s\n", fwrite_flag( pObjIndex->wear_flags, buf ) );
/*
* Using fwrite_flag to write most values gives a strange
* looking area file, consider making a case for each
* item type later.
*/
switch ( pObjIndex->item_type )
{
default:
fprintf( fp, "%s ", fwrite_flag( pObjIndex->value[0], buf ) );
fprintf( fp, "%s ", fwrite_flag( pObjIndex->value[1], buf ) );
fprintf( fp, "%s ", fwrite_flag( pObjIndex->value[2], buf ) );
fprintf( fp, "%s ", fwrite_flag( pObjIndex->value[3], buf ) );
fprintf( fp, "%s\n", fwrite_flag( pObjIndex->value[4], buf ) );
break;
case ITEM_DRINK_CON:
case ITEM_FOUNTAIN:
fprintf( fp, "%ld %ld '%s' %ld %ld\n",
pObjIndex->value[0],
pObjIndex->value[1],
liq_table[pObjIndex->value[2]].liq_name,
pObjIndex->value[3],
pObjIndex->value[4]);
break;
case ITEM_AIRSHIP:
fprintf (fp, "%s %ld %ld %ld %ld\n",
fwrite_flag (pObjIndex->value[0], buf),
pObjIndex->value[1], pObjIndex->value[2],
pObjIndex->value[3], pObjIndex->value[4]);
break;
case ITEM_CONTAINER:
fprintf( fp, "%ld %s %ld %ld %ld\n",
pObjIndex->value[0],
fwrite_flag( pObjIndex->value[1], buf ),
pObjIndex->value[2],
pObjIndex->value[3],
pObjIndex->value[4]);
break;
case ITEM_WEAPON:
fprintf( fp, "%s %ld %ld %s %s\n",
weapon_name(pObjIndex->value[0]),
pObjIndex->value[1],
pObjIndex->value[2],
attack_table[pObjIndex->value[3]].name,
fwrite_flag( pObjIndex->value[4], buf ) );
break;
case ITEM_ARROW:
fprintf( fp, "%ld %ld %ld %s %s\n",
pObjIndex->value[0],
pObjIndex->value[1],
pObjIndex->value[2],
arrow_table[pObjIndex->value[3]].name,
fwrite_flag( pObjIndex->value[4], buf ) );
break;
case ITEM_PILL:
case ITEM_POTION:
case ITEM_SCROLL:
fprintf( fp, "%ld '%s' '%s' '%s' '%s'\n",
pObjIndex->value[0] > 0 ? /* no negative numbers */
pObjIndex->value[0]
: 0,
pObjIndex->value[1] != -1 ?
skill_table[pObjIndex->value[1]].name
: "",
pObjIndex->value[2] != -1 ?
skill_table[pObjIndex->value[2]].name
: "",
pObjIndex->value[3] != -1 ?
skill_table[pObjIndex->value[3]].name
: "",
pObjIndex->value[4] != -1 ?
skill_table[pObjIndex->value[4]].name
: "");
break;
case ITEM_STAFF:
case ITEM_WAND:
fprintf( fp, "%ld %ld %ld '%s' %ld\n",
pObjIndex->value[0],
pObjIndex->value[1],
pObjIndex->value[2],
pObjIndex->value[3] != -1 ?
skill_table[pObjIndex->value[3]].name :
"",
pObjIndex->value[4] );
break;
}
fprintf( fp, "%d ", pObjIndex->level );
fprintf( fp, "%d ", pObjIndex->weight );
fprintf( fp, "%d ", pObjIndex->cost );
fprintf(fp, "%ld ", pObjIndex->link );
if ( pObjIndex->condition > 90 ) letter = 'P';
else if ( pObjIndex->condition > 75 ) letter = 'G';
else if ( pObjIndex->condition > 50 ) letter = 'A';
else if ( pObjIndex->condition > 25 ) letter = 'W';
else if ( pObjIndex->condition > 10 ) letter = 'D';
else if ( pObjIndex->condition > 0 ) letter = 'B';
else letter = 'R';
fprintf( fp, "%c\n", letter );
for ( pAf = pObjIndex->affected; pAf; pAf = pAf->next )
{
if (pAf->where == TO_OBJECT ||
(pAf->bitvector == 0 && pAf->where != TO_SKILLS))
fprintf( fp, "A\n%d %d\n", pAf->location, pAf->modifier );
else
{
fprintf( fp, "F\n" );
switch (pAf->where)
{
case TO_AFFECTS:
fprintf( fp, "A " );
break;
case TO_IMMUNE:
fprintf( fp, "I " );
break;
case TO_ABSORB:
fprintf( fp, "B " );
break;
case TO_RESIST:
fprintf( fp, "R " );
break;
case TO_VULN:
fprintf( fp, "V " );
break;
case TO_SKILLS:
fprintf( fp, "S " );
break;
default:
bug( "olc_save: Invalid Affect->where", 0);
break;
}
if (pAf->where == TO_SKILLS)
fprintf( fp, "'%s' %d\n",
skill_table[pAf->type].name, pAf->modifier);
else
fprintf( fp, "%d %d %s\n",
pAf->location, pAf->modifier,
fwrite_flag( pAf->bitvector, buf ) );
}
}
for ( pEd = pObjIndex->extra_descr; pEd; pEd = pEd->next )
{
fprintf( fp, "E\n%s~\n%s~\n", pEd->keyword,
fix_string( pEd->description ) );
}
for (pOprog = pObjIndex->oprogs; pOprog; pOprog = pOprog->next)
{
fprintf(fp, "O %s %ld %s~\n",
prog_type_to_name(pOprog->trig_type), pOprog->vnum,
pOprog->trig_phrase);
}
return;
}
void save_objects( FILE *fp, AREA_DATA *pArea )
void save_objects( FILE *fp, const AREA_DATA *pArea )
char *fix_string( const char *str )
{
static char strfix[MAX_STRING_LENGTH * 2];
int i;
int o;
if ( str == NULL )
return '\0';
for ( o = i = 0; str[i+o] != '\0'; i++ )
{
if (str[i+o] == '\r' || str[i+o] == '~')
o++;
strfix[i] = str[i+o];
}
strfix[i] = '\0';
return strfix;
}
static char strfix[MAX_STRING_LENGTH * 2];
It happens when I save my newbie zone area, but it doesn't happen 100% of the time. I've been unable to find a common factor for when it happens. But basically, I save the area, then within the next minute or two, the MUD crashes. I've caught the bug in GDB, and here is the output:
and it's said this before as well:
As you can see, it's crashing on the paf stuff in the obj_update function in update.c
Here is my obj_update function with the lines it's referencing being line 32 and 35 of the code flag's count:
Like I said, it's been an issue for a while, but normally we don't ever need to edit/save that area file, so it's something I've been putting off. But I need to go through and edit the area to update it on changes made on several key things, and this crash will make it problematic. Although I may have the area updated before a solution is found, I don't like having unknown crash bugs in the game and would like to get this solved more for the sake of having it solved than anything.
Anyone have any ideas? Any help will be greatly appreciated.