aboutsummaryrefslogtreecommitdiff
path: root/test/test-jump-dis.c
blob: ef6add829f30e8b9da2fc7d4b013572d94145862 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#define JUMP_DIS_VERBOSE
#include <stdio.h>
#include "jump-dis.c"
#include <stdlib.h>
int main(UNUSED int argc, char **argv) {
    static char buf[1048576];
    UNUSED size_t size = fread(buf, 1, sizeof(buf), stdin);
    printf("size=%zd\n", size);
    int patch_size = atoi(argv[1]);
    struct arch_dis_ctx arch;
    memset(&arch, 0, sizeof(arch));
#ifdef __arm__
    int thumb = atoi(argv[2]);
    arch.pc_low_bit = thumb;
#endif
    bool bad = P(main)(buf, 0x10000, 0x10000 + patch_size, arch);
    printf("final: bad = %d\n", bad);
}