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

"Zhang, Sonic" <[email protected]> Mon, 28 Dec 2009 17:57:23 +0800
Newsgroups gmane.linux.kernel,gmane.linux.kernel.debugging.kgdb.bugs,gmane.linux.kernel.debugging
Message-ID <[email protected]>
In order to make the code clear, it is better to change pc in struct pr=
_regs to reti.


Sonic=20

-----Original Message-----
=46rom: Mike Frysinger [mailto:[email protected]]=20
Sent: Sunday, December 27, 2009 5:12 AM
To: Jason Wessel
Cc: [email protected]; [email protected];=
 [email protected]; [email protected]; Zhang, Sonic
Subject: Re: [PATCH 09/37] kgdb,blackfin: Add in kgdb_arch_set_pc for b=
lackfin

On Wed, Dec 23, 2009 at 16:19, Jason Wessel wrote:
> The new debug core api requires all architectures that use to debug=20
> core to implement a function to set the program counter.
>
> CC: Mike Frysinger <[email protected]>
> Signed-off-by: Jason Wessel <[email protected]>
> ---
> =A0arch/blackfin/kernel/kgdb.c | =A0 =A05 +++++
> =A01 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/arch/blackfin/kernel/kgdb.c b/arch/blackfin/kernel/kgdb.=
c=20
> 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=20
> addr, char *bundle)
> =A0 =A0 =A0 =A0return bfin_probe_kernel_write((char *)addr, bundle,=20
> BREAK_INSTR_SIZE);
> =A0}
>
> +void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip) {
> + =A0 =A0 =A0 regs->retx =3D ip;
> +}
> +
> =A0int kgdb_arch_init(void)
> =A0{
> =A0 =A0 =A0 =A0kgdb_single_step =3D 0;

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

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