From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXDjI-0006k1-MY for qemu-devel@nongnu.org; Wed, 23 May 2012 11:44:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXDjA-0006vt-2x for qemu-devel@nongnu.org; Wed, 23 May 2012 11:44:04 -0400 Received: from mel.act-europe.fr ([194.98.77.210]:35403) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXDj9-0006qf-Py for qemu-devel@nongnu.org; Wed, 23 May 2012 11:43:56 -0400 Message-ID: <4FBD05A8.8050007@adacore.com> Date: Wed, 23 May 2012 17:43:36 +0200 From: Fabien Chouteau MIME-Version: 1.0 References: <1337074749-24189-1-git-send-email-chouteau@adacore.com> <4FB25AA9.3010905@suse.de> <4FB27F60.7090304@adacore.com> <4FB32412.8030407@suse.de> <4FB3656C.4000904@adacore.com> <4FB3AE2F.7030108@adacore.com> In-Reply-To: <4FB3AE2F.7030108@adacore.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] Avoid segfault in cpu_dump_state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-1?Q?Andreas_F=E4rber?= Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, agraf@suse.de On 05/16/2012 03:39 PM, Fabien Chouteau wrote: > On 05/16/2012 10:29 AM, Fabien Chouteau wrote: >> On 05/16/2012 05:50 AM, Andreas F=E4rber wrote: >>> Am 15.05.2012 18:08, schrieb Fabien Chouteau: >>>> On 05/15/2012 03:31 PM, Andreas F=E4rber wrote: >>>>> Am 15.05.2012 11:39, schrieb Fabien Chouteau: >>>>>> Do not call cpu_dump_state if logfile is NULL. >>>>> >>>>> And where is log_cpu_state() being called from? Its caller is passi= ng >>>>> NULL already then. >>>>> >>>> >>>> No, logfile is a global variable. log_cpu_state() takes only CPUStat= e >>>> and flags parameters. >>> >>> Ah, I see now that f is a different f here, logfile becomes >>> log_cpu_state()'s f. Unfortunate naming. >>> >>> Your fix looks OK then but I would recommend turning it into a static >>> inline function to avoid the line breaks. >>> >> >> In this case I can rewrite all the macros in qemu-log.h to static inli= ne. >> >=20 > This is more complex than expected... >=20 > 1 - GCC rejects inlined variadic functions >=20 > 2 - Moving from macro to inline implies use of types defined in cpu.h > (target_ulong, CPUArchState...), which I cannot include because > qemu-log.h is used in tools (i.e. without cpu.h). >=20 > Conclusion: unless someone volunteer for a massive restructuring of > qemu-log we have to keep the marcro for log_cpu_state. >=20 So, are we good with the second patch? --=20 Fabien Chouteau