mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 18:14:13 +08:00
Move aarch64_linux_prepare_to_resume to nat/aarch64-linux.c
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.
This commit is contained in:
parent
f6011a1c84
commit
db3cb7cb3e
@ -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>
|
2015-08-25 Yao Qi <yao.qi@linaro.org>
|
||||||
|
|
||||||
* aarch64-linux-nat.c (aarch64_linux_prepare_to_resume): Use
|
* aarch64-linux-nat.c (aarch64_linux_prepare_to_resume): Use
|
||||||
|
@ -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 \
|
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 \
|
expression.h score-tdep.h gdb_select.h ser-tcp.h \
|
||||||
extension.h extension-priv.h nat/aarch64-linux-hw-point.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 \
|
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 \
|
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 \
|
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
|
$(COMPILE) $(srcdir)/nat/aarch64-linux-hw-point.c
|
||||||
$(POSTCOMPILE)
|
$(POSTCOMPILE)
|
||||||
|
|
||||||
|
aarch64-linux.o: ${srcdir}/nat/aarch64-linux.c
|
||||||
|
$(COMPILE) $(srcdir)/nat/aarch64-linux.c
|
||||||
|
$(POSTCOMPILE)
|
||||||
|
|
||||||
#
|
#
|
||||||
# gdb/tui/ dependencies
|
# gdb/tui/ dependencies
|
||||||
#
|
#
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "aarch64-tdep.h"
|
#include "aarch64-tdep.h"
|
||||||
#include "aarch64-linux-tdep.h"
|
#include "aarch64-linux-tdep.h"
|
||||||
#include "aarch32-linux-nat.h"
|
#include "aarch32-linux-nat.h"
|
||||||
|
#include "nat/aarch64-linux.h"
|
||||||
#include "nat/aarch64-linux-hw-point.h"
|
#include "nat/aarch64-linux-hw-point.h"
|
||||||
|
|
||||||
#include "elf/external.h"
|
#include "elf/external.h"
|
||||||
@ -141,7 +142,7 @@ aarch64_forget_process (pid_t pid)
|
|||||||
|
|
||||||
/* Get debug registers state for process 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)
|
aarch64_get_debug_reg_state (pid_t pid)
|
||||||
{
|
{
|
||||||
return &aarch64_process_info_get (pid)->state;
|
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);
|
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
|
static void
|
||||||
aarch64_linux_new_thread (struct lwp_info *lp)
|
aarch64_linux_new_thread (struct lwp_info *lp)
|
||||||
{
|
{
|
||||||
|
@ -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 \
|
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 \
|
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-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
|
NAT_CDEPS = $(srcdir)/proc-service.list
|
||||||
|
|
||||||
LOADLIBES= -ldl $(RDYNAMIC)
|
LOADLIBES= -ldl $(RDYNAMIC)
|
||||||
|
@ -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>
|
2015-08-25 Yao Qi <yao.qi@linaro.org>
|
||||||
|
|
||||||
* linux-aarch64-low.c (aarch64_linux_prepare_to_resume): Use
|
* linux-aarch64-low.c (aarch64_linux_prepare_to_resume): Use
|
||||||
|
@ -609,6 +609,9 @@ linux-personality.o: ../nat/linux-personality.c
|
|||||||
aarch64-linux-hw-point.o: ../nat/aarch64-linux-hw-point.c
|
aarch64-linux-hw-point.o: ../nat/aarch64-linux-hw-point.c
|
||||||
$(COMPILE) $<
|
$(COMPILE) $<
|
||||||
$(POSTCOMPILE)
|
$(POSTCOMPILE)
|
||||||
|
aarch64-linux.o: ../nat/aarch64-linux.c
|
||||||
|
$(COMPILE) $<
|
||||||
|
$(POSTCOMPILE)
|
||||||
btrace-common.o: ../common/btrace-common.c
|
btrace-common.o: ../common/btrace-common.c
|
||||||
$(COMPILE) $<
|
$(COMPILE) $<
|
||||||
$(POSTCOMPILE)
|
$(POSTCOMPILE)
|
||||||
|
@ -52,6 +52,7 @@ case "${target}" in
|
|||||||
srv_regobj="${srv_regobj} arm-with-neon.o"
|
srv_regobj="${srv_regobj} arm-with-neon.o"
|
||||||
srv_tgtobj="linux-aarch64-low.o aarch64-linux-hw-point.o"
|
srv_tgtobj="linux-aarch64-low.o aarch64-linux-hw-point.o"
|
||||||
srv_tgtobj="$srv_tgtobj linux-aarch32-low.o"
|
srv_tgtobj="$srv_tgtobj linux-aarch32-low.o"
|
||||||
|
srv_tgtobj="$srv_tgtobj aarch64-linux.o"
|
||||||
srv_tgtobj="${srv_tgtobj} $srv_linux_obj"
|
srv_tgtobj="${srv_tgtobj} $srv_linux_obj"
|
||||||
srv_xmlfiles="aarch64.xml"
|
srv_xmlfiles="aarch64.xml"
|
||||||
srv_xmlfiles="${srv_xmlfiles} aarch64-core.xml"
|
srv_xmlfiles="${srv_xmlfiles} aarch64-core.xml"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "linux-low.h"
|
#include "linux-low.h"
|
||||||
|
#include "nat/aarch64-linux.h"
|
||||||
#include "nat/aarch64-linux-hw-point.h"
|
#include "nat/aarch64-linux-hw-point.h"
|
||||||
#include "linux-aarch32-low.h"
|
#include "linux-aarch32-low.h"
|
||||||
#include "elf/common.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
|
/* Return the pointer to the debug register state structure in the
|
||||||
current process' arch-specific data area. */
|
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)
|
aarch64_get_debug_reg_state (pid_t pid)
|
||||||
{
|
{
|
||||||
struct process_info *proc = find_process_pid (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;
|
*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
|
/* Return the right target description according to the ELF file of
|
||||||
current thread. */
|
current thread. */
|
||||||
|
|
||||||
|
@ -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);
|
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 */
|
#endif /* AARCH64_LINUX_HW_POINT_H */
|
||||||
|
64
gdb/nat/aarch64-linux.c
Normal file
64
gdb/nat/aarch64-linux.c
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
gdb/nat/aarch64-linux.h
Normal file
24
gdb/nat/aarch64-linux.h
Normal file
@ -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 */
|
Loading…
Reference in New Issue
Block a user