Welcome to the Builder Academy

Question crash - need help with the core

More
13 Mar 2018 15:58 #7695 by JTP
I had a crash:
Code:
Program terminated with signal 11, Segmentation fault. #0 0x080f2a98 in fname (namelist=0x0) at handler.c:42 42 for (point = holder; isalpha(*namelist); namelist++, point++) (gdb) Hangup detected on fd 0 Error detected on fd 0 error detected on stdin When i up the frames i see: #1 0x08076d70 in do_doorbash (ch=0xada0148, argument=0xbf8652e9 " w", cmd=506, subcmd=0) at act.offensive.c:793 793 sprintf(buf, "$n *CRASHES* through the %s!", fname(EXIT(ch, dir)->keyword)); #2 0x081081cd in command_interpreter (ch=0xada0148, argument=0xbf8652e4 "doorb w") at interpreter.c:672 672 ((*complete_cmd_info[cmd].command_pointer) (ch, line, cmd, complete_cmd_info[cmd].subcmd)); #3 0x080b9895 in game_loop (local_mother_desc=3) at comm.c:892 892 command_interpreter(d->character, comm); /* Send it to interpreter */ #4 0x080bad37 in init_game (argc=4263324, argv=0xbf865864) at comm.c:536 536 game_loop(mother_desc); #5 main (argc=4263324, argv=0xbf865864) at comm.c:356 356 init_game(port);

What more can i do ?

Please Log in or Create an account to join the conversation.

More
13 Mar 2018 20:57 #7696 by thomas
This is a good start. Let me walk you through the interesting bits of that output:
Code:
Program terminated with signal 11, Segmentation fault. #0 0x080f2a98 in fname (namelist=0x0) at handler.c:42 42 for (point = holder; isalpha(*namelist); namelist++, point++)
Here, we see that namelist is "0x0". This is what we call NULL when programming, and it means that whatever we've passed to fname() has not been set to anything useful. So, our next question is, what did we pass to fname()?
Code:
#1 0x08076d70 in do_doorbash (ch=0xada0148, argument=0xbf8652e9 " w", cmd=506, subcmd=0) at act.offensive.c:793 793 sprintf(buf, "$n *CRASHES* through the %s!", fname(EXIT(ch, dir)->keyword));
We're passing EXIT(ch, dir)->keyword to the fname() function. We see that this happens in act.offensive.c at line 793.
So, by now we know that some door keyword is not initialized. How to find out which door? Well, we can print some info, but because gdb doesn't work with macros, we need to look them up.

The EXIT macro is defined here: github.com/tbamud/tbamud/blob/41da68bdb0...ba6/src/utils.h#L829
Code:
#define EXIT(ch, door) (world[IN_ROOM(ch)].dir_option[door])
And IN_ROOM is also a macro. It's defined here github.com/tbamud/tbamud/blob/41da68bdb0...ba6/src/utils.h#L460
Code:
#define IN_ROOM(ch) ((ch)->in_room)
So, we're interested in the name of the room and the direction. Well, the direction is readily apparent from the argument: "argument=0xbf8652e9 " w"," means the door is probably to the west in that room.

Next, we need to know more about which room we're dealing with. And it just so happens that the macros help us out:
Code:
frame 1 print world[ch->in_room] print *world[ch->in_room]
One of those print statements will list out information about the room, among other things it's vnum. After that, it's just a question of fixing the buggy door.

Please Log in or Create an account to join the conversation.

More
13 Mar 2018 21:09 #7697 by JTP
Replied by JTP on topic crash - need help with the core
ok found the room. there was no door to the west, but there was from the east to this room.

So wierd a player tried to doorbash w when it was already open...

That should have given: There is no obstruction!

But maybe since there was from the east to this room, it was possible to type doorbash w..

I dont know...hope it fixed it making the door w locked.

Please Log in or Create an account to join the conversation.

More
13 Mar 2018 21:11 #7698 by JTP
Replied by JTP on topic crash - need help with the core
(gdb) print *world[ch->in_room]
Structure has no component named operator*.

Please Log in or Create an account to join the conversation.

More
13 Mar 2018 21:15 #7699 by JTP
Replied by JTP on topic crash - need help with the core
Ahh think i get it, doorbash is made to open the door both directions, so then w wasnt a closed/locked door, it must have failed

Please Log in or Create an account to join the conversation.

Time to create page: 0.203 seconds