@@ -602,9 +602,8 @@ class hsdis_backend : public hsdis_backend_base {
602602 if (_arch_name[0 ] == ' \0 ' )
603603 _arch_name = native_target_triple ();
604604
605- static bool complained = false ;
606-
607605 if (LLVMInitializeNativeTarget () != 0 ) {
606+ static bool complained = false ;
608607 if (!complained)
609608 (*_printf_callback)(_printf_stream, " failed to initialize LLVM native target\n " );
610609 complained = true ;
@@ -613,6 +612,7 @@ class hsdis_backend : public hsdis_backend_base {
613612 return ;
614613 }
615614 if (LLVMInitializeNativeAsmPrinter () != 0 ) {
615+ static bool complained = false ;
616616 if (!complained)
617617 (*_printf_callback)(_printf_stream, " failed to initialize LLVM native asm printer\n " );
618618 complained = true ;
@@ -621,6 +621,7 @@ class hsdis_backend : public hsdis_backend_base {
621621 return ;
622622 }
623623 if (LLVMInitializeNativeDisassembler () != 0 ) {
624+ static bool complained = false ;
624625 if (!complained)
625626 (*_printf_callback)(_printf_stream, " failed to initialize LLVM native disassembler\n " );
626627 complained = true ;
@@ -629,6 +630,7 @@ class hsdis_backend : public hsdis_backend_base {
629630 return ;
630631 }
631632 if ((_dcontext = LLVMCreateDisasm (_arch_name, NULL , 0 , NULL , NULL )) == NULL ) {
633+ static bool complained = false ;
632634 const char * bad = _arch_name;
633635 if (bad == &_target_triple[0 ])
634636 print_help (" bad target_triple=%s" , bad);
@@ -657,6 +659,7 @@ class hsdis_backend : public hsdis_backend_base {
657659 (*_printf_callback)(_printf_stream, " \n " );
658660 }
659661 (*_printf_callback)(_printf_stream, " hsdis output options:\n " );
662+ (*_printf_callback)(_printf_stream, " target_triple=<triple> select disassembly target\n " );
660663 (*_printf_callback)(_printf_stream, " help print this message\n " );
661664 }
662665
@@ -669,7 +672,7 @@ class hsdis_backend : public hsdis_backend_base {
669672 char buf[128 ];
670673 size_t size = LLVMDisasmInstruction (_dcontext, (uint8_t *)p, (uint64_t )(end - start), (uint64_t )p, buf, sizeof (buf));
671674 if (size > 0 ) {
672- _printf_callback (_printf_stream, " %s" , buf);
675+ (* _printf_callback) (_printf_stream, " %s" , buf);
673676 }
674677 return size;
675678 }
0 commit comments