Link Search Menu Expand Document

Dev-Misc Cheat Sheet


  • JSON Linting

    python -mjson.tool input.json
  • iotrack: LD_PRELOAD based I/O tracking
  • Linux Debugging Techniques: DeveloperWorks article on many debugging tools: MEMWATCH, YAMD, electric fence, gdb, kgdb, kdb
  • Google Address Sanitizer (Asan) for GCC 4.8+ and LLVM
  • cppcheck - static code analysis
  • ELF Inspection

    readelf -l <binary
  • kcachegrind: callgrind visualization
  • Object Dumping

    objdump -t <object file>   # print symbols table
    objdump -dS <object file>  # print assembly along source lines
  • Fedora - Crash Tracker
  • Ubuntu - Crash Tracker
  • Java - Debugging Flags

    J-Xdebug -J-Xnoagent -J-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9876
  • Gearman - Jobserver


Test Frameworks

Low-level C test frameworks:

  • Glib Testing
  • lcov - GCC based test coverage metrics:

    apt-get install lcov
    CLAGS=--coverage ./configure
    # Run tests
    lcov --capture --directory <project-dir> --output-file
    genhtml --output-directory out
  • Ruby rspec - Launch tests

    # There are a lot of rspec launch variants:
    rspec <path to .rb spec file>
    rspec <path to directory>
    bundle exec rspec <path to .rb spec file>




  • Pretty-print XML:

    xmllint --format my.xml
  • XPath on the command line

    # Print subtree of tag 'sometag'
    xmllint --xpath "//sometag" data.xml
    # Match an attribute 'someattr' of 'sometag' to have literal 'string'
    xmllint --xpath "//sometag[contains(@someattr, 'string')" data.xml