This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

MegaHAL - crash on startup

Discussion of Eggdrop's code and module programming in C.
Post Reply
s
surgeon
Voice
Posts: 4
Joined: Tue Jun 01, 2010 10:50 am
Location: Poland

MegaHAL - crash on startup

Post by surgeon »

x64 Freebsd 8.0
Eggdrop v1.6.19+ctcpfix (C) 1997 Robey Pointer (C) 2008 Eggheads
[17:32] --- Loading eggdrop v1.6.19+ctcpfix (Tue Jun 1 2010)
[17:32] Listening at telnet port xxxxx (bots).
[17:32] Listening at telnet port xxxxx (users).
[17:32] Module loaded: blowfish
[17:32] Module loaded: dns
[17:32] Module loaded: channels
[17:32] Module loaded: server
[17:32] Module loaded: ctcp
[17:32] Module loaded: irc
[17:32] Module loaded: transfer (with lang support)
[17:32] Module loaded: share
[17:32] Module loaded: compress
[17:32] Module loaded: notes (with lang support)
[17:32] Module loaded: console (with lang support)
[17:32] Module loaded: uptime
[17:32] .

[17:32] * Last context: tclhash.c/238 []
[17:32] * Please REPORT this BUG!
[17:32] * Check doc/BUG-REPORT on how to do so.
[17:32] * Wrote DEBUG
[17:32] * SEGMENT VIOLATION -- CRASHING!
Memory protection violation: 11 (core dumped)
Back trace:
This GDB was configured as "amd64-marcel-freebsd"...

warning: core file may not match specified executable file.
Core was generated by `eggdrop-1.6.19'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/lib/libtcl84.so.1...done.
Loaded symbols for /usr/local/lib/libtcl84.so.1
Reading symbols from /lib/libm.so.5...done.
Loaded symbols for /lib/libm.so.5
Reading symbols from /lib/libc.so.7...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /usr/home/surgeon/bot/modules/blowfish.so...done.
Loaded symbols for /usr/home/surgeon/bot/modules/blowfish.so
Reading symbols from /usr/home/surgeon/bot/modules/dns.so...done.
Loaded symbols for /usr/home/surgeon/bot/modules/dns.so
Reading symbols from /usr/home/surgeon/bot/modules/channels.so...done.
Loaded symbols for /usr/home/surgeon/bot/modules/channels.so
Reading symbols from /usr/home/surgeon/bot/modules/server.so...done.
Loaded symbols for /usr/home/surgeon/bot/modules/server.so
Reading symbols from /usr/home/surgeon/bot/modules/ctcp.so...done.
Loaded symbols for /usr/home/surgeon/bot/modules/ctcp.so
Reading symbols from /usr/home/surgeon/bot/modules/irc.so...done.
Loaded symbols for /usr/home/surgeon/bot/modules/irc.so
Reading symbols from /usr/home/surgeon/bot/modules/share.so...done.
Loaded symbols for /usr/home/surgeon/bot/modules/share.so
Reading symbols from /usr/home/surgeon/bot/modules/transfer.so...done.
Loaded symbols for /usr/home/surgeon/bot/modules/transfer.so
Reading symbols from /usr/home/surgeon/bot/modules/compress.so...done.
Loaded symbols for /usr/home/surgeon/bot/modules/compress.so
Reading symbols from /lib/libz.so.5...done.
Loaded symbols for /lib/libz.so.5
Reading symbols from /usr/home/surgeon/bot/modules/notes.so...done.
Loaded symbols for /usr/home/surgeon/bot/modules/notes.so
Reading symbols from /usr/home/surgeon/bot/modules/console.so...done.
Loaded symbols for /usr/home/surgeon/bot/modules/console.so
Reading symbols from /usr/home/surgeon/bot/modules/uptime.so...done.
Loaded symbols for /usr/home/surgeon/bot/modules/uptime.so
Reading symbols from /usr/home/surgeon/bot/modules/megahal.so...done.
Loaded symbols for /usr/home/surgeon/bot/modules/megahal.so
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0 0x0000000800a5b386 in strlen () from /lib/libc.so.7
(gdb) bt
#0 0x0000000800a5b386 in strlen () from /lib/libc.so.7
#1 0x0000000801accedb in megahal_start (global_funcs=Variable "global_funcs" is not available.
) at .././megahal.mod/megahal.c:2566
#2 0x000000000042ada3 in module_load (name=0x800c03900 "megahal") at modules.c:784
#3 0x0000000000435a3f in tcl_loadmodule (cd=Variable "cd" is not available.
) at tclmisc.c:527
#4 0x000000000042eec8 in utf_converter (cdata=0x800c89a70, myinterp=0x800c6c300, objc=2, objv=Variable "objv" is not available.
) at tcl.c:352
#5 0x00000008006bd6d6 in TclEvalObjvInternal () from /usr/local/lib/libtcl84.so.1
#6 0x00000008006bdbd1 in Tcl_EvalEx () from /usr/local/lib/libtcl84.so.1
#7 0x0000000800700467 in Tcl_FSEvalFile () from /usr/local/lib/libtcl84.so.1
#8 0x000000080070052f in Tcl_EvalFile () from /usr/local/lib/libtcl84.so.1
#9 0x000000000042e7df in readtclprog (fname=0x54aec0 "bot") at tcl.c:739
#10 0x0000000000410099 in chanprog () at chanprog.c:447
#11 0x000000000042553f in main (argc=3, argv=0x7fffffffea68) at ./main.c:814
I also tried older versions of eggdrop, tcls, even linux. Same effect.
Of course, I had to replace the stdlib malloc in megahal.c under fBSD.
p
pseudo
Halfop
Posts: 88
Joined: Mon Nov 23, 2009 4:52 am
Location: Bulgaria
Contact:

Post by pseudo »

There is a known problem with some 64-bit BSDs and eggdrop. Please look at this: http://trac.eggheads.org/ticket/2

Try the hack there and if it works, consider giving the current CVS a try.
s
surgeon
Voice
Posts: 4
Joined: Tue Jun 01, 2010 10:50 am
Location: Poland

Post by surgeon »

I do not understand something.
env MALLOC_OPTIONS='Dm' ./eggdrop
This means that variable MALLOC_OPTIONS should be set to 'Dm' ./eggdrop or only Dm?
Firtst option does not make sense. Second does not help for megahal malloc.

Patch created the following files on 1.6.19:
./src/mod/server.mod/servmsg.c.rej
./src/mod/module.h.rej
./src/cmds.c.rej
./configure.rej


and on current 1.6(.20):
./config.h.in.rej
./configure.rej
p
pseudo
Halfop
Posts: 88
Joined: Mon Nov 23, 2009 4:52 am
Location: Bulgaria
Contact:

Post by pseudo »

The patch is for cvs, it won't apply cleanly to 1.6.19. As for the environment variable, it clearly makes sense, otherwise I wouldn't bother writting short essays about it.

Code: Select all

env MALLOC_OPTIONS='Dm' ./eggdrop
The whole line sets MALLOC_OPTIONS to Dm and runs eggdrop. You're supposed to copy & paste it in your shell to run the bot. I won't go into details, but changing the memory allocation technique helps a purely 32-bit eggdrop to deal with a 64-bit addressing environment.

If you want to try out the cvs, download the snapshot instead of the 1.6.19 source: ftp://ftp.eggheads.org/pub/eggdrop/sour ... hot.tar.gz
It already contains the aforementioned patch, so there's no need to reapply it.
s
surgeon
Voice
Posts: 4
Joined: Tue Jun 01, 2010 10:50 am
Location: Poland

Post by surgeon »

As I understand it I still need to replace malloc.h to stdlib.h in megahal.c file to compile mod?

In this way, built and run eggdrop, still crashes while loading megahal.mod.
s
surgeon
Voice
Posts: 4
Joined: Tue Jun 01, 2010 10:50 am
Location: Poland

Post by surgeon »

I think that I have found the cause of crash. It seems that it was a blank line at end of file megahal.swp.
Post Reply