Register forum user name Search FAQ

Gammon Forum

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 ➜ ROM ➜ Running the server ➜ Cygwin Erorr.. Connection

Cygwin Erorr.. Connection

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #15 on Sat 14 Jan 2006 04:45 AM (UTC)

Amended on Sat 14 Jan 2006 04:47 AM (UTC) by Nick Gammon

Message
Sounds like it hit an exit statement, and probably exit (0).

Doing a grep of the source indicates lots of exit statements, and some of them being exit (0).

(Exit (0) is a "normal termination").

Here is how I would find which one it is hitting ...

Use gdb, add a breakpoint on "exit" and then run it. I tested this by deliberately corrupting an area file, to see what would happen ...


(gdb) break exit
Breakpoint 1 at 0x8048bbc
(gdb) run
Starting program: /home/nick/rom/src/rom 
Breakpoint 1 at 0x42029cd6
Sat Jan 14 16:40:15 2006 :: [*****] FILE: haon.are LINE: 10
Sat Jan 14 16:40:15 2006 :: [*****] BUG: Fread_number: bad format.

Breakpoint 1, 0x42029cd6 in exit () from /lib/tls/libc.so.6
(gdb) bt
#0  0x42029cd6 in exit () from /lib/tls/libc.so.6
#1  0x0807499e in fread_number (fp=0x80d83a8) at db.c:2194
#2  0x08070bdc in load_area (fp=0x80d83a8) at db.c:406
#3  0x08070927 in boot_db () at db.c:348
#4  0x0806b7c1 in main (argc=2, argv=0xbffff974) at comm.c:417
#5  0x420156a4 in __libc_start_main () from /lib/tls/libc.so.6
(gdb)


In this example we can see that there was a problem in load_area, which is what we expect.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by AliasCodec   USA  (26 posts)  Bio
Date Reply #16 on Sat 14 Jan 2006 04:51 AM (UTC)
Message
Ok, I went through my startup functions after the line ready to rock and put in breaks at increments of every 5th line until I found a point that it stopped.. 683 is the last line it loads, it never hits line 684.

Quote:

683 for ( d = descriptor_list; d; d = d->next )
684 {
685 maxdesc = UMAX( maxdesc, d->descriptor );
686 FD_SET( d->descriptor, &in_set );
687 FD_SET( d->descriptor, &out_set );
688 FD_SET( d->descriptor, &exc_set );
689
690 if ( d->ifd!=-1 && d->ipid!=-1 )
691 {
692 maxdesc = UMAX( maxdesc, d->ifd );
693 FD_SET( d->ifd, &in_set );
694 }
695 }


Top

Posted by AliasCodec   USA  (26 posts)  Bio
Date Reply #17 on Sat 14 Jan 2006 05:04 AM (UTC)
Message
Went a step farther and commented that out just to see if it was stopping at every

Quote:
for ( d = descriptor_list; d; d = d->next )
Quote:


and found that it is indeed. This has me completely baffled, as everything thus far has. Thank you for being patient with me as I try and work through this.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #18 on Sat 14 Jan 2006 05:06 AM (UTC)
Message
What happens when you step? Doesn't seem like an infinite loop.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by AliasCodec   USA  (26 posts)  Bio
Date Reply #19 on Sat 14 Jan 2006 05:11 AM (UTC)
Message
Ok, used step at the first break, line 683 where descriptor_list is first encountered, and kept going until I got a loop.

Quote:
(gdb) step
2500 for (hash = 0; hash < ARMY_HASH_SIZE; hash++){
(gdb) step
2501 for (pa = army_list[hash]; pa; pa = pa_next){
(gdb) step
2500 for (hash = 0; hash < ARMY_HASH_SIZE; hash++){
(gdb) step
2501 for (pa = army_list[hash]; pa; pa = pa_next){
(gdb) step
2500 for (hash = 0; hash < ARMY_HASH_SIZE; hash++){
(gdb) step
2501 for (pa = army_list[hash]; pa; pa = pa_next){
(gdb)


That continues over and over.
Top

Posted by AliasCodec   USA  (26 posts)  Bio
Date Reply #20 on Sat 14 Jan 2006 05:23 AM (UTC)
Message
Commented the call to that funtion out, and now it's looping at another for statement.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #21 on Sat 14 Jan 2006 05:29 AM (UTC)
Message
Print ARMY_HASH_SIZE when you're in that function that has it. If it's quite large, just skip past that loop.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by AliasCodec   USA  (26 posts)  Bio
Date Reply #22 on Sat 14 Jan 2006 05:41 AM (UTC)
Message
Guessing I used print correctly, never used it.

Quote:
2500 for (hash = 0; hash < ARMY_HASH_SIZE; hash++){
(gdb) step
2501 for (pa = army_list[hash]; pa; pa = pa_next){
(gdb) print ARMY_HASH_SIZE
No symbol "ARMY_HASH_SIZE" in current context.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #23 on Sat 14 Jan 2006 05:59 AM (UTC)
Message
You stepped too far. You need to use it under this line:
2500 for (hash = 0; hash < ARMY_HASH_SIZE; hash++){

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #24 on Sat 14 Jan 2006 06:00 AM (UTC)
Message
Now I'm a bit confused. You said before that you were getting a "normal termination" - that is, the program just exited.

Now you say you have found an infinite loop, in which case the program would not exit or do anything else.

Did you try putting a breakpoint on "exit" like I suggested?

You need to be aware that some loops may run for a long time, and seem to be taking forever in the debugger, but if they are iterating correctly they will eventually exit the loop. You can use something like "run to" to catch the exit from a loop.

Quote:

683 is the last line it loads, it never hits line 684.


What do you mean by that? Does it exit the program at that point?

Quote:

Commented the call to that funtion out, and now it's looping at another for statement.


I wouldn't start commenting out heaps of code, you will only introduce bugs doing that.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by AliasCodec   USA  (26 posts)  Bio
Date Reply #25 on Sat 14 Jan 2006 06:11 AM (UTC)
Message
Nick-

At first it terminated, and I thought it was normal termination of the program. When not running in gdb it tells me the program was aborted, and in gdb, it says "Program exited normally.". I thought line 683 was the problem, but after using step, I got to the loop in armies.c lines 2500 and 2501. As to commenting out segments, I did that just to test and see if that piece was the only thing causing the crash. After three runs in gdb with the commented out bit, I recompiled with the segment back in, not commented out. I tried break exit, and nothing came up, the same termination of the program. It is exiting the program when it goes to the for lines involving ARMY_HASH_SIZE so far as I can tell.

Zeno-

I went back and did print at both lines, pasted the wrong bit of output in that post. Both times I got that same message.

Quote:
4545 army_combat_update();
(gdb) print ARMY_HASH_SIZE
No symbol "ARMY_HASH_SIZE" in current context.
(gdb) step
army_combat_update () at armies.c:2500
2500 for (hash = 0; hash < ARMY_HASH_SIZE; hash++){
(gdb) print ARMY_HASH_SIZE
No symbol "ARMY_HASH_SIZE" in current context.
(gdb) step
2501 for (pa = army_list[hash]; pa; pa = pa_next){
(gdb) print ARMY_HASH_SIZE
No symbol "ARMY_HASH_SIZE" in current context.
Top

Posted by AliasCodec   USA  (26 posts)  Bio
Date Reply #26 on Sat 14 Jan 2006 07:48 AM (UTC)
Message
Alrighty, went back and started at the beginning.. spammed step to see how far I got before it crashed. I must have entered step a thousand times, but it got through ARMY_HAS_SIZE and the program terminated at the bolded line here:

Quote:
DESCRIPTOR_DATA* bring( ROOM_INDEX_DATA* room, char* arg ){
DESCRIPTOR_DATA *d;
int garbage;
char strsave[MIL];
FILE *fp;
CHAR_DATA* ch;

fclose( fpReserve );

if ( (ch = char_file_active( arg)) != NULL && ch->desc )
return ch->desc;

sprintf( strsave, "%s%s", PLAYER_DIR, capitalize( arg ) );
if ( ( fp = fopen( strsave, "r" ) ) == NULL ){
perror( strsave );
fpReserve = fopen( NULL_FILE, "r" );
return NULL;
}
fclose (fp);
fpReserve = fopen( NULL_FILE, "r" );

d = new_descriptor();
d->editor = 69;
garbage = load_char (d, arg);
load_obj (d->character);

d->character->next = char_list;
char_list = d->character;
d->character->next_player = player_list;
player_list = d->character;

reset_char(d->character);

char_to_room (d->character, room ? room : get_room_index(d->character->in_room->vnum));
d->character->logon = 0;

return d;
}
Top

Posted by AliasCodec   USA  (26 posts)  Bio
Date Reply #27 on Sat 14 Jan 2006 07:56 AM (UTC)
Message
...And I should shoot myself now. The error is somewhere in the pfiles. I moved every pfile to another folder and started the mud, guessing that the error was in load_char, and sure enough, MUD started up fine, no problems.

Now to find out what is making the pfiles cause the error.
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.


97,139 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.