mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-16 00:03:45 +00:00
Added setting for coreDumpLocation
This commit is contained in:
@@ -4230,6 +4230,10 @@ int MeshAgent_AgentMode(MeshAgentHostContainer *agentHost, int paramLen, char **
|
||||
agentHost->meshCoreCtx = ILibDuktape_ScriptContainer_InitializeJavaScriptEngineEx(0, 0, agentHost->chain, NULL, agentHost->masterDb, agentHost->exePath, agentHost->pipeManager, NULL, NULL);
|
||||
ILibDuktape_MeshAgent_Init(agentHost->meshCoreCtx, agentHost->chain, agentHost);
|
||||
ILibDuktape_SetNativeUncaughtExceptionHandler(agentHost->meshCoreCtx, MeshAgent_CoreModule_UncaughtException, agentHost);
|
||||
if ((agentHost->coreDumpEnabled = ILibSimpleDataStore_Get(agentHost->masterDb, "coreDumpEnabled", NULL, 0)) != 0)
|
||||
{
|
||||
duk_eval_string_noresult(agentHost->meshCoreCtx, "process.coreDumpLocation = process.platform=='win32'?(process.execPath.replace('.exe', '.dmp')):(process.execPath + '.dmp');");
|
||||
}
|
||||
|
||||
if (CoreModuleLen > 0)
|
||||
{
|
||||
|
||||
@@ -186,6 +186,7 @@ typedef struct MeshAgentHostContainer
|
||||
void *coreTimeout;
|
||||
int webSocketMaskOverride;
|
||||
int jsDebugPort;
|
||||
int coreDumpEnabled;
|
||||
|
||||
char agentHash[UTIL_SHA384_HASHSIZE];
|
||||
char serverHash[UTIL_SHA384_HASHSIZE];
|
||||
|
||||
@@ -1196,6 +1196,7 @@ SCRIPT_ENGINE_SETTINGS *ILibDuktape_ScriptContainer_GetSettings(duk_context *ctx
|
||||
|
||||
duk_push_global_object(ctx); // [g]
|
||||
duk_get_prop_string(ctx, -1, "process"); // [g][process]
|
||||
retVal->coreDumpLocation = (char*)Duktape_GetBufferProperty(ctx, -1, ILibDuktape_ScriptContainer_Process_CoreDumpPath);
|
||||
duk_get_prop_string(ctx, -1, ILibDuktape_ScriptContainer_Process_ArgArray); // [g][process][array]
|
||||
|
||||
int i, count = (int)duk_get_length(ctx, -1);
|
||||
@@ -1223,7 +1224,20 @@ SCRIPT_ENGINE_SETTINGS *ILibDuktape_ScriptContainer_GetSettings(duk_context *ctx
|
||||
}
|
||||
duk_context *ILibDuktape_ScriptContainer_InitializeJavaScriptEngineEx2(SCRIPT_ENGINE_SETTINGS *settings)
|
||||
{
|
||||
return(ILibDuktape_ScriptContainer_InitializeJavaScriptEngineEx(settings->securityFlags, settings->executionTimeout, settings->chain, settings->argList, settings->db, settings->exePath, settings->pipeManager, settings->exitHandler, settings->exitUserObject));
|
||||
duk_context *ctx = ILibDuktape_ScriptContainer_InitializeJavaScriptEngineEx(settings->securityFlags, settings->executionTimeout, settings->chain, settings->argList, settings->db, settings->exePath, settings->pipeManager, settings->exitHandler, settings->exitUserObject);
|
||||
if (settings->coreDumpLocation != NULL)
|
||||
{
|
||||
duk_push_global_object(ctx); // [g]
|
||||
duk_get_prop_string(ctx, -1, "process"); // [g][process]
|
||||
#ifdef WIN32
|
||||
ILibDuktape_String_PushWideString(ctx, settings->coreDumpLocation, 0);
|
||||
#else
|
||||
duk_push_string(ctx, settings->coreDumpLocation); // [g][process][location]
|
||||
#endif
|
||||
duk_put_prop_string(ctx, -2, "coreDumpLocation"); // [g][process]
|
||||
duk_pop_2(ctx); // ...
|
||||
}
|
||||
return(ctx);
|
||||
}
|
||||
|
||||
size_t ILibDuktape_ScriptContainer_TotalAllocations = 0;
|
||||
|
||||
@@ -135,6 +135,7 @@ typedef struct SCRIPT_ENGINE_SETTINGS
|
||||
void* nExceptionUserObject;
|
||||
|
||||
char *exePath;
|
||||
char *coreDumpLocation;
|
||||
ILibProcessPipe_Manager pipeManager;
|
||||
|
||||
char *argList[];
|
||||
|
||||
Reference in New Issue
Block a user