blob: 986b1d0f722b4b4280dcc1626a905bd7cdb1f1df (
plain) (
tree)
|
|
#include <fcntl.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "./structs.h"
#include "./read.h"
#include "./aggregate.h"
#pragma weak main
int main (int argc, char** argv) {
int wasm = open("./test.wasm", O_RDONLY);
read_aggr(wasm);
printf("magic_number:%x\n", magic_number_container->magic_number);
printf("version:%x\n", version_container->version);
printf("type section id:%d\n", W_Type_Section_container->id);
printf("type section payloadlength:%d\n", W_Type_Section_container->payloadlength);
printf("type_section entry count:%d\n", W_Type_Section_container->count);
for (int i=0; i < W_Type_Section_container->count; ++i) {
printf("param_count:%d\n",W_Type_Section_container->entries[i]->param_count);
for (int j = 0; j < W_Type_Section_container->entries[i]->param_count; ++j)
printf("param_types:%d\n",W_Type_Section_container->entries[i]->param_types[j]);
printf("return_count:%d\n", W_Type_Section_container->entries[i]->return_count);
for (int j = 0; j < W_Type_Section_container->entries[i]->return_count; ++j)
printf("param_types:%d\n",W_Type_Section_container->entries[i]->return_types[j]);
}
printf("import_section_id:%d\n", W_Import_Section_container->id);
printf("import_section_payloadlength:%d\n", W_Import_Section_container->payloadlength);
printf("import_section_count:%d\n", W_Import_Section_container->count);
for(int i = 0; i < W_Import_Section_container->count; ++i) {
printf("import_section_entry_module_length:%d\n", W_Import_Section_container->entries[i]->module_length);
printf("module_str:%s\n", W_Import_Section_container->entries[i]->module_str);
printf("import_section_entry_field_length:%d\n", W_Import_Section_container->entries[i]->field_len);
}
release_all();
return 0;
}
|