integrate tracer into main for variable watching

This commit is contained in:
Gabriel Ionita 2025-10-26 10:20:00 +01:00
parent b871618a1f
commit 024ba22ff0
Signed by: gabi
SSH Key Fingerprint: SHA256:mrbYmB/SGtDvT3etRoS6pDrMYWxR0/B5GSF6rR3qhhc

View File

@ -1,13 +1,11 @@
#include "symbol.hpp"
#include "tracer.hpp"
#include <cxxopts.hpp>
#include <fcntl.h>
#include <filesystem>
#include <iostream>
#include <libdwarf.h>
#include <string>
#include <sys/ptrace.h>
#include <sys/user.h>
#include <sys/wait.h>
#include <unistd.h>
int main(int argc, char **argv) {
@ -68,8 +66,15 @@ int main(int argc, char **argv) {
std::cout << "Size: " << var_info->size << " bytes" << std::endl;
std::cout << std::string(50, '-') << std::endl;
// TODO: Implement ptrace watchpoint
std::cerr << "Ptrace watchpoint not yet implemented" << std::endl;
// Close DWARF resources before forking
dwarf_finish(dbg);
close(fd);
// Start watching the variable
Tracer tracer;
tracer.watch_variable(exec_path.string(), var_info->address, var_info->size);
return 0;
} else {
// List mode: show all global integer variables
symbol.list_global_integer_vars(dbg);