Skip to content

Library

tmatis edited this page Mar 26, 2023 · 1 revision

Library

Overview

The library is responsible for injecting hooks in the program to debug. It will also send the backtrace of the functions to test to the host or make them fail by return a fake error return value.

File structure

  • srcs/: contains the source code of the library.
  • srcs/backtrace/: contains tools to get backtraces. as relative addresses using dladdr and backtrace.
  • srcs/env: contains the code that remove LD_PRELOAD from the environment variables. so the library is not loaded again if the program to debug launch another program.
  • srcs/events: contains the code to send events to the host.
  • srcs/function_seach: contains the code to search the original function in the program to debug since the real one is hooked so we search with dlsym the original function and store it in a binary search tree so we can find it faster the next time it's called.
  • srcs/hooks: contains various utilities to hook functions.
  • srcs/hooks/allocs: contains the code to hook malloc, calloc, realloc
  • srcs/hooks/functions: contains the code to various functions to hook. see Functions.md.
  • srcs/setup: contains the code to setup the library. (open the shared memory, ...)
  • srcs/shared_memory: contains the code to interact with the shared memory.
  • srcs/utils: various utilities.
Clone this wiki locally