[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC] Introduce qemu_abort? (was: Fix compiler warning
From: |
Blue Swirl |
Subject: |
Re: [Qemu-devel] [RFC] Introduce qemu_abort? (was: Fix compiler warning (always return a value)) |
Date: |
Wed, 26 Oct 2011 18:48:09 +0000 |
On Wed, Oct 26, 2011 at 18:34, Stefan Weil <address@hidden> wrote:
> 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?
It shouldn't destabilize anything since we are going to abort anyway.
> 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)
This function could also be added, though I'd leave actual conversions
to 1.1, in case printfs turn out dangerous.
- [Qemu-devel] [PATCH] Fix compiler warning (always return a value), Stefan Weil, 2011/10/24
- Re: [Qemu-devel] [PATCH] Fix compiler warning (always return a value), Stefan Hajnoczi, 2011/10/26
- Re: [Qemu-devel] [PATCH] Fix compiler warning (always return a value), introduce qemu_abort?, Stefan Weil, 2011/10/26
- Re: [Qemu-devel] [PATCH] Fix compiler warning (always return a value), introduce qemu_abort?, Blue Swirl, 2011/10/26
- [Qemu-devel] [RFC] Introduce qemu_abort? (was: Fix compiler warning (always return a value)), Stefan Weil, 2011/10/26
- Re: [Qemu-devel] [RFC] Introduce qemu_abort? (was: Fix compiler warning (always return a value)),
Blue Swirl <=
- Re: [Qemu-devel] [RFC] Introduce qemu_abort? (was: Fix compiler warning (always return a value)), Peter Maydell, 2011/10/26
- Re: [Qemu-devel] [RFC] Introduce qemu_abort?, Markus Armbruster, 2011/10/28
- Re: [Qemu-devel] [PATCH] Fix compiler warning (always return a value), introduce qemu_abort?, Stefan Hajnoczi, 2011/10/27
- Re: [Qemu-devel] [PATCH] Fix compiler warning (always return a value), introduce qemu_abort?, Alexander Graf, 2011/10/27
Re: [Qemu-devel] [PATCH] Fix compiler warning (always return a value), Markus Armbruster, 2011/10/28
- Re: [Qemu-devel] [PATCH] Fix compiler warning (always return a value), Stefan Hajnoczi, 2011/10/28
- Re: [Qemu-devel] [PATCH] Fix compiler warning (always return a value), Markus Armbruster, 2011/10/28
- Re: [Qemu-devel] [PATCH] Fix compiler warning (always return a value), Stefan Hajnoczi, 2011/10/28
- Re: [Qemu-devel] [PATCH] Fix compiler warning (always return a value), Markus Armbruster, 2011/10/28
- Re: [Qemu-devel] [PATCH] Fix compiler warning (always return a value), Stefan Hajnoczi, 2011/10/28