added message dumping for -parse option if running from console
This commit is contained in:
@@ -451,13 +451,6 @@ static int dumpErrors(const vector<FileInfo>& listOfProject, const vector<string
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* ferr = fopen(file.errPath.c_str(), "w");
|
|
||||||
FILE* fout = fopen(file.outPath.c_str(), "w");
|
|
||||||
if (!ferr)
|
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
|
||||||
if (!fout)
|
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
|
||||||
|
|
||||||
string errS = "", outS = "";
|
string errS = "", outS = "";
|
||||||
vector<string> splited;
|
vector<string> splited;
|
||||||
splitString(errors[z], '\n', splited);
|
splitString(errors[z], '\n', splited);
|
||||||
@@ -476,13 +469,22 @@ static int dumpErrors(const vector<FileInfo>& listOfProject, const vector<string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(fout, "%s", outS.c_str());
|
|
||||||
fprintf(ferr, "%s", errS.c_str());
|
FILE* ferr = fopen(file.errPath.c_str(), "w");
|
||||||
|
FILE* fout = fopen(file.outPath.c_str(), "w");
|
||||||
|
if (ferr)
|
||||||
|
{
|
||||||
|
fprintf(ferr, "%s", errS.c_str());
|
||||||
|
fclose(ferr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fout)
|
||||||
|
{
|
||||||
|
fprintf(fout, "%s", outS.c_str());
|
||||||
|
fclose(fout);
|
||||||
|
}
|
||||||
|
|
||||||
fflush(NULL);
|
fflush(NULL);
|
||||||
|
|
||||||
fclose(fout);
|
|
||||||
fclose(ferr);
|
|
||||||
++z;
|
++z;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -810,6 +812,8 @@ void parseFiles(int argc, char** argv)
|
|||||||
printf(" run parsing for inlining\n");
|
printf(" run parsing for inlining\n");
|
||||||
|
|
||||||
int rethrow = parseFiles(errors, listOfProject, filesCompilationOrder, isInline, true);
|
int rethrow = parseFiles(errors, listOfProject, filesCompilationOrder, isInline, true);
|
||||||
|
int errCount = dumpErrors(listOfProject, errors, messages);
|
||||||
|
|
||||||
if (rethrow == 0)
|
if (rethrow == 0)
|
||||||
{
|
{
|
||||||
for (auto& err : errors)
|
for (auto& err : errors)
|
||||||
@@ -839,5 +843,7 @@ void parseFiles(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("Parsing was completed with errors, throw code %d, errors count %d\n", rethrow, code);
|
printf("Parsing was completed with errors, throw code %d, errors count %d\n", rethrow, code);
|
||||||
|
|
||||||
|
dumpMessages(false, messages, VISUALIZER_DATA_PATH);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2403,40 +2403,6 @@ 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;
|
||||||
@@ -2696,9 +2662,9 @@ int main(int argc, char **argv)
|
|||||||
printStackTrace();
|
printStackTrace();
|
||||||
printf("exception occurred\n");
|
printf("exception occurred\n");
|
||||||
|
|
||||||
dumpMessages(true);
|
dumpMessages(true, SPF_messages, VISUALIZER_DATA_PATH);
|
||||||
}
|
}
|
||||||
dumpMessages(false);
|
dumpMessages(false, SPF_messages, VISUALIZER_DATA_PATH);
|
||||||
|
|
||||||
deleteAllAllocatedData(withDel);
|
deleteAllAllocatedData(withDel);
|
||||||
|
|
||||||
|
|||||||
@@ -14,15 +14,13 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <string>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
#include "utils.h"
|
|
||||||
#include "errors.h"
|
#include "errors.h"
|
||||||
|
#include "utils.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#include "graph_loops.h"
|
#include "graph_loops.h"
|
||||||
@@ -1738,3 +1736,37 @@ void copyStringToShort(short*& result, const string& resVal, bool withEnd)
|
|||||||
if (withEnd)
|
if (withEnd)
|
||||||
result[resVal.size()] = (short)'\0';
|
result[resVal.size()] = (short)'\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dumpMessages(bool inCatch, const map<string, vector<Messages>>& messages, const char *vis_path)
|
||||||
|
{
|
||||||
|
json byFileArray = json::array();
|
||||||
|
for (auto& byFile : 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(vis_path) + "/error_messages.json").c_str(), "w");
|
||||||
|
if (outF)
|
||||||
|
{
|
||||||
|
fprintf(outF, "%s", dump.c_str());
|
||||||
|
fclose(outF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
struct Messages;
|
||||||
struct DataDirective;
|
struct DataDirective;
|
||||||
|
|
||||||
namespace Distribution
|
namespace Distribution
|
||||||
{
|
{
|
||||||
class Array;
|
class Array;
|
||||||
@@ -98,3 +100,4 @@ std::set<DIST::Array*> fillDistributedArraysD(const DataDirective& dataDirective
|
|||||||
std::set<std::string> fillDistributedArrays(const DataDirective& dataDirectives, const std::map<DIST::Array*, std::tuple<int, std::string, std::string>>& tableOfUniqNamesByArray, const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCalls, bool onlyCommon = false, bool shortName = false);
|
std::set<std::string> fillDistributedArrays(const DataDirective& dataDirectives, const std::map<DIST::Array*, std::tuple<int, std::string, std::string>>& tableOfUniqNamesByArray, const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCalls, bool onlyCommon = false, bool shortName = false);
|
||||||
|
|
||||||
void copyStringToShort(short*& result, const std::string& resVal, bool withEnd = true);
|
void copyStringToShort(short*& result, const std::string& resVal, bool withEnd = true);
|
||||||
|
void dumpMessages(bool inCatch, const std::map<std::string, std::vector<Messages>>& messages, const char* vis_path);
|
||||||
|
|||||||
Reference in New Issue
Block a user