New "debug" status for amxx plugins
.
Correctly switches between amx_opcodelist and nodebug. Fixed metamod and amxmodx GPL alignment. Fixed debug mode not being set for non-JIT.
This commit is contained in:
parent
2d9ec5295d
commit
b7c0c47c05
|
@ -72,12 +72,10 @@ int CPluginMngr::loadPluginsFromFile( const char* filename )
|
|||
sscanf(line,"%s %s",pluginName, debug);
|
||||
if (!isalnum(*pluginName)) continue;
|
||||
|
||||
#ifdef JIT
|
||||
if (isalnum(*debug) && strcmp(debug, "debug") == 0)
|
||||
{
|
||||
debugFlag = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
CPlugin* plugin = loadPlugin( pluginsDir , pluginName , error, debugFlag);
|
||||
|
||||
|
@ -130,7 +128,16 @@ CPluginMngr::CPlugin* CPluginMngr::findPlugin(const char* name) {
|
|||
|
||||
const char* CPluginMngr::CPlugin::getStatus() const {
|
||||
switch(status){
|
||||
case ps_running: return "running";
|
||||
case ps_running:
|
||||
{
|
||||
if (getAMX()->flags & AMX_FLAG_DEBUG)
|
||||
{
|
||||
return "debug";
|
||||
} else {
|
||||
return "running";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ps_paused: return "paused";
|
||||
case ps_bad_load: return "bad load";
|
||||
case ps_stopped: return "stopped";
|
||||
|
|
|
@ -81,6 +81,7 @@ public:
|
|||
inline int getStatusCode() { return status; }
|
||||
inline int getId() const { return id; }
|
||||
inline AMX* getAMX() { return &amx; }
|
||||
inline const AMX* getAMX() const { return &amx; }
|
||||
inline void setTitle( const char* n ) { title.assign(n); }
|
||||
inline void setAuthor( const char* n ) { author.assign(n); }
|
||||
inline void setVersion( const char* n ) { version.assign(n); }
|
||||
|
|
|
@ -1817,7 +1817,12 @@ static void *amx_opcodelist_nodebug[] = {
|
|||
if ((amx->flags & AMX_FLAG_BROWSE)==AMX_FLAG_BROWSE) {
|
||||
assert(sizeof(cell)==sizeof(void *));
|
||||
assert(retval!=NULL);
|
||||
*retval=(cell)(amx_opcodelist_nodebug);
|
||||
if (amx->flags & AMX_FLAG_DEBUG)
|
||||
{
|
||||
*retval=(cell)(amx_opcodelist);
|
||||
} else {
|
||||
*retval=(cell)(amx_opcodelist_nodebug);
|
||||
}
|
||||
return 0;
|
||||
} /* if */
|
||||
|
||||
|
@ -2223,10 +2228,6 @@ static void *amx_opcodelist_nodebug[] = {
|
|||
cip=(cell *)(code+(int)offs);
|
||||
NEXT(cip);
|
||||
op_ret_nodebug:
|
||||
if (tracer)
|
||||
{
|
||||
(tracer)(amx, 1);
|
||||
}
|
||||
POP(frm);
|
||||
POP(offs);
|
||||
/* verify the return address */
|
||||
|
@ -2248,10 +2249,6 @@ static void *amx_opcodelist_nodebug[] = {
|
|||
stk+= *(cell *)(data+(int)stk) + sizeof(cell); /* remove parameters from the stack */
|
||||
NEXT(cip);
|
||||
op_retn_nodebug:
|
||||
if (tracer)
|
||||
{
|
||||
(tracer)(amx, 1);
|
||||
}
|
||||
POP(frm);
|
||||
POP(offs);
|
||||
/* verify the return address */
|
||||
|
@ -2269,10 +2266,6 @@ static void *amx_opcodelist_nodebug[] = {
|
|||
cip=JUMPABS(code, cip); /* jump to the address */
|
||||
NEXT(cip);
|
||||
op_call_nodebug:
|
||||
if (tracer)
|
||||
{
|
||||
(tracer)(amx, 2);
|
||||
}
|
||||
PUSH(((unsigned char *)cip-code)+sizeof(cell));/* push address behind instruction */
|
||||
cip=JUMPABS(code, cip); /* jump to the address */
|
||||
NEXT(cip);
|
||||
|
@ -2285,10 +2278,6 @@ static void *amx_opcodelist_nodebug[] = {
|
|||
cip=(cell *)(code+(int)pri);
|
||||
NEXT(cip);
|
||||
op_call_pri_nodebug:
|
||||
if (tracer)
|
||||
{
|
||||
(tracer)(amx, 2);
|
||||
}
|
||||
PUSH((unsigned char *)cip-code);
|
||||
cip=(cell *)(code+(int)pri);
|
||||
NEXT(cip);
|
||||
|
@ -2849,7 +2838,12 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
|
|||
*/
|
||||
*retval=(cell)amx_opcodelist;
|
||||
#else
|
||||
*retval=(cell)(amx_opcodelist_nodebug);
|
||||
if (amx->flags & AMX_FLAG_DEBUG)
|
||||
{
|
||||
*retval=(cell)(amx_opcodelist);
|
||||
} else {
|
||||
*retval=(cell)(amx_opcodelist_nodebug);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
} /* if */
|
||||
|
|
|
@ -117,8 +117,14 @@
|
|||
_dbgaddr EQU 38h ;DD ?
|
||||
_dbgparam EQU 3ch ;DD ?
|
||||
_dbgname EQU 40h ;DD ?
|
||||
_usertags EQU 44h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
|
||||
_userdata EQU 54h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
|
||||
_usertags1 EQU 44h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
|
||||
_usertags2 EQU 44h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
|
||||
_usertags3 EQU 44h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
|
||||
_usertags4 EQU 44h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
|
||||
_userdata1 EQU 54h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
|
||||
_userdata2 EQU 54h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
|
||||
_userdata3 EQU 54h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
|
||||
_userdata4 EQU 54h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
|
||||
_error EQU 64h ;DD ?
|
||||
_pri EQU 68h ;DD ?
|
||||
_alt EQU 6ch ;DD ?
|
||||
|
@ -171,6 +177,8 @@
|
|||
|
||||
AMX_FLAG_CHAR16 EQU 0001h ; characters are 16-bit
|
||||
AMX_FLAG_DEBUG EQU 0002h ; symbolic info. available
|
||||
AMX_FLAG_LINEOPS EQU 0020h ; line op information
|
||||
AMX_FLAG_TRACED EQU 0040h ;
|
||||
AMX_FLAG_BROWSE EQU 4000h
|
||||
AMX_FLAG_RELOC EQU 8000h ; jump/call addresses relocated
|
||||
|
||||
|
|
|
@ -1049,10 +1049,10 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
|
|||
g_mod_name.assign(a);
|
||||
|
||||
// ###### Print short GPL
|
||||
print_srvconsole( "\n AMX Mod X version %s Copyright (c) 2004 AMX Mod X Development Team \n"
|
||||
" AMX Mod X comes with ABSOLUTELY NO WARRANTY; for details type `amxx gpl'.\n", AMX_VERSION);
|
||||
print_srvconsole( " This is free software and you are welcome to redistribute it under \n"
|
||||
" certain conditions; type 'amxx gpl' for details.\n \n");
|
||||
print_srvconsole( "\n AMX Mod X version %s Copyright (c) 2004 AMX Mod X Development Team \n"
|
||||
" AMX Mod X comes with ABSOLUTELY NO WARRANTY; for details type `amxx gpl'.\n", AMX_VERSION);
|
||||
print_srvconsole( " This is free software and you are welcome to redistribute it under \n"
|
||||
" certain conditions; type 'amxx gpl' for details.\n \n");
|
||||
|
||||
// ###### Load custom path configuration
|
||||
Vault amx_config;
|
||||
|
|
|
@ -148,7 +148,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
|
|||
return (amx->error = AMX_ERR_FORMAT);
|
||||
}
|
||||
|
||||
if ( ((int)CVAR_GET_FLOAT("amx_debug") >= 2 || (debug && (int)CVAR_GET_FLOAT("amx_debug"))) )
|
||||
if ( (int)CVAR_GET_FLOAT("amx_debug") >= 2 || debug)
|
||||
{
|
||||
//automatic debug mode
|
||||
hdr->flags |= AMX_FLAG_LINEOPS;
|
||||
|
@ -1200,7 +1200,11 @@ void LogError(AMX *amx, int err, const char *fmt, ...)
|
|||
} else {
|
||||
GenericError(amx, err, line, buf, dbg->files[file]);
|
||||
}
|
||||
AMXXLOG_Log("[AMXX] %s %s", buf, vbuf);
|
||||
AMXXLOG_Log("[AMXX] %s", buf);
|
||||
if (*vbuf)
|
||||
{
|
||||
AMXXLOG_Log("[AMXX] %s", vbuf);
|
||||
}
|
||||
AMXXLOG_Log("[AMXX] Debug Trace =>");
|
||||
//log the error right away
|
||||
while (t != NULL)
|
||||
|
@ -1209,9 +1213,9 @@ void LogError(AMX *amx, int err, const char *fmt, ...)
|
|||
file = t->file;
|
||||
if (file >= dbg->numFiles)
|
||||
{
|
||||
AMXXLOG_Log("[AMXX] [%d] Line %d, Plugin \"%s\"", i++, line, g_plugins.findPluginFast(amx)->getName());
|
||||
AMXXLOG_Log("[AMXX] [%d] Line %d, File \"%s\"", i++, line, g_plugins.findPluginFast(amx)->getName());
|
||||
} else {
|
||||
AMXXLOG_Log("[AMXX] [%d] Line %d, Plugin \"%s\"", i++, line, dbg->files[file]);
|
||||
AMXXLOG_Log("[AMXX] [%d] Line %d, File \"%s\"", i++, line, dbg->files[file]);
|
||||
}
|
||||
if (tracer)
|
||||
(tracer)(amx, 1); //pop
|
||||
|
|
Loading…
Reference in New Issue
Block a user