[PATCH] linkers: Speed up reading large executables for all cases except inlining
chrisj at rtems.org
chrisj at rtems.org
Wed May 18 08:14:53 UTC 2022
From: Chris Johns <chrisj at rtems.org>
- Only load the function DWARF data if checking inlines
---
linkers/rtems-exeinfo.cpp | 45 ++++++++++++++++++++++----------------
rtemstoolkit/rld-dwarf.cpp | 2 +-
2 files changed, 27 insertions(+), 20 deletions(-)
diff --git a/linkers/rtems-exeinfo.cpp b/linkers/rtems-exeinfo.cpp
index e54f9b2..0900812 100644
--- a/linkers/rtems-exeinfo.cpp
+++ b/linkers/rtems-exeinfo.cpp
@@ -144,7 +144,7 @@ namespace rld
/**
* Load the executable file.
*/
- image (const std::string exe_name);
+ image (const std::string exe_name, bool load_functions);
/**
* Clean up.
@@ -283,7 +283,7 @@ namespace rld
}
}
- image::image (const std::string exe_name)
+ image::image (const std::string exe_name, bool load_functions)
: exe (exe_name),
init (0),
fini (0)
@@ -321,7 +321,11 @@ namespace rld
debug.load_debug ();
debug.load_types ();
debug.load_variables ();
- debug.load_functions ();
+ if (load_functions)
+ {
+ std::cout << "May take a while ..." << std::endl;
+ debug.load_functions ();
+ }
symbols.globals (addresses);
symbols.weaks (addresses);
symbols.locals (addresses);
@@ -610,23 +614,26 @@ namespace rld
uint32_t address;
symbols::symbol* sym;
sec.data >> address;
- sym = addresses[address];
- std::cout << " "
- << std::hex << std::setfill ('0')
- << "0x" << std::setw (8) << address
- << std::dec << std::setfill ('0');
- if (sym)
- {
- std::string label = sym->name ();
- if (rld::symbols::is_cplusplus (label))
- rld::symbols::demangle_name (label, label);
- std::cout << " " << label;
- }
- else
+ if (address != 0)
{
- std::cout << " no symbol";
+ sym = addresses[address];
+ std::cout << " "
+ << std::hex << std::setfill ('0')
+ << "0x" << std::setw (8) << address
+ << std::dec << std::setfill ('0');
+ if (sym)
+ {
+ std::string label = sym->name ();
+ if (rld::symbols::is_cplusplus (label))
+ rld::symbols::demangle_name (label, label);
+ std::cout << " " << label;
+ }
+ else
+ {
+ std::cout << " no symbol (maybe static to a module)";
+ }
+ std::cout << std::endl;
}
- std::cout << std::endl;
}
}
@@ -1114,7 +1121,7 @@ main (int argc, char* argv[])
/*
* Open the executable and read the symbols.
*/
- rld::exeinfo::image exe (exe_name);
+ rld::exeinfo::image exe (exe_name, inlined | dwarf_data);
std::cout << "exe: " << exe.exe.name ().full () << std::endl
<< std::endl;
diff --git a/rtemstoolkit/rld-dwarf.cpp b/rtemstoolkit/rld-dwarf.cpp
index e41be8c..c11a13e 100644
--- a/rtemstoolkit/rld-dwarf.cpp
+++ b/rtemstoolkit/rld-dwarf.cpp
@@ -1812,7 +1812,7 @@ namespace rld
debug_info_entry next (die.get_debug ());
if (die.get_child (next))
- load_functions (next);
+ load_variables (next);
if (!die.get_sibling (next))
break;
--
2.19.1
More information about the devel
mailing list