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
    
  
  
    
  | #ifndef INTRUSIVE_LIST_H | |
| #define INTRUSIVE_LIST_H | |
| #include <stddef.h> | |
| /* Basic intrusive doubly-linked list node */ | |
| struct list_head { | |
| struct list_head *next, *prev; | |
| }; | 
  
    
      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
    
  
  
    
  | git clone https://github.com/torvalds/linux.git | |
| cd linux | |
| mkdir -p build | |
| KBUILD_OUTPUT=build make O=build -j $(($(nproc)-1)) defconfig | |
| KBUILD_OUTPUT=build make O=build -j $(($(nproc)-1)) | 
  
    
      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 re | |
| import subprocess | |
| import os | |
| import pty | |
| import tty | |
| import fcntl | |
| import stat | |
| import threading | |
| from queue import Queue | |
| import logging | 
  
    
      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
    
  
  
    
  | function(set_kconfig_vars_from_file FILENAME) | |
| # Optional Kconfig integration | |
| if(EXISTS "${FILENAME}") | |
| file(READ "${FILENAME}" KCONFIG_CONTENTS) | |
| string(REGEX MATCHALL "CONFIG_[A-Za-z0-9_]+=(y|n)" KCONFIG_LINES "${KCONFIG_CONTENTS}") | |
| foreach(line ${KCONFIG_LINES}) | |
| message("${line}") | |
| string(REPLACE "=" ";" line_parts ${line}) | |
| list(GET line_parts 0 VAR) | 
  
    
      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
    
  
  
    
  | git clone https://github.com/llvm/llvm-project.git | |
| cd llvm-project | |
| cmake -S llvm -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_PROJECTS=clang | |
| ninja -C 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
    
  
  
    
  | 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 | 
  
    
      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
    
  
  
    
  | # 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
    
  
  
    
  | 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 libdaq from source | |
| git clone https://github.com/snort3/libdaq | |
| cd libdaq | |
| ./bootstrap | |
| mkdir build | |
| cd build | |
| ../configure | |
| make | |
| cd ../../ | 
NewerOlder