WIP
This commit is contained in:
@@ -123,6 +123,8 @@ void LLDBBackend::handle_state_change(lldb::StateType state)
|
||||
}
|
||||
}
|
||||
|
||||
this->dump_threads();
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case eStateStopped:
|
||||
@@ -280,6 +282,63 @@ void LLDBBackend::dump_threads()
|
||||
if (sel.IsValid())
|
||||
{
|
||||
printf("Selected Thread: %lu\n", sel.GetThreadID());
|
||||
|
||||
auto frame = sel.GetFrameAtIndex(0);
|
||||
auto symctx = frame.GetSymbolContext(eSymbolContextEverything);
|
||||
auto stream = SBStream{};
|
||||
symctx.GetDescription(stream);
|
||||
|
||||
printf("Symctx: %.*s\n", static_cast<int>(stream.GetSize()),
|
||||
stream.GetData());
|
||||
|
||||
auto list = _target.FindTypes("test::MyType");
|
||||
printf("List len: %lu\n", list.GetSize());
|
||||
auto len = list.GetSize();
|
||||
for (uint32_t i = 0; i < len; ++i)
|
||||
{
|
||||
auto typ = list.GetTypeAtIndex(i);
|
||||
stream.Clear();
|
||||
typ.GetDescription(stream, eDescriptionLevelFull);
|
||||
|
||||
printf("Type %u: %.*s\n", i, static_cast<int>(stream.GetSize()),
|
||||
stream.GetData());
|
||||
}
|
||||
|
||||
stream.Clear();
|
||||
auto sc =
|
||||
frame.GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol);
|
||||
|
||||
uint64_t start, end;
|
||||
if (sc.GetFunction().IsValid())
|
||||
{
|
||||
auto fn = sc.GetFunction();
|
||||
start = fn.GetStartAddress().GetLoadAddress(_target);
|
||||
end = fn.GetEndAddress().GetLoadAddress(_target);
|
||||
} else if (sc.GetSymbol().IsValid()
|
||||
&& sc.GetSymbol().GetStartAddress().IsValid())
|
||||
{
|
||||
auto sym = sc.GetSymbol();
|
||||
start = sym.GetStartAddress().GetLoadAddress(_target);
|
||||
end = sym.GetEndAddress().GetLoadAddress(_target);
|
||||
} else
|
||||
{
|
||||
start = frame.GetPC();
|
||||
end = start + 0x100;
|
||||
}
|
||||
|
||||
auto buf = std::vector<uint8_t>{};
|
||||
buf.resize(end - start);
|
||||
auto err = SBError{};
|
||||
_target.ReadMemory(SBAddress{start, _target}, buf.data(), buf.size(), err);
|
||||
|
||||
auto inst_list =
|
||||
_target.GetInstructionsWithFlavor(start, "intel", buf.data(), buf.size());
|
||||
stream.Clear();
|
||||
inst_list.GetDescription(stream);
|
||||
printf("InstList: %.*s\n", static_cast<int>(stream.GetSize()),
|
||||
stream.GetData());
|
||||
|
||||
//printf("Disasm: %s\n", frame.Disassemble());
|
||||
} else
|
||||
{
|
||||
printf("Selected thread not valid\n");
|
||||
|
||||
Reference in New Issue
Block a user