Looking while fighting = crash?

Posted by DjNiVeK on Tue 14 Dec 2004 11:39 AM — 20 posts, 66,720 views.

#0
Ok, I have a strange bug now. When you're fighting a mob, or player, it doesn't really matter, the mud crashes with a stackdump when you try to look. Problem here is I don't know where to start looking.
Looking outside of a battle works fine, but if a fight is going on and someone looks, it crashes.
I also tried that gdb thingie, but it asks you to look at a core, but mine doesn't save it in a core, and gdb doesn't open it.
USA #1
Attach gdb to the MUD process, and then recreate the crash.
#2
On my own computer, I run it as an .exe, so it doesn't have a PID.
Also, on a temporary server, when I try to run smaug in the area folder, I get a 'permission denied'. Startup does work, but there isn't a smaug running with an ID then.
USA #3
Well, what are you using to compile? Cygwin? If so, it should have a PID. With the permission denied error, just chmod it to the correct values.
#4
Yea, I use cygwin to compile, but not to run the process.
I'll try the chmod in a few
USA #5
Oh I see. So you're using Smaug, converted to Windows?
#6
yep, the version done with a little change in the makefile to a .exe
USA #7
Well I'm going to suggest using Cygwin to run it too, or find a way to attach gdb, because it'll be useful in the future, along with right now.

What I'm guessing is, while fighting, something (perhaps replacing the title of the victim in the room) is being set incorrectly.
#8
lol, you're absolutely right. I have been able to gdb it now, and the crash is caused by a strcat( buf, victim->pcdata->title);

Now lets see how to fix it...thanks :)
USA #9
So most likely either buf was never declared or defined, or you somehow lost victim. (Or it could be that the victim is a NPC)

If you can't figure it out, post the gdb here.
Amended on Tue 14 Dec 2004 02:13 PM by Zeno
Canada #10
If your unfamiliar with GDB, I suggest reading through Nick's guide to GDB, its an invaluable piece of information
for anyone unused to the program.
#11
@Greven: Yep, I read it but until Zeno said to run smaug with Cygwin, the GDB tutorial didn't really work for me. Now it works fine :)

I also fixed the bug, so now you can look during battle =)

Thanks =)
Canada #12
Why didn't gdb work with cygwin? You said that you got it to work in one of the above posts.

P.S. If you have fixed the issue, you could post it here so that anyone checking this post in the future with a similiar problem can see how you fixed the issue.
Amended on Tue 14 Dec 2004 03:57 PM by Greven
#13
attaching gdb to smaug didn't work because I usually manually start up smaug outside of the windows (as the .exe) and not in cygwin. It doesn't have a PID then. Later I started it up in cygwin, and it got a PID, so attaching gdb could work, so now it worked :)
Canada #14
You can also boot inside of gdb, as this is a very handy feature. I would recommend, as I think most people here would, that you figure out why it you can't boot in the shell, as this is a much better method. There are numerous posts that you could check on how to fix your startup.
USA #15
Probably the reason startup didn't run the exec because it was permission denied, which he fixed.

As for the core not saving, I'm not sure if Cygwin does generate a core.
Canada #16
Fairly certain that cygwin will not export a core, though if someone can get it to I'd be more than happy to hear it.
#17
I haven't seen any core after the stackdumps (even in cygwin), so I guess it doesn't, lol
USA #18
I'm not sure it's even possible for Cygwin to dump a core, because I think that depends on Windows - Cygwin isn't actually running a Unix environment, just pretending to. The core is taken from the OS proper and I don't think one can do that without going in and editing the OS's kernel.
Australia Forum Administrator #19
I've never seen one. I think you just need to run it under gdb if you are expecting a crash.