-
Notifications
You must be signed in to change notification settings - Fork 2
Signal handlers
The LeakSanitizer adds a few signal handlers to your program.
Signal handlers installed by your program take precedence over the LeakSanitizer's handlers.
Upon receipt of a deadly signal, the program is terminated and the callstack of the receiving point is printed. The faulty address is also printed if available.
Tip
Example:
Segmentation fault (SIGSEGV) on address 0x0!
Address not existent (MAPERR).
In: (fdf) get_next_line (bonus/get_next_line_bonus.c:0:37)
at: (fdf) generate_read_file (model/generate.c:79:9)
at: (fdf) generate_parse_arguments (model/generate.c:21:17)
at: (fdf) main (main.c:24:10)
at: (/usr/lib/dyld) start + 1903
SIGSEGV
SIGABRT
SIGTERM
SIGALRM
SIGPIPE
SIGFPE
SIGILL
SIGQUIT
SIGHUP
SIGBUS
SIGXFSZ
SIGXCPU
SIGSYS
SIGVTALRM
SIGPROF
SIGTRAP
The SIGUSR1
causes the current memory statistics to be printed. It shows you the amount of the currently
allocated objects and the amount of the currently allocated bytes as well as their peek values.
Tip
Example:
Stats of the memory usage so far:
297 objects in the heap, peek 661, 485 deleted objects.
7.72 MiB currently used, peek 7.72 MiB.
[====================================================================================================] of 7.72 MiB peek
297 objects currently in the heap, peek 661 objects.
[=============================================.......................................................] of 661 objects peek
The SIGUSR2
causes the callstack of the signal handler to be printed. One can easily see what the application is currently doing
using that callstack.
Tip
Example:
The current callstack:
In: (fdf) renderer_draw_line (renderer/renderer_draw.c:46:6)
at: (fdf) renderer_draw_core (renderer/renderer_draw.c:97:3)
at: (fdf) renderer_draw (renderer/renderer_draw.c:24:4)
at: (fdf) delegate_render_frame (renderer/renderer.c:14:2)
at: (libmlx.dylib) do_loop_hook2 (mlx_init_loop.m:16:3)
at: (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation) __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
at: (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation) __CFRunLoopDoTimer + 807
at: (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation) __CFRunLoopDoTimers + 285
at: (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation) __CFRunLoopRun + 2206
at: (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation) CFRunLoopRunSpecific + 560
at: (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox) RunCurrentEventLoopInMode + 292
at: (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox) ReceiveNextEventCommon + 657
at: (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox) _BlockUntilNextEventMatchingListInModeWithFilter + 64
at: (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit) _DPSNextEvent + 858
at: (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit) -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1214
at: (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit) -[NSApplication run] + 586
at: (libmlx.dylib) mlx_loop (mlx_init_loop.m:104:3)
at: (fdf) onApplicationFinishedLaunching (delegate/app_delegate.c:36:2)
at: (fdf) main (main.c:32:10)
at: (/usr/lib/dyld) start + 1903
Copyright (C) 2022 - 2024 mhahnFr.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".