]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: debug: improve backtrace() on aarch64 and possibly other systems
authorWilly Tarreau <w@1wt.eu>
Wed, 4 Mar 2020 06:44:06 +0000 (07:44 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 4 Mar 2020 11:04:07 +0000 (12:04 +0100)
commit13faf16e1ebfc93e49dc5a8948519fad600e1136
tree9f0c80559efc79e3f707ffcd0226cf66977a832c
parentcdd8074433d8ada867ba9b2bc11db098fd363035
MINOR: debug: improve backtrace() on aarch64 and possibly other systems

It happens that on aarch64 backtrace() only returns one entry (tested
with gcc 4.7.4, 5.5.0 and 7.4.1). Probably that it refrains from unwinding
the stack due to the risk of hitting a bad pointer. Here we can use
may_access() to know when it's safe, so we can actually unwind the stack
without taking risks. It happens that the faulting function (the one
just after the signal handler) is not listed here, very likely because
the signal handler uses a special stack and did not create a new frame.

So this patch creates a new my_backtrace() function in standard.h that
either calls backtrace() or does its own unrolling. The choice depends
on HA_HAVE_WORKING_BACKTRACE which is set in compat.h based on the build
target.
include/common/compat.h
include/common/standard.h
src/debug.c