Remove unconditional arch dependency on asm/debugger.h
v4 cover Remove unconditional arch dependency on asm/debugger.h
This series removes the unconditional requirement that all architectures implement asm/debugger.h. It additionally removes arm's debugger.h and disentangles some of the x86 gdbsx/gdbstub/generic debugger code.
Additionally, this series does the following:
- Provides generic stubs when !CONFIG_CRASH_DEBUG
- Adds stronger separation between gdbstub, gdbsx, and generic debugger code.
v4 simply includes the review feedback from v3 with no other big changes (as was the case for v3 in comparison to v2).
Bobby Eshleman (6):
arm/traps: remove debugger_trap_fatal() calls x86/debugger: separate Xen and guest debugging debugger_trap_*
functions
arch/x86: rename debug.c to gdbsx.c
x86/gdbsx: expand dbg_rw_mem() inline
arch/x86: move domain_pause_for_debugger() to domain.h
x86: change asm/debugger.h to xen/debugger.h
xen/arch/arm/traps.c | 7 ----
xen/arch/x86/Makefile | 2 +-
xen/arch/x86/domain.c | 2 +-
xen/arch/x86/domctl.c | 12 +-----
xen/arch/x86/{debug.c => gdbsx.c} | 28 ++++++-------
xen/arch/x86/nmi.c | 1 -
xen/arch/x86/traps.c | 52 +++++++++++++++----------
xen/common/domain.c | 2 +-
xen/common/gdbstub.c | 2 +-
xen/common/keyhandler.c | 2 +-
xen/common/shutdown.c | 2 +-
xen/drivers/char/console.c | 2 +-
xen/include/asm-arm/debugger.h | 15 -------
xen/include/asm-x86/debugger.h | 65 +------------------------------
xen/include/asm-x86/domain.h | 2 +
xen/include/asm-x86/gdbsx.h | 19 +++++++++
xen/include/xen/debugger.h | 51 ++++++++++++++++++++++++
17 files changed, 125 insertions(+), 141 deletions(-)
rename xen/arch/x86/{debug.c => gdbsx.c} (89%)
delete mode 100644 xen/include/asm-arm/debugger.h
create mode 100644 xen/include/asm-x86/gdbsx.h
create mode 100644 xen/include/xen/debugger.hSignature · 1 line
2.32.0
PATCH v4 1/6 arm/traps: remove debugger_trap_fatal() calls
ARM doesn't actually use debugger_trap_* anything, and is stubbed out.
This commit simply removes the unneeded calls.
--- xen/arch/arm/traps.c | 7 ------- 1 file changed, 7 deletions(-)
xen/arch/arm/traps.c +0 -7
@@ -41,7 +41,6 @@#include <asm/acpi.h> #include <asm/cpuerrata.h> #include <asm/cpufeature.h> -#include <asm/debugger.h> #include <asm/event.h> #include <asm/hsr.h> #include <asm/mmio.h>
@@ -1266,10 +1265,6 @@ int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc)case BUGFRAME_bug:printk ("Xen BUG at %s%s:%d\n" , prefix, filename, lineno); - -if (debugger_trap_fatal (TRAP_invalid_op, regs) ) -return 0 ; -show_execution_state (regs);panic ("Xen BUG at %s%s:%d\n" , prefix, filename, lineno);
@@ -1281,8 +1276,6 @@ int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc)printk ("Assertion '%s' failed at %s%s:%d\n" , predicate, prefix, filename, lineno); -if (debugger_trap_fatal (TRAP_invalid_op, regs) ) -return 0 ;show_execution_state (regs);panic ("Assertion '%s' failed at %s%s:%d\n" , predicate, prefix, filename, lineno);
Signature · 1 line
2.32.0
Re: [PATCH v4 1/6] arm/traps: remove debugger_trap_fatal() calls
Quoted 5 lines · Bobby Eshleman
ARM doesn't actually use debugger_trap_* anything, and is stubbed out.
This commit simply removes the unneeded calls.
Signed-off-by Bobby Eshleman <[email protected]>
Julien already acked this patch on v3. You should carry the tag on future revisions.
PATCH v4 2/6 x86/debugger: separate Xen and guest debugging debugger_trap_* functions
In reply to Bobby EshlemanThe functions debugger_trap_fatal(), debugger_trap_immediate(), and debugger_trap_entry() are generic hook functions for debugger support. In practice, debugger_trap_fatal() and debugger_trap_immediate() are only used in the debugging of Xen itself and debugger_trap_entry() is only used in the debugging of guests. That is, debugger_trap_entry() is part of gdbsx functionality and not the Xen gdstub. This is evidenced by debugger_trap_fatal()'s usage of domain_pause_for_debugger(). Because of this, debugger_trap_entry() many not belong alongside the Xen debug functions.
This commit fixes this by expanding inline debugger_trap_entry() into its usage sites in x86/traps.c and stubbing out domain_pause_for_debugger() when !CONFIG_GDBSX. Placing what was debugger_trap_entry() under the scope of gdbsx instead of gdbstub.
The function calls that caused an effective no-op and early exit out of debugger_trap_entry() are removed completely (when the trapnr is not int3/debug).
This commit is one of a series geared towards removing the unnecessary requirement that all architectures to implement <asm/debugger.h>.
---
Changes in v4:
- Reword commit message for accuracy (make weaker claims)
- Fix "if { return } else if { return }" anti-pattern
xen/arch/x86/domain.c | 2 +- xen/arch/x86/traps.c | 50 ++++++++++++++++++++-------------- xen/include/asm-x86/debugger.h | 42 ++-------------------------- 3 files changed, 33 insertions(+), 61 deletions(-)
xen/arch/x86/domain.c +1 -1
@@ -2541,7 +2541,7 @@ __initcall(init_vcpu_kick_softirq);void domain_pause_for_debugger (void ) { -#ifdef CONFIG_CRASH_DEBUG +#ifdef CONFIG_GDBSX struct vcpu *curr = current;struct domain *d = curr->domain;
xen/arch/x86/traps.c +30 -20
114 lines not on this page · raw message
xen/include/asm-x86/debugger.h +2 -40
64 lines not on this page · raw message
Signature · 1 line
2.32.0
Re: [PATCH v4 2/6] x86/debugger: separate Xen and guest debugging debugger_trap_* functions
Quoted 15 lines · Bobby Eshleman
xen/arch/x86/traps.c +0
-3@@ -858,13 +858,20 @@ static void do_trap(struct cpu_user_regs *regs)if ( regs->error_code &X86_XEC_EXT ) goto hardware_trap; -if (debugger_trap_entry (trapnr, regs) ) -return ; -ASSERT (trapnr <32 );if (guest_mode (regs) ) {
xen/arch/x86/traps.c static void do_trap(struct cpu_user_regs *regs) · line 874
Quoted 10 lines
xen/arch/x86/traps.c +10
-0+struct vcpu *curr = current; +if ( (trapnr == TRAP_debug || trapnr == TRAP_int3) && +guest_kernel_mode (curr, regs) && + curr->domain->debugger_attached ) + { +if ( trapnr != TRAP_debug ) + curr->arch.gdbsx_vcpu_event = trapnr; +domain_pause_for_debugger (); +return ; + }
This is unreachable. do_trap() isn't used for TRAP_debug or TRAP_int3.
Quoted 11 lines
xen/arch/x86/traps.c +0
-3@@ -2014,9 +2021,6 @@ void do_entry_CP(struct cpu_user_regs *regs)const char *err ="??" ;unsigned int ec = regs->error_code; -if (debugger_trap_entry (TRAP_debug, regs) ) -return ; -/* Decode ec if possible */ if ( ec <ARRAY_SIZE (errors) && errors[ec][0 ] ) err = errors[ec];
xen/arch/x86/traps.c void do_entry_CP(struct cpu_user_regs *regs) · line 2040
Quoted 9 lines
xen/arch/x86/traps.c +6
-0@@ -2028,6 +2032,12 @@ void do_entry_CP(struct cpu_user_regs *regs)*/ if (guest_mode (regs) ) { +struct vcpu *curr = current; +if (guest_kernel_mode (curr, regs) && curr->domain->debugger_attached ) + { +domain_pause_for_debugger (); +return ; + }
Urgh. The TRAP_debug above was a copy/paste error.
I'll submit a patch, as it wants backporting for a couple of releases, after which there should be no additions in do_entry_CP().
Everything else looks good.
~Andrew
PATCH v4 3/6 arch/x86: rename debug.c to gdbsx.c
In reply to Bobby EshlemanThis commit renames debug.c to gdbsx.c to clarify its purpose.
The function gdbsx_guest_mem_io() is moved from domctl.c to gdbsx.c.
Although gdbsx_guest_mem_io() is conditionally removed from its single call site in domctl.c upon !CONFIG_GDBSX and so no stub is technically necessary, this commit adds a stub that would preserve the functioning of that call site if the #ifdef CONFIG_GDBSX were to ever be removed or the function were to ever be called outside of such an ifdef block.
---
Changes in v4:
- Alphebetize Makefile addition
- Fix broken header guard
- Include errno.h in gdbsx.h
xen/arch/x86/Makefile | 2 +-
xen/arch/x86/domctl.c | 12 +-----------
xen/arch/x86/{debug.c => gdbsx.c} | 12 ++++++++++--
xen/include/asm-x86/debugger.h | 6 ------
xen/include/asm-x86/gdbsx.h | 19 +++++++++++++++++++
5 files changed, 31 insertions(+), 20 deletions(-)
rename xen/arch/x86/{debug.c => gdbsx.c} (93%)
create mode 100644 xen/include/asm-x86/gdbsx.hxen/arch/x86/Makefile +1 -1
@@ -20,7 +20,6 @@ obj-y += cpuid.o obj-$(CONFIG_PV) += compat.o obj-$(CONFIG_PV32) += x86_64/compat.o obj-$(CONFIG_KEXEC) += crash.o -obj-$(CONFIG_GDBSX) += debug.o obj-y += delay.o obj-y += desc.o obj-bin-y += dmi_scan.init.o
@@ -32,6 +31,7 @@ obj-y += emul-i8254.o obj-y += extable.o obj-y += flushtlb.o obj-$(CONFIG_CRASH_DEBUG) += gdbstub.o +obj-$(CONFIG_GDBSX) += gdbsx.o obj-y += hypercall.o obj-y += i387.o obj-y += i8259.o
xen/arch/x86/domctl.c +1 -11
@@ -20,6 +20,7 @@#include <xen/console.h> #include <xen/iocap.h> #include <xen/paging.h> +#include <asm/gdbsx.h> #include <asm/irq.h> #include <asm/hvm/emulate.h> #include <asm/hvm/hvm.h>
@@ -33,20 +34,9 @@#include <public/vm_event.h> #include <asm/mem_sharing.h> #include <asm/xstate.h> -#include <asm/debugger.h> #include <asm/psr.h> #include <asm/cpuid.h> -#ifdef CONFIG_GDBSX -static int gdbsx_guest_mem_io (domid_t domid,struct xen_domctl_gdbsx_memio *iop) -{ - iop->remain =dbg_rw_mem (iop->gva,guest_handle_from_ptr (iop->uva, void), - iop->len, domid, iop->gwr, iop->pgd3val); - -return iop->remain ? -EFAULT :0 ; -} -#endif -static int update_domain_cpu_policy (struct domain *d,xen_domctl_cpu_policy_t *xdpc) {
xen/arch/x86/gdbsx.c renamed from xen/arch/x86/debug.c +10 -2
@@ -19,7 +19,7 @@#include <xen/mm.h> #include <xen/domain_page.h> #include <xen/guest_access.h> -#include <asm/debugger.h> +#include <asm/gdbsx.h> #include <asm/p2m.h> typedef unsigned long dbgva_t ;
@@ -158,7 +158,7 @@ static unsigned int dbg_rw_guest_mem(struct domain *dp, unsigned long addr,* pgd3: value of init_mm.pgd[3] in guest. see above. * Returns: number of bytes remaining to be copied. */ -unsigned int dbg_rw_mem (unsigned long gva,XEN_GUEST_HANDLE_PARAM (void ) buf, +static unsigned int dbg_rw_mem (unsigned long gva,XEN_GUEST_HANDLE_PARAM (void ) buf,unsigned int len,domid_t domid,bool toaddr,uint64_t pgd3) {
@@ -174,6 +174,14 @@ unsigned int dbg_rw_mem(unsigned long gva, XEN_GUEST_HANDLE_PARAM(void) buf,return len; } +int gdbsx_guest_mem_io (domid_t domid,struct xen_domctl_gdbsx_memio *iop) +{ + iop->remain =dbg_rw_mem (iop->gva,guest_handle_from_ptr (iop->uva, void), + iop->len, domid, iop->gwr, iop->pgd3val); + +return iop->remain ? -EFAULT :0 ; +} +/* * Local variables: * mode: C
xen/include/asm-x86/debugger.h +0 -6
@@ -54,10 +54,4 @@ static inline bool debugger_trap_fatal(#endif -#ifdef CONFIG_GDBSX -unsigned int dbg_rw_mem (unsigned long gva,XEN_GUEST_HANDLE_PARAM (void ) buf, -unsigned int len,domid_t domid,bool toaddr, -uint64_t pgd3); -#endif -#endif /* __X86_DEBUGGER_H__ */
xen/include/asm-x86/gdbsx.h new file +19 -0
@@ -0,0 +1,19 @@ +#ifndef __X86_GDBX_H__ +#define __X86_GDBX_H__ + +#include <xen/errno.h> + +#ifdef CONFIG_GDBSX + +int gdbsx_guest_mem_io (domid_t domid,struct xen_domctl_gdbsx_memio *iop); + +#else + +static inline int gdbsx_guest_mem_io (domid_t domid,struct xen_domctl_gdbsx_memio *iop) +{ +return -EOPNOTSUPP ; +} + +#endif + +#endif
Signature · 1 line
2.32.0
Re: [PATCH v4 3/6] arch/x86: rename debug.c to gdbsx.c
xen/include/asm-x86/gdbsx.h line 4
Quoted 10 lines · Bobby Eshleman
xen/include/asm-x86/gdbsx.h new file +4
-0@@ -0,0 +1,19 @@ +#ifndef __X86_GDBX_H__ +#define __X86_GDBX_H__ + +#include <xen/errno.h>
The errno include wants to move below....
However, you need to avoid latent build errors based on the order of includes. I'd include public/domctl.h which will get you both domid_t and struct xen_domctl_gdbsx_memio.
xen/include/asm-x86/gdbsx.h line 11
Quoted 7 lines
xen/include/asm-x86/gdbsx.h new file +7
-0+ +#ifdef CONFIG_GDBSX + +int gdbsx_guest_mem_io (domid_t domid,struct xen_domctl_gdbsx_memio *iop); + +#else +
... specifically here.
~Andrew
Quoted 8 lines
xen/include/asm-x86/gdbsx.h new file +8
-0+static inline int gdbsx_guest_mem_io (domid_t domid,struct xen_domctl_gdbsx_memio *iop) +{ +return -EOPNOTSUPP ; +} + +#endif + +#endif
Re: [PATCH v4 3/6] arch/x86: rename debug.c to gdbsx.c
Quoted 14 lines · Andrew Cooper
xen/include/asm-x86/gdbsx.h line 4
Quoted 10 lines · Bobby Eshleman
xen/include/asm-x86/gdbsx.h new file +4
-0@@ -0,0 +1,19 @@ +#ifndef __X86_GDBX_H__ +#define __X86_GDBX_H__ + +#include <xen/errno.h> The errno include wants to move below....
Quoted 3 lines
However, you need to avoid latent build errors based on the order of includes. I'd include
public/domctl.hwhich will get you bothdomid_tand structxen_domctl_gdbsx_memio.
public/xen.h should suffice as ...
Quoted 9 lines
xen/include/asm-x86/gdbsx.h line 11
Quoted 6 lines
xen/include/asm-x86/gdbsx.h new file +6
-0+#ifdef CONFIG_GDBSX + +int gdbsx_guest_mem_io (domid_t domid,struct xen_domctl_gdbsx_memio *iop); + +#else +... specifically here.
Quoted 6 lines
~Andrew
xen/include/asm-x86/gdbsx.h line 15
Quoted 4 lines
xen/include/asm-x86/gdbsx.h new file +4
-0+static inline int gdbsx_guest_mem_io (domid_t domid,struct xen_domctl_gdbsx_memio *iop) +{ +return -EOPNOTSUPP ; +}
... for struct xen_domctl_gdbsx_memio a forward declaration is all that's needed here.
Jan
PATCH v4 4/6 x86/gdbsx: expand dbg_rw_mem() inline
In reply to Bobby EshlemanBecause dbg_rw_mem() has only a single call site, this commit expands it inline.
---
Changes in v4:
- Add DCO
xen/arch/x86/gdbsx.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-)
xen/arch/x86/gdbsx.c +9 -21
@@ -151,33 +151,21 @@ static unsigned int dbg_rw_guest_mem(struct domain *dp, unsigned long addr,return len; } -/* -* addr is guest addr -* buf is debugger buffer. -* if toaddr, then addr = buf (write to addr), else buf = addr (rd from guest) -* pgd3: value of init_mm.pgd[3] in guest. see above. -* Returns: number of bytes remaining to be copied. -*/ -static unsigned int dbg_rw_mem (unsigned long gva,XEN_GUEST_HANDLE_PARAM (void ) buf, -unsigned int len,domid_t domid,bool toaddr, -uint64_t pgd3) +int gdbsx_guest_mem_io (domid_t domid,struct xen_domctl_gdbsx_memio *iop) {struct domain *d =rcu_lock_domain_by_id (domid); -if ( d ) +if ( d && !d->is_dying ) { -if ( !d->is_dying ) - len =dbg_rw_guest_mem (d, gva, buf, len, toaddr, pgd3); -rcu_unlock_domain (d); + iop->remain =dbg_rw_guest_mem ( + d, iop->gva,guest_handle_from_ptr (iop->uva, void), + iop->len, domid, iop->pgd3val); } +else + iop->remain = iop->len; -return len; -} - -int gdbsx_guest_mem_io (domid_t domid,struct xen_domctl_gdbsx_memio *iop) -{ - iop->remain =dbg_rw_mem (iop->gva,guest_handle_from_ptr (iop->uva, void), - iop->len, domid, iop->gwr, iop->pgd3val); +if ( d ) +rcu_unlock_domain (d);return iop->remain ? -EFAULT :0 ; }
Signature · 1 line
2.32.0
Re: [PATCH v4 4/6] x86/gdbsx: expand dbg_rw_mem() inline
Quoted 4 lines · Bobby Eshleman
Because
dbg_rw_mem()has only a single call site, this commit expands it inline.Signed-off-by Bobby Eshleman <[email protected]>
PATCH v4 5/6 arch/x86: move domain_pause_for_debugger() to domain.h
In reply to Bobby Eshlemandomain_pause_for_debugger() was previously in debugger.h. This commit moves it to domain.h because its implementation is in domain.c.
---
Changes in v3:
- domain_pause_for_debugger() is now moved into debugger.h, not a new file debugger.c
Changes in v4:
- Don't unnecessarily include <asm/domain.h>
xen/arch/x86/nmi.c | 1 - xen/arch/x86/traps.c | 1 - xen/include/asm-x86/debugger.h | 2 -- xen/include/asm-x86/domain.h | 2 ++ 4 files changed, 2 insertions(+), 4 deletions(-)
xen/arch/x86/nmi.c +0 -1
@@ -30,7 +30,6 @@#include <asm/msr.h> #include <asm/mpspec.h> #include <asm/nmi.h> -#include <asm/debugger.h> #include <asm/div64.h> #include <asm/apic.h>
xen/arch/x86/traps.c +0 -1
@@ -62,7 +62,6 @@#include <asm/uaccess.h> #include <asm/i387.h> #include <asm/xstate.h> -#include <asm/debugger.h> #include <asm/msr.h> #include <asm/nmi.h> #include <asm/xenoprof.h>
xen/include/asm-x86/debugger.h +0 -2
@@ -26,8 +26,6 @@#include <asm/regs.h> #include <asm/processor.h> -void domain_pause_for_debugger (void ); -#ifdef CONFIG_CRASH_DEBUG #include <xen/gdbstub.h>
xen/include/asm-x86/domain.h +2 -0
@@ -672,6 +672,8 @@ void update_guest_memory_policy(struct vcpu *v,void domain_cpu_policy_changed (struct domain *d); +void domain_pause_for_debugger (void ); +bool update_runstate_area (struct vcpu *);bool update_secondary_system_time (struct vcpu *,struct vcpu_time_info *);
Signature · 1 line
2.32.0
Re: [PATCH v4 5/6] arch/x86: move domain_pause_for_debugger() to domain.h
Quoted 4 lines · Bobby Eshleman
domain_pause_for_debugger()was previously indebugger.h. This commit moves it todomain.hbecause its implementation is indomain.c.Signed-off-by Bobby Eshleman <[email protected]>
PATCH v4 6/6 x86: change asm/debugger.h to xen/debugger.h
In reply to Bobby EshlemanThis commit allows non-x86 architecture to omit the file asm/debugger.h if they do not require it. It changes debugger.h to be a general xen/debugger.h which, if CONFIG_CRASH_DEBUG, resolves to include asm/debugger.h.
It also changes all asm/debugger.h includes to xen/debugger.h.
Because it is no longer required, arm/debugger.h is removed.
---
Changes in v4:
- Replace #include <asm/regs.h> with struct cpu_user_regs
xen/arch/x86/traps.c | 1 + xen/common/domain.c | 2 +- xen/common/gdbstub.c | 2 +- xen/common/keyhandler.c | 2 +- xen/common/shutdown.c | 2 +- xen/drivers/char/console.c | 2 +- xen/include/asm-arm/debugger.h | 15 ---------- xen/include/asm-x86/debugger.h | 15 ---------- xen/include/xen/debugger.h | 51 ++++++++++++++++++++++++++++++++++ 9 files changed, 57 insertions(+), 35 deletions(-) delete mode 100644 xen/include/asm-arm/debugger.h create mode 100644 xen/include/xen/debugger.h
xen/arch/x86/traps.c +1 -0
@@ -35,6 +35,7 @@#include <xen/shutdown.h> #include <xen/guest_access.h> #include <asm/regs.h> +#include <xen/debugger.h> #include <xen/delay.h> #include <xen/event.h> #include <xen/spinlock.h>
xen/common/domain.c +1 -1
@@ -11,6 +11,7 @@#include <xen/err.h> #include <xen/param.h> #include <xen/sched.h> +#include <xen/debugger.h> #include <xen/domain.h> #include <xen/mm.h> #include <xen/event.h>
@@ -33,7 +34,6 @@#include <xen/xenoprof.h> #include <xen/irq.h> #include <xen/argo.h> -#include <asm/debugger.h> #include <asm/p2m.h> #include <asm/processor.h> #include <public/sched.h>
xen/common/gdbstub.c +1 -1
@@ -38,12 +38,12 @@#include <xen/serial.h> #include <xen/irq.h> #include <xen/watchdog.h> -#include <asm/debugger.h> #include <xen/init.h> #include <xen/param.h> #include <xen/smp.h> #include <xen/console.h> #include <xen/errno.h> +#include <xen/debugger.h> #include <xen/delay.h> #include <asm/byteorder.h>
xen/common/keyhandler.c +1 -1
@@ -3,6 +3,7 @@*/ #include <asm/regs.h> +#include <xen/debugger.h> #include <xen/delay.h> #include <xen/keyhandler.h> #include <xen/param.h>
@@ -20,7 +21,6 @@#include <xen/mm.h> #include <xen/watchdog.h> #include <xen/init.h> -#include <asm/debugger.h> #include <asm/div64.h> static unsigned char keypress_key;
xen/common/shutdown.c +1 -1
@@ -2,13 +2,13 @@#include <xen/lib.h> #include <xen/param.h> #include <xen/sched.h> +#include <xen/debugger.h> #include <xen/domain.h> #include <xen/delay.h> #include <xen/watchdog.h> #include <xen/shutdown.h> #include <xen/console.h> #include <xen/kexec.h> -#include <asm/debugger.h> #include <public/sched.h> /* opt_noreboot: If true, machine will need manual reset on error. */
xen/drivers/char/console.c +1 -1
@@ -15,6 +15,7 @@#include <xen/init.h> #include <xen/event.h> #include <xen/console.h> +#include <xen/debugger.h> #include <xen/param.h> #include <xen/serial.h> #include <xen/softirq.h>
@@ -26,7 +27,6 @@#include <xen/kexec.h> #include <xen/ctype.h> #include <xen/warning.h> -#include <asm/debugger.h> #include <asm/div64.h> #include <xen/hypercall.h> /* for do_console_io */ #include <xen/early_printk.h>
xen/include/asm-arm/debugger.h deleted +0 -15
@@ -1,15 +0,0 @@ -#ifndef __ARM_DEBUGGER_H__ -#define __ARM_DEBUGGER_H__ - -#define debugger_trap_fatal (v, r) (0) -#define debugger_trap_immediate () ((void) 0) - -#endif /* __ARM_DEBUGGER_H__ */ -/* -* Local variables: -* mode: C -* c-file-style: "BSD" -* c-basic-offset: 4 -* indent-tabs-mode: nil -* End: -*/
xen/include/asm-x86/debugger.h +0 -15
@@ -25,9 +25,6 @@#include <xen/sched.h> #include <asm/regs.h> #include <asm/processor.h> - -#ifdef CONFIG_CRASH_DEBUG -#include <xen/gdbstub.h> static inline bool debugger_trap_fatal(
@@ -40,16 +37,4 @@ static inline bool debugger_trap_fatal(/* Int3 is a trivial way to gather cpu_user_regs context. */ #define debugger_trap_immediate () __asm__ __volatile__ ( "int3" ); -#else - -static inline bool debugger_trap_fatal ( -unsigned int vector,struct cpu_user_regs *regs) -{ -return false; -} - -#define debugger_trap_immediate () ((void)0) - -#endif -#endif /* __X86_DEBUGGER_H__ */
xen/include/xen/debugger.h new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
2.32.0
Re: [PATCH v4 6/6] x86: change asm/debugger.h to xen/debugger.h
Quoted 10 lines · Bobby Eshleman
This commit allows non-x86 architecture to omit the file
asm/debugger.hif they do not require it. It changesdebugger.hto be a generalxen/debugger.hwhich, ifCONFIG_CRASH_DEBUG, resolves to includeasm/debugger.h.It also changes all
asm/debugger.hincludes toxen/debugger.h.Because it is no longer required,
arm/debugger.his removed.Signed-off-by Bobby Eshleman <[email protected]>
Julien also acked this patch.
Quoted 21 lines
xen/include/xen/debugger.h new file +15
-0@@ -0,0 +1,51 @@ +/****************************************************************************** +* Generic hooks into arch-dependent Xen. +* +* 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/>. +* +* Each debugger should define two functions here: +* +* 1. debugger_trap_fatal(): +* Called when Xen is about to give up and crash. Typically you will use this
xen/include/xen/debugger.h line 25
Quoted 10 lines
xen/include/xen/debugger.h new file +10
-0+* hook to drop into a debug session. It can also be used to hook off +* deliberately caused traps (which you then handle and return non-zero). +* +* 2. debugger_trap_immediate(): +* Called if we want to drop into a debugger now. This is essentially the +* same as debugger_trap_fatal, except that we use the current register state +* rather than the state which was in effect when we took the trap. +* For example: if we're dying because of an unhandled exception, we call +* debugger_trap_fatal; if we're dying because of a panic() we call +* debugger_trap_immediate().
This comment is now duplicated in x86's asm/debugger.h. The x86 copy wants deleting as part of this move.
xen/include/xen/debugger.h line 35
Quoted 10 lines
xen/include/xen/debugger.h new file +10
-0+*/ + +#ifndef __XEN_DEBUGGER_H__ +#define __XEN_DEBUGGER_H__ + +#ifdef CONFIG_CRASH_DEBUG + +#include <asm/debugger.h> + +#else
#include <xen/types.h> because you need bool and false to make this compile.
~Andrew
Quoted 16 lines
xen/include/xen/debugger.h new file +16
-0+ +struct cpu_user_regs ; + +static inline bool debugger_trap_fatal ( +unsigned int vector,const struct cpu_user_regs *regs) +{ +return false; +} + +static inline void debugger_trap_immediate (void ) +{ +} + +#endif /* CONFIG_CRASH_DEBUG */ + +#endif /* __XEN_DEBUGGER_H__ */