kdb
[Top] [All Lists]

RE: [PATCH 09/37] kgdb,blackfin: Add in kgdb_arch_set_pc for blackfin

To: "Mike Frysinger" <vapier.adi@xxxxxxxxx>, "Jason Wessel" <jason.wessel@xxxxxxxxxxxxx>
Subject: RE: [PATCH 09/37] kgdb,blackfin: Add in kgdb_arch_set_pc for blackfin
From: "Zhang, Sonic" <Sonic.Zhang@xxxxxxxxxx>
Date: Mon, 28 Dec 2009 17:49:15 +0800
Cc: <linux-kernel@xxxxxxxxxxxxxxx>, <kgdb-bugreport@xxxxxxxxxxxxxxxxxxxxx>, <kdb@xxxxxxxxxxx>, <mingo@xxxxxxx>
In-reply-to: <8bd0f97a0912261312x4b7c7df6s14ac0137b702044e@xxxxxxxxxxxxxx>
References: <1261603190-5036-1-git-send-email-jason.wessel@xxxxxxxxxxxxx> <1261603190-5036-2-git-send-email-jason.wessel@xxxxxxxxxxxxx> <1261603190-5036-3-git-send-email-jason.wessel@xxxxxxxxxxxxx> <1261603190-5036-4-git-send-email-jason.wessel@xxxxxxxxxxxxx> <1261603190-5036-5-git-send-email-jason.wessel@xxxxxxxxxxxxx> <1261603190-5036-6-git-send-email-jason.wessel@xxxxxxxxxxxxx> <1261603190-5036-7-git-send-email-jason.wessel@xxxxxxxxxxxxx> <1261603190-5036-8-git-send-email-jason.wessel@xxxxxxxxxxxxx> <1261603190-5036-9-git-send-email-jason.wessel@xxxxxxxxxxxxx> <1261603190-5036-10-git-send-email-jason.wessel@xxxxxxxxxxxxx> <8bd0f97a0912261312x4b7c7df6s14ac0137b702044e@xxxxxxxxxxxxxx>
Thread-index: AcqGcCfI8PfSjo8ZQ3SJCF39GAgpCwBLvsQg
Thread-topic: [PATCH 09/37] kgdb,blackfin: Add in kgdb_arch_set_pc for blackfin
There is no wonky.

Field pc in blackfin struct pt_regs is the same as reti register. 
    gdb_regs[BFIN_RETI] = regs->pc;

Field BFIN_PC in array gdb_regs contains the address which gdb thinks the 
kernel should resume from. And field retx is the resume address on current 
kernel stack.
    regs->retx = gdb_regs[BFIN_PC];


Jason's patch is fine to me.


Sonic


-----Original Message-----
From: Mike Frysinger [mailto:vapier.adi@xxxxxxxxx] 
Sent: Sunday, December 27, 2009 5:12 AM
To: Jason Wessel
Cc: linux-kernel@xxxxxxxxxxxxxxx; kgdb-bugreport@xxxxxxxxxxxxxxxxxxxxx; 
kdb@xxxxxxxxxxx; mingo@xxxxxxx; Zhang, Sonic
Subject: Re: [PATCH 09/37] kgdb,blackfin: Add in kgdb_arch_set_pc for blackfin

On Wed, Dec 23, 2009 at 16:19, Jason Wessel wrote:
> The new debug core api requires all architectures that use to debug 
> core to implement a function to set the program counter.
>
> CC: Mike Frysinger <vapier@xxxxxxxxxx>
> Signed-off-by: Jason Wessel <jason.wessel@xxxxxxxxxxxxx>
> ---
>  arch/blackfin/kernel/kgdb.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/arch/blackfin/kernel/kgdb.c b/arch/blackfin/kernel/kgdb.c 
> index f1036b6..5965188 100644
> --- a/arch/blackfin/kernel/kgdb.c
> +++ b/arch/blackfin/kernel/kgdb.c
> @@ -644,6 +644,11 @@ int kgdb_arch_remove_breakpoint(unsigned long 
> addr, char *bundle)
>        return bfin_probe_kernel_write((char *)addr, bundle, 
> BREAK_INSTR_SIZE);
>  }
>
> +void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip) {
> +       regs->retx = ip;
> +}
> +
>  int kgdb_arch_init(void)
>  {
>        kgdb_single_step = 0;

Sonic should be able to check this.  our pc handling seems a little wonky atm:

arch/blackfin/kernel/kgdb.c:
void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) { ...
    gdb_regs[BFIN_RETI] = regs->pc;
    gdb_regs[BFIN_RETX] = regs->retx;
    gdb_regs[BFIN_PC] = regs->pc;
...
}
...
void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) { ...
    regs->pc = gdb_regs[BFIN_PC];
    regs->retx = gdb_regs[BFIN_PC];
    /* nothing for BFIN_RETI */
...
}
-mike

<Prev in Thread] Current Thread [Next in Thread>