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>
28 lines
534 B
C++
28 lines
534 B
C++
/*
|
|
* Copyright (C) 2024 Xiaomi Corporation. All rights reserved.
|
|
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
*/
|
|
|
|
#include "wasm_file.h"
|
|
|
|
#include <cstring>
|
|
|
|
#include "analyzer_error.h"
|
|
#include "common.h"
|
|
|
|
namespace analyzer {
|
|
|
|
WasmFile::WasmFile(const char *file_name)
|
|
: BinaryFile(file_name)
|
|
{}
|
|
|
|
Result
|
|
WasmFile::Scan()
|
|
{
|
|
WASMModuleMemConsumption mem_conspn = GetMemConsumption();
|
|
wasm_get_module_mem_consumption((WASMModule *)GetModule(), &mem_conspn);
|
|
return Result::Ok;
|
|
}
|
|
|
|
} // namespace analyzer
|