qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item
Date: Fri, 11 Sep 2015 09:09:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Programmingkid <address@hidden> writes:

> On Sep 10, 2015, at 1:15 PM, Markus Armbruster wrote:
>
>> Programmingkid <address@hidden> writes:
>> 
>>> On Sep 10, 2015, at 3:21 AM, Markus Armbruster wrote:
>>> 
>>>> Programmingkid <address@hidden> writes:
>>>> 
>>>>> Does this look about right?
>>>>> 
>>>>>   QDict *qdict;
>>>>>   Error *errp;
>>>>>   QObject **ret_data;
>>>>>   static int counter;
>>>>>   char *idString, *fileName;
>>>>> 
>>>>>   // The file variable is objective-c, left that code out
>>>>> 
>>>>>       fileName = g_strdup_printf("%s",
>>>>>                           [file cStringUsingEncoding: 
>>>>> NSASCIIStringEncoding]);
>>>>> 
>>>>>       /* Create an unique id */
>>>>>       idString = g_strdup_printf("USB%d", counter++);
>>>>> 
>>>>>       /* Create the QDICT object */
>>>>>       qdict = 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);
>>>>> 
>>>>> 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(). 
>>>> 
>>>> My crystal ball is down for maintenance today, so you'll have to gives
>>>> us the clues yourself: a stack backtrace, for starters :)
>>> 
>>> Here is the error:
>>> 
>>> 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
>> 
>> 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=0x1a7e130) at qobject.h:109
> 109       assert(obj->type != NULL);
> (gdb) bt
> #0  0x00000001003c39e9 in qobject_type (obj=0x1a7e130) at qobject.h:109
> #1 0x00000001003c4145 in qdict_get_try_str (qdict=0x102890a00,
> key=0x1003e8308 "id") at qobject/qdict.c:341
> #2 0x00000001003dba44 in qemu_opts_from_qdict (list=0x1005a2f40,
> qdict=0x102890a00, errp=0x7fff5fbfcfe0) at util/qemu-option.c:968
> #3 0x00000001001693b4 in qmp_device_add (qdict=0x102890a00,
> ret_data=0x7fff5fbfd038, errp=0x7fff5fbfd030) 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?

I can't see your bug.

I'm happy to explain how things work and provide advice, I review
working patches touching my areas of expertise, but I can't do your
debugging for you, sorry.

For example code using QDict, check out tests/check-qdict.c.



reply via email to

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