You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. /* General "disassemble this chunk" code. Used for debugging. */
  2. #include "qemu/osdep.h"
  3. #include "disas/dis-asm.h"
  4. #include "elf.h"
  5. #include "qemu/qemu-print.h"
  6. #include "cpu.h"
  7. #include "disas/disas.h"
  8. #include "disas/capstone.h"
  9. typedef struct CPUDebug {
  10. struct disassemble_info info;
  11. CPUState *cpu;
  12. } CPUDebug;
  13. /* Filled in by elfload.c. Simplistic, but will do for now. */
  14. struct syminfo *syminfos = NULL;
  15. /* Get LENGTH bytes from info's buffer, at target address memaddr.
  16. Transfer them to myaddr. */
  17. int
  18. buffer_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length,
  19. struct disassemble_info *info)
  20. {
  21. if (memaddr < info->buffer_vma
  22. || memaddr + length > info->buffer_vma + info->buffer_length)
  23. /* Out of bounds. Use EIO because GDB uses it. */
  24. return EIO;
  25. memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length);
  26. return 0;
  27. }
  28. /* Get LENGTH bytes from info's buffer, at target address memaddr.
  29. Transfer them to myaddr. */
  30. static int
  31. target_read_memory (bfd_vma memaddr,
  32. bfd_byte *myaddr,
  33. int length,
  34. struct disassemble_info *info)
  35. {
  36. CPUDebug *s = container_of(info, CPUDebug, info);
  37. cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);
  38. return 0;
  39. }
  40. /* Print an error message. We can assume that this is in response to
  41. an error return from buffer_read_memory. */
  42. void
  43. perror_memory (int status, bfd_vma memaddr, struct disassemble_info *info)
  44. {
  45. if (status != EIO)
  46. /* Can't happen. */
  47. (*info->fprintf_func) (info->stream, "Unknown error %d\n", status);
  48. else
  49. /* Actually, address between memaddr and memaddr + len was
  50. out of bounds. */
  51. (*info->fprintf_func) (info->stream,
  52. "Address 0x%" PRIx64 " is out of bounds.\n", memaddr);
  53. }
  54. /* This could be in a separate file, to save minuscule amounts of space
  55. in statically linked executables. */
  56. /* Just print the address is hex. This is included for completeness even
  57. though both GDB and objdump provide their own (to print symbolic
  58. addresses). */
  59. void
  60. generic_print_address (bfd_vma addr, struct disassemble_info *info)
  61. {
  62. (*info->fprintf_func) (info->stream, "0x%" PRIx64, addr);
  63. }
  64. /* Print address in hex, truncated to the width of a host virtual address. */
  65. static void
  66. generic_print_host_address(bfd_vma addr, struct disassemble_info *info)
  67. {
  68. uint64_t mask = ~0ULL >> (64 - (sizeof(void *) * 8));
  69. generic_print_address(addr & mask, info);
  70. }
  71. /* Just return the given address. */
  72. int
  73. generic_symbol_at_address (bfd_vma addr, struct disassemble_info *info)
  74. {
  75. return 1;
  76. }
  77. bfd_vma bfd_getl64 (const bfd_byte *addr)
  78. {
  79. unsigned long long v;
  80. v = (unsigned long long) addr[0];
  81. v |= (unsigned long long) addr[1] << 8;
  82. v |= (unsigned long long) addr[2] << 16;
  83. v |= (unsigned long long) addr[3] << 24;
  84. v |= (unsigned long long) addr[4] << 32;
  85. v |= (unsigned long long) addr[5] << 40;
  86. v |= (unsigned long long) addr[6] << 48;
  87. v |= (unsigned long long) addr[7] << 56;
  88. return (bfd_vma) v;
  89. }
  90. bfd_vma bfd_getl32 (const bfd_byte *addr)
  91. {
  92. unsigned long v;
  93. v = (unsigned long) addr[0];
  94. v |= (unsigned long) addr[1] << 8;
  95. v |= (unsigned long) addr[2] << 16;
  96. v |= (unsigned long) addr[3] << 24;
  97. return (bfd_vma) v;
  98. }
  99. bfd_vma bfd_getb32 (const bfd_byte *addr)
  100. {
  101. unsigned long v;
  102. v = (unsigned long) addr[0] << 24;
  103. v |= (unsigned long) addr[1] << 16;
  104. v |= (unsigned long) addr[2] << 8;
  105. v |= (unsigned long) addr[3];
  106. return (bfd_vma) v;
  107. }
  108. bfd_vma bfd_getl16 (const bfd_byte *addr)
  109. {
  110. unsigned long v;
  111. v = (unsigned long) addr[0];
  112. v |= (unsigned long) addr[1] << 8;
  113. return (bfd_vma) v;
  114. }
  115. bfd_vma bfd_getb16 (const bfd_byte *addr)
  116. {
  117. unsigned long v;
  118. v = (unsigned long) addr[0] << 24;
  119. v |= (unsigned long) addr[1] << 16;
  120. return (bfd_vma) v;
  121. }
  122. static int print_insn_objdump(bfd_vma pc, disassemble_info *info,
  123. const char *prefix)
  124. {
  125. int i, n = info->buffer_length;
  126. uint8_t *buf = g_malloc(n);
  127. info->read_memory_func(pc, buf, n, info);
  128. for (i = 0; i < n; ++i) {
  129. if (i % 32 == 0) {
  130. info->fprintf_func(info->stream, "\n%s: ", prefix);
  131. }
  132. info->fprintf_func(info->stream, "%02x", buf[i]);
  133. }
  134. g_free(buf);
  135. return n;
  136. }
  137. static int print_insn_od_host(bfd_vma pc, disassemble_info *info)
  138. {
  139. return print_insn_objdump(pc, info, "OBJD-H");
  140. }
  141. static int print_insn_od_target(bfd_vma pc, disassemble_info *info)
  142. {
  143. return print_insn_objdump(pc, info, "OBJD-T");
  144. }
  145. #ifdef CONFIG_CAPSTONE
  146. /* Temporary storage for the capstone library. This will be alloced via
  147. malloc with a size private to the library; thus there's no reason not
  148. to share this across calls and across host vs target disassembly. */
  149. static __thread cs_insn *cap_insn;
  150. /* Initialize the Capstone library. */
  151. /* ??? It would be nice to cache this. We would need one handle for the
  152. host and one for the target. For most targets we can reset specific
  153. parameters via cs_option(CS_OPT_MODE, new_mode), but we cannot change
  154. CS_ARCH_* in this way. Thus we would need to be able to close and
  155. re-open the target handle with a different arch for the target in order
  156. to handle AArch64 vs AArch32 mode switching. */
  157. static cs_err cap_disas_start(disassemble_info *info, csh *handle)
  158. {
  159. cs_mode cap_mode = info->cap_mode;
  160. cs_err err;
  161. cap_mode += (info->endian == BFD_ENDIAN_BIG ? CS_MODE_BIG_ENDIAN
  162. : CS_MODE_LITTLE_ENDIAN);
  163. err = cs_open(info->cap_arch, cap_mode, handle);
  164. if (err != CS_ERR_OK) {
  165. return err;
  166. }
  167. /* ??? There probably ought to be a better place to put this. */
  168. if (info->cap_arch == CS_ARCH_X86) {
  169. /* We don't care about errors (if for some reason the library
  170. is compiled without AT&T syntax); the user will just have
  171. to deal with the Intel syntax. */
  172. cs_option(*handle, CS_OPT_SYNTAX, CS_OPT_SYNTAX_ATT);
  173. }
  174. /* "Disassemble" unknown insns as ".byte W,X,Y,Z". */
  175. cs_option(*handle, CS_OPT_SKIPDATA, CS_OPT_ON);
  176. /* Allocate temp space for cs_disasm_iter. */
  177. if (cap_insn == NULL) {
  178. cap_insn = cs_malloc(*handle);
  179. if (cap_insn == NULL) {
  180. cs_close(handle);
  181. return CS_ERR_MEM;
  182. }
  183. }
  184. return CS_ERR_OK;
  185. }
  186. static void cap_dump_insn_units(disassemble_info *info, cs_insn *insn,
  187. int i, int n)
  188. {
  189. fprintf_function print = info->fprintf_func;
  190. FILE *stream = info->stream;
  191. switch (info->cap_insn_unit) {
  192. case 4:
  193. if (info->endian == BFD_ENDIAN_BIG) {
  194. for (; i < n; i += 4) {
  195. print(stream, " %08x", ldl_be_p(insn->bytes + i));
  196. }
  197. } else {
  198. for (; i < n; i += 4) {
  199. print(stream, " %08x", ldl_le_p(insn->bytes + i));
  200. }
  201. }
  202. break;
  203. case 2:
  204. if (info->endian == BFD_ENDIAN_BIG) {
  205. for (; i < n; i += 2) {
  206. print(stream, " %04x", lduw_be_p(insn->bytes + i));
  207. }
  208. } else {
  209. for (; i < n; i += 2) {
  210. print(stream, " %04x", lduw_le_p(insn->bytes + i));
  211. }
  212. }
  213. break;
  214. default:
  215. for (; i < n; i++) {
  216. print(stream, " %02x", insn->bytes[i]);
  217. }
  218. break;
  219. }
  220. }
  221. static void cap_dump_insn(disassemble_info *info, cs_insn *insn)
  222. {
  223. fprintf_function print = info->fprintf_func;
  224. int i, n, split;
  225. print(info->stream, "0x%08" PRIx64 ": ", insn->address);
  226. n = insn->size;
  227. split = info->cap_insn_split;
  228. /* Dump the first SPLIT bytes of the instruction. */
  229. cap_dump_insn_units(info, insn, 0, MIN(n, split));
  230. /* Add padding up to SPLIT so that mnemonics line up. */
  231. if (n < split) {
  232. int width = (split - n) / info->cap_insn_unit;
  233. width *= (2 * info->cap_insn_unit + 1);
  234. print(info->stream, "%*s", width, "");
  235. }
  236. /* Print the actual instruction. */
  237. print(info->stream, " %-8s %s\n", insn->mnemonic, insn->op_str);
  238. /* Dump any remaining part of the insn on subsequent lines. */
  239. for (i = split; i < n; i += split) {
  240. print(info->stream, "0x%08" PRIx64 ": ", insn->address + i);
  241. cap_dump_insn_units(info, insn, i, MIN(n, i + split));
  242. print(info->stream, "\n");
  243. }
  244. }
  245. /* Disassemble SIZE bytes at PC for the target. */
  246. static bool cap_disas_target(disassemble_info *info, uint64_t pc, size_t size)
  247. {
  248. uint8_t cap_buf[1024];
  249. csh handle;
  250. cs_insn *insn;
  251. size_t csize = 0;
  252. if (cap_disas_start(info, &handle) != CS_ERR_OK) {
  253. return false;
  254. }
  255. insn = cap_insn;
  256. while (1) {
  257. size_t tsize = MIN(sizeof(cap_buf) - csize, size);
  258. const uint8_t *cbuf = cap_buf;
  259. target_read_memory(pc + csize, cap_buf + csize, tsize, info);
  260. csize += tsize;
  261. size -= tsize;
  262. while (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) {
  263. cap_dump_insn(info, insn);
  264. }
  265. /* If the target memory is not consumed, go back for more... */
  266. if (size != 0) {
  267. /* ... taking care to move any remaining fractional insn
  268. to the beginning of the buffer. */
  269. if (csize != 0) {
  270. memmove(cap_buf, cbuf, csize);
  271. }
  272. continue;
  273. }
  274. /* Since the target memory is consumed, we should not have
  275. a remaining fractional insn. */
  276. if (csize != 0) {
  277. (*info->fprintf_func)(info->stream,
  278. "Disassembler disagrees with translator "
  279. "over instruction decoding\n"
  280. "Please report this to qemu-devel@nongnu.org\n");
  281. }
  282. break;
  283. }
  284. cs_close(&handle);
  285. return true;
  286. }
  287. /* Disassemble SIZE bytes at CODE for the host. */
  288. static bool cap_disas_host(disassemble_info *info, void *code, size_t size)
  289. {
  290. csh handle;
  291. const uint8_t *cbuf;
  292. cs_insn *insn;
  293. uint64_t pc;
  294. if (cap_disas_start(info, &handle) != CS_ERR_OK) {
  295. return false;
  296. }
  297. insn = cap_insn;
  298. cbuf = code;
  299. pc = (uintptr_t)code;
  300. while (cs_disasm_iter(handle, &cbuf, &size, &pc, insn)) {
  301. cap_dump_insn(info, insn);
  302. }
  303. if (size != 0) {
  304. (*info->fprintf_func)(info->stream,
  305. "Disassembler disagrees with TCG over instruction encoding\n"
  306. "Please report this to qemu-devel@nongnu.org\n");
  307. }
  308. cs_close(&handle);
  309. return true;
  310. }
  311. #if !defined(CONFIG_USER_ONLY)
  312. /* Disassemble COUNT insns at PC for the target. */
  313. static bool cap_disas_monitor(disassemble_info *info, uint64_t pc, int count)
  314. {
  315. uint8_t cap_buf[32];
  316. csh handle;
  317. cs_insn *insn;
  318. size_t csize = 0;
  319. if (cap_disas_start(info, &handle) != CS_ERR_OK) {
  320. return false;
  321. }
  322. insn = cap_insn;
  323. while (1) {
  324. /* We want to read memory for one insn, but generically we do not
  325. know how much memory that is. We have a small buffer which is
  326. known to be sufficient for all supported targets. Try to not
  327. read beyond the page, Just In Case. For even more simplicity,
  328. ignore the actual target page size and use a 1k boundary. If
  329. that turns out to be insufficient, we'll come back around the
  330. loop and read more. */
  331. uint64_t epc = QEMU_ALIGN_UP(pc + csize + 1, 1024);
  332. size_t tsize = MIN(sizeof(cap_buf) - csize, epc - pc);
  333. const uint8_t *cbuf = cap_buf;
  334. /* Make certain that we can make progress. */
  335. assert(tsize != 0);
  336. info->read_memory_func(pc, cap_buf + csize, tsize, info);
  337. csize += tsize;
  338. if (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) {
  339. cap_dump_insn(info, insn);
  340. if (--count <= 0) {
  341. break;
  342. }
  343. }
  344. memmove(cap_buf, cbuf, csize);
  345. }
  346. cs_close(&handle);
  347. return true;
  348. }
  349. #endif /* !CONFIG_USER_ONLY */
  350. #else
  351. # define cap_disas_target(i, p, s) false
  352. # define cap_disas_host(i, p, s) false
  353. # define cap_disas_monitor(i, p, c) false
  354. #endif /* CONFIG_CAPSTONE */
  355. /* Disassemble this for me please... (debugging). */
  356. void target_disas(FILE *out, CPUState *cpu, target_ulong code,
  357. target_ulong size)
  358. {
  359. CPUClass *cc = CPU_GET_CLASS(cpu);
  360. target_ulong pc;
  361. int count;
  362. CPUDebug s;
  363. INIT_DISASSEMBLE_INFO(s.info, out, fprintf);
  364. s.cpu = cpu;
  365. s.info.read_memory_func = target_read_memory;
  366. s.info.buffer_vma = code;
  367. s.info.buffer_length = size;
  368. s.info.print_address_func = generic_print_address;
  369. s.info.cap_arch = -1;
  370. s.info.cap_mode = 0;
  371. s.info.cap_insn_unit = 4;
  372. s.info.cap_insn_split = 4;
  373. #ifdef TARGET_WORDS_BIGENDIAN
  374. s.info.endian = BFD_ENDIAN_BIG;
  375. #else
  376. s.info.endian = BFD_ENDIAN_LITTLE;
  377. #endif
  378. if (cc->disas_set_info) {
  379. cc->disas_set_info(cpu, &s.info);
  380. }
  381. if (s.info.cap_arch >= 0 && cap_disas_target(&s.info, code, size)) {
  382. return;
  383. }
  384. if (s.info.print_insn == NULL) {
  385. s.info.print_insn = print_insn_od_target;
  386. }
  387. for (pc = code; size > 0; pc += count, size -= count) {
  388. fprintf(out, "0x" TARGET_FMT_lx ": ", pc);
  389. count = s.info.print_insn(pc, &s.info);
  390. fprintf(out, "\n");
  391. if (count < 0)
  392. break;
  393. if (size < count) {
  394. fprintf(out,
  395. "Disassembler disagrees with translator over instruction "
  396. "decoding\n"
  397. "Please report this to qemu-devel@nongnu.org\n");
  398. break;
  399. }
  400. }
  401. }
  402. /* Disassemble this for me please... (debugging). */
  403. void disas(FILE *out, void *code, unsigned long size)
  404. {
  405. uintptr_t pc;
  406. int count;
  407. CPUDebug s;
  408. int (*print_insn)(bfd_vma pc, disassemble_info *info) = NULL;
  409. INIT_DISASSEMBLE_INFO(s.info, out, fprintf);
  410. s.info.print_address_func = generic_print_host_address;
  411. s.info.buffer = code;
  412. s.info.buffer_vma = (uintptr_t)code;
  413. s.info.buffer_length = size;
  414. s.info.cap_arch = -1;
  415. s.info.cap_mode = 0;
  416. s.info.cap_insn_unit = 4;
  417. s.info.cap_insn_split = 4;
  418. #ifdef HOST_WORDS_BIGENDIAN
  419. s.info.endian = BFD_ENDIAN_BIG;
  420. #else
  421. s.info.endian = BFD_ENDIAN_LITTLE;
  422. #endif
  423. #if defined(CONFIG_TCG_INTERPRETER)
  424. print_insn = print_insn_tci;
  425. #elif defined(__i386__)
  426. s.info.mach = bfd_mach_i386_i386;
  427. print_insn = print_insn_i386;
  428. s.info.cap_arch = CS_ARCH_X86;
  429. s.info.cap_mode = CS_MODE_32;
  430. s.info.cap_insn_unit = 1;
  431. s.info.cap_insn_split = 8;
  432. #elif defined(__x86_64__)
  433. s.info.mach = bfd_mach_x86_64;
  434. print_insn = print_insn_i386;
  435. s.info.cap_arch = CS_ARCH_X86;
  436. s.info.cap_mode = CS_MODE_64;
  437. s.info.cap_insn_unit = 1;
  438. s.info.cap_insn_split = 8;
  439. #elif defined(_ARCH_PPC)
  440. s.info.disassembler_options = (char *)"any";
  441. print_insn = print_insn_ppc;
  442. s.info.cap_arch = CS_ARCH_PPC;
  443. # ifdef _ARCH_PPC64
  444. s.info.cap_mode = CS_MODE_64;
  445. # endif
  446. #elif defined(__riscv) && defined(CONFIG_RISCV_DIS)
  447. #if defined(_ILP32) || (__riscv_xlen == 32)
  448. print_insn = print_insn_riscv32;
  449. #elif defined(_LP64)
  450. print_insn = print_insn_riscv64;
  451. #else
  452. #error unsupported RISC-V ABI
  453. #endif
  454. #elif defined(__aarch64__) && defined(CONFIG_ARM_A64_DIS)
  455. print_insn = print_insn_arm_a64;
  456. s.info.cap_arch = CS_ARCH_ARM64;
  457. #elif defined(__alpha__)
  458. print_insn = print_insn_alpha;
  459. #elif defined(__sparc__)
  460. print_insn = print_insn_sparc;
  461. s.info.mach = bfd_mach_sparc_v9b;
  462. #elif defined(__arm__)
  463. print_insn = print_insn_arm;
  464. s.info.cap_arch = CS_ARCH_ARM;
  465. /* TCG only generates code for arm mode. */
  466. #elif defined(__MIPSEB__)
  467. print_insn = print_insn_big_mips;
  468. #elif defined(__MIPSEL__)
  469. print_insn = print_insn_little_mips;
  470. #elif defined(__m68k__)
  471. print_insn = print_insn_m68k;
  472. #elif defined(__s390__)
  473. print_insn = print_insn_s390;
  474. #elif defined(__hppa__)
  475. print_insn = print_insn_hppa;
  476. #endif
  477. if (s.info.cap_arch >= 0 && cap_disas_host(&s.info, code, size)) {
  478. return;
  479. }
  480. if (print_insn == NULL) {
  481. print_insn = print_insn_od_host;
  482. }
  483. for (pc = (uintptr_t)code; size > 0; pc += count, size -= count) {
  484. fprintf(out, "0x%08" PRIxPTR ": ", pc);
  485. count = print_insn(pc, &s.info);
  486. fprintf(out, "\n");
  487. if (count < 0)
  488. break;
  489. }
  490. }
  491. /* Look up symbol for debugging purpose. Returns "" if unknown. */
  492. const char *lookup_symbol(target_ulong orig_addr)
  493. {
  494. const char *symbol = "";
  495. struct syminfo *s;
  496. for (s = syminfos; s; s = s->next) {
  497. symbol = s->lookup_symbol(s, orig_addr);
  498. if (symbol[0] != '\0') {
  499. break;
  500. }
  501. }
  502. return symbol;
  503. }
  504. #if !defined(CONFIG_USER_ONLY)
  505. #include "monitor/monitor.h"
  506. static int
  507. physical_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length,
  508. struct disassemble_info *info)
  509. {
  510. CPUDebug *s = container_of(info, CPUDebug, info);
  511. address_space_read(s->cpu->as, memaddr, MEMTXATTRS_UNSPECIFIED,
  512. myaddr, length);
  513. return 0;
  514. }
  515. /* Disassembler for the monitor. */
  516. void monitor_disas(Monitor *mon, CPUState *cpu,
  517. target_ulong pc, int nb_insn, int is_physical)
  518. {
  519. CPUClass *cc = CPU_GET_CLASS(cpu);
  520. int count, i;
  521. CPUDebug s;
  522. INIT_DISASSEMBLE_INFO(s.info, NULL, qemu_fprintf);
  523. s.cpu = cpu;
  524. s.info.read_memory_func
  525. = (is_physical ? physical_read_memory : target_read_memory);
  526. s.info.print_address_func = generic_print_address;
  527. s.info.buffer_vma = pc;
  528. s.info.cap_arch = -1;
  529. s.info.cap_mode = 0;
  530. s.info.cap_insn_unit = 4;
  531. s.info.cap_insn_split = 4;
  532. #ifdef TARGET_WORDS_BIGENDIAN
  533. s.info.endian = BFD_ENDIAN_BIG;
  534. #else
  535. s.info.endian = BFD_ENDIAN_LITTLE;
  536. #endif
  537. if (cc->disas_set_info) {
  538. cc->disas_set_info(cpu, &s.info);
  539. }
  540. if (s.info.cap_arch >= 0 && cap_disas_monitor(&s.info, pc, nb_insn)) {
  541. return;
  542. }
  543. if (!s.info.print_insn) {
  544. monitor_printf(mon, "0x" TARGET_FMT_lx
  545. ": Asm output not supported on this arch\n", pc);
  546. return;
  547. }
  548. for(i = 0; i < nb_insn; i++) {
  549. monitor_printf(mon, "0x" TARGET_FMT_lx ": ", pc);
  550. count = s.info.print_insn(pc, &s.info);
  551. monitor_printf(mon, "\n");
  552. if (count < 0)
  553. break;
  554. pc += count;
  555. }
  556. }
  557. #endif