Giter Site home page Giter Site logo

kittyfault's Introduction

kittyfault

Replace your SIGSEGV handler with a cute little kitty cat. Unofficial fork from dogfault.

Tired of seeing the vanilla Segmentation fault (core dumped) message? Simply drop kittyfault.h into your program's folder and include it. You will be met with an adorable little feline delivering the otherwise morbid news.

Usage

Load kittyfault.h as an installed library and compile with the -I. flag or -I<kittyfault-directory-path>.

To enable stack trace detection (*Nix only), programs compiled against a specific ANSI C standard must specify the POSIX standard using -D_POSIX_C_SOURCE=199309L (199309 or greater) or by compiling with --std=<gnu std version> instead of --std=<std version>.

Furthermore, to enable function name detection *Nix environments must compile with the -rdynamic flag.

Otherwise, this header is compatible with both WIN32 (MinGW, etc) and *Nix environments.

Compatible with both gcc and clang.

Example

/* example.c */
#include <kittyfault.h>

void foo();
void bar();

int main()
{
    foo();

    puts("I shouldn't be printed\n");
    return EXIT_SUCCESS;
}

void foo()
{
    bar();
    puts("I shouldn't be printed either\n");
}

void bar()
{
    const char *s = NULL;
    printf("%c\n", s[0]); // standard segfault
}

POSIX Output

$ gcc example.c -I. -rdynamic
$ ./a.out
           A___A
     ____ / o o \ *meow*
___/~____   ='= / Segmentation fault at address (nil)
  (______)__m_m_) Stack trace is below. *purr*
----------------------------------------------------------
./a.out() [0x400b7c]
/lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x7fdc2c2654b0]
./a.out(bar+0x14) [0x400d09]
./a.out(foo+0xe) [0x400ce8]
./a.out(main+0xe) [0x400cc9]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7fdc2c250830]
./a.out(_start+0x29) [0x400a49]

WIN32 Output

> gcc -g example.c -I.
> a.exe
           A___A
     ____ / o o \ *meow*
___/~____   ='= / Segmentation fault caught!
  (______)__m_m_) Run with a debugger to find the cause. *purr*
---------------------------------------------------------------

License

MIT

kittyfault's People

Contributors

enioluwas avatar

Stargazers

Cristian Camilo Ruiz avatar Pebaz avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.