regs and we can step into!

This commit is contained in:
T0b1
2023-06-02 02:06:49 +02:00
parent d4bf6731a3
commit ac3718b12b
17 changed files with 1434 additions and 344 deletions

View File

@@ -5,19 +5,55 @@
#include <lldb/API/SBTarget.h>
#include <lldb/API/SBProcess.h>
#include <string>
#include <thread>
#include <mutex>
namespace dbgui::backend {
struct LLDBBackend : Backend {
// TODO: source_init_file: false
LLDBBackend(std::string filename);
virtual ~LLDBBackend();
namespace dbgui::backend
{
struct LLDBBackend : Backend
{
struct RegSet
{
std::string set_name;
// map from debugger reg idx to frontend reg idx
// std::vector<uint16_t> idx_map;
std::vector<const char *> names;
// TODO: make this data structure not garbage
std::vector<std::vector<uint8_t>> values;
};
void start() override;
// TODO: source_init_file: false
LLDBBackend(std::string filename);
virtual ~LLDBBackend();
private:
std::string _filename;
lldb::SBDebugger _instance;
lldb::SBTarget _target;
std::optional<lldb::SBProcess> _process;
};
}
void start() override;
bool step_into() override;
bool step_over() override;
bool step_out() override;
private:
void run_msg_loop();
void wait_for_debug_events();
void handle_state_change(lldb::StateType);
void prepare_proc_info(BackToFront::InitialProcessInfo &,
std::vector<BackToFront::RegsChanged> &);
void dump_threads();
void check_reg_changes();
std::string _filename;
lldb::SBDebugger _instance;
std::mutex _data_lock;
lldb::SBTarget _target;
std::optional<lldb::SBProcess> _process;
std::thread _msg_thread;
// process state
bool _first_run = true;
TargetState _state = TargetState::stopped;
std::vector<RegSet> _reg_sets = {};
};
} // namespace dbgui::backend