linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: dbaryshkov@gmail.com (Dmitry Eremin-Solenikov)
To: linux-arm-kernel@lists.infradead.org
Subject: Problem with GDB when debugging IRQ handlers
Date: Wed, 29 Jun 2011 15:20:58 +0400	[thread overview]
Message-ID: <BANLkTinqnW7sY0Nf5bR1KhVZa2ouyh2x0Q@mail.gmail.com> (raw)
In-Reply-To: <20110629090941.GD10623@e102109-lin.cambridge.arm.com>

On 6/29/11, Catalin Marinas <catalin.marinas@arm.com> wrote:
> On Tue, Jun 28, 2011 at 11:26:28PM +0100, Dmitry Eremin-Solenikov wrote:
>> On 6/28/11, Catalin Marinas <catalin.marinas@arm.com> wrote:
>> > On Tue, Jun 28, 2011 at 04:45:52PM +0100, Dmitry Eremin-Solenikov wrote:
>> >>  	.macro	svc_entry, stack_hole=0
>> >>   UNWIND(.fnstart		)
>> >> +	.cfi_startproc
>> >>   UNWIND(.save {r0 - pc}		)
>> >>  	sub	sp, sp, #(S_FRAME_SIZE + \stack_hole - 4)
>> >>  #ifdef CONFIG_THUMB2_KERNEL
>> >> @@ -146,6 +148,24 @@ ENDPROC(__und_invalid)
>> >>  	@  r4 - orig_r0 (see pt_regs definition in ptrace.h)
>> >>  	@
>> >>  	stmia	r5, {r0 - r4}
>> >> +	.cfi_def_cfa_offset S_PC + 4
>> >> +	.cfi_offset 14, -4
>> >> +#define	CFI_REG_OFF(r) .cfi_offset r, (r - 16) * 4
>> >> +	CFI_REG_OFF(13)
>> >> +	CFI_REG_OFF(12)
>> >> +	CFI_REG_OFF(11)
>> >> +	CFI_REG_OFF(10)
>> >> +	CFI_REG_OFF(9)
>> >> +	CFI_REG_OFF(8)
>> >> +	CFI_REG_OFF(7)
>> >> +	CFI_REG_OFF(6)
>> >> +	CFI_REG_OFF(5)
>> >> +	CFI_REG_OFF(4)
>> >> +	CFI_REG_OFF(3)
>> >> +	CFI_REG_OFF(2)
>> >> +	CFI_REG_OFF(1)
>> >> +	CFI_REG_OFF(0)
>> >> +#undef CFI_REG_OFF
>> >>  	.endm
>> >
>> > Do we need all the registers in here for gdb stack unwinding? In general
>> > we would only need LR, SP and FP.
>>
>> CFI info isn't only related to stack unwinding. IIUC (I'll have to run
>> more experiments) these instrutions will help me to get correct
>> variables/arguments values in the before-exception stack frames.
>
> OK, in this case we may need to add some annotations. You could actually
> generate a .s file from and existing C one (including -g) and see what
> .cfi directives it generates.

Yes, that actually gave me some ideas. Unfortunately entry*.S files are
a bit ... uncommon, so there are nearly no 1-1 cases. BTW: It seems x86
has .cfi annotations connected to most if not all assembler commands.
I think this is a bit too much, but you got the idea.

-- 
With best wishes
Dmitry

  reply	other threads:[~2011-06-29 11:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-27 12:53 Problem with GDB when debugging IRQ handlers Dmitry Eremin-Solenikov
2011-06-27 13:27 ` Russell King - ARM Linux
2011-06-27 14:04   ` Dmitry Eremin-Solenikov
2011-06-27 14:11     ` Hui Zhu
2011-06-27 14:58     ` Yao Qi
2011-06-28 10:39       ` Russell King - ARM Linux
2011-06-28 12:06         ` Dmitry Eremin-Solenikov
2011-06-28 12:13           ` Russell King - ARM Linux
2011-06-28 14:20           ` Catalin Marinas
2011-06-28 14:30             ` Catalin Marinas
2011-06-28 14:37               ` Russell King - ARM Linux
2011-06-28 14:42                 ` Catalin Marinas
2011-06-28 14:44               ` Dmitry Eremin-Solenikov
2011-06-28 14:54                 ` Dmitry Eremin-Solenikov
2011-06-28 15:06                   ` Catalin Marinas
2011-06-28 15:45                     ` Dmitry Eremin-Solenikov
2011-06-28 16:11                       ` Catalin Marinas
2011-06-28 22:26                         ` Dmitry Eremin-Solenikov
2011-06-29  9:09                           ` Catalin Marinas
2011-06-29 11:20                             ` Dmitry Eremin-Solenikov [this message]
2011-06-28 12:06         ` Hui Zhu
2011-06-28 12:09           ` Russell King - ARM Linux
2011-06-28 13:24             ` Catalin Marinas
2011-06-28 13:15   ` Catalin Marinas

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=BANLkTinqnW7sY0Nf5bR1KhVZa2ouyh2x0Q@mail.gmail.com \
    --to=dbaryshkov@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).