[Lldb-commits] [lldb] [lldb][riscv] Fix setting breakpoint for undecoded instruction (PR #90075)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 14 05:53:05 PDT 2024
================
@@ -94,6 +94,39 @@ static lldb::addr_t ReadFlags(NativeRegisterContext ®siter_context) {
LLDB_INVALID_ADDRESS);
}
+static int GetSoftwareBreakpointSize(const ArchSpec &arch,
+ lldb::addr_t next_flags) {
+ if (arch.GetMachine() == llvm::Triple::arm) {
+ if (next_flags & 0x20)
+ // Thumb mode
+ return 2;
+ else
+ // Arm mode
+ return 4;
+ }
+ if (arch.IsMIPS() || arch.GetTriple().isPPC64() ||
+ arch.GetTriple().isRISCV() || arch.GetTriple().isLoongArch())
+ return 4;
+ return 0;
+}
+
+static Status SetSoftwareBreakpointOnPC(const ArchSpec &arch, lldb::addr_t pc,
----------------
ita-sc wrote:
I would like to keep `Status` in this MR, as from my point of view, this MR will do more that it should -- it will add a new functionality and change the way we work with errors here.
Moreover, changing this will result in unnecessary casts from `Status` to `Error` (`process.SetBreakpoint`) and from `Error` to `Status`(`SetupSoftwareSingleStepping`).
Note: I've checked that we have `Status::ToError` and `Status(llvm::Error error)` ctor, but I'm not sure these functions will suffice (AFAIU `m_code` will be saved only if `m_type == ErrorType::eErrorTypePOSIX`).
https://github.com/llvm/llvm-project/pull/90075
More information about the lldb-commits
mailing list