Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ skill table crashing?
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Frobozz
(75 posts) Bio
|
Date
| Mon 20 Dec 2004 07:57 PM (UTC) |
Message
| Hi!
I've been trying to debug this for over a week now, I hope someone here can help out a bit. Right now when I try to use the command: sset save skill table, the entire mud goes down. So I went and put bug()'s in the code, and this is what it produced:
sset save skill table
Log: Valens: sset save skill table
Log: [*****] BUG: here?
Saving skill table...
Log: [*****] BUG: Here 2?
Log: [*****] BUG: 3?
Log: [*****] BUG: 8?
Log: [*****] BUG: 9?
Log: [*****] BUG: last
And this is the code:
void save_skill_table()
{
int x;
int sn;
FILE *fpout;
if ( (fpout=fopen( SKILL_FILE, "w" )) == NULL )
{
bug( "Here 1?", 0);
perror( SKILL_FILE );
bug( "Cannot open skills.dat for writting", 0 );
return;
}
bug( "Here 2?", 0);
for ( x = 0; x < top_sn; x++ )
{
bug( "3?", 0);
if ( !skill_table[x]->name || skill_table[x]->name[0] == '\0' )
bug( "4?", 0);
break;
if ( SPELL_FLAG(get_skilltype(sn), SF_DELETED))
bug( "5?", 0);
continue;
fprintf( fpout, "#SKILL\n" );
bug( "6?", 0);
fwrite_skill( fpout, skill_table[x] );
bug( "7", 0);
}
bug( "8?", 0);
fprintf( fpout, "#END\n" );
bug( "9?", 0);
fclose( fpout );
bug( "last", 0);
}
Does anyone see what's wrong with it? Or have a suggestion on how to solve this problem?
| Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #1 on Mon 20 Dec 2004 08:58 PM (UTC) |
Message
| Well, it looks like its breaking on the first skill because that skill has no name. Check your skill.dat file and make sure that there are no null skill being written. |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
Posted by
| Frobozz
(75 posts) Bio
|
Date
| Reply #2 on Mon 20 Dec 2004 09:22 PM (UTC) |
Message
| First lines of skills.dat
#SKILL
Name reserved~
Type Spell
Info 0
Flags 0
Minpos 112
Slot 95
Code spell_null
Dammsg ~
Wearoff ???~
Minlevel 51
End
#SKILL
Name acid breath~
Type Spell
Info 5
Flags 0
Target 1
Minpos 110
Slot 200
Mana 20
Rounds 4
Code spell_acid_breath
Dammsg blast of acid~
Wearoff !Acid Breath!~
Minlevel 43
End
#SKILL
Name animate dead~
Type Spell
Info 0
Flags 0
Minpos 110
Slot 231
Mana 220
Rounds 12
Code spell_animate_dead
Dammsg ~
Wearoff !Animate Dead!~
Minlevel 42
End
| Top |
|
Posted by
| Frobozz
(75 posts) Bio
|
Date
| Reply #3 on Mon 20 Dec 2004 09:24 PM (UTC) |
Message
| Would the code: spell_null be what you were talking about? Would that be causing the crash?
#SKILL
Name enhanced damage~
Type Skill
Info 0
Flags 0
Minpos 105
Code spell_null
Dammsg ~
Wearoff !Enhanced Damage!~
Minlevel 1
End
#SKILL
Name evasive style~
Type Skill
Info 0
Flags 0
Rounds 4
Code spell_null
Dammsg ~
Wearoff !evasive style!~
Teachers 10340 3004~
Minlevel 1
End | Top |
|
Posted by
| Frobozz
(75 posts) Bio
|
Date
| Reply #4 on Mon 20 Dec 2004 09:43 PM (UTC) |
Message
| I also added bug()'s into do_sset in skills.c to see what would happen... This is what came out:
Log: Valens: sset save skill table
Log: [*****] BUG: here above arg2, skill
Saving skill table...
Log: [*****] BUG: in skills.c
Log: [*****] BUG: Here 2?
Log: [*****] BUG: 3?
Log: [*****] BUG: 8?
Log: [*****] BUG: 9?
Log: [*****] BUG: last
Log: [*****] BUG: below save_skill_table()
}
send_to_char( "Skill being any skill or spell.\n\r", ch );
return;
}
if ( get_trust(ch) > LEVEL_SUB_IMPLEM
&& !str_cmp( arg1, "save" )
&& !str_cmp( argument, "table" ) )
{
bug( " here above arg2, skill", 0);;
if ( !str_cmp( arg2, "skill" ) )
{
send_to_char( "Saving skill table...\n\r", ch );
bug( "in skills.c", 0);
save_skill_table();
bug( "below save_skill_table()",0);
save_classes();
/* save_races(); */
return;
bug( "after skills return",0);
}
if ( !str_cmp( arg2, "herb" ) )
So it looks like it's going in one great big circle from sset back to save_skill_table, etc... But I dont see the error :( | Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #5 on Mon 20 Dec 2004 09:56 PM (UTC) |
Message
| So this is crashing the mud? Do you get a core, or if not, have you tried booting the mud in GDB to see where the problem. |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
Posted by
| Frobozz
(75 posts) Bio
|
Date
| Reply #6 on Mon 20 Dec 2004 10:56 PM (UTC) |
Message
| Perhaps this whole thing has me completely frazzled or.. well.. yeah...
But this is supposedly my core file in ..\smaug\area
[frobozz area]$ ls -lh core*
-rwx--x--x 1 frobozz frobozz 428k Dec 20 17:42 core
After reading the gdb helpfile I have no idea how to run gdb, and then fire up the mud, to watch for that...
Your help here is greatly appreciated.
Thank you! | Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #7 on Tue 21 Dec 2004 04:04 AM (UTC) |
Message
| well, assuming your executable is called "smaug" and your using port <port>, you want to execute the following commands to boot the mud in GDB-
cd area
gdb ../src/smaug
run <port>
This will boot the mud inside GDB. Log in, and recreate the crash. At that time, you can go into GDB and see what command it crashed. To see the order in which this command was called, use BT. You can use commands like "print skill_table" for example to see the memory adress of the first index. Refer to Nick's guide for a much more indepth way to use GDB.
I really suggest, as will most everyone on here to get confortable with GDB, as it is an invaluable tool for coders. |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
Posted by
| Frobozz
(75 posts) Bio
|
Date
| Reply #8 on Tue 21 Dec 2004 04:31 AM (UTC) |
Message
| Interesting. Thank you, truly.
This is what happend:
Mon Dec 20 23:26:24 2004 :: Loading Morphs
Mon Dec 20 23:26:24 2004 :: Done.
Mon Dec 20 23:26:24 2004 :: Initializing socket
Mon Dec 20 23:26:24 2004 :: (Name Not Set) ready at address bb7.bet
Mon Dec 20 23:27:08 2004 :: Sock.sinaddr: 68.255.250.237, port 359
Mon Dec 20 23:27:10 2004 :: Preloading player data for: Valens (7K)
Mon Dec 20 23:27:12 2004 :: Loading player data for: Valens (7K)
Mon Dec 20 23:27:12 2004 :: Valens (68.255.250.237) has connected.
Mon Dec 20 23:27:49 2004 :: Log Valens: sset
Mon Dec 20 23:28:41 2004 :: Log Valens: sset fatigue flag delete
Mon Dec 20 23:28:43 2004 :: Log Valens: sset fatigue flag deleted
Mon Dec 20 23:28:48 2004 :: Log Valens: sset save skill table
Mon Dec 20 23:28:48 2004 :: [*****] BUG: here above arg2, skill
Mon Dec 20 23:28:48 2004 :: [*****] BUG: in skills.c
Mon Dec 20 23:28:48 2004 :: [*****] BUG: hmmm!
Mon Dec 20 23:28:48 2004 :: [*****] BUG: skill_table 2
Mon Dec 20 23:28:48 2004 :: [*****] BUG: skill_table 3
Program received signal SIGSEGV, Segmentation fault.
0x08184d66 in save_skill_table () at tables.c:1960
1960 if ( SPELL_FLAG(get_skilltype(sn), SF_DELETED))
(gdb) bt
#0 0x08184d66 in save_skill_table () at tables.c:1960
#1 0x081657e5 in do_sset (ch=0x8406250, argument=0xbffff370 "table") at skills.c:815
#2 0x08107111 in interpret (ch=0x8406250, argument=0xbffff365 "save skill table") at interp.c:577
#3 0x080c7164 in game_loop () at comm.c:651
#4 0x080c671e in main (argc=2, argv=0xbffffc94) at comm.c:308
#5 0x4003f177 in __libc_start_main (main=0x80c630c <main>, argc=2, ubp_av=0xbffffc94, init=0x80490dc <_init>,
fini=0x8196970 <_fini>, rtld_fini=0x4000e184 <_dl_fini>, stack_end=0xbffffc8c) at ../sysdeps/generic/libc-start.c:129
(gdb) fame 0
Undefined command: "fame". Try "help".
(gdb) frame 0
#0 0x08184d66 in save_skill_table () at tables.c:1960
1960 if ( SPELL_FLAG(get_skilltype(sn), SF_DELETED))
(gdb) frame 1
#1 0x081657e5 in do_sset (ch=0x8406250, argument=0xbffff370 "table") at skills.c:815
815 save_skill_table();
(gdb) frame 2
#2 0x08107111 in interpret (ch=0x8406250, argument=0xbffff365 "save skill table") at interp.c:577
577 (*cmd->do_fun) ( ch, argument );
(gdb) frame 3
#3 0x080c7164 in game_loop () at comm.c:651
651 interpret( d->character, cmdline );
(gdb) frame 4
#4 0x080c671e in main (argc=2, argv=0xbffffc94) at comm.c:308
308 game_loop( );
(gdb) frame 5
#5 0x4003f177 in __libc_start_main (main=0x80c630c <main>, argc=2, ubp_av=0xbffffc94, init=0x80490dc <_init>,
fini=0x8196970 <_fini>, rtld_fini=0x4000e184 <_dl_fini>, stack_end=0xbffffc8c) at ../sysdeps/generic/libc-start.c:129
129 ../sysdeps/generic/libc-start.c: No such file or directory.
in ../sysdeps/generic/libc-start.c
| Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #9 on Tue 21 Dec 2004 01:26 PM (UTC) |
Message
| From where its crashing, you need to try printing all the variables and see what the values are. SPELL_FLAG is a macro, so look it up in mud.h and see what it does so you can print out everything you need.
For example:
print sn |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
Posted by
| Frobozz
(75 posts) Bio
|
Date
| Reply #10 on Tue 21 Dec 2004 07:48 PM (UTC) |
Message
| It was this:
0x08184d66 in save_skill_table () at tables.c:1960
1960 if ( SPELL_FLAG(get_skilltype(sn), SF_DELETED))
get_skilltype(sn) should have been X...
Because well.. I was dumb
Thank you for all your help! | Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #11 on Tue 21 Dec 2004 08:36 PM (UTC) |
Message
| Ah, of course. After dealing with skill code for a while you tend to assume that sn is used for the purpose of x. Guess I need to pay more attention :) |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
Posted by
| Frobozz
(75 posts) Bio
|
Date
| Reply #12 on Mon 27 Dec 2004 02:13 AM (UTC) |
Message
| LOL
Nope, pretty sure Im the one that needs to pay more attention!
Thanks :) | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
28,539 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top