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