add error log to sdk tool

Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I6HH1O
Signed-off-by: zhouzebin <zhouzebin1@huawei.com>
Change-Id: I47b373da88e2ac41369285cd210cfb5925227b26
This commit is contained in:
zhouzebin 2023-02-28 20:48:45 +08:00
parent a56c31c6ed
commit 94eda86773
4 changed files with 7 additions and 2 deletions

View File

@ -236,6 +236,8 @@ void AnFileInfo::Save(const std::string &filename, kungfu::Triple triple)
}
if (totalCodeSize_ == 0) {
LOG_HOST_TOOL_ERROR << "The an file generated by the aot compiler is empty! "
<< "Maybe file in apPath is empty or all methods in ap file mismatched";
LOG_COMPILER(FATAL) << "error: code size of generated an file is empty!";
}

View File

@ -34,12 +34,13 @@ protected:
bool VerifyInner(const std::array<uint8_t, VERSION_SIZE> &lastVersion) const
{
if (magic_ != MAGIC) {
LOG_HOST_TOOL_ERROR << "Magic mismatch, please make sure apPath file and the code are matched";
LOG_ECMA(ERROR) << "magic error, expected magic is " << ConvToStr(MAGIC)
<< ", but got " << ConvToStr(magic_);
return false;
}
if (version_ > lastVersion) {
LOG_ECMA(ERROR) << "version error, expected version should be less or equal than "
LOG_HOST_TOOL_ERROR << "version error, expected version should be less or equal than "
<< ConvToStr(lastVersion) << ", but got " << GetVersionInner();
return false;
}

View File

@ -28,5 +28,7 @@
#define LOG_DEBUGGER(level) ARK_LOG(level, Component::DEBUGGER)
#define LOG_BUILTINS(level) ARK_LOG(level, Component::BUILTINS)
#define LOG_ECMA_IF(cond, level) (cond) && ARK_LOG(level, Component::ALL)
// When the AOT compiler is integrated into the IDE, tag the output error messages for developers
#define LOG_HOST_TOOL_ERROR ARK_LOG(ERROR, Component::NO_TAG) << "[HostTool] "
#endif // ECMASCRIPT_LOG_WRAPPER_H

View File

@ -93,7 +93,7 @@ MemMap FileMap(const char *fileName, int flag, int prot, int64_t offset)
auto size = fileSize.QuadPart;
if (size <= 0) {
CloseHandle(fd);
LOG_ECMA(ERROR) << fileName << " file is empty";
LOG_HOST_TOOL_ERROR << fileName << " file is empty";
return MemMap();
}