Skip to content

Commit 9ed16d4

Browse files
Tor Didriksendahlerlend
authored andcommitted
Bug#34904177 Add lines and numbers to callstack
produced by my_print_stacktrace Additional patch, enabling stacktrace for freebsd and all Linux platforms. Change-Id: Ibc2c83ea7172a2b3af3bd6757ac09ec057c7d1ca
1 parent 58ca915 commit 9ed16d4

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

cmake/libbacktrace.cmake

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@
2020
# along with this program; if not, write to the Free Software
2121
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2222

23-
SET (VERIFIED_PLATFORMS
24-
LINUX_ALPINE
25-
LINUX_FEDORA
26-
LINUX_RHEL7
27-
LINUX_RHEL8
28-
LINUX_RHEL9
23+
SET(VERIFIED_PLATFORMS
24+
FREEBSD
25+
LINUX
2926
SOLARIS
30-
)
27+
)
28+
3129
UNSET(VERIFIED_PLATFORM)
3230
FOREACH(platform ${VERIFIED_PLATFORMS})
3331
IF(${platform})
@@ -50,8 +48,9 @@ IF(NOT WITH_EXT_BACKTRACE)
5048
RETURN()
5149
ENDIF()
5250

53-
IF(NOT LINUX AND NOT SOLARIS)
54-
MESSAGE(FATAL_ERROR "libbacktrace can only be used on linux/solaris builds")
51+
IF(NOT LINUX AND NOT SOLARIS AND NOT FREEBSD)
52+
MESSAGE(FATAL_ERROR
53+
"libbacktrace can only be used on linux/solaris/freebsd builds")
5554
ENDIF()
5655

5756
IF(VERIFIED_PLATFORM)

extra/libbacktrace/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ SET(BACKTRACE_DEFINITIONS
6363
HAVE_SYS_TYPES_H=1
6464
HAVE_UNISTD_H=1
6565
)
66+
IF(FREEBSD)
67+
LIST(APPEND BACKTRACE_DEFINITIONS
68+
HAVE_KERN_PROC=1
69+
HAVE_KERN_PROC_ARGS=1
70+
)
71+
ENDIF()
6672

6773
# Ensure no tail-call optimization to stabilize the number of reported frames
6874
ADD_COMPILE_FLAGS(src/stacktrace.cc COMPILE_FLAGS -fno-optimize-sibling-calls)

mysys/stacktrace.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include <sys/types.h>
4141
#include <cstdint>
4242
#include <string_view>
43-
#if defined(__linux__) || defined(__sun)
43+
#if defined(__linux__) || defined(__sun) || defined(__FreeBSD__)
4444
#include <sys/syscall.h>
4545
#ifdef HAVE_EXT_BACKTRACE
4646
#include <backtrace/stacktrace.hpp>

0 commit comments

Comments
 (0)