From: Nick Alcock Date: Tue, 7 Mar 2017 20:22:52 +0000 (+0000) Subject: ctf: add module parameter to simple_dwfl_new() and adjust both callers X-Git-Tag: v4.1.12-102.0.20170529_2200~57^2~7 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cc64dc07c65cd1cb2aff84543b2432043e1cdffb;p=users%2Fjedix%2Flinux-maple.git ctf: add module parameter to simple_dwfl_new() and adjust both callers An upcoming speedup to dwarf2ctf needs this. Orabug: 25815306 Signed-off-by: Nick Alcock Reviewed-by: tomas.jedlicka@oracle.com --- diff --git a/scripts/dwarf2ctf/dwarf2ctf.c b/scripts/dwarf2ctf/dwarf2ctf.c index 0d0f955a7d50..82ce1d7fad4a 100644 --- a/scripts/dwarf2ctf/dwarf2ctf.c +++ b/scripts/dwarf2ctf/dwarf2ctf.c @@ -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; diff --git a/scripts/eu_simple.c b/scripts/eu_simple.c index 9c7f8ac064f7..578657094273 100644 --- a/scripts/eu_simple.c +++ b/scripts/eu_simple.c @@ -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"; diff --git a/scripts/eu_simple.h b/scripts/eu_simple.h index 90491b5a79d2..f7ddaafbeabd 100644 --- a/scripts/eu_simple.h +++ b/scripts/eu_simple.h @@ -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(). diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index c4ef754c4bb4..907959f83ae7 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -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;