/*===-- disassemble.c - tool for testing libLLVM and llvm-c API -----------===*\ |* *| |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| |* Exceptions. *| |* See https://llvm.org/LICENSE.txt for license information. *| |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| |* *| |*===----------------------------------------------------------------------===*| |* *| |* This file implements the --disassemble command in llvm-c-test. *| |* --disassemble reads lines from stdin, parses them as a triple and hex *| |* machine code, and prints disassembly of the machine code. *| |* *| \*===----------------------------------------------------------------------===*/ #include "llvm-c-test.h" #include "llvm-c/Disassembler.h" #include "llvm-c/Target.h" #include <stdio.h> #include <stdlib.h> #include <string.h> static void pprint(int pos, unsigned char *buf, int len, const char *disasm) { … } static void do_disassemble(const char *triple, const char *features, unsigned char *buf, int siz) { … } static void handle_line(char **tokens, int ntokens) { … } int llvm_disassemble(void) { … }