Received: from eggs.gnu.org ([2001:4830:134:3::10]:39692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Za5qG-0005Fu-6c for qemu-devel@nongnu.org; Thu, 10 Sep 2015 13:41:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Za5qC-00059T-GW for qemu-devel@nongnu.org; Thu, 10 Sep 2015 13:41:00 -0400 Received: from mail-qg0-x22c.google.com ([2607:f8b0:400d:c04::22c]:33020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Za5qB-000598-PC for qemu-devel@nongnu.org; Thu, 10 Sep 2015 13:40:55 -0400 Received: by qgev79 with SMTP id v79so41674879qge.0 for ; Thu, 10 Sep 2015 10:40:55 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: <87r3m6w609.fsf@blackfin.pond.sub.org> Date: Thu, 10 Sep 2015 13:40:52 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <6E76ADBA-1F18-4E01-B944-01E5FDF30097@gmail.com> References: <65D87A2B-B94F-4236-A9BB-D0F0B7FCF96B@gmail.com> <26B5A68C-92C9-4528-BA17-4A282DCFF035@gmail.com> <87fv2og36d.fsf@blackfin.pond.sub.org> <9F6A7240-9CB8-41E2-AB87-B74CD7961191@gmail.com> <8737yocap6.fsf@blackfin.pond.sub.org> <8737ym210g.fsf@blackfin.pond.sub.org> <8E0D4F86-D62E-40A7-8337-58095F2B2E58@gmail.com> <87r3m6w609.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Peter Maydell , qemu-devel qemu-devel On Sep 10, 2015, at 1:15 PM, Markus Armbruster wrote: > Programmingkid writes: >=20 >> On Sep 10, 2015, at 3:21 AM, Markus Armbruster wrote: >>=20 >>> Programmingkid writes: >>>=20 >>>> Does this look about right? >>>>=20 >>>> QDict *qdict; >>>> Error *errp; >>>> QObject **ret_data; >>>> static int counter; >>>> char *idString, *fileName; >>>>=20 >>>> // The file variable is objective-c, left that code out >>>>=20 >>>> fileName =3D g_strdup_printf("%s", >>>> [file cStringUsingEncoding: = NSASCIIStringEncoding]); >>>>=20 >>>> /* Create an unique id */ >>>> idString =3D g_strdup_printf("USB%d", counter++); >>>>=20 >>>> /* Create the QDICT object */ >>>> qdict =3D qdict_new(); >>>> qdict_put_obj(qdict, "id", qstring_from_str(idString)); >>>> qdict_put_obj(qdict, "device", qstring_from_str(idString)); >>>> qdict_put_obj(qdict, "if", qstring_from_str("none")); >>>> qdict_put_obj(qdict, "file", qstring_from_str(fileName)); >>>> qdict_put_obj(qdict, "driver", = qstring_from_str("usb-storage")); >>>> drive_add(IF_DEFAULT, 0, fileName, "none"); >>>> qmp_device_add(qdict, ret_data, &errp); >>>> handleAnyDeviceErrors(errp); >>>> g_free(fileName); >>>> g_free(idString); >>>>=20 >>>> This is a sample of what I am working on. For some reason, it = crashes QEMU. Any clues why? I think it might be because of = qdict_put_obj().=20 >>>=20 >>> My crystal ball is down for maintenance today, so you'll have to = gives >>> us the clues yourself: a stack backtrace, for starters :) >>=20 >> Here is the error: >>=20 >> 2015-09-10 12:21:12.355 qemu-system-ppc[17603:903] HIToolbox: = ignoring >> exception 'Uncaught system exception: signal 11' that raised inside >> Carbon event dispatch >> ( >> 0 CoreFoundation 0x00007fff83ad37b4 __exceptionPreprocess + >> 180 >> 1 libobjc.A.dylib 0x00007fff83567f03 objc_exception_throw + 45 >> 2 CoreFoundation 0x00007fff83b2b969 -[NSException raise] + 9 >> 3 ExceptionHandling 0x00007fff845082d3 >> NSExceptionHandlerUncaughtSignalHandler + 37 >> 4 libSystem.B.dylib 0x00007fff825431ba _sigtramp + 26 >> 5 ??? 0x00007fff5fc12dc0 0x0 + 140734799883712 >> 6 qemu-system-ppc 0x00000001003c4109 qdict_get_try_str + 58 >> 7 qemu-system-ppc 0x00000001003dba04 qemu_opts_from_qdict + 63 >> 8 qemu-system-ppc 0x0000000100169388 qmp_device_add + 78 >=20 > Crashes in qdict_get_try_str(). Use a debugger to find out what goes > wrong there. This is what it said: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000001a7e130 0x00000001003c39e9 in qobject_type (obj=3D0x1a7e130) at qobject.h:109 109 assert(obj->type !=3D NULL); (gdb) bt #0 0x00000001003c39e9 in qobject_type (obj=3D0x1a7e130) at = qobject.h:109 #1 0x00000001003c4145 in qdict_get_try_str (qdict=3D0x102890a00, = key=3D0x1003e8308 "id") at qobject/qdict.c:341 #2 0x00000001003dba44 in qemu_opts_from_qdict (list=3D0x1005a2f40, = qdict=3D0x102890a00, errp=3D0x7fff5fbfcfe0) at util/qemu-option.c:968 #3 0x00000001001693b4 in qmp_device_add (qdict=3D0x102890a00, = ret_data=3D0x7fff5fbfd038, errp=3D0x7fff5fbfd030) at qdev-monitor.c:767 I do not know much about the QDict type. Did I use it right by using = qstring_from_str() to set a key's value to another string?=