integrate tracer into main for variable watching
This commit is contained in:
parent
b871618a1f
commit
024ba22ff0
15
src/main.cpp
15
src/main.cpp
@ -1,13 +1,11 @@
|
|||||||
#include "symbol.hpp"
|
#include "symbol.hpp"
|
||||||
|
#include "tracer.hpp"
|
||||||
#include <cxxopts.hpp>
|
#include <cxxopts.hpp>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <libdwarf.h>
|
#include <libdwarf.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sys/ptrace.h>
|
|
||||||
#include <sys/user.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
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 << "Size: " << var_info->size << " bytes" << std::endl;
|
||||||
std::cout << std::string(50, '-') << std::endl;
|
std::cout << std::string(50, '-') << std::endl;
|
||||||
|
|
||||||
// TODO: Implement ptrace watchpoint
|
// Close DWARF resources before forking
|
||||||
std::cerr << "Ptrace watchpoint not yet implemented" << std::endl;
|
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 {
|
} else {
|
||||||
// List mode: show all global integer variables
|
// List mode: show all global integer variables
|
||||||
symbol.list_global_integer_vars(dbg);
|
symbol.list_global_integer_vars(dbg);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user