added dumping messages to json

This commit is contained in:
ALEXks
2025-05-27 18:10:24 +03:00
parent 7ee9d839a1
commit 8f55c13a0c

View File

@@ -64,6 +64,7 @@
#include "DvmhRegions/LoopChecker.h"
#include "DvmhRegions/ReadWriteAnalyzer.h"
#include "Utils/utils.h"
#include "Utils/json.hpp"
#include "Distribution/Array.h"
#include "VisualizerCalls/get_information.h"
@@ -107,6 +108,7 @@ using namespace std;
using std::chrono::high_resolution_clock;
using std::chrono::duration_cast;
using std::chrono::milliseconds;
using json = nlohmann::json;
int PASSES_DONE[EMPTY_PASS];
bool PASSES_DONE_INIT = false;
@@ -2658,9 +2660,28 @@ int main(int argc, char **argv)
{
printStackTrace();
printf("exception occurred\n");
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["allMessage"] = byFileArray;
FILE* outF = fopen("dump_messages.json", "w");
fprintf(outF, "%s", allMessages.dump().c_str());
fclose(outF);
}
deleteAllAllocatedData(withDel);