]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ctf: add module parameter to simple_dwfl_new() and adjust both callers
authorNick Alcock <nick.alcock@oracle.com>
Tue, 7 Mar 2017 20:22:52 +0000 (20:22 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 26 May 2017 00:06:06 +0000 (01:06 +0100)
An upcoming speedup to dwarf2ctf needs this.

Orabug: 25815306
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: tomas.jedlicka@oracle.com
scripts/dwarf2ctf/dwarf2ctf.c
scripts/eu_simple.c
scripts/eu_simple.h
scripts/kallsyms.c

index 0d0f955a7d50e92fa9989e29215b3538489811f5..82ce1d7fad4ae0167def2f44610772989eb6e12f 100644 (file)
@@ -1314,7 +1314,7 @@ static void init_tu_to_modules(void)
                 * construct mappings from each TU to "vmlinux".
                 */
 
-               Dwfl *dwfl = simple_dwfl_new(builtin_objects[i]);
+               Dwfl *dwfl = simple_dwfl_new(builtin_objects[i], NULL);
                Dwarf_Die *tu = NULL;
                Dwarf_Addr junk;
 
@@ -1342,7 +1342,7 @@ static void init_tu_to_modules(void)
                 * mappings from each TU to the module name.
                 */
 
-               Dwfl *dwfl = simple_dwfl_new(builtin_modules[i]);
+               Dwfl *dwfl = simple_dwfl_new(builtin_modules[i], NULL);
                Dwarf_Die *tu = NULL;
                Dwarf_Addr junk;
 
@@ -1596,7 +1596,7 @@ static void process_file(const char *file_name,
        char *fn_module_name = fn_to_module(file_name);
        const char *module_name = fn_module_name;
 
-       Dwfl *dwfl = simple_dwfl_new(file_name);
+       Dwfl *dwfl = simple_dwfl_new(file_name, NULL);
        GHashTable *seen_before = g_hash_table_new_full(g_str_hash, g_str_equal,
                                                        free, free);
        Dwarf_Die *tu_die = NULL;
index 9c7f8ac064f7bf9745323663f2abebb757098f9c..5786570942736b6ac189d30824675bfb5bfcd507 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Convenience wrappers for functions in elfutils.
  *
- * (C) 2014 Oracle, Inc.  All rights reserved.
+ * (C) 2014, 2017 Oracle, Inc.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -54,22 +54,26 @@ static int no_debuginfo(Dwfl_Module *mod __unused__,
 /*
  * Wrap up dwfl_new() complexities.
  */
-Dwfl *simple_dwfl_new(const char *file_name)
+Dwfl *simple_dwfl_new(const char *file_name, Dwfl_Module **module)
 {
        const char *err;
        static Dwfl_Callbacks cb = { .find_debuginfo = no_debuginfo,
                                     .section_address = dwfl_offline_section_address };
        Dwfl *dwfl = dwfl_begin(&cb);
+       Dwfl_Module *mod;
 
        if (dwfl == NULL) {
                err = "initialize libdwfl";
                goto fail;
        }
 
-       if (private_dwfl_report_elf(dwfl, "", file_name, -1, 0) == NULL) {
+       mod = private_dwfl_report_elf(dwfl, "", file_name, -1, 0);
+       if (mod == NULL) {
                err = "open object file with libdwfl";
                goto fail;
        }
+       if (module)
+               *module = mod;
 
        if (dwfl_report_end(dwfl, NULL, NULL) != 0) {
                err = "finish opening object file with libdwfl";
index 90491b5a79d29ac5f9f6765d5ae85243b27b63a3..f7ddaafbeabd9bb46489a180d94359cb196cd1d8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Simplifying wrappers for functions in elfutils.
  *
- * (C) 2014 Oracle, Inc.  All rights reserved.
+ * (C) 2014, 2017 Oracle, Inc.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
 /*
  * Wrap up dwfl_new() complexities.
  */
-Dwfl *simple_dwfl_new(const char *file_name);
+Dwfl *simple_dwfl_new(const char *file_name, Dwfl_Module **module);
 
 /*
  * The converse of simple_dwfl_new().
index c4ef754c4bb4abee9e5fccfd2d4b36e8289fbaf4..907959f83ae757b0831f11700e5d63f0bf1488f2 100644 (file)
@@ -761,7 +761,7 @@ static void read_module_symbols(unsigned int module_name,
                                const char *module_path,
                                GHashTable *module_symbol_seen)
 {
-       Dwfl *dwfl = simple_dwfl_new(module_path);
+       Dwfl *dwfl = simple_dwfl_new(module_path, NULL);
        Dwarf_Die *tu = NULL;
        Dwarf_Addr junk;
        unsigned int *module_idx = NULL;