Git Product home page Git Product logo

samp-plugin-jit's People

Contributors

oscar-broman avatar y-less avatar zeex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

samp-plugin-jit's Issues

Get rid of inline assembly

Since there are two versions, for GCC and MSVC, it's hard to not make a mistake somewhere or forget to update one of them. A separate file(s) written in YASM/NASM syntax (or any other assembler that would work on both platforms) would be much better.

Various malfunctions.

I can't really give much more info, except that on windows suddendly script publics don't get called, this was checked for onplayerclicktextdraw and onplayertext.

My plugins:

plugins jit crashdetect MapAndreas streamer mysql_r7 TranslationPlugin sscanf MathPlugin rwthread socket gvar nativechecker

Tested on win32. there are no useful messages anywhere in logs.

On linux, i get the following message:
[11:36:54] [debug] Server crashed due to an unknown error
[11:36:54] [debug] Thread backtrace:

It tends to crash whenever i do some more things in script, usually in connection with mysql plugin.
One of example linux crashes (via GDB):

backtrace:
#0 0xf475674f in ?? ()

No symbol table info available.
#1 0xf4756643 in ?? ()

No symbol table info available.
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

I can help debug anything.. you can find me on irc.tl - #partyserver JernejL or JernejL_Work nick

Crash CallLocalFunction

С этим кодом вылетает

include <a_samp>

public OnGameModeInit() CallLocalFunction("Test", "");
main(){}
forward Test();
public Test()
{
new a[2];
new b=-1;
a[b]=0;
}

Packed string indexing bug (LODB.I / STRB.I issue)

#include <a_samp>
new mas[1 char];

main()
{
    mas{0}=1;
    printf("%d",mas{0});
}

Выдаёт вместо 1 - 134217728

Написал заного, т.к. ты удалил свои аккаунты на форуме и возможно это потерялось у тебя

Crash (y_va)

Крашит при использовании библиотеки от YSI y_va.

YSI crash

Crashes on startup.

Dump

Download: samp-server_120621_120117.dmp

crashinfo.txt

SA-MP Server: 0.3e

Exception At Address: 0x01F59DBE Module: (Unknown)

Registers:
EAX: 0x01F00924 EBX: 0x032CE3A1 ECX: 0xFFFA6BE0 EDX: 0x01F00924
ESI: 0x022A32C8 EDI: 0x03558E95 EBP: 0x03558E4D ESP: 0x03558E49
EFLAGS: 0x00010207

Stack:
+0000: 0x01F00924   0x0028AAC4   0x01F59D48   0x00000000
+0010: 0x0005E381   0x00001AB8   0xFFFA1CB3   0x0028AADC
+0020: 0x003F0090   0x00000000   0x00000008   0x000051D4
+0030: 0x00005220   0x0028AAF4   0x003F0090   0x00000000
+0040: 0x00000008   0x000049EC   0x00004A38   0x0028AB0C
+0050: 0x003F0090   0x00000000   0x00000008   0x000041FC
+0060: 0x0000425C   0x0028AB24   0x003F0090   0x00000000
+0070: 0x00000008   0x00003AC8   0x00003B1C   0x0028AB3C
+0080: 0x003F0090   0x00000000   0x00000008   0x00000654
+0090: 0x000006AC   0x00000000   0x003F0090   0x00000000
+00A0: 0x00000000   0x00000000   0x00000000   0x00000000
+00B0: 0x00000000   0x00000000   0x00000000   0x00000000
+00C0: 0x00000000   0x00000000   0x00000000   0x00000000
+00D0: 0x00000000   0x00000000   0x00000000   0x00000000
+00E0: 0x00000000   0x00000000   0x00000000   0x00000000
+00F0: 0x00000000   0x00000000   0x00000000   0x00000000
+0100: 0x00000000   0x00000000   0x00000000   0x00000000
+0110: 0x00000000   0x00000000   0x00000000   0x00000000
+0120: 0x00000000   0x00000000   0x00000000   0x00000000
+0130: 0x00000000   0x00000000   0x00000000   0x00000000

--------------------------

Loaded Modules:
samp-server.exe A: 0x00400000 - 0x004EE000  (\\psf\Home\Desktop\PAWN-Boilerplate\samp-server.exe)
ntdll.dll   A: 0x774F0000 - 0x77670000  (C:\Windows\SysWOW64\ntdll.dll)
kernel32.dll    A: 0x74FC0000 - 0x750D0000  (C:\Windows\syswow64\kernel32.dll)
KERNELBASE.dll  A: 0x76480000 - 0x764C6000  (C:\Windows\syswow64\KERNELBASE.dll)
SHELL32.dll A: 0x75340000 - 0x75F8A000  (C:\Windows\syswow64\SHELL32.dll)
msvcrt.dll  A: 0x762C0000 - 0x7636C000  (C:\Windows\syswow64\msvcrt.dll)
SHLWAPI.dll A: 0x764D0000 - 0x76527000  (C:\Windows\syswow64\SHLWAPI.dll)
GDI32.dll   A: 0x74E60000 - 0x74EF0000  (C:\Windows\syswow64\GDI32.dll)
USER32.dll  A: 0x76AA0000 - 0x76BA0000  (C:\Windows\syswow64\USER32.dll)
ADVAPI32.dll    A: 0x76790000 - 0x76830000  (C:\Windows\syswow64\ADVAPI32.dll)
sechost.dll A: 0x75320000 - 0x75339000  (C:\Windows\SysWOW64\sechost.dll)
RPCRT4.dll  A: 0x750D0000 - 0x751C0000  (C:\Windows\syswow64\RPCRT4.dll)
SspiCli.dll A: 0x74BD0000 - 0x74C30000  (C:\Windows\syswow64\SspiCli.dll)
CRYPTBASE.dll   A: 0x74BC0000 - 0x74BCC000  (C:\Windows\syswow64\CRYPTBASE.dll)
LPK.dll A: 0x774C0000 - 0x774CA000  (C:\Windows\syswow64\LPK.dll)
USP10.dll   A: 0x74F20000 - 0x74FBD000  (C:\Windows\syswow64\USP10.dll)
WSOCK32.dll A: 0x73450000 - 0x73457000  (C:\Windows\system32\WSOCK32.dll)
WS2_32.dll  A: 0x76720000 - 0x76755000  (C:\Windows\syswow64\WS2_32.dll)
NSI.dll A: 0x75F90000 - 0x75F96000  (C:\Windows\syswow64\NSI.dll)
WINMM.dll   A: 0x733E0000 - 0x73412000  (C:\Windows\system32\WINMM.dll)
IMM32.DLL   A: 0x74C30000 - 0x74C90000  (C:\Windows\system32\IMM32.DLL)
MSCTF.dll   A: 0x76530000 - 0x765FC000  (C:\Windows\syswow64\MSCTF.dll)
jit.DLL A: 0x74050000 - 0x74092000  (\\psf\Home\Desktop\PAWN-Boilerplate\plugins\jit.DLL)
MSVCP100.dll    A: 0x73FE0000 - 0x74049000  (C:\Windows\system32\MSVCP100.dll)
MSVCR100.dll    A: 0x73F20000 - 0x73FDE000  (C:\Windows\system32\MSVCR100.dll)
sscanf.DLL  A: 0x10000000 - 0x1000C000  (\\psf\Home\Desktop\PAWN-Boilerplate\plugins\sscanf.DLL)
whirlpool.DLL   A: 0x002C0000 - 0x002CC000  (\\psf\Home\Desktop\PAWN-Boilerplate\plugins\whirlpool.DLL)
MSVCR80.dll A: 0x735B0000 - 0x7364B000  (C:\Windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.6195_none_d09154e044272b9a\MSVCR80.dll)
mswsock.dll A: 0x73050000 - 0x7308C000  (C:\Windows\system32\mswsock.dll)
wshtcpip.dll    A: 0x73040000 - 0x73045000  (C:\Windows\System32\wshtcpip.dll)
NLAapi.dll  A: 0x72970000 - 0x72980000  (C:\Windows\system32\NLAapi.dll)
napinsp.dll A: 0x72960000 - 0x72970000  (C:\Windows\system32\napinsp.dll)
pnrpnsp.dll A: 0x72940000 - 0x72952000  (C:\Windows\system32\pnrpnsp.dll)
DNSAPI.dll  A: 0x728F0000 - 0x72934000  (C:\Windows\system32\DNSAPI.dll)
winrnr.dll  A: 0x728E0000 - 0x728E8000  (C:\Windows\System32\winrnr.dll)
wshbth.dll  A: 0x728D0000 - 0x728DD000  (C:\Windows\system32\wshbth.dll)
mdnsNSP.dll A: 0x728A0000 - 0x728C1000  (C:\Program Files (x86)\Bonjour\mdnsNSP.dll)
Iphlpapi.DLL    A: 0x73120000 - 0x7313C000  (C:\Windows\system32\Iphlpapi.DLL)
WINNSI.DLL  A: 0x73110000 - 0x73117000  (C:\Windows\system32\WINNSI.DLL)
rasadhlp.dll    A: 0x72850000 - 0x72856000  (C:\Windows\system32\rasadhlp.dll)

--------------------------
SA-MP Server: 0.3e

Exception At Address: 0x7778016E Module: (ntdll.dll)

Registers:
EAX: 0x00000000 EBX: 0x03468994 ECX: 0x94740000 EDX: 0x0008E8B8
ESI: 0x00587060 EDI: 0x03468E95 EBP: 0x03468E4D ESP: 0x03468980
EFLAGS: 0x00000213

Stack:
+0000: 0x00000000   0x00000001   0x03468994   0x7778016E
+0010: 0x00000000   0xC0000005   0x00000000   0x00000000
+0020: 0x00639DBE   0x00000002   0x00000000   0x037BECC5
+0030: 0x00000000   0x00000000   0x00000000   0x00000000
+0040: 0x00000000   0x00000000   0x00000000   0x00000000
+0050: 0x00000000   0x00000000   0x00000000   0x00000000
+0060: 0x00000000   0x0001007F   0x00000000   0x00000000
+0070: 0x00000000   0x00000000   0x00000000   0x00000000
+0080: 0x0000027F   0x00000100   0x0000FFFF   0x7494F968
+0090: 0x00000000   0x0018FD38   0x00000000   0x00000000
+00A0: 0x00000000   0x00000000   0x00000000   0x00000000
+00B0: 0x00000000   0x00000000   0x00000000   0x00000000
+00C0: 0x00000000   0x00000000   0x00000000   0x00000000
+00D0: 0x00000000   0x40028000   0x00000000   0x80000000
+00E0: 0x00003FFD   0x00000000   0x3FFF8000   0x0008F038
+00F0: 0x0000002B   0x00000053   0x0000002B   0x0000002B
+0100: 0x03468E95   0x00587060   0x031DE3A1   0x005E0924
+0110: 0xFFFA6BE0   0x005E0924   0x03468E4D   0x00639DBE
+0120: 0x00000023   0x00010207   0x03468E49   0x0000002B
+0130: 0x0100027F   0x00000000   0x7494F968   0x00000000

--------------------------

Loaded Modules:
samp-server.exe A: 0x00400000 - 0x004EE000  (Y:\Desktop\PAWN-Boilerplate\samp-server.exe)
ntdll.dll   A: 0x77770000 - 0x778F0000  (C:\Windows\SysWOW64\ntdll.dll)
kernel32.dll    A: 0x750C0000 - 0x751D0000  (C:\Windows\syswow64\kernel32.dll)
KERNELBASE.dll  A: 0x75400000 - 0x75446000  (C:\Windows\syswow64\KERNELBASE.dll)
SHELL32.dll A: 0x757C0000 - 0x7640A000  (C:\Windows\syswow64\SHELL32.dll)
msvcrt.dll  A: 0x76410000 - 0x764BC000  (C:\Windows\syswow64\msvcrt.dll)
SHLWAPI.dll A: 0x75730000 - 0x75787000  (C:\Windows\syswow64\SHLWAPI.dll)
GDI32.dll   A: 0x76900000 - 0x76990000  (C:\Windows\syswow64\GDI32.dll)
USER32.dll  A: 0x76A90000 - 0x76B90000  (C:\Windows\syswow64\USER32.dll)
ADVAPI32.dll    A: 0x76CE0000 - 0x76D80000  (C:\Windows\syswow64\ADVAPI32.dll)
sechost.dll A: 0x75070000 - 0x75089000  (C:\Windows\SysWOW64\sechost.dll)
RPCRT4.dll  A: 0x76BF0000 - 0x76CE0000  (C:\Windows\syswow64\RPCRT4.dll)
SspiCli.dll A: 0x74E50000 - 0x74EB0000  (C:\Windows\syswow64\SspiCli.dll)
CRYPTBASE.dll   A: 0x74E40000 - 0x74E4C000  (C:\Windows\syswow64\CRYPTBASE.dll)
LPK.dll A: 0x76520000 - 0x7652A000  (C:\Windows\syswow64\LPK.dll)
USP10.dll   A: 0x76990000 - 0x76A2D000  (C:\Windows\syswow64\USP10.dll)
WSOCK32.dll A: 0x736D0000 - 0x736D7000  (C:\Windows\system32\WSOCK32.dll)
WS2_32.dll  A: 0x76A30000 - 0x76A65000  (C:\Windows\syswow64\WS2_32.dll)
NSI.dll A: 0x76A70000 - 0x76A76000  (C:\Windows\syswow64\NSI.dll)
WINMM.dll   A: 0x73660000 - 0x73692000  (C:\Windows\system32\WINMM.dll)
IMM32.DLL   A: 0x76B90000 - 0x76BF0000  (C:\Windows\system32\IMM32.DLL)
MSCTF.dll   A: 0x75660000 - 0x7572C000  (C:\Windows\syswow64\MSCTF.dll)
jit.DLL A: 0x748A0000 - 0x748E2000  (Y:\Desktop\PAWN-Boilerplate\plugins\jit.DLL)
MSVCP100.dll    A: 0x74520000 - 0x74589000  (C:\Windows\system32\MSVCP100.dll)
MSVCR100.dll    A: 0x74460000 - 0x7451E000  (C:\Windows\system32\MSVCR100.dll)
sscanf.DLL  A: 0x10000000 - 0x1000C000  (Y:\Desktop\PAWN-Boilerplate\plugins\sscanf.DLL)
whirlpool.DLL   A: 0x003A0000 - 0x003AC000  (Y:\Desktop\PAWN-Boilerplate\plugins\whirlpool.DLL)
MSVCR80.dll A: 0x73830000 - 0x738CB000  (C:\Windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.6195_none_d09154e044272b9a\MSVCR80.dll)
mswsock.dll A: 0x732D0000 - 0x7330C000  (C:\Windows\system32\mswsock.dll)
wshtcpip.dll    A: 0x732C0000 - 0x732C5000  (C:\Windows\System32\wshtcpip.dll)
NLAapi.dll  A: 0x72BF0000 - 0x72C00000  (C:\Windows\system32\NLAapi.dll)
napinsp.dll A: 0x72BE0000 - 0x72BF0000  (C:\Windows\system32\napinsp.dll)
pnrpnsp.dll A: 0x72BC0000 - 0x72BD2000  (C:\Windows\system32\pnrpnsp.dll)
DNSAPI.dll  A: 0x72B70000 - 0x72BB4000  (C:\Windows\system32\DNSAPI.dll)
winrnr.dll  A: 0x72B60000 - 0x72B68000  (C:\Windows\System32\winrnr.dll)
wshbth.dll  A: 0x72B50000 - 0x72B5D000  (C:\Windows\system32\wshbth.dll)
mdnsNSP.dll A: 0x72B20000 - 0x72B41000  (C:\Program Files (x86)\Bonjour\mdnsNSP.dll)
Iphlpapi.DLL    A: 0x733A0000 - 0x733BC000  (C:\Windows\system32\Iphlpapi.DLL)
WINNSI.DLL  A: 0x73390000 - 0x73397000  (C:\Windows\system32\WINNSI.DLL)
rasadhlp.dll    A: 0x72AD0000 - 0x72AD6000  (C:\Windows\system32\rasadhlp.dll)

Jit plugin crashes server at startup

Hello,

I've decided to give jit-plugin a try so, I tested it among the following plugins:

plugins jit.so mysql.so streamer.so sscanf.so

I'm using jit plugin from github https://github.com/Zeex/samp-plugin-jit/archive/master.zip
Compiled from source on the remote host.

When I start the server, it runs for a while, then it crashes.

Started server on xxx.xxx.xxx.xxx:7777, with maxplayers: 350 lanmode is ON.
Segmentation fault

server_log.txt:

[30/01/2014 11:21:13] Server Plugins
[30/01/2014 11:21:13] --------------
[30/01/2014 11:21:13]  Loading plugin: jit.so
[30/01/2014 11:21:13]   JIT plugin v2.0 is OK.
[30/01/2014 11:21:13]   Loaded.
[30/01/2014 11:21:13]  Loading plugin: mysql.so
[30/01/2014 11:21:13] 

  > MySQL plugin R7-2 successfully loaded.

[30/01/2014 11:21:13]   Loaded.
[30/01/2014 11:21:13]  Loading plugin: streamer.so
[30/01/2014 11:21:13] 

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[30/01/2014 11:21:13]   Loaded.
[30/01/2014 11:21:13]  Loading plugin: sscanf.so
[30/01/2014 11:21:13] 

[30/01/2014 11:21:13]  ===============================
[30/01/2014 11:21:13]       sscanf plugin loaded.     
[30/01/2014 11:21:13]          Version:  2.8.1        
[30/01/2014 11:21:13]    (c) 2012 Alex "Y_Less" Cole  
[30/01/2014 11:21:13]  ===============================

it even loads some data from mysql.. before it crashes.

...
...
...
[11:26:40] InitPrBrgThread(d) - Threaded function called.
[11:26:40] >> cache_get_data( Connection handle: 1 )
[11:26:40] ProcessTick() - The cache has been cleared.
[11:26:40] Passing query SELECT * FROM `bizuri_preturi_tunning` | d
[11:26:40] ProcessQueryThread(IPrTunnThread) - Query was successful. (SELECT * FROM `bizuri_preturi_tunning`)
[11:26:40] ProcessQueryThread(IPrTunnThread) - Data caching enabled.
[11:26:40] CMySQLHandler::StoreResult() - Result was stored.
[11:26:40] CMySQLHandler::FreeResult() - Result was successfully free'd.
[11:26:40] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[11:26:40] IPrTunnThread(d) - Threaded function called.
[11:26:40] >> cache_get_data( Connection handle: 1 )
[11:26:40] ProcessTick() - The cache has been cleared.
[11:26:40] Passing query SELECT t1.*, t2.* FROM factiuni_spawns as t1, factiuni_arme as t2 WHERE t1.id = t2.id | d
[11:26:40] ProcessQueryThread(InitSpawnsThread) - Query was successful. (SELECT t1.*, t2.* FROM factiuni_spawns as t1, factiuni_arme as t2 WHERE t1.id = t2.id)
[11:26:40] ProcessQueryThread(InitSpawnsThread) - Data caching enabled.
[11:26:40] CMySQLHandler::StoreResult() - Result was stored.
[11:26:40] CMySQLHandler::FreeResult() - Result was successfully free'd.
[11:26:40] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[11:26:40] InitSpawnsThread(d) - Threaded function called.
[11:26:40] >> cache_get_data( Connection handle: 1 )
[11:26:40] ProcessTick() - The cache has been cleared.
[11:26:40] Passing query SELECT * from factiuni_skinuri as t1 INNER JOIN players_ClassSel as t2 on (t1.factionid=t2.factionid) ORDER BY t1.id ASC | d
[11:26:40] ProcessQueryThread(InitSkinThread) - Query was successful. (SELECT * from factiuni_skinuri as t1 INNER JOIN players_ClassSel as t2 on (t1.factionid=t2.factionid) ORDER BY t1.id ASC)
[11:26:40] ProcessQueryThread(InitSkinThread) - Data caching enabled.
[11:26:40] CMySQLHandler::StoreResult() - Result was stored.
[11:26:40] CMySQLHandler::FreeResult() - Result was successfully free'd.
[11:26:40] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[11:26:40] InitSkinThread(d) - Threaded function called.
[11:26:40] >> cache_get_data( Connection handle: 1 )

Trace:

Starting program: /home/samp/sampsrv/./sampsrv 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
[New Thread 0xb7951b40 (LWP 6135)]
[Thread 0xb7951b40 (LWP 6135) exited]
[New Thread 0xb7951b40 (LWP 6136)]
[New Thread 0xb6b69b40 (LWP 6137)]

Started server on xxx.xxx.xxx.xxx:7777, with maxplayers: 350 lanmode is ON.


Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) thread apply all bt full

Thread 4 (Thread 0xb6b69b40 (LWP 6137)):
#0  0xb7d9e67c in nanosleep () at ../sysdeps/unix/syscall-template.S:81
No locals.
#1  0xb7dcd9cd in usleep (useconds=5000) at ../sysdeps/unix/sysv/linux/usleep.c:32
        ts = {tv_sec = 0, tv_nsec = 5000000}
#2  0x08076220 in ?? ()
No symbol table info available.
#3  0xb7fbca0d in start_thread (arg=0xb6b69b40) at pthread_create.c:311
        __res = 
        pd = 0xb6b69b40
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-1208168448, 0, 4001536, -1229548504, 819204668, -1436473794}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = 0
        pagesize_m1 = 
        sp = 
        freesize = 
        __PRETTY_FUNCTION__ = "start_thread"
#4  0xb7dd3b4e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:131
No locals.

Thread 3 (Thread 0xb7951b40 (LWP 6136)):
#0  0xb7d9e67c in nanosleep () at ../sysdeps/unix/syscall-template.S:81
No locals.
#1  0xb7dcd9cd in usleep (useconds=5000) at ../sysdeps/unix/sysv/linux/usleep.c:32
        ts = {tv_sec = 0, tv_nsec = 5000000}
#2  0xb797f97a in ProcessQueryThread(void*) () from plugins/mysql.so
No symbol table info available.
#3  0xb7fbca0d in start_thread (arg=0xb7951b40) at pthread_create.c:311
        __res = 
        pd = 0xb7951b40
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-1208168448, 0, 4001536, -1214966744, 2010387006, -1436473794}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = 0
        pagesize_m1 = 
        sp = 
        freesize = 
        __PRETTY_FUNCTION__ = "start_thread"
#4  0xb7dd3b4e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:131
No locals.

Thread 1 (Thread 0xb7cf7700 (LWP 6131)):
#0  0x00000000 in ?? ()
No symbol table info available.
#1  0x00000000 in ?? ()
No symbol table info available.

Is this because of multithreading from mysql plugin?

Any suggestions how to make it work?

Thank you in advance,
Mike.

Crashes

Could it be possible to prevent errors from killing the whole server (similar to the default behavior)? Instead of crashing and shutting down, just halt execution of the current callback.

Having int3 breakpoints in BOUNDS opcodes and such would also be nice, but that's a separate thing.

Compatibility whit crashdetect

if I have crashdetect in my server i recive
In order for runtime error detection to work CrashDetect must be loaded before jit.DLL.

but if i load crashdetect before jit, jit dosn't load

Startup crash

v1.2.5 crashes server if there is no "main()" function in gamemode
1
2

Modulus operator

I thought I was going crazy, but after some debugging I realized it was not my fault!

Negative numbers remain negative.

public OnFilterScriptInit() {
    new a = -5, b = 10;
    printf("-5 %% 10 = %d", a % b);
}

Output:

[00:39:30] -5 % 10 = -5

Idea about LCTRL 6

Correct me if I'm wrong, but LCTRL 6 never appears in the AMX unless #emit is used?

If that's the case, the JIT compiler could be clever and replace that with PUSH.pri followed by the address (and remove the next push), thus making many broken libs work again.

Crash at start

I get this error, when i start my server, and after it, the server is shut down

[12:45:55] [debug] Server crashed due to an unknown error
[12:45:55] [debug] Thread backtrace:
[12:45:55] [debug] #0  0xb75ebf29 in jit::Jitter::CallFunction(int, int*, int*) () from plugins/jit.so
[12:45:55] [debug] #1  0xb75ebd9d in jit::Jitter::CallPublicFunction(int, int*) () from plugins/jit.so
[12:45:55] [debug] #2  0xb75f64c1 in ?? () from plugins/jit.so
[12:45:55] [debug] #3  0x80d3612 in ?? () from ./samp03svr
[12:45:55] [debug] #4  0xb5773c80 in ?? () from (2?·�
[12:45:55] [debug] #5  0xb75ebf29 in jit::Jitter::CallFunction(int, int*, int*) () from plugins/jit.so
[12:45:55] [debug] #6  0xb75ebd9d in jit::Jitter::CallPublicFunction(int, int*) () from plugins/jit.so
[12:45:55] [debug] #7  0xb75f64c1 in ?? () from plugins/jit.so
[12:45:55] [debug] #8  0x80d3612 in ?? () from ./samp03svr
[12:45:55] [debug] #9  0xb57731e7 in ?? () from (2?·�
[12:45:55] [debug] #10 0xb75ebf29 in jit::Jitter::CallFunction(int, int*, int*) () from plugins/jit.so
[12:45:55] [debug] #11 0xb75ebd9d in jit::Jitter::CallPublicFunction(int, int*) () from plugins/jit.so
[12:45:55] [debug] #12 0xb75f64c1 in ?? () from plugins/jit.so
[12:45:55] [debug] #13 0x806b5a6 in ?? () from ./samp03svr
[12:45:55] [debug] #14 0x807a691 in ?? () from ./samp03svr
[12:45:55] [debug] #15 0x807a99a in ?? () from ./samp03svr
[12:45:55] [debug] #16 0x8077bd7 in ?? () from ./samp03svr
[12:45:55] [debug] #17 0xb7623ca6 in __libc_start_main () from /lib/i686/cmov/libc.so.6
[12:45:55] [debug] #18 0x804b4c1 in __gxx_personality_v0 () from ./samp03svr

Crash callback jit-1.2

Непомню с какой именно версии начались вылеты

crashdetect ничего не выдаёт, в логах пусто, crashinfo.txt не создаётся

Сам колбек OnPlayerConnect вызывается и обрабатывается, после завершения креш
Падает если присутствует CallRemoteFunction в OnPlayerConnect, независимо есть ли вызываемая функция в фильтрскрипте

OnPlayerText

This is in a script's OnPlayerText:

format(string, sizeof(string), "(%d) %s", playerid, text);
SendPlayerMessageToAll(playerid, string);

return 0;

Everyone in the server sees duplicate chat messages, one with (id) and one without (the original).

Compatibility with Streamer Plugin

After updating from 1.2.5 to 2.0, I found that Streamer Plugin cannot properly run Streamer_AppendArrayData. It will say "*** Streamer_AppendArrayData: Invalid ID specified".

Publics executed only once

server.cfg
plugins jit streamer
расположение плагина до или после не меняет ничего

#include <a_samp>
#include <streamer>

main()
{
    new tick=GetTickCount();
    new j;
    for(new i=0;i<100000000;i++) j=i;
    printf("%d",GetTickCount()-tick);
}

Jit не работает с #include

Floating-point native calls

It seems floatcmp is still invoked. Couldn't this be replaced by an instruction from the x87 FPU set?

The same goes for floattan, atan2, floatsin, floatcos, floatfract, and probably a few other functions.

main() {
    new Float:a = 2.0, Float:b = 2.0;

    if (a == b) {
        printf("equal");
    }
}

By the way, what happened to the donate link?

Crash linux filterscipts

Загрузить любой фильтрскрипт
Не имеет значение есть в нём код или нет

Мод тоже пустой
main(){}

Проверялось на дебиане и убунте

Последнее что выдаёт в логах
[16/04/2012 01:18:30] Loaded 1 filterscripts.

С Crashdetect

[16/04/2012 01:22:08] Loaded 1 filterscripts.

[16/04/2012 01:22:08] [debug] Server crashed while executing 1.amx
[16/04/2012 01:22:08] [debug] Backtrace:
[16/04/2012 01:22:08] [debug] #0 ???????? in main () at C:\game\server\gamemodes\1.pwn:2
[16/04/2012 01:22:08] [debug] Thread backtrace:

Вариант jit crashdetect streamer, выдаёт только на дебиане, и то только в случае если загрузка стримера после краша

[16/04/2012 12:29:27] Loaded 1 filterscripts.

[16/04/2012 12:29:27] [debug] Server crashed while executing universal_mode.amx
[16/04/2012 12:29:27] [debug] Backtrace:
[16/04/2012 12:29:27] [debug] #0 ???????? in main () at C:\game\server\gamemodes\1.pwn:2
[16/04/2012 12:29:27] [debug] Thread backtrace:
[16/04/2012 12:29:27] [debug] #0 0xf73f72ce in crashdetect::PrintThreadBacktrace(int) () from plugins/crashdetect.so
[16/04/2012 12:29:27] [debug] #1 0xf73f5e04 in crashdetect::Crash() () from plugins/crashdetect.so
[16/04/2012 12:29:27] [debug] #2 0xf7400815 in ?? () from plugins/crashdetect.so
[16/04/2012 12:29:27] [debug] #3 0xffffe400 in ?? ()
[16/04/2012 12:29:27] [debug] #4 0xf73f66df in crashdetect::HandleAmxExec(int*, int) () from plugins/crashdetect.so
[16/04/2012 12:29:27] [debug] #5 0xf73ff709 in ?? () from plugins/crashdetect.so
[16/04/2012 12:29:27] [debug] #6 0xf7432b62 in amx_Exec () from plugins/jit.so
[16/04/2012 12:29:27] [debug] #7 0xf7440fbe in ?? () from plugins/jit.so
[16/04/2012 12:29:27] [debug] #8 0x806ed3f in ?? () from ./samp03svr
[16/04/2012 12:29:27] [debug] #9 0x8079fed in ?? () from ./samp03svr
[16/04/2012 12:29:27] [debug] #10 0x8077217 in ?? () from ./samp03svr
[16/04/2012 12:29:27] [debug] #11 0xf7479ca6 in __libc_start_main () from /lib32/libc.so.6
[16/04/2012 12:29:27] [debug] #12 0x804b4c1 in __gxx_personality_v0 () from ./samp03svr

Inconsistency

The following code does not work properly when the JIT plugin is enabled. Tested on Linux and Windows.

Output without JIT:

[0] = 70
[1] = 71
[2] = 72
[3] = 73
[4] = 74
[5] = 75

Output with JIT:

[0] = -6
[1] = 71
[2] = 72
[3] = 73
[4] = -10
[5] = 75
#include <a_samp>

main()
{
    new arr_in[] = {70, 71, 72, 73, 74, 75};
    new arr_compressed[sizeof(arr_in)];
    new arr_out[sizeof(arr_in)];

    CompressArray(arr_in, _, arr_compressed);
    DecompressArray(arr_compressed, arr_out);

    for (new i = 0; i < sizeof(arr_out); i++) {
        printf("[%d] = %d", i, arr_out[i]);
    }
}

stock CompressArray(const aiArray[], iSize = sizeof(aiArray), aiOutput[]) {
    new
        iOutputIndex = 4,
        iValue,
        iMSB,
        iShift
    ;

    // * 0b11000000 = Single byte, negative
    // * 0b10000000 = Single byte
    // * 0b01000000 = Multi-byte
    //   - 0b01000000 = More bytes
    //   - 0b11000000 = Last byte
    //   - 0b10000000 = Unused

    for (new i = 0; i < iSize; i++) {
        // Will the value fit in one byte?

        iValue = aiArray[i];

        if (-0b00111111 <= iValue <= 0b00111111) {
            // Is the value negative?

            if (iValue & 0x80000000) {
                // Set the "single byte, negative" bits on and put the value without its sign

                aiOutput{iOutputIndex++} = 0b11000000 | -iValue;
            } else {
                // Just put the value in with the "single byte" bit

                aiOutput{iOutputIndex++} = 0b10000000 |  iValue;
            }
        } else {
            // Figure out how many bits we'll have to write
            iMSB = FindMSB(iValue) + 1;

            // Make iShift a multiple of 6 (if it isn't already)
            if ((iShift = iMSB % 6))
                aiOutput{iOutputIndex++} = 0b01000000 | (iValue >>> (iMSB - iShift) & ~(0xFFFFFFFF << iShift));

            iShift = iMSB - iShift;

            // Write bits out left-right
            while ((iShift -= 6) >= 0)
                aiOutput{iOutputIndex++} = 0b01000000 | (iValue >>> iShift & 0b00111111);

            // Change the "more bytes" bits into "last byte"
            aiOutput{iOutputIndex - 1} |= 0b11000000;
        }
    }

    // Put the number of bytes we just wrote into the first cell of the output
    aiOutput[0] = 0x80808080 | ((iOutputIndex & 0x1FE00000) << 3) | ((iOutputIndex & 0x3FC000) << 2) | ((iOutputIndex & 0x7F80) << 1) | (iOutputIndex & 0x7F);

    // Make sure the bytes in the last cell are 0
    aiOutput{iOutputIndex} = 0;

    iValue = iOutputIndex;

    while (++iOutputIndex % 4)
        aiOutput{iOutputIndex} = 0;

    // Return the number of bytes written (not counting the first 4)
    return iValue;
}

stock DecompressArray(const aiCompressedArray[], aiOutput[], iOutputSize = sizeof(aiOutput)) {
    new
        iBytes,
        iOutputIndex = 0
    ;

    // Get the number of bytes to parse
    iBytes = aiCompressedArray[0];
    iBytes = ((iBytes & 0x7F000000) >>> 3) | ((iBytes & 0x7F0000) >>> 2) | ((iBytes & 0x7F00) >>> 1) | (iBytes & 0x7F);

    for (new i = 4; i < iBytes; i++) {
        // Out of slots?
        if (iOutputIndex >= iOutputSize) {
            printf("(DecompressArray) Compressed array is larger than decompress buffer.");

            break;
        }

        // Single byte?
        if ((aiCompressedArray{i} & 0b10000000)) {
            // Negative?
            if ((aiCompressedArray{i} & 0b01000000))
                aiOutput[iOutputIndex++] = -(aiCompressedArray{i} & 0b00111111);
            else
                aiOutput[iOutputIndex++] =  (aiCompressedArray{i} & 0b00111111);
        } else {
            // Multi byte; read the last bits
            aiOutput[iOutputIndex] = aiCompressedArray{i} & 0b00111111;

            // Keep reading bits while shifting the value to the left
            do {
                aiOutput[iOutputIndex] <<= 6;
                aiOutput[iOutputIndex]  |= aiCompressedArray{++i} & 0b00111111;
            } while ((aiCompressedArray{i} & 0b10000000) == 0);

            iOutputIndex++;
        }
    }

    return iOutputIndex;
}

stock FindMSB(iInput) {
    // http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn

    static const
        s_aiDeBruijnBitPositionsPacked[32 char] = {
            0x0A010900,
            0x1D02150D,
            0x12100E0B,
            0x1E031916,
            0x1C140C08,
            0x0718110F,
            0x06171B13,
            0x1F04051A
        }
    ;

    if (iInput) {
        #emit LOAD.S.pri  iInput
        #emit MOVE.alt
        #emit SHR.C.alt   1
        #emit OR
        #emit MOVE.alt
        #emit SHR.C.alt   2
        #emit OR
        #emit MOVE.alt
        #emit SHR.C.alt   4
        #emit OR
        #emit MOVE.alt
        #emit SHR.C.alt   8
        #emit OR
        #emit MOVE.alt
        #emit SHR.C.alt   16
        #emit OR
        #emit CONST.alt   0x07C4ACDD
        #emit UMUL
        #emit SHR.C.pri   27
        #emit ADD.C       s_aiDeBruijnBitPositionsPacked
        #emit LODB.I      1
        #emit RETN
    }

    return -1;
}

[JIT 2.0] Crashes on connect

I'm running CentOS 6, 64-bit and using the JIT 2.0, the server is up, but once someone connects it instantly crashes.

plugins jit.so sscanf.so Whirlpool.so mysql_static.so (MySQL R34)

LCTRL 8 / SCTRL 8 - get/set ASM pointer

With the JIT plugin, doing this:

#emit LOAD.S.pri pointer
#emit SCTRL      6

For a dynamic jump is quite inefficient - actually less so than in the VM because of the address translations required. This is unfortunate but understandable. I'm proposing LCTRL 8 to load the compiled address of the AMX address in pri in to pri, and SCTRL 8 to jump straight to that exact assembly location in the JIT. I realise there are serious uses of abuse with this, but with all the other ways of executing arbitrary ASM and the damage caused by an invalid SCTRL 6, I think this problem is minor. The above code would thus be equivalent to:

#emit LOAD.S.pri pointer
#emit LCTRL      8
#emit SCTRL      8

Or a loop of this:

{
	#emit LOAD.S.pri pointer
	#emit SCTRL      6
}

Could become this:

#emit LOAD.S.pri pointer
#emit LCTRL      8
#emit STOR.S.pri pointer
{
	#emit LOAD.S.pri pointer
	#emit SCTRL      8
}

Thus doing the lookup only once. The real address could also be stored by libraries like y_inline (which I'm trying to get JIT compatible) when it detects that the JIT is in use. LCTRL 7 is helpfuly a NO-OP when the JIT plugin isn't there. These would probably be so as well - the LCTRL 8 would work quite nicely as the contents of pri wouldn't get modified at all. But SCTRL 8 would not jump instead of jumping, and that's bad, so they could not be used execpt when runtime detection proves that the JIT exists.

SIGSEGV in any filterscript?

I hav few filterscripts, samp03svr receives SIGSEGV anytime when i start server with these filterscripts. It looks like this:

"Loading filterscript 'xxx.amx'...
SIGSEGV". When i remove script xxx it crashes at zzz...

What data you want? I'm using linux.

crashdetect must be loaded before jit, jit must be loaded before crashdetect

03/13/18 23:13:00  Loading plugin: jit.so
03/13/18 23:13:00   JIT plugin v2.1 is OK.
03/13/18 23:13:00   Loaded.
03/13/18 23:13:00  Loading plugin: crashdetect.so
03/13/18 23:13:00   CrashDetect must be loaded before 'jit.so'
03/13/18 23:15:48  Loading plugin: crashdetect.so
03/13/18 23:15:48   CrashDetect v4.18.1 is OK.
03/13/18 23:15:48   Loaded.
03/13/18 23:15:48  Loading plugin: jit.so
03/13/18 23:15:48   JIT must be loaded before 'crashdetect.so'

Debian 9.3 64bit (32bit libraries installed)

at start Segmentation fault

Hello. At start server show error "Segmentation fault ./samp03svr". Dedicated server OC Debian 7.3 64 bit. Use YSI library(y_dialog,y_hook,y_CMD,y_timer). Help fix.

Crash

Версия 0.7.5 вылетает

Server crashed due to an unknown error
Native backtrace:

К сожалению проверить на версии 0.7.4 не могу ты её удалил =(

IsJITPresent returns false in OnJITCompile

Since that callback is the place to do JIT-compatible rewriting, this seems like the number one place to want that function to work. I realise that the obvious response is "if that callback was called, of COURSE the JIT exists", but generic code may not know where it was called from without extensive passing around of data.

getarg()

getarg() crash server everytime :-) I think you don't need debug informations, reproduce it yourself.

SIGSEGV on startup

I have a codebase without a single line of #emit, and I'm trying to debug a strange start-up error.

I read the wiki, but I'm not exactly sure how to pinpoint the issue.

Here's the output I have:

(gdb) run
Starting program: samp03svr
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0xf7b50b70 (LWP 21403)]

Started server on 1.2.3.4:5678 with maxplayers: 100 lanmode is OFF.

[Thread 0xf7b50b70 (LWP 21403) exited]
[New Thread 0xf7b50b70 (LWP 21404)]

Program received signal SIGSEGV, Segmentation fault.
__memcpy_ssse3 () at ../sysdeps/i386/i686/multiarch/memcpy-ssse3.S:898
898     ../sysdeps/i386/i686/multiarch/memcpy-ssse3.S: No such file or directory.
(gdb) backtrace
#0  __memcpy_ssse3 () at ../sysdeps/i386/i686/multiarch/memcpy-ssse3.S:898
#1  0xf7f78588 in char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) ()
   from /usr/lib/i386-linux-gnu/libstdc++.so.6
#2  0xf7f78642 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned int, std::allocator<char> const&)
    () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#3  0xf7cfb064 in amxjit::(anonymous namespace)::AsmJitLoggerAdtapter::logString(unsigned int, char const*, unsigned int) () from plugins/jit.so
#4  0xf7d02560 in asmjit::Logger::logFormat(unsigned int, char const*, ...) () from plugins/jit.so
#5  0xf7cff507 in amxjit::CompilerAsmjit::Process(amxjit::Instruction const&) () from plugins/jit.so
#6  0xf7cf49ec in amxjit::Compiler::Compile(amxjit::AMXPtr) () from plugins/jit.so
#7  0xf7cf34aa in JIT::Exec(int*, int) () from plugins/jit.so
#8  0xf7cf4500 in amx_Exec_JIT(tagAMX*, int*, int) () from plugins/jit.so
#9  0x080a3b5b in ?? ()
#10 0x080a9fdd in ?? ()
#11 0x080a8882 in ?? ()
#12 0xf7d32e66 in __libc_start_main (main=0x80a7ce0, argc=1, ubp_av=0xffffec44, init=0x81477b0, fini=0x81477a0, rtld_fini=0xf7fef590, stack_end=0xffffec3c)
    at libc-start.c:244
#13 0x0804b4d1 in ?? ()
(gdb) q
A debugging session is active.

        Inferior 1 [process 21400] will be killed.

Accessing previous function's frame

This function, among others, breaks when using the JIT plugin:

stock getstringarg(dest[], arg, len = sizeof (dest)) {
    // Get the address of the previous function's stack.  First get the index of
    // the argument required.
    #emit LOAD.S.pri arg
    // Then convert that number to bytes from cells.
    #emit SMUL.C     4
    // Get the previous function's frame.  Stored in variable 0 (in the current
    // frame).  Parameters are FRM+n+12, locals are FRM-n, previous frame is
    // FRM+0, return address is FRM+4, parameter count is FRM+8.  We could add
    // checks that "arg * 4 < *(*(FRM + 0) + 8)", for the previous frame parameter
    // count (in C pointer speak).
    #emit LOAD.S.alt 0
    // Add the frame pointer to the argument offset in bytes.
    #emit ADD
    // Add 12 to skip over the function header.
    #emit ADD.C      12
    // Load the address stored in the specified address.
    #emit LOAD.I
    // Push the length for "strcat".
    #emit PUSH.S     len
    // Push the address we just determined was the source.
    #emit PUSH.pri
    // Load the address of the destination.
    #emit LOAD.S.alt dest
    // Blank the first cell so "strcat" behaves like "strcpy".
    #emit CONST.pri  0
    // Store the loaded number 0 to the loaded address.
    #emit STOR.I
    // Push the loaded address.
    #emit PUSH.alt
    // Push the number of parameters passed (in bytes) to the function.
    #emit PUSH.C     12
    // Call the function.
    #emit SYSREQ.C   strcat
    // Restore the stack to its level before we called this native.
    #emit STACK      16
}

Problems with run-time errors

0.4.1 crashes my server when there is a runtime error:
pawn Code:
public OnFilterScriptInit()
{
new x = 10,y[1];
y[x] = 1;
return 1;
}

0.3.6 doesn't crash the server, but crashdetect 4.7.1 cannot detect any error with the same script above.

Server hanging

When I'm using this plugin, sometimes my server will become unresponsive. In the SA-MP browser, I still see the same number of players online (and the player list with nicknames), but there is actually nobody online and players can't connect.

How do I debug things like this?

AMX stack underflow

В каких то определённых случаях не вызывается, при этом не вызывается стандартный
То есть вызов колбеков вообще не происходит
Например написание команды в чат приводит к server unknown command

Причину не нашёл ещё

[error]ubuntu 14.04

how to fix this error?
os: ubuntu 14.04 64bit

./samp03svr: relocation error: plugins/jit.so: symbol _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1EPKcRKS3_, version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference

numargs native

The numargs native function does not work properly.

Test case:

stock test(...) {
    printf("args: %d", numargs());
}

main() {
    test(1, 2);
    test(1, 2, 3);
    test(1, 2, 3, 4);
    test(1, 2, 3, 4, 5);
    test(1, 2, 3, 4, 5, 6);
    test(1, 2, 3, 4, 5, 6, 7);
}

Output:

args: 25
args: 25
args: 25
args: 25
args: 25
args: 25

Initialize after OnGameModeInit

Would it be possible to let OnGameModeInit run then use the AMX from memory? This would allow libraries that modify the COD to work (given it's done during startup).

TestExit() doesn't work when called after CallLocalFunction()

Something weird is going on after commit d673359: the SendRconCommand("exit") call in TestExit has absolutely no effect in some scenarios, notably when called after CallLocalFunction (e.g. see tests/misc/halt_deep). The native executes normally and even returns 1 (successful return) but the server doesn't exit for some reason.

I have absolutely no idea what the heck could cause this as the code looks identical to me...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.