Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add helper tool to cause a segfault for testing purposes.
`segfault-build` creates `segfault-run`. Running `segfault-run` results in `segfault-run` terminating with a segfault. This is useful to test if coredump files are being generated when an application crashes. sudo segfault-build > /usr/sbin/segfault-build: SUCCESS. You can now run: > segfault-run segfault-run > Segmentation fault (core dumped) echo $? > 139
- Loading branch information
Patrick Schleizer
committed
Dec 25, 2020
1 parent
e44067c
commit f7b7457
Showing
6 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.\" generated with Ronn-NG/v0.8.0 | ||
.\" http://github.com/apjanke/ronn-ng/tree/0.8.0 | ||
.TH "SEGFAULT\-BUILD" "8" "January 2020" "debug-misc" "debug-misc Manual" | ||
.SH "NAME" | ||
\fBsegfault\-build\fR \- create segfault\-run program | ||
.P | ||
.SH "SYNOPSIS" | ||
segfault\-build | ||
.SH "DESCRIPTION" | ||
Creates \fBsegfault\-run\fR\. | ||
.SH "RETURN VALUES" | ||
0 success\. | ||
.P | ||
Non\-zero otherwise\. | ||
.SH "AUTHOR" | ||
This man page has been written by Patrick Schleizer (adrelanos@riseup\.net)\. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
segfault-build(8) -- create segfault-run program | ||
============================================= | ||
|
||
<span class="comment"> | ||
# Copyright (C) 2012 - 2020 ENCRYPTED SUPPORT LP <adrelanos@riseup.net> | ||
# See the file COPYING for copying conditions. | ||
</span> | ||
|
||
## SYNOPSIS | ||
|
||
segfault-build | ||
|
||
## DESCRIPTION | ||
|
||
Creates `segfault-run`. | ||
|
||
## RETURN VALUES | ||
|
||
0 success. | ||
|
||
Non-zero otherwise. | ||
|
||
## AUTHOR | ||
|
||
This man page has been written by Patrick Schleizer (adrelanos@riseup.net). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
## Copyright (C) 2020 - 2020 ENCRYPTED SUPPORT LP <adrelanos@riseup.net> | ||
## See the file COPYING for copying conditions. | ||
|
||
if [ ! "$(id -u)" = "0" ]; then | ||
echo "$0: ERROR: Needs to run as root. Run: | ||
sudo $0" >&2 | ||
exit 1 | ||
fi | ||
|
||
if ! type -P gcc >/dev/null ; then | ||
echo "$0: ERROR: gcc not installed. To install: | ||
sudo apt update | ||
sudo apt --no-install-recommends install gcc" >&2 | ||
exit 1 | ||
fi | ||
|
||
gcc /usr/share/debug-misc/segfault.c -g -o /usr/bin/segfault-run | ||
|
||
echo "$0: SUCCESS. You can now run:" | ||
echo "segfault-run" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
int main(void) | ||
{ | ||
char *s = "hello world"; | ||
*s = 'H'; | ||
} |