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: Tue, 28 Jun 2011 18:54:11 +0400	[thread overview]
Message-ID: <BANLkTinoLB89VAWh-tSswq+H9EcmcQWnXQ@mail.gmail.com> (raw)
In-Reply-To: <BANLkTinL7-Kjx5fHrwHYHHhgjJ-6ex3=eA@mail.gmail.com>

On 6/28/11, Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> wrote:
> On 6/28/11, Catalin Marinas <catalin.marinas@arm.com> wrote:
>> On Tue, Jun 28, 2011 at 03:20:45PM +0100, Catalin Marinas wrote:
>>> On Tue, Jun 28, 2011 at 04:06:11PM +0400, Dmitry Eremin-Solenikov wrote:
>>> > On 6/28/11, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
>>> > I did some checks. It seems, the problem isn't related to unwinder. At
>>> > least
>>> > it looks like kernel has all necessary unwinding subops. It looks like
>>> > the
>>> > problem is really related to the lack of necessary .cfi information.
>>> > At
>>> > least
>>> > when i added .cfi_startproc/.cfi_endproc annotations to entry-armv.S
>>> > code,
>>> > gdb stopped decoding backtrace with the "previous frame identical to
>>> > this frame"
>>> > error. Unfortunately I don't have enough knowledge to add .cfi
>>> > annotations to
>>> > irq handlers.
>>>
>>> I think it may have stopped decoding because of some information it
>>> reads from the stack doesn't look sane. But I wonder whether we could
>>> get it looping again depending on the register values in the interrupted
>>> context.
>>>
>>> > diff --git a/arch/arm/kernel/entry-armv.S
>>> > b/arch/arm/kernel/entry-armv.S
>>> > index e8d8856..d77f9d7 100644
>>> > --- a/arch/arm/kernel/entry-armv.S
>>> > +++ b/arch/arm/kernel/entry-armv.S
>>> > @@ -28,6 +28,7 @@
>>> >  #include "entry-header.S"
>>> >  #include <asm/entry-macro-multi.S>
>>> >
>>> > +	.cfi_sections	.debug_frame
>>> >  /*
>>> >   * Interrupt handling.  Preserves r7, r8, r9
>>> >   */
>>> > @@ -113,6 +114,7 @@ ENDPROC(__und_invalid)
>>> >
>>> >  	.macro	svc_entry, stack_hole=0
>>> >   UNWIND(.fnstart		)
>>> > +	.cfi_startproc
>>> >   UNWIND(.save {r0 - pc}		)
>>> >  	sub	sp, sp, #(S_FRAME_SIZE + \stack_hole - 4)
>>>
>>> Could you add some directives like below in the svc_entry macro (after
>>> "sub sp...", not sure if it matters) and check whether gdb behaves
>>> better:
>>>
>>> 	.cfi_def_cfa_offset S_PC
>>> 	.cfi_offset 14, -4
>>
>> Actually since the return address is in S_PC (which maybe gdb assumes it
>> would be the saved LR), this is probably not be correct. After SVC
>> entry, we have he following structure on the stack:
>>
>> 	ORIG_r0
>> 	CPSR
>> 		<--- assuming this is the Call Frame Address (SP+S_PC+4)
>> 	PC	<--- CFA - 4
>> 	LR	<--- don't care
>> 	SP	<--- CFA - 12
>> 	...
>>
>>
>> So we tell gdb about this with something like below (untested):
>>
>> 	.cfi_def_cfa_offset S_PC + 4
>> 	.cfi_offset 14, -4
>> 	.cfi_offset 13, -12
>
> This brings "unknown CFA rule" gdb exception, but it seems I got your idea.

No, this seems to work, it was my fault. I got more or less reasonable
backtrace now.

-- 
With best wishes
Dmitry

  reply	other threads:[~2011-06-28 14:54 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 [this message]
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
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=BANLkTinoLB89VAWh-tSswq+H9EcmcQWnXQ@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).