Simple 20 Minute Code Review

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    Simple 20 Minute Code Review - Presentation Transcript

    1. 06/04/09 - joe turner <joe@agavemountain.com> 20 Minute Code Review Agave Mountain Agave Mountain, Inc. Joe Turner
    2. 06/04/09 - joe turner <joe@agavemountain.com> 1. Signal Handler / Back Trace
    3. 06/04/09 - joe turner <joe@agavemountain.com> Signal handler registered and is called : CTRL-C stops application Bus fault Floating point exception segment fault etc… Calls back_trace() and/or prints out signal # Signal Handler static void sig_handler(int signum) { switch (signum) { case SIGHUP: case SIGINT: case SIGILL: case SIGBUS: case SIGFPE: case SIGSEGV: case SIGTERM: case SIGSTKFLT: back_trace(); default: printf(&quot;Caught signal %d &quot;, signum); }; exit(0); }
    4. 06/04/09 - joe turner <joe@agavemountain.com> glibc now has a built in functions for generating a backtrace. **See speaker’s notes for the glibc documentation. back_trace() static void back_trace(void) { int c, i; void *addresses[10]; char **strings; c = backtrace(addresses, 10); strings = backtrace_symbols(addresses,c); printf(&quot;backtrace returned: %d &quot;, c); for(i = 0; i < c; i++) { printf(&quot;%d: %X &quot;, i, (int)addresses[i]); printf(&quot;%s &quot;, strings[i]); } free (strings); }
    5. The End. and happily ever after. 06/04/09 - joe turner <joe@agavemountain.com>

    + Joe TurnerJoe Turner, 2 years ago

    custom

    791 views, 1 favs, 0 embeds more stats

    A very simple code review example.

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 791
      • 791 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories