|
From: | Stefan Weil |
Subject: | [Qemu-devel] [RFC] Introduce qemu_abort? (was: Fix compiler warning (always return a value)) |
Date: | Wed, 26 Oct 2011 20:34:56 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20110921 Thunderbird/3.1.15 |
Am 26.10.2011 19:49, schrieb Blue Swirl:
On Wed, Oct 26, 2011 at 16:35, Stefan Weil <address@hidden> wrote:... I personally don't like abort() because it does not show the reason for the failure. Most users don't know how to get a core dump or how to use gdb. And even for those who know, a crash caused by an abort() which cannot be reproduced usually happens on a system were ulimit disables core dumps... I'd like to have a qemu_abort() macro in qemu-common.h which replaces all abort() calls used today:Also assert(0) calls.#define qemu_abort() \ do { \ fprintf(stderr, "QEMU aborted in %s, %s:%u\n", __func__, __FILE__, __LINE__); abort(); } while (0) (The macro could also call a function which handles fprintf and abort).There could be also a version with additional error message parameter.
Replacing abort() and assert(0) by qemu_abort() touches a lot of files. Do you think this can be a change for QEMU 1.0, or is it better to wait? Adding the infrastructure (macros / implementation) could be done faster. I suggest these interfaces in qemu-common.h: qemu_abort() - abort QEMU with a message containing function name, file name and line (macro, see message text in my previous mail cited above) qemu_fatal(formatstring, ...) - abort QEMU with a printf like message (function, prints "QEMU aborted, " and the text according to the parameters) Regards, Stefan W.
[Prev in Thread] | Current Thread | [Next in Thread] |