mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 19:34:56 +00:00
ldso: dump link map of loaded shared objects
Also log the link-map information of shared objects loaded after startup if 'ld_verbose' is configured.
This commit is contained in:
parent
4ef2b0ed2e
commit
7a64e0bb80
@ -12,8 +12,23 @@
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
#include <linker.h>
|
||||
|
||||
/**
|
||||
* C-break function for GDB
|
||||
*/
|
||||
extern "C" void brk(Linker::Debug *, Linker::Link_map *) { }
|
||||
|
||||
|
||||
void Linker::dump_link_map(Object *o)
|
||||
{
|
||||
for (; o; o = o->next_obj()) {
|
||||
|
||||
if (o->is_binary())
|
||||
continue;
|
||||
|
||||
Genode::printf(" " EFMT " .. " EFMT ": %s\n",
|
||||
o->link_map()->addr, o->link_map()->addr + o->size() - 1,
|
||||
o->name());
|
||||
}
|
||||
}
|
||||
|
@ -22,8 +22,12 @@ constexpr bool verbose_link_map = false;
|
||||
namespace Linker {
|
||||
struct Debug;
|
||||
struct Link_map;
|
||||
|
||||
struct Object;
|
||||
void dump_link_map(Object *o);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* LIBC debug support
|
||||
*/
|
||||
|
@ -538,21 +538,6 @@ extern "C" void init_rtld()
|
||||
}
|
||||
|
||||
|
||||
static void dump_loaded()
|
||||
{
|
||||
Object *o = Elf_object::obj_list()->head();
|
||||
for(; o; o = o->next_obj()) {
|
||||
|
||||
if (o->is_binary())
|
||||
continue;
|
||||
|
||||
Genode::printf(" " EFMT " .. " EFMT ": %s\n",
|
||||
o->link_map()->addr, o->link_map()->addr + o->size() - 1,
|
||||
o->name());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Genode::size_t Component::stack_size() { return 16*1024*sizeof(long); }
|
||||
char const * Component::name() { return "ep"; }
|
||||
|
||||
@ -585,7 +570,7 @@ void Component::construct(Genode::Environment &env)
|
||||
Genode::Thread_base::stack_area_virtual_base(),
|
||||
Genode::Thread_base::stack_area_virtual_base() +
|
||||
Genode::Thread_base::stack_area_virtual_size() - 1);
|
||||
dump_loaded();
|
||||
dump_link_map(Elf_object::obj_list()->head());
|
||||
}
|
||||
} catch (...) { }
|
||||
|
||||
|
@ -11,6 +11,10 @@
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <os/config.h>
|
||||
|
||||
/* local includes */
|
||||
#include <linker.h>
|
||||
|
||||
|
||||
@ -63,6 +67,13 @@ Genode::Shared_object::Shared_object(char const *file, unsigned flags)
|
||||
bind_now = (flags & Shared_object::NOW) ? true : false;
|
||||
|
||||
_handle = (Root_object *)new (Genode::env()->heap()) Root_object(file ? file : binary_name(), flags);
|
||||
|
||||
/* print loaded object information */
|
||||
try {
|
||||
if (Genode::config()->xml_node().attribute("ld_verbose").has_value("yes"))
|
||||
Linker::dump_link_map(to_root(_handle)->dep.head()->obj);
|
||||
} catch (...) { }
|
||||
|
||||
} catch (...) { throw Invalid_file(); }
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user