powerpc: Replace hardcoded offset by BREAK_INSTR_SIZE
PATCH 1/1 powerpc: Replace hardcoded offset by BREAK_INSTR_SIZE
kgdb_handle_breakpoint checks the first arch_kgdb_breakpoint which is not known by gdb that's why is necessary jump over it. The jump lenght is equal to BREAK_INSTR_SIZE that's why is cleaner to use defined macro instead of hardcoded non-described offset.
--- arch/powerpc/kernel/kgdb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/kernel/kgdb.c +1 -1
@@ -129,7 +129,7 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)return 0 ;if (*(u32 *) (regs->nip) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr)) - regs->nip +=4 ; + regs->nip +=BREAK_INSTR_SIZE ;return 1 ; }
Signature · 1 line
1.5.5.6
Quoted 7 lines · Michal Simek
kgdb_handle_breakpointchecks the firstarch_kgdb_breakpointwhich is not known by gdb that's why is necessary jump over it. The jump lenght is equal toBREAK_INSTR_SIZEthat's why is cleaner to use defined macro instead of hardcoded non-described offset.
Seems fine to me. I'll add this to the kgdb merge queue for 2.6.36.
Jason.
Quoted 22 lines
Signed-off-by Michal Simek <[email protected]>CC Jason Wessel <[email protected]>CC Benjamin Herrenschmidt <[email protected]>--- arch/powerpc/kernel/kgdb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/powerpc/kernel/kgdb.c +1
-1@@ -129,7 +129,7 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)return 0 ;if (*(u32 *) (regs->nip) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr)) - regs->nip +=4 ; + regs->nip +=BREAK_INSTR_SIZE ;return 1 ; }
Quoted 19 lines · Michal Simek
kgdb_handle_breakpointchecks the firstarch_kgdb_breakpointwhich is not known by gdb that's why is necessary jump over it. The jump lenght is equal toBREAK_INSTR_SIZEthat's why is cleaner to use defined macro instead of hardcoded non-described offset.Signed-off-by Michal Simek <[email protected]>CC Jason Wessel <[email protected]>CC Benjamin Herrenschmidt <[email protected]>--- arch/powerpc/kernel/kgdb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/powerpc/kernel/kgdb.c +0
-0
arch/powerpc/kernel/kgdb.c static int kgdb_handle_breakpoint(struct pt_regs *regs) · line 132
Quoted 5 lines
arch/powerpc/kernel/kgdb.c +1
-1@@ -129,7 +129,7 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)return 0 ;if (*(u32 *) (regs->nip) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr)) - regs->nip +=4 ; + regs->nip +=BREAK_INSTR_SIZE ;
Except to powerpc fokls, who intuitively know what nip + 4 means, but will have to lookup what BREAK_INSTR_SIZE is to be sure. But I'm being nit-picky :)
cheers