samp-log-core
samp-log-core copied to clipboard
Crash using the JIT plugin's "jit_sleep" option in a script with debug symbols
I can't quite explain what happens, but I made an example with the MySQL plugin:
#pragma option -d3
#include <a_samp>
#include <a_mysql>
new MySQL:db_handle;
public OnGameModeInit()
{
db_handle = mysql_connect(/* example database connection data */);
mysql_tquery(db_handle, "SELECT 1 AS \"ONE\";", "QueryDone", "i", 10);
return 1;
}
forward QueryDone(test_param);
public QueryDone(test_param)
{
printf("QueryDone(test_param = %i)", test_param);
new rowcount;
cache_get_row_count(rowcount);
// On the JIT, the native above crashes the server, so everything below wouldn't get printed.
printf("rowcount = %i", rowcount);
if(rowcount)
{
new one;
cache_get_value_name_int(0, "ONE", one);
printf("one = %i", one);
}
mysql_close(db_handle);
return 1;
}
Running this code in a default server with the JIT and MySQL plugins and jit_sleep 1
in the server.cfg, the server will crash when the cache_get_row_count
native gets called.
But if I remove only the -d3
option (without toggling jit_sleep
), I get the expected output:
QueryDone(test_param = 10)
rowcount = 1
one = 1
Messing around with a debugger and log-core 0.4 with debug symbols, I could find out that log-core crashes because of an access violation exception in this line:
https://github.com/maddinat0r/samp-log-core/blob/b5276ee8e80b2c19cc68796c77ce76b479a4f9e0/src/CAmxDebugManager.cpp#L173
logcore_debuginfo 0
in the server.cfg "fixes" it