Skip to content

Conversation

firewave
Copy link
Collaborator

No description provided.

@firewave
Copy link
Collaborator Author

Prerequisite for #7296 which will remove the only include from config.h leading to features.h to be not included anymore and __GLIB__ never be defined.

@firewave
Copy link
Collaborator Author

In case this might lead to some platform which no longer includes the stacktrace you can still manually pass USE_UNIX_BACKTRACE_SUPPORT to the build. Unlikely though since I doubt anybody is really leveraging this (there's https://trac.cppcheck.net/ticket/11255 about using it in daca instead of gdb).

@firewave firewave marked this pull request as draft August 28, 2025 10:11
@firewave firewave changed the title config.h: removed check of non-builtin define for USE_UNIX_BACKTRACE_SUPPORT config.h: removed check of non-builtin define for USE_UNIX_BACKTRACE_SUPPORT / hardened print_stacktrace() Aug 28, 2025
@firewave
Copy link
Collaborator Author

macos-13 does not return anything from backtrace().

The macos-15 output looks like this:

0   test-signalhandler                  0x0000000100dbf42c _Z16print_stacktraceP7__sFILEibib + 124
1   test-signalhandler                  0x0000000100dbbf84 _ZL21CppcheckSignalHandleriP9__siginfoPv + 1628
2   libsystem_platform.dylib            0x0000000190d7c624 _sigtramp + 56
3   libsystem_pthread.dylib             0x0000000190d4288c pthread_kill + 296
4   libsystem_c.dylib                   0x0000000190c4bc60 abort + 124
5   test-signalhandler                  0x0000000100dbb404 _Z7my_segvv + 0

@firewave
Copy link
Collaborator Author

firewave commented Aug 28, 2025

For comparison the ubuntu-22.04 (sans the top frame) looks like this:

./test-signalhandler(_Z16print_stacktraceP8_IO_FILEibib+0xa1) [0x55cb65e41464]
./test-signalhandler(+0xf9d9) [0x55cb65e3c9d9]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f2c97c42520]
/lib/x86_64-linux-gnu/libc.so.6(pthread_kill+0x12c) [0x7f2c97c969fc]
/lib/x86_64-linux-gnu/libc.so.6(raise+0x16) [0x7f2c97c42476]
/lib/x86_64-linux-gnu/libc.so.6(abort+0xd3) [0x7f2c97c287f3]
./test-signalhandler(_Z7my_segvv+0) [0x55cb65e3b906]
./test-signalhandler(main+0x7e) [0x55cb65e3b9df]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f2c97c29d90]

Copy link

@firewave
Copy link
Collaborator Author

I filed https://trac.cppcheck.net/ticket/14096 about supporting it on macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant