All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Kanavin <alexander.kanavin@linux.intel.com>
To: Mark Hatle <mark.hatle@windriver.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 00/29] Add gobject introspection support to oe-core
Date: Tue, 17 Nov 2015 16:06:39 +0200	[thread overview]
Message-ID: <564B346F.2000407@linux.intel.com> (raw)
In-Reply-To: <564A0051.2080005@windriver.com>

On 11/16/2015 06:12 PM, Mark Hatle wrote:

> I think a small group of folks that are interested in this work and who
> understand facets of it should get together and try to identify the problem and
> come up with an alternative solution.
>
> I have a lot of experience with pulling out internal structure size, packing,
> order, etc from generated binaries via objdump, readelf and other mechanisms --
> but I have no experience using gobject itself.
>
> So if we could get together to identify how a gobject binary is generated -- how
> the introspection happens internally -- and the output of the introspection
> tool.  It's very likely that I or others can come up with an approach to do the
> introspection that doesn't require QEMU.  (It may require the gobject binary
> generation having additional information placed in it -- or an introspection to
> occur at the time of compilation and saved away in a cache...)  but the point
> is, we need to figure out a general solution to this that doesn't require QEMU
> for "most things".

I know GObject fairly well, since I've done a medium-size project with 
it (https://01.org/gsso/) and I think the above is totally unrealistic. 
Below is an explanation why.

The idea of GObject is to make object oriented programming semantics 
(classes, inheritance, methods, properties and signals) available to C 
programmers. This is achieved by implementing a dynamic type system 
called GType. It serves as a register of available types, to which new 
types can be added, and information about existing types can be queried.

This type register is constructed entirely at runtime. When a 
gobject-based library is loaded into memory, it adds the types that are 
defined in the library (for example, classes and interfaces) to the 
register using GType's API.

There are no tools that can extract the type information at source code 
level, or any preprocessor for the special type syntax (like there is 
for example a preprocessor called 'moc' in Qt). In the source code the 
types are defined entirely using C syntax: a really awkward combination 
of macros and function definitions that the macros refer to. The code 
goes straight to the C compiler which of course knows nothing about the 
types. So writing such a tool would basically amount to writing a 
special-purpose C interpreter: not feasible.

When some library's types need to be introspected, a small binary is 
compiled and linked with the library by the introspection build system, 
and then executed. This binary iterates over available types, and asks 
GType to describe them. These descriptions are then written in the XML 
format to the .gir file. We cannot fetch this information directly from 
internal structures of GType, because these structures don't exist on 
disk; they're only created at runtime through executing type definition 
functions. So again, you'd need some kind of bytecode interpreter to 
extract this information from executable objects, which would look a lot 
like QEMU :)

So the bottom line, to generate introspection info, you have to run the 
code of the library that you introspect, either with QEMU, or on target 
hardware, and I don't see a way to avoid this, short of complete rewrite 
of the entire glib ecosystem. If someone wants to have this feature, but 
doesn't have a working QEMU, they should get their act together and fix it.

Alex


  reply	other threads:[~2015-11-17 14:05 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09 14:50 [PATCH 00/29] Add gobject introspection support to oe-core Alexander Kanavin
2015-11-09 14:50 ` [PATCH 01/29] qemu.bbclass: add qemu_wrapper_cmdline() Alexander Kanavin
2015-11-09 14:50 ` [PATCH 02/29] qemu: don't blacklist mips64 when building runners of userspace binaries Alexander Kanavin
2015-11-09 14:50 ` [PATCH 03/29] gobject-introspection: add the recipe Alexander Kanavin
2015-11-09 14:50 ` [PATCH 04/29] gtk-doc-stub: remove introspection stubs Alexander Kanavin
2015-11-09 14:50 ` [PATCH 05/29] gobject-introspection.bbclass: add a class that enables gobject introspection Alexander Kanavin
2015-11-09 14:50 ` [PATCH 06/29] python3-native: use the previous version of python-config script Alexander Kanavin
2015-11-09 14:50 ` [PATCH 07/29] avahi-ui: remove the dependency on python-pygtk by disabling avahi-discover Alexander Kanavin
2015-11-09 14:50 ` [PATCH 08/29] python-pygtk: remove the recipe Alexander Kanavin
2015-11-10 13:13   ` Jussi Kukkonen
2015-11-10 13:25     ` Alexander Kanavin
2015-11-10 14:18       ` Jussi Kukkonen
2015-11-10 14:31         ` Paul Eggleton
2015-11-09 14:50 ` [PATCH 09/29] avahi: enable gobject-introspection Alexander Kanavin
2015-11-09 14:50 ` [PATCH 10/29] udev: enable gobject introspection Alexander Kanavin
2015-11-09 14:50 ` [PATCH 11/29] vala: enable the use of vapigen by packages with vala support Alexander Kanavin
2015-11-09 14:50 ` [PATCH 12/29] gcr: enable generation of vapi files using vapigen Alexander Kanavin
2015-11-09 14:50 ` [PATCH 13/29] gdk-pixbuf: enable gobject introspection Alexander Kanavin
2015-11-09 14:50 ` [PATCH 14/29] gconf: enable gobject-introspection Alexander Kanavin
2015-11-09 14:50 ` [PATCH 15/29] gtk+: enable gobject introspection Alexander Kanavin
2015-11-09 14:50 ` [PATCH 16/29] gtk+3: enable gobject-introspection Alexander Kanavin
2015-11-09 14:50 ` [PATCH 17/29] libsecret: enable generation of vapi files using vapigen Alexander Kanavin
2015-11-09 14:50 ` [PATCH 18/29] clutter: enable gobject introspection Alexander Kanavin
2015-11-09 14:50 ` [PATCH 19/29] vala.bbclass: remove pre-packaged vapigen.m4 from tarballs Alexander Kanavin
2015-11-09 14:50 ` [PATCH 20/29] libsoup-2.4: enable gobject introspection Alexander Kanavin
2015-11-09 14:50 ` [PATCH 21/29] at-spi2-core: " Alexander Kanavin
2015-11-09 14:50 ` [PATCH 22/29] gstreamer: " Alexander Kanavin
2015-11-09 14:50 ` [PATCH 23/29] gnomebase.bbclass: " Alexander Kanavin
2015-11-09 14:50 ` [PATCH 24/29] webkitgtk: " Alexander Kanavin
2015-11-09 14:50 ` [PATCH 25/29] gcr: disable gobject introspection on x86-64 for now Alexander Kanavin
2015-11-09 14:50 ` [PATCH 26/29] gcr: disable gobject-introspection on mips64 Alexander Kanavin
2015-11-09 14:50 ` [PATCH 27/29] libsecret: " Alexander Kanavin
2015-11-09 14:50 ` [PATCH 28/29] webkitgtk: disable gobject-introspection on powerpc Alexander Kanavin
2015-11-09 14:50 ` [PATCH 29/29] packagegroup-core-x11-sato: add python-pygobject and gtk+3 Alexander Kanavin
2015-11-10 14:31 ` [PATCH 00/29] Add gobject introspection support to oe-core Mark Hatle
2015-11-10 15:36   ` Alexander Kanavin
2015-11-10 16:39     ` Mark Hatle
2015-11-10 17:40       ` Burton, Ross
2015-11-10 18:25         ` Mark Hatle
2015-11-10 22:39           ` Richard Purdie
2015-11-10 23:10       ` Phil Blundell
2015-11-10 23:40         ` Burton, Ross
2015-11-11  0:15           ` Mark Hatle
2015-11-11  3:29           ` Khem Raj
2015-11-11 12:53           ` Alexander Kanavin
2015-11-11 13:14             ` Alexander Kanavin
2015-11-11 12:45       ` Alexander Kanavin
2015-11-11 13:34         ` Mark Hatle
2015-11-11 13:48           ` Alexander Kanavin
2015-11-11 13:50             ` Ricardo Ribalda Delgado
2015-11-11 13:55               ` Alexander Kanavin
2015-11-11 13:57                 ` Ricardo Ribalda Delgado
2015-11-11 13:59                   ` Alexander Kanavin
2015-11-11 13:58           ` Alexander Kanavin
2015-11-13 13:53             ` Mark Hatle
2015-11-13 16:12               ` alexander.kanavin
2015-11-13 16:31                 ` Mark Hatle
2015-11-16  9:52                   ` Alexander Kanavin
2015-11-16 16:12                     ` Mark Hatle
2015-11-17 14:06                       ` Alexander Kanavin [this message]
2015-11-17 15:02                         ` Mark Hatle
2015-11-18 16:10                           ` Alexander Kanavin
2016-01-19 16:03                             ` Mark Hatle
2016-03-10 16:56 ` Martin Jansa
2016-03-10 16:56   ` Burton, Ross
2016-03-10 17:05     ` Martin Jansa
2015-11-26 14:26 Alexander Kanavin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=564B346F.2000407@linux.intel.com \
    --to=alexander.kanavin@linux.intel.com \
    --cc=mark.hatle@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.