[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 09/12] plugins: add API to print errors
From: |
Sven Schnelle |
Subject: |
[PATCH v3 09/12] plugins: add API to print errors |
Date: |
Fri, 1 Mar 2024 18:46:06 +0100 |
add qemu_plugin_error_print() which is a wrapper around
error_report_err(). This will be used by
qemu_plugin_parse_filter_ranges() to report parse failures.
Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
include/qemu/qemu-plugin.h | 12 ++++++++++++
plugins/api.c | 7 +++++++
plugins/qemu-plugins.symbols | 1 +
3 files changed, 20 insertions(+)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index 45e2ebc8f8..5839feea4d 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/qemu/qemu-plugin.h
@@ -752,5 +752,17 @@ QEMU_PLUGIN_API
int qemu_plugin_read_register(struct qemu_plugin_register *handle,
GByteArray *buf);
+typedef struct Error Error;
+
+/**
+ * qemu_plugin_error_print() - print and free error
+ *
+ * @err: a @Error handle
+ *
+ * This function shows and and frees the supplied error.
+ */
+
+QEMU_PLUGIN_API
+void qemu_plugin_error_print(Error *err);
#endif /* QEMU_QEMU_PLUGIN_H */
diff --git a/plugins/api.c b/plugins/api.c
index 81f43c9ce8..8fd3a8964a 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -45,6 +45,7 @@
#include "exec/ram_addr.h"
#include "disas/disas.h"
#include "plugin.h"
+#include "qapi/error.h"
#ifndef CONFIG_USER_ONLY
#include "qemu/plugin-memory.h"
#include "hw/boards.h"
@@ -465,3 +466,9 @@ int qemu_plugin_read_register(struct qemu_plugin_register
*reg, GByteArray *buf)
return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg));
}
+
+void qemu_plugin_error_print(Error *err)
+{
+ error_report_err(err);
+}
+
diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols
index 27fe97239b..b142d11e58 100644
--- a/plugins/qemu-plugins.symbols
+++ b/plugins/qemu-plugins.symbols
@@ -2,6 +2,7 @@
qemu_plugin_bool_parse;
qemu_plugin_end_code;
qemu_plugin_entry_code;
+ qemu_plugin_error_print;
qemu_plugin_get_hwaddr;
qemu_plugin_get_registers;
qemu_plugin_hwaddr_device_name;
--
2.43.2
- [PATCH v3 06/12] util/range: split up range_list_from_string(), (continued)
- [PATCH v3 06/12] util/range: split up range_list_from_string(), Sven Schnelle, 2024/03/01
- [PATCH v3 05/12] util/range: use append_new_range() in range_list_from_string(), Sven Schnelle, 2024/03/01
- [PATCH v3 02/12] util/log: make qemu_set_dfilter_ranges() take a GList, Sven Schnelle, 2024/03/01
- [PATCH v3 03/12] util/range: move range_list_from_string() to range.c, Sven Schnelle, 2024/03/01
- [PATCH v3 07/12] util/range: make range_list_from_string() accept a single number, Sven Schnelle, 2024/03/01
- [PATCH v3 08/12] qemu/range: add range_list_contains() function, Sven Schnelle, 2024/03/01
- [PATCH v3 04/12] util/range: add range_list_free(), Sven Schnelle, 2024/03/01
- [PATCH v3 10/12] plugins: add range list API, Sven Schnelle, 2024/03/01
- [PATCH v3 12/12] plugins/execlog: add data address match, Sven Schnelle, 2024/03/01
- [PATCH v3 09/12] plugins: add API to print errors,
Sven Schnelle <=
- [PATCH v3 11/12] plugins/execlog: use range list api, Sven Schnelle, 2024/03/01