Received: from eggs.gnu.org ([2001:4830:134:3::10]:50980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9JSY-0005Xa-O7 for qemu-devel@nongnu.org; Tue, 22 Nov 2016 17:22:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9JST-0000hV-NG for qemu-devel@nongnu.org; Tue, 22 Nov 2016 17:22:38 -0500 Received: from mail-io0-x241.google.com ([2607:f8b0:4001:c06::241]:32869) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c9JST-0000hK-Gh for qemu-devel@nongnu.org; Tue, 22 Nov 2016 17:22:33 -0500 Received: by mail-io0-x241.google.com with SMTP id j92so13344038ioi.0 for ; Tue, 22 Nov 2016 14:22:33 -0800 (PST) In-Reply-To: <182f25fb-98bd-73db-62f3-ff18b30a49cd@redhat.com> References: <673F175E-AF65-4F4F-9895-C7335A36AC29@gmail.com> <8b136de6-490a-d194-b7a6-eabfb87daf2c@redhat.com> <16AF327F-E1FE-4F2E-9919-A474276474FF@gmail.com> <182f25fb-98bd-73db-62f3-ff18b30a49cd@redhat.com> Mime-Version: 1.0 (Apple Message framework v753.1) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: G 3 Date: Tue, 22 Nov 2016 17:22:26 -0500 Subject: Re: [Qemu-devel] qobject/qjson.c:69: failed assertion `obj != NULL' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Paolo Bonzini , Markus Armbruster , qemu-devel qemu-devel On Nov 21, 2016, at 3:36 PM, Eric Blake wrote: > On 11/21/2016 02:12 PM, G 3 wrote: >> >> On Nov 21, 2016, at 5:02 AM, Paolo Bonzini wrote: >> >>> >>> >>> On 21/11/2016 07:30, G 3 wrote: >>>> When I try to use qemu-system-i386, I see this error message: >>>> >>>> qobject/qjson.c:69: failed assertion `obj != NULL'. > >>>> >>>> The string argument is this: { 'seconds': %qd, 'microseconds': % >>>> qd } >>>> >>>> Would anyone know how to fix this problem? >>> >>> Please include the full backtrace. > >> #3 0x003ec69c in qobject_from_jsonf (string=0x443f44 >> "{ 'seconds': %qd, >> 'microseconds': %qd }") at qobject/qjson.c:69 >> #4 0x0033f6e4 in timestamp_put (qdict=0x2052e00) at >> /Users/john/desktop/qemu-2.0.0/monitor.c:476 > > Why on earth are you trying to compile qemu 2.0.0? The latest version > we support on this list is currently 2.6.x for patch backports, with > 2.7.0 as the latest stable release; and very soon now it will be 2.7.x > for backports and 2.8.0 as the latest stable release. > > The source of your problem is that your platform defines PRId64 as > 'qd', > but the qemu JSON parser only recognizes lld (POSIX) or I64d > (mingw) for > parsing 64-bit numbers. We could enhance the JSON parser to recognize > the non-standard qd in addition to the hack we already have for mingw, > but I'd argue that using qobject_from_jsonf() is already less-than- > useful. > > On the other hand, timestamp_put() (which now lives in qapi/qmp- > event.c, > rather than monitor.c) is still using qobject_from_jsonf() with PRId64 > in current git master. If you don't want to hack the JSON parser > (and I > recommend that you don't), the alternative is to get rid of that > function call and replace it with an open-coded construction of a > QDict > with manual population of its two members. It's hard to argue that > the > complexity of maintaining our pseudo-printf JSON parser for > constructing > a QObject with one line is worth the effort compared to the three or > four lines to construct the same QObject by hand. I would just like to note for anyone else who might face this problem in the future that replacing %PRId64 with %lld fixed the problem. I made the replacement in timestamp_put().