Add aot binary analysis tool aot-analyzer (#3379)
Add aot binary analysis tool aot-analyzer, samples: ```bash # parse example.aot, and print basic information about AoT file $ ./aot-analyzer -i example.aot # parse example.aot, and print the size of text section of the AoT file $ ./aot-analyzer -t example.aot # compare these two files, and show the difference in function size between them $ ./aot-analyzer -c example.aot example.wasm ``` Signed-off-by: ganjing <ganjing@xiaomi.com>
This commit is contained in:
52
test-tools/aot-analyzer/include/analyzer_error.h
Normal file
52
test-tools/aot-analyzer/include/analyzer_error.h
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Xiaomi Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef ANALYZER_ERROR_H_
|
||||
#define ANALYZER_ERROR_H_
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
namespace analyzer {
|
||||
|
||||
enum class ErrorLevel {
|
||||
Warning,
|
||||
Error,
|
||||
};
|
||||
|
||||
static inline const char *
|
||||
GetErrorLevelName(ErrorLevel error_level)
|
||||
{
|
||||
switch (error_level) {
|
||||
case ErrorLevel::Warning:
|
||||
return "warning";
|
||||
case ErrorLevel::Error:
|
||||
return "error";
|
||||
}
|
||||
ANALYZER_UNREACHABLE;
|
||||
}
|
||||
|
||||
class Error
|
||||
{
|
||||
public:
|
||||
Error()
|
||||
: error_level_(ErrorLevel::Error)
|
||||
{}
|
||||
Error(ErrorLevel error_level, std::string_view message)
|
||||
: error_level_(error_level)
|
||||
, message_(message)
|
||||
{}
|
||||
|
||||
ErrorLevel error_level_;
|
||||
std::string message_;
|
||||
};
|
||||
|
||||
using Errors = std::vector<Error>;
|
||||
|
||||
} // namespace analyzer
|
||||
#endif
|
||||
Reference in New Issue
Block a user