logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Trouble with Chat Plugin

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux technical support
View previous topic :: View next topic  
Author Message
eeriegeek



Joined: 07 Jan 2008
Posts: 59

PostPosted: Tue Feb 14, 2012 3:34    Post subject: Trouble with Chat Plugin Reply with quote

I recently added the chat plugin to my module and everything seemed to be going fine. I was running fedora core 14 i386 in a chroot on x86_64 with builds from the svn trunk. Last week I decided to upgrade my dev computer to fedora core 16 and have run into crashes at startup in ChatHookProc. The environment is about the same as before (except of course the os version). I built a full i386 chroot and built the trunk checkout from svn in the chroot.

When the module starts up it loads, then core dumps right after the module load event right about the time of the first chat message (an IM_DEAD message from an creature that dies on spawn.)

chat section of nwnx2.ini
Code:

# nwnx_chat.so
#
[CHAT]
chat_script=nwnx_chat_nml
server_script=nwnx_chat_srv
processnpc=0
ignore_silent=0

server console:
Code:

NWNX2lib: Init
NWNX2lib: org SetString() at 0x81f41b4, new SetString() at 0xf76fe8e2
NWNX2lib: org GetObj() at 0x81f40bc, new GetObj() at 0xf76fe90a
* Parsing configuration...
NWN Extender v2.7.1-dev
(c) 2004 by the APS/NWNX Linux Conversion Group
(c) 2007-2009 by virusman and Acaos
Based on the Win32 version (c) 2003 by Ingmar Stieger (Papillon)
and Jeroen Broekhuizen
visit us at http://www.avlis.org

* Searching for signatures...
* Loading modules...
ODBC plugin registered.
FIXES plugin registered.
SYSTEM plugin registered.
FUNCS plugin registered.
CHAT plugin registered.
* NWNX2 activated.
Neverwinter Nights Server
Build:8109
Copyright BioWare Corp 1998-2004

Server: Loading...
Server: Running...

Server: Loading module "ic207nwn169cep24a"..........................................................................
...............................................................................................................
..............................................................................................................
.................................
Server: Module loaded
INIT(S): valid ret=0x082041ec
INIT(S): reset ignored ret=0x082041ec
/home/nwn/bin/server-command: line 11:  5112 Segmentation fault      (core dumped) /home/nwn/server/nwserver -publicserver 0 -module "ic207nwn169cep24a"



nwnx startup log
Code:

NWN Extender v2.7.1-dev
--------------------------------
ODBC plugin registered.
Address: F7403AA0
FIXES plugin registered.
Address: F648B640
SYSTEM plugin registered.
Address: F73F6A54
FUNCS plugin registered.
Address: F647FB2C
CHAT plugin registered.
Address: F646E800
* NWNX2 activated.



tail of the server log:
Code:

[Mon Feb 13 17:03:09] DEBUG[1] ee_me_moduleload: ReCheck Current World Date/Time: [1067-02-01 02:20]
[Mon Feb 13 17:03:09] DEBUG[1] ee_me_moduleload: Time, DB[1329170589], SYS[1329170589]
[Mon Feb 13 17:03:09] DEBUG[3] ee_me_moduleload: **************** END MODULE OnModuleLoad Event Handler ****************
[Mon Feb 13 17:03:09] LOG: CHAT: F[Dead Bear]T[]V[13]M[NW_I_AM_DEAD]


the chat plugin log:
Code:

NWNX Chat version 1.0.0 for Linux.
(c) 2005-2006 by dumbo (dumbo@nm.ru)
(c) 2006-2010 virusman (virusman@virusman.ru)
Settings:
chat_script: nwnx_chat_nml
server_script: nwnx_chat_srv
cc_script: cc_script
max_msg_len: 1024
processnpc: 1
ignore_silent: 1

! ChatProc hooked at 806839c.
! RunProc located at 8261f94.
o CHAT: mode=D, from_oID=00001B0A, msg='NW_I_AM_DEAD', to_ID=FFFFFFFF

backtrace from core:
Code:

No symbol table info available.
#4  0xf76c7cd3 in start_thread (arg=0xf6c99b40) at pthread_create.c:309
        __res = <optimized out>
        pd = 0xf6c99b40
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-143814668, 0, 4001536, -154561496, -2066969748, -820818065}, mask_was_saved = 0}}, priv = {
            pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#5  0xf760783e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:133
No locals.

Thread 1 (Thread 0xf7405700 (LWP 31272)):
#0  ChatHookProc (pthis=Cannot access memory at address 0x1b12
) at HookChat.cpp:65
No locals.
Cannot access memory at address 0x1b0e
(gdb)
(gdb) disas ChatHookProc
Dump of assembler code for function ChatHookProc(char*, int, int, char const**, int, char const*):
   0xf6469a68 <+0>:     push   %ebp
   0xf6469a69 <+1>:     mov    %esp,%ebp
   0xf6469a6b <+3>:     sub    $0x28,%esp
   0xf6469a6e <+6>:     pusha
   0xf6469a6f <+7>:     mov    0xf646e75c,%eax
   0xf6469a74 <+12>:    test   %eax,%eax
   0xf6469a76 <+14>:    jne    0xf6469a80 <ChatHookProc(char*, int, int, char const**, int, char const*)+24>
   0xf6469a78 <+16>:    mov    0x8(%ebp),%eax
   0xf6469a7b <+19>:    mov    %eax,0xf646e75c
   0xf6469a80 <+24>:    mov    0xf646e768,%al
   0xf6469a85 <+29>:    test   %al,%al
   0xf6469a87 <+31>:    jne    0xf6469ab6 <ChatHookProc(char*, int, int, char const**, int, char const*)+78>
   0xf6469a89 <+33>:    mov    0x18(%ebp),%eax
   0xf6469a8c <+36>:    mov    %eax,0x10(%esp)
   0xf6469a90 <+40>:    mov    0x14(%ebp),%eax
   0xf6469a93 <+43>:    mov    %eax,0xc(%esp)
   0xf6469a97 <+47>:    mov    0x10(%ebp),%eax
   0xf6469a9a <+50>:    mov    %eax,0x8(%esp)
   0xf6469a9e <+54>:    mov    0xc(%ebp),%eax
   0xf6469aa1 <+57>:    mov    %eax,0x4(%esp)
   0xf6469aa5 <+61>:    movl   $0xf646e800,(%esp)
   0xf6469aac <+68>:    call   0xf646b17a <CNWNXChat::Chat(int, int, char const**, int)>
   0xf6469ab1 <+73>:    mov    %eax,0xf646e7e0
   0xf6469ab6 <+78>:    popa
=> 0xf6469ab7 <+79>:    leave
   0xf6469ab8 <+80>:    mov    0xf646e768,%al
   0xf6469abd <+85>:    test   %al,%al
   0xf6469abf <+87>:    jne    0xf6469acb <ChatHookProc(char*, int, int, char const**, int, char const*)+99>
   0xf6469ac1 <+89>:    mov    0xf646e7e0,%eax
   0xf6469ac6 <+94>:    test   %eax,%eax
   0xf6469ac8 <+96>:    je     0xf6469acb <ChatHookProc(char*, int, int, char const**, int, char const*)+99>
   0xf6469aca <+98>:    ret
   0xf6469acb <+99>:    mov    $0xf646e7a0,%eax
   0xf6469ad0 <+104>:   jmp    *%eax
   0xf6469ad2 <+106>:   leave
   0xf6469ad3 <+107>:   ret
End of assembler dump.


Code:

[nwn@earendil server]$ uname -p
x86_64
[nwn@earendil server]$ gcc -dumpmachine
i686-redhat-linux
[nwn@earendil server]$ gcc -dumpversion
4.6.2

HookChat.cpp
Code:

void ChatHookProc(char * pthis, const int mode, const int id, const char **msg, const int to, const char * xz)
{
        asm ("pusha");
        if(!pChatThis) pChatThis = pthis;
        if (!scriptRun)
                lastRet = chat.Chat(mode, id, msg, to);
        asm ("popa");
        asm ("leave");                                    <--- line 65
        if (!scriptRun && lastRet)
                asm ("ret");
        asm ("mov $d_ret_code_chat, %eax");
        asm ("jmp %eax");
}



I've tried this with both the trunk version of chat (0.3.5) where I first noticed it, and the 1.0.0 version which seems to do the same thing. I did notice the plugin seems to ignore the processnpc and ignore_silent flags according to the logs.

If I remove the chat plugin the other plugins seem to function normally, including the odbc plugin.

Any ideas appreciated!
Back to top
View user's profile Send private message
pain



Joined: 30 Oct 2011
Posts: 16

PostPosted: Tue Feb 14, 2012 18:52    Post subject: Reply with quote

Doesn't NWN1 have a chat function now?
Back to top
View user's profile Send private message
eeriegeek



Joined: 07 Jan 2008
Posts: 59

PostPosted: Tue Feb 14, 2012 21:01    Post subject: Reply with quote

The regular NWN OnPlayerChat module event is great, but it doesn't capture a number of useful messages including tells, server messages, and silent shouts.
Back to top
View user's profile Send private message
pain



Joined: 30 Oct 2011
Posts: 16

PostPosted: Tue Feb 14, 2012 23:59    Post subject: Reply with quote

eeriegeek wrote:
The regular NWN OnPlayerChat module event is great, but it doesn't capture a number of useful messages including tells, server messages, and silent shouts.


Hmm, was thinking it worked like the one in NWN2, for that it passes the channel which is being used as well as the message, and who it's to. It basically removed the need for me to use NWNx to deal with chat entirely.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux technical support All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group