← 返回命令列表

Linux command

catchsegv 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Run program with segfault catching

catchsegv [./program]

Run with arguments

catchsegv [./program] [arg1] [arg2]

说明

catchsegv is a debugging wrapper that intercepts segmentation faults in a program and prints a symbolic backtrace to help diagnose the crash. It works by using LD_PRELOAD to inject libSegFault.so, which installs a signal handler for SIGSEGV and other fatal signals. When the wrapped program crashes, catchsegv displays a stack trace with function names, source file locations (if debug symbols are available), and memory map information. This provides a lightweight alternative to running programs under a full debugger when you only need crash diagnostics. The tool was part of the glibc debug utilities but has been removed from glibc 2.35 and later. Modern alternatives include AddressSanitizer and core dump analysis with GDB.

FAQ

What is the catchsegv command used for?

catchsegv is a debugging wrapper that intercepts segmentation faults in a program and prints a symbolic backtrace to help diagnose the crash. It works by using LD_PRELOAD to inject libSegFault.so, which installs a signal handler for SIGSEGV and other fatal signals. When the wrapped program crashes, catchsegv displays a stack trace with function names, source file locations (if debug symbols are available), and memory map information. This provides a lightweight alternative to running programs under a full debugger when you only need crash diagnostics. The tool was part of the glibc debug utilities but has been removed from glibc 2.35 and later. Modern alternatives include AddressSanitizer and core dump analysis with GDB.

How do I run a basic catchsegv example?

Run `catchsegv [./program]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

Where can I find more catchsegv examples?

This page includes 2 examples for catchsegv, plus related commands for nearby Linux tasks.