qemu-e2k/qga
Markus Armbruster 1e9b65bb1b error: On abort, report where the error was created
This is particularly useful when we abort in error_propagate(),
because there the stack backtrace doesn't lead to where the error was
created.  Looks like this:

    Unexpected error in parse_block_error_action() at .../qemu/blockdev.c:322:
    qemu-system-x86_64: -drive if=none,werror=foo: 'foo' invalid write error action
    Aborted (core dumped)

Note: to get this example output, I monkey-patched drive_new() to pass
&error_abort to blockdev_init().

To keep the error handling boiler plate from growing even more, all
error_setFOO() become macros expanding into error_setFOO_internal()
with additional __FILE__, __LINE__, __func__ arguments.  Not exactly
pretty, but it works.

The macro trickery breaks down when you take the address of an
error_setFOO().  Fortunately, we do that in just one place: qemu-ga's
Windows VSS provider and requester DLL wants to call
error_setg_win32() through a function pointer "to avoid linking glib
to the DLL".  Use error_setg_win32_internal() there.  The use of the
function pointer is already wrapped in a macro, so the churn isn't
bad.

Code size increases by some 35KiB for me (0.7%).  Tolerable.  Could be
less if we passed relative rather than absolute source file names to
the compiler, or forwent reporting __func__.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
2015-09-10 13:48:06 +02:00
..
installer qemu-ga: Fixed paths issue with MSI build 2015-09-01 11:07:09 -05:00
vss-win32 error: On abort, report where the error was created 2015-09-10 13:48:06 +02:00
Makefile.objs qemu-ga: Call Windows VSS requester in fsfreeze command handler 2013-09-09 14:17:57 -05:00
channel-posix.c channel-posix: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK) 2014-08-15 18:03:13 +01:00
channel-win32.c qemu-ga: debug printouts to help troubleshoot installation 2015-06-17 16:03:46 +02:00
channel.h qemu-ga: move channel/transport functionality into wrapper class 2012-02-23 15:40:16 -06:00
commands-posix.c qga: make split_list() return allocated strings 2015-09-01 11:07:10 -05:00
commands-win32.c qemu-ga: implement win32 guest-set-user-password 2015-09-01 13:16:26 -05:00
commands.c qga: Consistently name Error ** objects errp, and not err 2014-05-09 09:11:26 -04:00
guest-agent-command-state.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
guest-agent-core.h qga: Disable unsupported commands by default 2014-08-07 17:15:53 -05:00
main.c qga: add --dump-conf option 2015-09-01 13:16:25 -05:00
qapi-schema.json qga: misc spelling 2015-09-01 11:07:09 -05:00
service-win32.c qga: escape cmdline args when registering win32 service (CVE-2013-2231) 2013-07-25 14:49:04 -05:00
service-win32.h qga: save state directory in ga_install_service() 2013-05-30 11:37:37 -05:00
vss-win32.c error: On abort, report where the error was created 2015-09-10 13:48:06 +02:00
vss-win32.h qga: Consistently name Error ** objects errp, and not err 2014-05-09 09:11:26 -04:00