]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ctf: update the shared CTF file right after initialization
authorNick Alcock <nick.alcock@oracle.com>
Thu, 22 Nov 2012 09:34:41 +0000 (09:34 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Mon, 29 Jun 2015 21:41:39 +0000 (22:41 +0100)
If we don't do this, the void and function pointer types are not available for
lookup until something else gets added to the shared type repository and
triggers an update, so insertions of types depending on such types into the
shared type repository will fail until that happens.  Since function pointers
are seen a lot in structures in the Linux kernel, such a failure for a member of
a structure means that all later members of the structure are skipped, and since
a major cause of insertion into the shared type repository is recursive
insertion from structure members in headers, this has the effect of losing track
of quite a lot of types first seen in translation units mentioned early on the
dwarf2ctf command line.  Fortunately, since they haven't been successfully
inserted, insertion is retried later and succeeds.  So this bugfix fixes a
latent bug only.

We would have seen this long ago as a bunch of error output were it not for a
bug in libdtrace-ctf leading to bad ID errors in CTF lookups that recurse to
parents not being emitted anywhere we were looking for them.  Fixing that bug
requires us to fix this one, lest we get bombed with error messages
henceforward.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
scripts/dwarf2ctf/dwarf2ctf.c

index 8bf7cf62e8b9aaf944934b5c31fbef0648d62141..8726b652ef3a93f01fcae1cb3dfe922361dfd7c7 100644 (file)
@@ -976,6 +976,12 @@ static ctf_file_t *init_ctf_table(const char *module_name)
                                             &func_info, NULL);
                ctf_funcptr_type = ctf_add_pointer(ctf_file, CTF_ADD_ROOT,
                                                   func_type);
+
+               if (ctf_update(ctf_file) < 0) {
+                       fprintf(stderr, "Cannot initialize shared CTF "
+                               "file: %s\n", ctf_errmsg(ctf_errno(ctf_file)));
+                       exit(1);
+               }
        } else {
                /*
                 * Local types module with deduplication enabled: point the