summaryrefslogtreecommitdiff
path: root/include/my_global.h
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2018-01-16 22:57:52 +0200
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2018-01-19 16:11:34 +0200
commit26e5f9dda13efad33e867742ea4e42e479b51b2b (patch)
tree022d92626b90a9253c37770f1d2dfc5d7a02a4de /include/my_global.h
parenta7a4519a40c58947796c6d9b2e4e58acc18aeef8 (diff)
downloadmariadb-git-26e5f9dda13efad33e867742ea4e42e479b51b2b.tar.gz
MDEV-14229: Stack trace is not resolved for shared objects
Resolving a stacktrace including functions in dynamic libraries requires us to look inside the libraries for the symbols. Addr2line needs to be started with the correct binary for each address on the stack. To do this, figure out which library it is using dladdr, then if the addr2line binary was started with a different binary, fork it again with the correct one. We only have one addr2line process running at any point during the stacktrace resolving step. The maximum number of forks for addr2line should generally be around 6. One for server stacktrace code, one for plugin code, one when going back into server code, one for pthread library, one for libc, one for the _start function in the server. More can come up if plugin calls server function which goes back to a plugin, etc.
Diffstat (limited to 'include/my_global.h')
-rw-r--r--include/my_global.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/my_global.h b/include/my_global.h
index cf140cf54ce..767ac3e459e 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1373,11 +1373,15 @@ static inline char *dlerror(void)
#ifndef HAVE_DLERROR
#define dlerror() ""
#endif
+#ifndef HAVE_DLADDR
+#define dladdr(A, B) 0
+#endif
#else
#define dlerror() "No support for dynamic loading (static build?)"
#define dlopen(A,B) 0
#define dlsym(A,B) 0
#define dlclose(A) 0
+#define dladdr(A, B) 0
#endif
/*