0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd::mods::ldso: Improve exceptions for undefined symbols.

This commit is contained in:
Jason Volk 2019-09-19 11:00:12 -07:00
parent 42f02d2aa7
commit 6b69fe2d24

View file

@ -267,21 +267,45 @@ _dl_signal_exception(int errcode,
struct dl_exception *e, struct dl_exception *e,
const char *occasion) const char *occasion)
{ {
const ircd::unwind free using namespace ircd;
const unwind free
{ {
std::bind(_dl_exception_free, e) std::bind(_dl_exception_free, e)
}; };
ircd::log::derror assert(e);
log::derror
{ {
ircd::mods::log, "dynamic linker (%d) %s in `%s' :%s", mods::log, "dynamic linker (%d) %s in `%s' :%s",
errcode, errcode,
occasion, occasion,
e->objname, e->objname,
e->errstring e->errstring
}; };
throw ircd::mods::error static const auto &undefined_symbol_prefix
{
"undefined symbol: "
};
if(startswith(e->errstring, undefined_symbol_prefix))
{
const auto &mangled
{
lstrip(e->errstring, undefined_symbol_prefix)
};
throw mods::undefined_symbol
{
"%s %s (%s)",
e->objname,
demangle(mangled),
mangled,
};
}
throw mods::error
{ {
"%s in %s (%d) %s", "%s in %s (%d) %s",
occasion, occasion,