add VarInfo struct and methods for finding specific variables

This commit is contained in:
Gabriel Ionita 2025-10-25 12:00:00 +01:00
parent 6e8cfba046
commit 01c96b0467
Signed by: gabi
SSH Key Fingerprint: SHA256:mrbYmB/SGtDvT3etRoS6pDrMYWxR0/B5GSF6rR3qhhc

View File

@ -4,15 +4,24 @@
#include <cstdint> #include <cstdint>
#include <libdwarf.h> #include <libdwarf.h>
#include <memory> #include <memory>
#include <optional>
#include <string> #include <string>
template <typename T> using ptr = std::unique_ptr<T>; template <typename T> using ptr = std::unique_ptr<T>;
struct VarInfo {
std::string name;
Dwarf_Addr address;
size_t size;
};
class Symbol { class Symbol {
public: public:
bool is_integer_type(Dwarf_Debug dbg, Dwarf_Die die); bool is_integer_type(Dwarf_Debug dbg, Dwarf_Die die);
Dwarf_Addr get_global_var_addr(Dwarf_Debug dbg, Dwarf_Die die); Dwarf_Addr get_global_var_addr(Dwarf_Debug dbg, Dwarf_Die die);
size_t get_var_size(Dwarf_Debug dbg, Dwarf_Die die);
void list_global_integer_vars(Dwarf_Debug dbg); void list_global_integer_vars(Dwarf_Debug dbg);
std::optional<VarInfo> find_global_var(Dwarf_Debug dbg, const std::string &var_name);
}; };
#endif #endif