qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [RFC] Introduce qemu_abort? (was: Fix compiler warning (always return a value))
Date: Wed, 26 Oct 2011 20:34:56 +0200	[thread overview]
Message-ID: <4EA852D0.8080601@weilnetz.de> (raw)
In-Reply-To: <CAAu8pHv75vPNusfwjdP4XiDWjYm2F8KXLuJcd8CX4nWX2cyRfQ@mail.gmail.com>

Am 26.10.2011 19:49, schrieb Blue Swirl:
> On Wed, Oct 26, 2011 at 16:35, Stefan Weil <sw@weilnetz.de> 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.

  reply	other threads:[~2011-10-26 18:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-24 20:18 [Qemu-devel] [PATCH] Fix compiler warning (always return a value) Stefan Weil
2011-10-26 12:54 ` Stefan Hajnoczi
2011-10-26 16:35   ` [Qemu-devel] [PATCH] Fix compiler warning (always return a value), introduce qemu_abort? Stefan Weil
2011-10-26 17:49     ` Blue Swirl
2011-10-26 18:34       ` Stefan Weil [this message]
2011-10-26 18:48         ` [Qemu-devel] [RFC] Introduce qemu_abort? (was: Fix compiler warning (always return a value)) Blue Swirl
2011-10-26 20:36         ` Peter Maydell
2011-10-28  7:53           ` [Qemu-devel] [RFC] Introduce qemu_abort? Markus Armbruster
2011-10-27  7:11     ` [Qemu-devel] [PATCH] Fix compiler warning (always return a value), introduce qemu_abort? Stefan Hajnoczi
2011-10-27  8:24     ` Alexander Graf
2011-10-28  7:40   ` [Qemu-devel] [PATCH] Fix compiler warning (always return a value) Markus Armbruster
2011-10-28  8:49     ` Stefan Hajnoczi
2011-10-28  8:59       ` Markus Armbruster
2011-10-28  9:02         ` Stefan Hajnoczi
2011-10-28 11:07           ` Markus Armbruster
2011-10-28 12:41             ` Stefan Hajnoczi
2011-10-28 14:39               ` Markus Armbruster
2011-10-28 16:40                 ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EA852D0.8080601@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).