MINOR: tools: add resolve_sym_name() to resolve function pointers
authorWilly Tarreau <w@1wt.eu>
Tue, 3 Mar 2020 16:09:08 +0000 (17:09 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 3 Mar 2020 17:18:40 +0000 (18:18 +0100)
commiteb8b1ca3eb4c8d4688e1a4a1d9c1b91f68324e09
tree1f1eb651d53a55603cae731fd350b534f6ae87df
parent762fb3ec8e05ca7a61b28e8a876c194c9db591ef
MINOR: tools: add resolve_sym_name() to resolve function pointers

We use various hacks at a few places to try to identify known function
pointers in debugging outputs (show threads & show fd). Let's centralize
this into a new function dedicated to this. It already knows about the
functions matched by "show threads" and "show fd", and when built with
USE_DL, it can rely on dladdr1() to resolve other functions. There are
some limitations, as static functions are not resolved, linking with
-rdynamic is mandatory, and even then some functions will not necessarily
appear. It's possible to do a better job by rebuilding the whole symbol
table from the ELF headers in memory but it's less portable and the gains
are still limited, so this solution remains a reasonable tradeoff.
include/common/standard.h
src/standard.c