MCPcopy Create free account
hub / github.com/Vector35/debugger / WriteRegister

Method WriteRegister

core/adapters/lldbadapter.cpp:742–773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

740
741
742bool LldbAdapter::WriteRegister(const std::string& name, std::uintptr_t value)
743{
744 // SBThread thread = m_process.GetSelectedThread();
745 // if (!thread.IsValid())
746 // return false;
747 //
748 // size_t frameCount = thread.GetNumFrames();
749 // if (frameCount == 0)
750 // return false;
751 //
752 // SBFrame frame = thread.GetFrameAtIndex(0);
753 // if (!frame.IsValid())
754 // return false;
755 //
756 // SBValue reg = frame.FindRegister(name.c_str());
757 // if (!reg.IsValid())
758 // return false;
759 //
760 // SBError error;
761 // bool ok = reg.SetValueFromCString(fmt::format("{}", value).c_str(), error);
762 // return ok && error.Success();
763
764 // An LLDB bug forces the use of a command rather than the above code via API. When one tries to update the pc
765 // value using the API, the GetInstructionOffset() function will still return the old value, making the current
766 // instruction highlight inaccurate.
767 auto command = fmt::format("reg write {} 0x{:x}", name, value);
768 auto result = InvokeBackendCommand(command);
769 if ((result.rfind("error: ", 0) == 0))
770 return false;
771
772 return true;
773}
774
775
776DataBuffer LldbAdapter::ReadMemory(std::uintptr_t address, std::size_t size)

Callers 1

SetRegisterValueMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected