I have ubuntu 20.04 64bits. and have this file hmp-sss.h and code:
..... {.name = "memsave",.args_type = "val:l,size:i,filename:s",.params = "addr size file",.help = "save to disk virtual memory dump starting at 'addr' of size 'size'",.cmd = hmp_memsave,},{.name = "pmemsave",.args_type = "val:l,size:i,filename:s",.params = "addr size file",.help = "save to disk physical memory dump starting at 'addr' of size 'size'",.cmd = hmp_pmemsave,},{.name = "pmemaccess",.args_type = "path:s",.params = "path",.help = "mount guest physical memory image at 'path'",.user_print = monitor_user_noop,.cmd = do_physical_memory_access,},{.name = "boot_set",.args_type = "bootdevice:s",.params = "bootdevice",.help = "define new values for the boot device list",.cmd = hmp_boot_set,},....
And the function in file monitor.c:
#include "qemu/osdep.h"#include <dirent.h>#include "qemu-common.h"#include "cpu.h"#include "hw/hw.h"#include "monitor/qdev.h"#include "hw/usb.h"#include "hw/i386/pc.h"#include "hw/pci/pci.h"#include "sysemu/watchdog.h"#include "hw/loader.h"#include "exec/gdbstub.h"#include "net/net.h"#include "net/slirp.h"#include "chardev/char-fe.h"#include "ui/qemu-spice.h"#include "sysemu/numa.h"#include "monitor/monitor.h"#include "qemu/config-file.h"#include "qemu/readline.h"#include "ui/console.h"#include "ui/input.h"#include "sysemu/blockdev.h"#include "sysemu/block-backend.h"#include "audio/audio.h"#include "disas/disas.h"#include "sysemu/balloon.h"#include "qemu/timer.h"#include "sysemu/hw_accel.h"#include "qemu/acl.h"#include "sysemu/tpm.h"#include "qapi/qmp/qerror.h"#include "qapi/qmp/types.h"#include "qapi/qmp/qjson.h"#include "qapi/qmp/json-streamer.h"#include "qapi/qmp/json-parser.h"#include "qom/object_interfaces.h"#include "trace-root.h"#include "trace/control.h"#include "monitor/hmp-target.h"#ifdef CONFIG_TRACE_SIMPLE#include "trace/simple.h"#endif#include "exec/memory.h"#include "exec/exec-all.h"#include "qemu/log.h"#include "qmp-commands.h"#include "hmp.h"#include "qemu/thread.h"#include "block/qapi.h"#include "qapi/qmp-event.h"#include "qapi-event.h"#include "qmp-introspect.h"#include "sysemu/qtest.h"#include "sysemu/cpus.h"#include "qemu/cutils.h"#include "qapi/qmp/dispatch.h"#include "qmp-commands.h"#include "memory-access.h"#if defined(TARGET_S390X)#include "hw/s390x/storage-keys.h"#include "hw/s390x/storage-attributes.h"#endif.....static int do_physical_memory_access(Monitor *mon, const QDict *qdict, QObject **ret_data){ const char *path = qdict_get_str(qdict, "path"); memory_access_start(path); return 0;}static void monitor_user_noop(Monitor *mon, const QObject *data) { }
And the out compile is:
tut@tutu:~/qemu-2.10.1$ make subdir-x86_64-softmmu CC x86_64-softmmu/monitor.oIn file included from /home/tut/qemu-2.10.1/monitor.c:2335:./hmp-sss.h:459:15: error: ‘monitor_user_noop’ undeclared here (not in a function); did you mean ‘monitor_is_qmp’? 459 | .user_print = monitor_user_noop, | ^~~~~~~~~~~~~~~~~ | monitor_is_qmp./hmp-sss.h:460:8: error: ‘do_physical_memory_access’ undeclared here (not in a function); did you mean ‘cpu_physical_memory_read’? 460 | .cmd = do_physical_memory_access, | ^~~~~~~~~~~~~~~~~~~~~~~~~ | cpu_physical_memory_read/home/tut/qemu-2.10.1/monitor.c:4210:13: warning: ‘monitor_user_noop’ defined but not used [-Wunused-function] 4210 | static void monitor_user_noop(Monitor *mon, const QObject *data) { } | ^~~~~~~~~~~~~~~~~/home/tut/qemu-2.10.1/monitor.c:4203:12: warning: ‘do_physical_memory_access’ defined but not used [-Wunused-function] 4203 | static int do_physical_memory_access(Monitor *mon, const QDict *qdict, QObject **ret_data) | ^~~~~~~~~~~~~~~~~~~~~~~~~make[1]: *** [/home/tut/qemu-2.10.1/rules.mak:66: monitor.o] Error 1make: *** [Makefile:326: subdir-x86_64-softmmu] Error 2
Why send this message?