GNOME Bugzilla – Bug 606180
foo-1.0.tgir generate fail on Sparc
Last modified: 2015-02-07 16:53:39 UTC
Build gobject-introspection 0.6.7 tarball or git-master on OpenSolaris sparc box, I always get following error: [...] ../../tools/g-ir-generate --includedir=. --includedir=../../gir foo-1.0.typelib -o foo-1.0.tgir ** ERROR:ginfo.c:287:g_base_info_get_name: code should not be reached make[3]: *** [foo-1.0.tgir] Abort (core dumped) make[3]: *** Deleting file `foo-1.0.tgir' This issue does not happen on i386 and amd64 box. I think it might be sparc specific.
Created attachment 150880 [details] diff file of foo-1.0.tgir compared with amd64 and sparc The diff file shows error happens when parsing callback function do_foo. With debugging, the interface type is not GI_INFO_TYPE_CALLBACK and goes to line 404. Which is clearly wrong. tools/generate.c ---------------- 400 interface = g_type_info_get_interface (type); 401 if (interface && g_base_info_get_type(interface) == GI_INFO_TYPE_CALLBACK ) 402 write_callback_info (namespace, (GICallbackInfo *)interface, file); 403 else 404 write_type_info (namespace, type, file);
I confirm this issue happens between 0.6.5 and 0.6.6 release.
It might be related with ending issue. I print rinfo->typelib->data[rinfo->offset..rinfo->offset+7] in g_type_info_get_interface() of line 1002 when parsing function do_foo. ginfo.c --------- 997 g_type_info_get_interface (GITypeInfo *info) 998 { 999 GIRealInfo *rinfo = (GIRealInfo *)info; 1000 SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset]; 1001 1002 if (rinfo->type_is_embedded) On sparc [3572] = '\0' [3573] = '\002' [3574] = '\0' [3575] = '\0' [3576] = '\0' [3577] = '\0' [3578] = '\015' [3579] = '|' on x86 [3572] = '\002' [3573] = '\0' [3574] = '\0' [3575] = '\0' [3576] = '|' [3577] = '\015' [3578] = '\0' [3579] = '\0' It cause the variable type->offset is set to 131072U, which is incorrect. Any idea?
Scrolling through the commits from 0.6.5 to 0.6.6, f8693bda3775f6339f38a1 looks like a probable candidate, but I'm not seeing offhand the problem there.
(In reply to comment #3) > It might be related with ending issue. > > I print rinfo->typelib->data[rinfo->offset..rinfo->offset+7] in > g_type_info_get_interface() of line 1002 when parsing function do_foo. That's expected as far as I understand it (http://c-faq.com/struct/bitfield0.html). The interesting data point is whether "print blob->has_embedded_type" returns 1 or not.
*** Bug 606317 has been marked as a duplicate of this bug. ***
See 606317 for the powerpc equivalent, which would seem to increase the likelihood of this being endianness related somehow.
Created attachment 150998 [details] [review] [ginfo] Correctly cast to a CommonBlob when looking up embedded types When looking at an embedded type (e.g. a Callback after a Field), the offset we put in the info structure was to the CallbackBlob itself. However the code in g_type_info_get_interface assumed that the offset was to a SimpleTypeBlob, which it wasn't.
(In reply to comment #8) > Created an attachment (id=150998) [details] [review] > [ginfo] Correctly cast to a CommonBlob when looking up embedded types > > When looking at an embedded type (e.g. a Callback after a Field), the > offset we put in the info structure was to the CallbackBlob itself. > > However the code in g_type_info_get_interface assumed that the offset > was to a SimpleTypeBlob, which it wasn't. I confirmed this patch make build pass under sparc 64-bit and 32-bit.
Review of attachment 150998 [details] [review]: Looks great, thanks!
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]