gnulib: define the path to gnulib's parent dir
[binutils-gdb.git] / gdbserver / linux-riscv-low.cc
index 9e96504687e08795436760b813892ca4df7d5810..8bf97ea4aa3a9b90980b967aea580919d7ce6143 100644 (file)
@@ -1,6 +1,6 @@
 /* GNU/Linux/RISC-V specific low level interface, for the remote server
    for GDB.
-   Copyright (C) 2020 Free Software Foundation, Inc.
+   Copyright (C) 2020-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -57,6 +57,8 @@ protected:
   CORE_ADDR low_get_pc (regcache *regcache) override;
 
   void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
+
+  bool low_breakpoint_at (CORE_ADDR pc) override;
 };
 
 /* The singleton target ops object.  */
@@ -86,11 +88,11 @@ riscv_target::low_arch_setup ()
 
   const riscv_gdbarch_features features
     = riscv_linux_read_features (lwpid_of (current_thread));
-  target_desc *tdesc = riscv_create_target_description (features);
+  target_desc_up tdesc = riscv_create_target_description (features);
 
   if (!tdesc->expedite_regs)
-    init_target_desc (tdesc, expedite_regs);
-  current_process ()->tdesc = tdesc;
+    init_target_desc (tdesc.get (), expedite_regs);
+  current_process ()->tdesc = tdesc.release ();
 }
 
 /* Collect GPRs from REGCACHE into BUF.  */
@@ -283,10 +285,10 @@ riscv_target::sw_breakpoint_from_kind (int kind, int *size)
     }
 }
 
-/* Implementation of linux_target_ops method "breakpoint_at".  */
+/* Implementation of linux target ops method "low_breakpoint_at".  */
 
-static int
-riscv_breakpoint_at (CORE_ADDR pc)
+bool
+riscv_target::low_breakpoint_at (CORE_ADDR pc)
 {
   union
     {
@@ -301,18 +303,11 @@ riscv_breakpoint_at (CORE_ADDR pc)
              && target_read_memory (pc + sizeof (buf.insn), buf.bytes,
                                     sizeof (buf.insn)) == 0
              && buf.insn == riscv_ibreakpoint[1])))
-    return 1;
+    return true;
   else
-    return 0;
+    return false;
 }
 
-/* RISC-V/Linux target operations.  */
-struct linux_target_ops the_low_target =
-{
-  0,    /* decr_pc_after_break */
-  riscv_breakpoint_at,
-};
-
 /* The linux target ops object.  */
 
 linux_process_target *the_linux_target = &the_riscv_target;