From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: yao@codesourcery.com
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH/arm] Backtrace through exception frames on arm/cortex-m target
Date: Tue, 13 Nov 2012 14:27:00 -0000 [thread overview]
Message-ID: <201211131427.qADERVUl015787@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <1352816140-3221-1-git-send-email-yao@codesourcery.com> (message from Yao Qi on Tue, 13 Nov 2012 22:15:40 +0800)
> From: Yao Qi <yao@codesourcery.com>
> Date: Tue, 13 Nov 2012 22:15:40 +0800
>
> Hi,
> This patch adds support for backtracing through exceptions on
> M-profile targets. Dan wrote this patch two years ago, tested
> by hand that set a breakpoint on an interrupt handler and GDB will
> show the complete stack frame including the exception handler
> and the source location that caused the fault. I update the patch a
> little for some API changes in GDB trunk.
>
> I considered to write a test case for this, but it hard to write
> single case for different corex-m boards with different system
> libraries. So no test case is included.
>
> Regression tested for arm-none-eabi (-march=armv6-m and -march=armv7-m
> respectively) and arm-none-linux-gnueabi (-marm/-mthumb
> -march=armv4/-mthumb -march=armv7-a). OK to apply?
No. Because...
> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
> index 1a67366..5f22649 100644
> --- a/gdb/arm-tdep.c
> +++ b/gdb/arm-tdep.c
> @@ -448,6 +448,11 @@ arm_pc_is_thumb (struct gdbarch *gdbarch, CORE_ADDR memaddr)
> static CORE_ADDR
> arm_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR val)
> {
> + /* On M-profile devices, do not strip the low bit from EXC_RETURN
> + (the magic exception return address). */
> + if (gdbarch_tdep (gdbarch)->is_m && (val & 0xfffffff0) == 0xfffffff0)
> + return val;
> +
> if (arm_apcs_32)
> return UNMAKE_THUMB_ADDR (val);
> else
> @@ -2926,6 +2931,103 @@ struct frame_unwind arm_stub_unwind = {
> arm_stub_unwind_sniffer
> };
>
> +static struct arm_prologue_cache *
> +arm_m_exception_cache (struct frame_info *this_frame)
> +{
> + struct gdbarch *gdbarch = get_frame_arch (this_frame);
> + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
> + struct arm_prologue_cache *cache;
> + CORE_ADDR unwound_sp;
> + LONGEST xpsr;
> +
> + cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache);
> + cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
> +
> + unwound_sp = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM);
Calling get_frame_register_unsign(this_frame, ...) in the unwinder
itself is verboten!.
next prev parent reply other threads:[~2012-11-13 14:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-13 14:16 Yao Qi
2012-11-13 14:27 ` Mark Kettenis [this message]
2012-11-13 14:44 ` Yao Qi
2012-11-13 15:12 ` Mark Kettenis
2012-11-13 15:50 ` Joel Brobecker
2012-11-14 2:23 ` Yao Qi
2012-11-14 2:57 ` Joel Brobecker
2012-11-14 3:48 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201211131427.qADERVUl015787@glazunov.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=gdb-patches@sourceware.org \
--cc=yao@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox