Go to the documentation of this file.
94 if (
c >=
'0' &&
c <=
'9') {
98 if (
c >=
'a' &&
c <=
'f') {
114 if (strlen(
code) == 0)
119 while (
code[
i] !=
'\0') {
138 printf(
"Syntax: %s [-u|-d|-s|-v] <arch+mode> <assembly-hexstring> [start-address-in-hex-format]\n",
prog);
139 printf(
"\nThe following <arch+mode> options are supported:\n");
142 printf(
" x16 16-bit mode (X86)\n");
143 printf(
" x32 32-bit mode (X86)\n");
144 printf(
" x64 64-bit mode (X86)\n");
145 printf(
" x16att 16-bit mode (X86), syntax AT&T\n");
146 printf(
" x32att 32-bit mode (X86), syntax AT&T\n");
147 printf(
" x64att 64-bit mode (X86), syntax AT&T\n");
152 printf(
" armbe arm + big endian\n");
153 printf(
" thumb thumb mode\n");
154 printf(
" thumbbe thumb + big endian\n");
155 printf(
" cortexm thumb + cortex-m extensions\n");
159 printf(
" arm64 aarch64 mode\n");
160 printf(
" arm64be aarch64 + big endian\n");
164 printf(
" mips mips32 + little endian\n");
165 printf(
" mipsbe mips32 + big endian\n");
166 printf(
" mips64 mips64 + little endian\n");
167 printf(
" mips64be mips64 + big endian\n");
171 printf(
" ppc64 ppc64 + little endian\n");
172 printf(
" ppc64be ppc64 + big endian\n");
180 printf(
" systemz systemz (s390x)\n");
188 printf(
" m68k m68k + big endian\n");
189 printf(
" m68k40 m68k_040\n");
193 printf(
" tms320c64x TMS320C64x\n");
197 printf(
" m6800 M6800/2\n");
198 printf(
" m6801 M6801/3\n");
200 printf(
" m6808 M68HC08\n");
202 printf(
" m6811 M68HC11\n");
203 printf(
" cpu12 M68HC12/HCS12\n");
204 printf(
" hd6301 HD6301/3\n");
205 printf(
" hd6309 HD6309\n");
210 printf(
" evm Ethereum Virtual Machine\n");
214 printf(
" mos65xx MOS65XX family\n");
217 printf(
"\nExtra options:\n");
218 printf(
" -d show detailed information of the instructions\n");
219 printf(
" -u show immediates as unsigned\n");
220 printf(
" -s decode in SKIPDATA mode\n");
221 printf(
" -v show version & Capstone core build info\n\n");
269 if (ins->detail->groups_count) {
273 for(j = 0; j < ins->detail->groups_count; j++) {
282 int main(
int argc,
char **argv)
294 bool detail_flag =
false;
295 bool unsigned_flag =
false;
299 while ((
c =
getopt (argc, argv,
"sudhv")) != -1) {
305 unsigned_flag =
true;
313 printf(
"Capstone build: ");
385 args_left = argc -
optind;
386 if (args_left < 2 || args_left > 3) {
398 if (args_left == 3) {
400 address = strtoull(src, &
temp, 16);
401 if (
temp == src || *
temp !=
'\0' || errno == ERANGE) {
402 printf(
"ERROR: invalid address argument, quit!\n");
413 if (strstr (
mode,
"att")) {
426 printf(
"ERROR: Invalid <arch+mode>: \"%s\", quit!\n",
mode);
432 printf(
"ERROR: Failed on cs_open(), quit!\n");
452 printf(
"%2"PRIx64
" ", insn[
i].address);
453 for (j = 0; j < insn[
i].size; j++) {
461 for (; j < 16; j++) {
466 printf(
" %s\t%s\n", insn[
i].mnemonic, insn[
i].op_str);
475 printf(
"ERROR: invalid assembly code\n");
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_close(csh *handle)
@ CS_OPT_SYNTAX
Assembly output syntax.
@ CS_MODE_32
32-bit mode (X86)
@ CS_MODE_M680X_6800
M680X Motorola 6800,6802 mode.
@ CS_MODE_LITTLE_ENDIAN
little-endian mode (default mode)
@ CS_MODE_M680X_6805
M680X Motorola/Freescale 6805 mode.
@ CS_ARCH_M68K
68K architecture
@ CS_ARCH_MOS65XX
MOS65XX architecture (including MOS6502)
CAPSTONE_EXPORT size_t CAPSTONE_API cs_disasm(csh ud, const uint8_t *buffer, size_t size, uint64_t offset, size_t count, cs_insn **insn)
@ CS_MODE_M680X_CPU12
used on M68HC12/HCS12
@ CS_ARCH_PPC
PowerPC architecture.
_Use_decl_annotations_ int __cdecl printf(const char *_Format,...)
@ CS_MODE_M680X_6801
M680X Motorola 6801,6803 mode.
@ CS_OPT_UNSIGNED
print immediate operands in unsigned form
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_open(cs_arch arch, cs_mode mode, csh *handle)
cs_arch
Architecture type.
@ CS_OPT_DETAIL
Break down instruction structure into details.
int getopt(int nargc, char *const nargv[], const char *ostr)
@ CS_MODE_16
16-bit mode (X86)
@ CS_ARCH_EVM
Ethereum architecture.
@ CS_ARCH_M680X
680X architecture
@ CS_ARCH_TMS320C64X
TMS320C64x architecture.
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_option(csh ud, cs_opt_type type, size_t value)
@ CS_MODE_M680X_6808
M680X Motorola/Freescale/NXP 68HC08 mode.
#define CS_SUPPORT_X86_REDUCE
@ CS_ARCH_SYSZ
SystemZ architecture.
@ CS_ARCH_X86
X86 architecture (including x86 & x86-64)
unsigned __int64 uint64_t
@ CS_OPT_SYNTAX_ATT
X86 ATT asm syntax (CS_OPT_SYNTAX).
CAPSTONE_EXPORT bool CAPSTONE_API cs_support(int query)
@ CS_OPT_ON
Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA).
@ CS_MODE_M68K_040
M68K 68040 mode.
@ CS_MODE_THUMB
ARM's Thumb mode, including Thumb-2.
@ CS_MODE_BIG_ENDIAN
big-endian mode
@ CS_OPT_SKIPDATA
Skip data when disassembling. Then engine is in SKIPDATA mode.
@ CS_MODE_MCLASS
ARM's Cortex-M series.
@ CS_MODE_M680X_6809
M680X Motorola 6809 mode.
@ CS_MODE_M680X_6309
M680X Hitachi 6309 mode.
@ CS_ARCH_SPARC
Sparc architecture.
@ CS_ARCH_MIPS
Mips architecture.
@ CS_MODE_M680X_HCS08
M680X Freescale/NXP HCS08 mode.
@ CS_MODE_MIPS64
Mips64 ISA (Mips)
@ CS_MODE_64
64-bit mode (X86, PPC)
@ CS_ARCH_ARM
ARM architecture (including Thumb, Thumb-2)
const CAPSTONE_EXPORT char *CAPSTONE_API cs_group_name(csh ud, unsigned int group)
CAPSTONE_EXPORT void CAPSTONE_API cs_free(cs_insn *insn, size_t count)
@ CS_MODE_M680X_6301
M680X Hitachi 6301,6303 mode.
@ CS_ARCH_ARM64
ARM-64, also called AArch64.
@ CS_MODE_MIPS32
Mips32 ISA (Mips)
@ CS_MODE_M680X_6811
M680X Motorola/Freescale/NXP 68HC11 mode.
@ CS_ARCH_XCORE
XCore architecture.
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:02