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:
GanJingSaiyan
2024-05-08 16:31:39 +08:00
committed by GitHub
parent 1c2a8fca4e
commit 07eae7c424
15 changed files with 2127 additions and 0 deletions

View File

@ -0,0 +1,27 @@
/*
* 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