rabbitizer/test.c

33 lines
693 B
C
Raw Normal View History

2022-06-04 00:19:58 +00:00
/* SPDX-FileCopyrightText: © 2022 Decompollaborate */
/* SPDX-License-Identifier: MIT */
#include "instructions/RabbitizerInstr.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
2022-06-04 00:19:58 +00:00
2022-06-04 00:19:58 +00:00
int main() {
2022-06-04 02:39:10 +00:00
uint32_t word = 0x8D4A7E18;
2022-06-04 00:19:58 +00:00
RabbitizerInstr instr;
char *buffer;
int extraLJust = 10;
2022-06-04 00:19:58 +00:00
RabbitizerInstr_Init(&instr, word);
2022-06-04 05:24:59 +00:00
RabbitizerInstr_ProcessUniqueId(&instr);
buffer = malloc(RabbitizerInstr_GetSizeForBuffer(&instr, 0, extraLJust) + 1);
assert(buffer != NULL);
RabbitizerInstr_Disassemble(&instr, buffer, NULL, 0, extraLJust);
2022-06-04 00:19:58 +00:00
printf("%08X: %s\n", word, buffer);
free(buffer);
2022-06-04 00:19:58 +00:00
RabbitizerInstr_Destroy(&instr);
return 0;
}