mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-01-26 05:38:04 +03:00
LogError() now can log native function names.
This commit is contained in:
parent
c9c26b869c
commit
3587483fa6
@ -428,6 +428,7 @@ int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params)
|
|||||||
AMX_HEADER *hdr;
|
AMX_HEADER *hdr;
|
||||||
AMX_FUNCSTUB *func;
|
AMX_FUNCSTUB *func;
|
||||||
AMX_NATIVE f;
|
AMX_NATIVE f;
|
||||||
|
int i =0;
|
||||||
|
|
||||||
assert(amx!=NULL);
|
assert(amx!=NULL);
|
||||||
hdr=(AMX_HEADER *)amx->base;
|
hdr=(AMX_HEADER *)amx->base;
|
||||||
@ -437,6 +438,7 @@ int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params)
|
|||||||
assert(index>=0 && index<(cell)NUMENTRIES(hdr,natives,libraries));
|
assert(index>=0 && index<(cell)NUMENTRIES(hdr,natives,libraries));
|
||||||
func=GETENTRY(hdr,natives,index);
|
func=GETENTRY(hdr,natives,index);
|
||||||
f=(AMX_NATIVE)func->address;
|
f=(AMX_NATIVE)func->address;
|
||||||
|
amx->userdata[2] = (char *)GETENTRYNAME(hdr, func);
|
||||||
assert(f!=NULL);
|
assert(f!=NULL);
|
||||||
|
|
||||||
/* now that we have found the function, patch the program so that any
|
/* now that we have found the function, patch the program so that any
|
||||||
@ -606,6 +608,7 @@ static int amx_BrowseRelocate(AMX *amx)
|
|||||||
} else {
|
} else {
|
||||||
amx->userdata[0] = 0;
|
amx->userdata[0] = 0;
|
||||||
amx->userdata[1] = 0;
|
amx->userdata[1] = 0;
|
||||||
|
amx->userdata[2] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined __GNUC__ || defined ASM32 || defined JIT && !defined __64BIT__
|
#if defined __GNUC__ || defined ASM32 || defined JIT && !defined __64BIT__
|
||||||
|
@ -1166,6 +1166,8 @@ void GenericError(AMX *amx, int err, int line, char buf[], const char *file)
|
|||||||
{
|
{
|
||||||
sprintf(buf, "Run time error %d on line %d (%s \"%s\").", err, line, (file?"file":"plugin"), (file?file:g_plugins.findPluginFast(amx)->getName()));
|
sprintf(buf, "Run time error %d on line %d (%s \"%s\").", err, line, (file?"file":"plugin"), (file?file:g_plugins.findPluginFast(amx)->getName()));
|
||||||
} else {
|
} else {
|
||||||
|
if (err == AMX_ERR_NATIVE && amx->userdata[2])
|
||||||
|
geterr = (char *)(amx->userdata[2]);
|
||||||
sprintf(buf, "Run time error %d (%s) on line %d (%s \"%s\").", err, geterr, line, (file?"file":"plugin"), (file?file:g_plugins.findPluginFast(amx)->getName()));
|
sprintf(buf, "Run time error %d (%s) on line %d (%s \"%s\").", err, geterr, line, (file?"file":"plugin"), (file?file:g_plugins.findPluginFast(amx)->getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user