Rtoax / ulpatch

ULPatch is open source user space live patch tool.
https://rtoax.github.io/ulpatch/
GNU General Public License v2.0
4 stars 2 forks source link

error: too few arguments to function ‘init_disassemble_info’ #8

Closed Rtoax closed 3 months ago

Rtoax commented 3 months ago

whten compile tests/disasm, get:

ulpatch/tests/disasm$ make 
cc -lopcodes -Wall -O0 -g -ggdb   -c -o disasm-tst0.o disasm-tst0.c
disasm-tst0.c: In function ‘disassemble_raw’:
disasm-tst0.c:49:3: error: too few arguments to function ‘init_disassemble_info’
   49 |   init_disassemble_info(&disasm_info, &ss, dis_fprintf);
      |   ^~~~~~~~~~~~~~~~~~~~~
In file included from disasm-tst0.c:10:
/usr/include/dis-asm.h:480:13: note: declared here
  480 | extern void init_disassemble_info (struct disassemble_info *dinfo, void *stream,
      |             ^~~~~~~~~~~~~~~~~~~~~
make: *** [<builtin>: disasm-tst0.o] Error 1
Rtoax commented 3 months ago

In binutils (https://sourceware.org/git/binutils-gdb.git) commit 60a3da00bd5407f07d64dff82a4dae98230dfaac ("objdump/opcodes: add syntax highlighting to disassembler output")

--- a/include/dis-asm.h
+++ b/include/dis-asm.h
@@ -394,11 +470,13 @@ extern bool generic_symbol_is_valid
 /* Method to initialize a disassemble_info struct.  This should be
    called by all applications creating such a struct.  */
 extern void init_disassemble_info (struct disassemble_info *dinfo, void *stream,
-                                  fprintf_ftype fprintf_func);
+                                  fprintf_ftype fprintf_func,
+                                  fprintf_styled_ftype fprintf_styled_func);

 /* For compatibility with existing code.  */
-#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \
-  init_disassemble_info (&(INFO), (STREAM), (fprintf_ftype) (FPRINTF_FUNC))
+#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC, FPRINTF_STYLED_FUNC)  \
+  init_disassemble_info (&(INFO), (STREAM), (fprintf_ftype) (FPRINTF_FUNC), \
+                        (fprintf_styled_ftype) (FPRINTF_STYLED_FUNC))

 #ifdef __cplusplus
 }