Re: [bug]With class selection

From: Ryan Guthrie (guthrie@HENGE1.HENGE.COM)
Date: 07/19/97


>Since you cant examine the stack with gdb, why not run the program from
>inside gdb? load it up with gdb bin/circle.  in it type set args -q 4000(or
>whatever args you us) create your char, but send a Ctrl-Z to gdb when you
>get to the menu, send the command and step through the code a couple lines
>at a time.  I wouldnt suggest doing this on a port other players log onto
>though...cuz it will apear that the mud is frozen while you step through it

Sun Jul 20 07:24:33 :: New connection.  Waking up.
Sun Jul 20 07:28:12 :: SYSERR: Couldn't open player file pfiles/a/abc
Sun Jul 20 07:28:12 :: Abc [henge1.henge.com] new player.
Sun Jul 20 07:28:15 :: Abc entering game with no equipment.
Sun Jul 20 07:28:15 :: Abc advanced to level 1

It seemed to work through gdb:
gdb bin/circle
run -q 5000
At least it didn't crash.

So then i think, well maybe the bug(virus) is a 24 hour virus(this has
happened to me before so...) so i try it w/o gdb:

By what name do you wish to be known? abcII

...

Select a class:
  [C]leric
  [T]hief
  [W]arrior
  [M]agic-user
Class: c
Connection closed by foreign host.

Crashed

Sun Jul 20 07:32:47 :: SYSERR: Couldn't open player file pfiles/a/abcii

Ok, someone suggested running a backtrace while the mud is running and at
class suspend it and bt is.  This is what i get:

                                **SUSPENDED**
0x40020287 in __select ()
(gdb) bt
#0  0x40020287 in __select ()
#1  0x4009fa8c in __DTOR_END__ ()
#2  0x8049624 in init_game (port=5000) at comm.c:244
#3  0x80495aa in main (argc=3, argv=0xbffffd68) at comm.c:214
#4  0x804926b in _start ()

Now i go through the frames:
(gdb) frame 0
#0  0x40020287 in __select ()
(gdb) frame 1
#1  0x4009fa8c in __DTOR_END__ ()
(gdb) frame 2
#2  0x8049624 in init_game (port=5000) at comm.c:244
244       game_loop(mother_desc);
(gdb) frame 3
#3  0x80495aa in main (argc=3, argv=0xbffffd68) at comm.c:214
214         init_game(port);
(gdb) frame 4
#4  0x804926b in _start ()
(gdb)

Now i find the code for each line:
frame 2:

  log("Entering game loop.");

  game_loop(mother_desc);        <----line 244

  log("Closing all sockets.");
  while (descriptor_list)
    close_socket(descriptor_list);

Frame 3:

  if (scheck) {
    boot_world();
    log("Done.");
    exit(0);
  } else {
    sprintf(buf, "Running game on port %d.", port);
    log(buf);
    init_game(port);            <---Line 214
  }

  return 0;
}

haven't done a thing with game_loop or init_game so i wouldn't see the
problem there.  Another thing that boggels me is why it crashes w/o gdb
but with gdb it works fine?

Whew, if you get this far thanks for reading this much...I wouldn't
normally read a message this long:)

                        -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-
                        |          Ryan Guthrie         |
                        |       guthrie@henge.com       |
                        -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST