This file contains hidden or 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
| sudo apt install gcc-aarch64-linux-gnu | |
| sudo apt install crossbuild-essential-arm64 | |
| sudo apt install crossbuild-essential-armel | |
| sudo apt install gcc-arm-linux-gnueabi gcc-arm-none-eabi | |
| git clone https://sourceware.org/git/glibc.git | |
| cd glibc | |
| mkdir build | |
| cd build |
This file contains hidden or 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
| # hg update --clean # clean | |
| # hg purge | |
| hg clone https://gmplib.org/repo/gmp | |
| cd gmp | |
| ./.bootstrap | |
| mkdir build | |
| cd build |
This file contains hidden or 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
| import string | |
| def batch(it, sz): | |
| for i in range(0, len(it), sz): | |
| yield it[i:i+sz] | |
| def hexdump_str(bytevals, offset=0, bytes_per_line=16, bytegroupsize=2): | |
| # get max address size |
This file contains hidden or 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
| def group_by_increment(iterable, group_incr, field_access=None, do_sort=True): | |
| """ | |
| Identify series of values that increment/decrement | |
| within a bounds @group_incr, grouping them into lists. | |
| The comparison to determine whether a value belongs in a group is | |
| if (prev_val + group_incr) <= curr_val: | |
| @iterable: iterable. This must be sorted for this function to work correctly. | |
| @group_incr: amount to be added to a value to determine | |
| @field_access: optional function to run on each element of the iterable to get |
This file contains hidden or 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
| sudo apt install gcc-aarch64-linux-gnu | |
| sudo apt install crossbuild-essential-arm64 | |
| sudo apt install crossbuild-essential-armel | |
| sudo apt install gcc-arm-linux-gnueabi gcc-arm-none-eabi | |
| git clone https://sourceware.org/git/glibc.git | |
| cd glibc | |
| mkdir build | |
| cd build |
This file contains hidden or 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
| # build libdaq from source | |
| git clone https://github.com/snort3/libdaq | |
| cd libdaq | |
| ./bootstrap | |
| mkdir build | |
| cd build | |
| ../configure | |
| make | |
| cd ../../ |
This file contains hidden or 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
| import ctypes | |
| def arb_read(addr, size=4): | |
| return bytes((ctypes.c_byte*size).from_address(addr)) | |
| def arb_write(addr, byts): | |
| (ctypes.c_byte*len(byts)).from_address(addr)[:] = byts | |
| def rough_addr_of(a): |
This file contains hidden or 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
| # build targets with code coverage, CFLAGS bit only works if `+=` is used in the make file | |
| CFLAGS="-fprofile-arcs -ftest-coverage" make CC=gcc | |
| # <run test case> | |
| # create files for all coverage reached by test case (don't use if using lcov) | |
| find . -type f -iname '*.gcda' |xargs gcov | |
| # generate coverage file for gcda files under this directory | |
| lcov -c -d . -o coverage.info |
This file contains hidden or 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
| CFLAGS="-fsanitize=undefined" make |
This file contains hidden or 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
| clang -fprofile-instr-generate -fcoverage-mapping -o main main.c | |
| LLVM_PROFILE_FILE="prof.profraw" ./main | |
| # merge many profraw files into a profdata | |
| llvm-profdata merge -sparse prof.profraw -o prof.profdata | |
| # show coverage | |
| llvm-cov show ./main -instr-profile=prof.profdata |