added dump messages function
This commit is contained in:
@@ -2403,6 +2403,40 @@ void runPass(const int curr_regime, const char *proj_name, const char *folderNam
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dumpMessages(bool inCatch)
|
||||||
|
{
|
||||||
|
json byFileArray = json::array();
|
||||||
|
for (auto& byFile : SPF_messages)
|
||||||
|
{
|
||||||
|
json inFile;
|
||||||
|
inFile["file"] = byFile.first;
|
||||||
|
|
||||||
|
json messages = json::array();
|
||||||
|
for (auto& message : byFile.second)
|
||||||
|
{
|
||||||
|
if (inCatch)
|
||||||
|
message.print(byFile.first);
|
||||||
|
messages.push_back(message.toJson());
|
||||||
|
}
|
||||||
|
inFile["messages"] = messages;
|
||||||
|
byFileArray.push_back(inFile);
|
||||||
|
}
|
||||||
|
json allMessages;
|
||||||
|
allMessages["allMessages"] = byFileArray;
|
||||||
|
|
||||||
|
const string dump = allMessages.dump().c_str();
|
||||||
|
|
||||||
|
if (dump.size())
|
||||||
|
{
|
||||||
|
FILE* outF = fopen((string(VISUALIZER_DATA_PATH) + "/error_messages.json").c_str(), "w");
|
||||||
|
if (outF)
|
||||||
|
{
|
||||||
|
fprintf(outF, "%s", dump.c_str());
|
||||||
|
fclose(outF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int leakMemDump = 0;
|
int leakMemDump = 0;
|
||||||
@@ -2662,35 +2696,12 @@ int main(int argc, char **argv)
|
|||||||
printStackTrace();
|
printStackTrace();
|
||||||
printf("exception occurred\n");
|
printf("exception occurred\n");
|
||||||
|
|
||||||
FILE* outF = fopen((string(VISUALIZER_DATA_PATH) + "/error_messages.json").c_str(), "w");
|
dumpMessages(true);
|
||||||
if (outF)
|
|
||||||
{
|
|
||||||
json byFileArray = json::array();
|
|
||||||
for (auto& byFile : SPF_messages)
|
|
||||||
{
|
|
||||||
json inFile;
|
|
||||||
inFile["file"] = byFile.first;
|
|
||||||
|
|
||||||
json messages = json::array();
|
|
||||||
for (auto& message : byFile.second)
|
|
||||||
{
|
|
||||||
message.print(byFile.first);
|
|
||||||
messages.push_back(message.toJson());
|
|
||||||
}
|
|
||||||
inFile["messages"] = messages;
|
|
||||||
byFileArray.push_back(inFile);
|
|
||||||
}
|
|
||||||
json allMessages;
|
|
||||||
allMessages["allMessages"] = byFileArray;
|
|
||||||
|
|
||||||
fprintf(outF, "%s", allMessages.dump().c_str());
|
|
||||||
fclose(outF);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
dumpMessages(false);
|
||||||
|
|
||||||
deleteAllAllocatedData(withDel);
|
deleteAllAllocatedData(withDel);
|
||||||
|
|
||||||
|
|
||||||
#if _WIN32 && _DEBUG
|
#if _WIN32 && _DEBUG
|
||||||
if (leakMemDump)
|
if (leakMemDump)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user