qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Coding style for errors


From: Peter Maydell
Subject: Re: [Qemu-devel] Coding style for errors
Date: Wed, 21 Oct 2015 21:16:39 +0100

On 21 October 2015 at 17:48, Markus Armbruster <address@hidden> wrote:
> Lluís Vilanova <address@hidden> writes:
>
>> Hi,
>>
>> I was wondering what is the proper way (or ways, depending on the subsystem) 
>> of
>> reporting and signalling errors in QEMU. The coding style file does not seem 
>> to
>> mention it, and the code uses all kinds of forms for that:
>>
>> * printf + exit(1)
>> * fprintf(stderr) + exit(1)
>> * error_report + exit(1)
>> * cpu_abort
>> * Some other I probably forgot
>
> cpu_abort() and hw_error() are fancy ways to abort().  Terminating with
> abort() on "this can't be happening" conditions is perfectly sensible,
> and doing it in fancy ways can be useful.  For other errors, it's
> inappropriate.

In particular, the fact that TCG will cpu_abort() if you try to
generate code out of something that's not RAM is a perpetual
source of confusion to users, because the usual reason it happens
is not a QEMU bug but buggy guest code jumping off to a random address...

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]