Move aarch64_linux_prepare_to_resume to nat/aarch64-linux.c
authorYao Qi <yao.qi@linaro.org>
Tue, 25 Aug 2015 10:38:29 +0000 (11:38 +0100)
committerYao Qi <yao.qi@linaro.org>
Tue, 25 Aug 2015 10:39:14 +0000 (11:39 +0100)
gdb:

2015-08-25  Yao Qi  <yao.qi@linaro.org>

* Makefile.in (aarch64-liunx.o): New rule.
(HFILES_NO_SRCDIR): Add aarch64-linux.h.
* config/aarch64/linux.mh (NAT_FILE): Add aarch64-linux.o.
* aarch64-linux-nat.c: Include nat/aarch64-linux.h.
* aarch64-linux-nat.c (aarch64_get_debug_reg_state): Make it
extern.
(aarch64_linux_prepare_to_resume): Move it nat/aarch64-linux.c.
* nat/aarch64-linux-hw-point.h (aarch64_debug_reg_state): Declare
* nat/aarch64-linux.c: New file.
* nat/aarch64-linux.h: New file.

gdb/gdbserver:

2015-08-25  Yao Qi  <yao.qi@linaro.org>

* Makefile.in (aarch64-linux.o): New rule.
* configure.srv (aarch64*-*-linux*): Append aarch64-linux.o to
srv_tgtobj.
* linux-aarch64-low.c: Include nat/aarch64-linux.h.
(aarch64_init_debug_reg_state): Make it extern.
(aarch64_linux_prepare_to_resume): Remove.

gdb/ChangeLog
gdb/Makefile.in
gdb/aarch64-linux-nat.c
gdb/config/aarch64/linux.mh
gdb/gdbserver/ChangeLog
gdb/gdbserver/Makefile.in
gdb/gdbserver/configure.srv
gdb/gdbserver/linux-aarch64-low.c
gdb/nat/aarch64-linux-hw-point.h
gdb/nat/aarch64-linux.c [new file with mode: 0644]
gdb/nat/aarch64-linux.h [new file with mode: 0644]

index 6ffaaca6676465a04490c3116e3806867b7d08ca..97c3a480c409c1b0018708d7b7b2e95e5d8828ba 100644 (file)
@@ -1,3 +1,16 @@
+2015-08-25  Yao Qi  <yao.qi@linaro.org>
+
+       * Makefile.in (aarch64-liunx.o): New rule.
+       (HFILES_NO_SRCDIR): Add aarch64-linux.h.
+       * config/aarch64/linux.mh (NAT_FILE): Add aarch64-linux.o.
+       * aarch64-linux-nat.c: Include nat/aarch64-linux.h.
+       * aarch64-linux-nat.c (aarch64_get_debug_reg_state): Make it
+       extern.
+       (aarch64_linux_prepare_to_resume): Move it nat/aarch64-linux.c.
+       * nat/aarch64-linux-hw-point.h (aarch64_debug_reg_state): Declare
+       * nat/aarch64-linux.c: New file.
+       * nat/aarch64-linux.h: New file.
+
 2015-08-25  Yao Qi  <yao.qi@linaro.org>
 
        * aarch64-linux-nat.c (aarch64_linux_prepare_to_resume): Use
index 924979b92fbb0623558b92867f4101ba5e540a42..0d7cf979e3512263a9bb3c99806d118d10e7b4b4 100644 (file)
@@ -937,7 +937,7 @@ tui/tui-winsource.h tui/tui-regs.h tui/tui-io.h tui/tui-layout.h \
 tui/tui-source.h sol2-tdep.h gregset.h sh-tdep.h sh64-tdep.h \
 expression.h score-tdep.h gdb_select.h ser-tcp.h \
 extension.h extension-priv.h nat/aarch64-linux-hw-point.h \
-build-id.h buildsym.h valprint.h \
+build-id.h buildsym.h valprint.h nat/aarch64-linux.h \
 typeprint.h mi/mi-getopt.h mi/mi-parse.h mi/mi-console.h \
 mi/mi-out.h mi/mi-main.h mi/mi-common.h mi/mi-cmds.h linux-nat.h \
 complaints.h gdb_proc_service.h gdb_regex.h xtensa-tdep.h inf-loop.h \
@@ -2332,6 +2332,10 @@ aarch64-linux-hw-point.o: ${srcdir}/nat/aarch64-linux-hw-point.c
        $(COMPILE) $(srcdir)/nat/aarch64-linux-hw-point.c
        $(POSTCOMPILE)
 
+aarch64-linux.o: ${srcdir}/nat/aarch64-linux.c
+       $(COMPILE) $(srcdir)/nat/aarch64-linux.c
+       $(POSTCOMPILE)
+
 #
 # gdb/tui/ dependencies
 #
index b23026aae091d7335e30aa7007634d06f175f221..ea56238646366e15c8a6e0b5ea5eaf033b659323 100644 (file)
@@ -30,6 +30,7 @@
 #include "aarch64-tdep.h"
 #include "aarch64-linux-tdep.h"
 #include "aarch32-linux-nat.h"
+#include "nat/aarch64-linux.h"
 #include "nat/aarch64-linux-hw-point.h"
 
 #include "elf/external.h"
@@ -141,7 +142,7 @@ aarch64_forget_process (pid_t pid)
 
 /* Get debug registers state for process PID.  */
 
-static struct aarch64_debug_reg_state *
+struct aarch64_debug_reg_state *
 aarch64_get_debug_reg_state (pid_t pid)
 {
   return &aarch64_process_info_get (pid)->state;
@@ -425,47 +426,6 @@ supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
                          AARCH64_LINUX_SIZEOF_FPREGSET);
 }
 
-/* Called when resuming a thread.
-   The hardware debug registers are updated when there is any change.  */
-
-static void
-aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
-{
-  struct arch_lwp_info *info = lwp_arch_private_info (lwp);
-
-  /* NULL means this is the main thread still going through the shell,
-     or, no watchpoint has been set yet.  In that case, there's
-     nothing to do.  */
-  if (info == NULL)
-    return;
-
-  if (DR_HAS_CHANGED (info->dr_changed_bp)
-      || DR_HAS_CHANGED (info->dr_changed_wp))
-    {
-      ptid_t ptid = ptid_of_lwp (lwp);
-      int tid = ptid_get_lwp (ptid);
-      struct aarch64_debug_reg_state *state
-       = aarch64_get_debug_reg_state (ptid_get_pid (ptid));
-
-      if (show_debug_regs)
-       fprintf_unfiltered (gdb_stdlog, "prepare_to_resume thread %d\n", tid);
-
-      /* Watchpoints.  */
-      if (DR_HAS_CHANGED (info->dr_changed_wp))
-       {
-         aarch64_linux_set_debug_regs (state, tid, 1);
-         DR_CLEAR_CHANGED (info->dr_changed_wp);
-       }
-
-      /* Breakpoints.  */
-      if (DR_HAS_CHANGED (info->dr_changed_bp))
-       {
-         aarch64_linux_set_debug_regs (state, tid, 0);
-         DR_CLEAR_CHANGED (info->dr_changed_bp);
-       }
-    }
-}
-
 static void
 aarch64_linux_new_thread (struct lwp_info *lp)
 {
index 231aea17f74418bc769d32c26bc23efc818a30a7..ea56ff68ffc2c8dae7a97cc6641ac38b3a0ef062 100644 (file)
@@ -22,7 +22,8 @@ NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o aarch64-linux-nat.o aarch32-linux-nat.o \
        proc-service.o linux-thread-db.o linux-nat.o linux-fork.o \
        linux-procfs.o linux-ptrace.o linux-osdata.o linux-waitpid.o \
-       linux-personality.o linux-namespaces.o aarch64-linux-hw-point.o
+       linux-personality.o linux-namespaces.o aarch64-linux-hw-point.o \
+       aarch64-linux.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES= -ldl $(RDYNAMIC)
index 6fdc29c8616331d7ca00e4427290d8d932aa9341..274f8504be75e0aa6c749cce750374ebc146cc35 100644 (file)
@@ -1,3 +1,12 @@
+2015-08-25  Yao Qi  <yao.qi@linaro.org>
+
+       * Makefile.in (aarch64-linux.o): New rule.
+       * configure.srv (aarch64*-*-linux*): Append aarch64-linux.o to
+       srv_tgtobj.
+       * linux-aarch64-low.c: Include nat/aarch64-linux.h.
+       (aarch64_init_debug_reg_state): Make it extern.
+       (aarch64_linux_prepare_to_resume): Remove.
+
 2015-08-25  Yao Qi  <yao.qi@linaro.org>
 
        * linux-aarch64-low.c (aarch64_linux_prepare_to_resume): Use
index 5e04e530a9c168ac432f0e2f6dc43171e1cede65..b715a3252f58f9501aaedd6008e9169a425b0d94 100644 (file)
@@ -609,6 +609,9 @@ linux-personality.o: ../nat/linux-personality.c
 aarch64-linux-hw-point.o: ../nat/aarch64-linux-hw-point.c
        $(COMPILE) $<
        $(POSTCOMPILE)
+aarch64-linux.o: ../nat/aarch64-linux.c
+       $(COMPILE) $<
+       $(POSTCOMPILE)
 btrace-common.o: ../common/btrace-common.c
        $(COMPILE) $<
        $(POSTCOMPILE)
index 320c26af24689730217c6c12d178fe597e0bcbd9..aa232f8239e610f991b5fb7aec121511802beddd 100644 (file)
@@ -52,6 +52,7 @@ case "${target}" in
                        srv_regobj="${srv_regobj} arm-with-neon.o"
                        srv_tgtobj="linux-aarch64-low.o aarch64-linux-hw-point.o"
                        srv_tgtobj="$srv_tgtobj linux-aarch32-low.o"
+                       srv_tgtobj="$srv_tgtobj aarch64-linux.o"
                        srv_tgtobj="${srv_tgtobj} $srv_linux_obj"
                        srv_xmlfiles="aarch64.xml"
                        srv_xmlfiles="${srv_xmlfiles} aarch64-core.xml"
index 4b1d7d58534349b6ffdd20cb01e64707a67a128e..d35d4e9770ad5b522d3dae3ceb8596e7ced8fe99 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "server.h"
 #include "linux-low.h"
+#include "nat/aarch64-linux.h"
 #include "nat/aarch64-linux-hw-point.h"
 #include "linux-aarch32-low.h"
 #include "elf/common.h"
@@ -237,7 +238,7 @@ aarch64_init_debug_reg_state (struct aarch64_debug_reg_state *state)
 /* Return the pointer to the debug register state structure in the
    current process' arch-specific data area.  */
 
-static struct aarch64_debug_reg_state *
+struct aarch64_debug_reg_state *
 aarch64_get_debug_reg_state (pid_t pid)
 {
   struct process_info *proc = find_process_pid (pid);
@@ -482,42 +483,6 @@ aarch64_linux_new_fork (struct process_info *parent,
   *child->priv->arch_private = *parent->priv->arch_private;
 }
 
-/* Implementation of linux_target_ops method "linux_prepare_to_resume".
-
-   If the debug regs have changed, update the thread's copies.  */
-
-static void
-aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
-{
-  struct arch_lwp_info *info = lwp_arch_private_info (lwp);
-
-  if (DR_HAS_CHANGED (info->dr_changed_bp)
-      || DR_HAS_CHANGED (info->dr_changed_wp))
-    {
-      ptid_t ptid = ptid_of_lwp (lwp);
-      int tid = ptid_get_lwp (ptid);
-      struct aarch64_debug_reg_state *state
-       = aarch64_get_debug_reg_state (ptid_get_pid (ptid));
-
-      if (show_debug_regs)
-       fprintf (stderr, "prepare_to_resume thread %d\n", tid);
-
-      /* Watchpoints.  */
-      if (DR_HAS_CHANGED (info->dr_changed_wp))
-       {
-         aarch64_linux_set_debug_regs (state, tid, 1);
-         DR_CLEAR_CHANGED (info->dr_changed_wp);
-       }
-
-      /* Breakpoints.  */
-      if (DR_HAS_CHANGED (info->dr_changed_bp))
-       {
-         aarch64_linux_set_debug_regs (state, tid, 0);
-         DR_CLEAR_CHANGED (info->dr_changed_bp);
-       }
-    }
-}
-
 /* Return the right target description according to the ELF file of
    current thread.  */
 
index 17cc42058e248e3d71b17072f8aaa21dfd425eaf..a27a2018570a4b2a2fd710244a0ad250a0b66a7c 100644 (file)
@@ -180,4 +180,6 @@ void aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state,
 
 void aarch64_linux_get_debug_reg_capacity (int tid);
 
+struct aarch64_debug_reg_state *aarch64_get_debug_reg_state (pid_t pid);
+
 #endif /* AARCH64_LINUX_HW_POINT_H */
diff --git a/gdb/nat/aarch64-linux.c b/gdb/nat/aarch64-linux.c
new file mode 100644 (file)
index 0000000..7b4ead7
--- /dev/null
@@ -0,0 +1,64 @@
+/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
+   Contributed by ARM Ltd.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include "common-defs.h"
+#include "break-common.h"
+#include "nat/linux-nat.h"
+#include "nat/aarch64-linux-hw-point.h"
+#include "nat/aarch64-linux.h"
+
+/* Called when resuming a thread LWP.
+   The hardware debug registers are updated when there is any change.  */
+
+void
+aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
+{
+  struct arch_lwp_info *info = lwp_arch_private_info (lwp);
+
+  /* NULL means this is the main thread still going through the shell,
+     or, no watchpoint has been set yet.  In that case, there's
+     nothing to do.  */
+  if (info == NULL)
+    return;
+
+  if (DR_HAS_CHANGED (info->dr_changed_bp)
+      || DR_HAS_CHANGED (info->dr_changed_wp))
+    {
+      ptid_t ptid = ptid_of_lwp (lwp);
+      int tid = ptid_get_lwp (ptid);
+      struct aarch64_debug_reg_state *state
+       = aarch64_get_debug_reg_state (ptid_get_pid (ptid));
+
+      if (show_debug_regs)
+       debug_printf ("prepare_to_resume thread %d\n", tid);
+
+      /* Watchpoints.  */
+      if (DR_HAS_CHANGED (info->dr_changed_wp))
+       {
+         aarch64_linux_set_debug_regs (state, tid, 1);
+         DR_CLEAR_CHANGED (info->dr_changed_wp);
+       }
+
+      /* Breakpoints.  */
+      if (DR_HAS_CHANGED (info->dr_changed_bp))
+       {
+         aarch64_linux_set_debug_regs (state, tid, 0);
+         DR_CLEAR_CHANGED (info->dr_changed_bp);
+       }
+    }
+}
diff --git a/gdb/nat/aarch64-linux.h b/gdb/nat/aarch64-linux.h
new file mode 100644 (file)
index 0000000..cf4e468
--- /dev/null
@@ -0,0 +1,24 @@
+/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
+   Contributed by ARM Ltd.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef AARCH64_LINUX_H
+#define AARCH64_LINUX_H 1
+
+void aarch64_linux_prepare_to_resume (struct lwp_info *lwp);
+
+#endif /* AARCH64_LINUX_H */
This page took 0.036254 seconds and 4 git commands to generate.