Patchwork [2/3] powerpc: Bail out of KGDB when we've been triggered

login
register
mail settings
Submitter Tiejun Chen
Date Aug. 22, 2012, 10:43 a.m.
Message ID <1345632192-19810-2-git-send-email-tiejun.chen@windriver.com>
Download mbox | patch
Permalink /patch/179296/
State Superseded
Headers show

Comments

Tiejun Chen - Aug. 22, 2012, 10:43 a.m.
We need to skip a breakpoint exception when it occurs after
a breakpoint has already been removed.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
 arch/powerpc/kernel/kgdb.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
Tabi Timur-B04825 - Aug. 22, 2012, 3:07 p.m.
On Wed, Aug 22, 2012 at 5:43 AM, Tiejun Chen <tiejun.chen@windriver.com> wrote:

> +int kgdb_skipexception(int exception, struct pt_regs *regs)
> +{
> +       if (kgdb_isremovedbreak(regs->nip))
> +               return 1;
> +
> +       return 0;
> +}

int kgdb_skipexception(int exception, struct pt_regs *regs)
{
        return !!kgdb_isremovedbreak(regs->nip));
}

If the caller only cares about zero vs. non-zero, you can drop the !!.
Tiejun Chen - Aug. 23, 2012, 1:54 a.m.
On 08/22/2012 11:07 PM, Tabi Timur-B04825 wrote:
> On Wed, Aug 22, 2012 at 5:43 AM, Tiejun Chen <tiejun.chen@windriver.com> wrote:
> 
>> +int kgdb_skipexception(int exception, struct pt_regs *regs)
>> +{
>> +       if (kgdb_isremovedbreak(regs->nip))
>> +               return 1;
>> +
>> +       return 0;
>> +}
> 
> int kgdb_skipexception(int exception, struct pt_regs *regs)
> {
>         return !!kgdb_isremovedbreak(regs->nip));
> }
> 
> If the caller only cares about zero vs. non-zero, you can drop the !!.

Yes, so 'return kgdb_isremovedbreak(regs->nip);' is already fine and simple.

I'll update this as v2 so thanks your comment.

Tiejun

Patch

diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index bbabc5a..e84252b 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -101,6 +101,24 @@  static int computeSignal(unsigned int tt)
 	return SIGHUP;		/* default for things we don't know about */
 }
 
+/**
+ *
+ *	kgdb_skipexception - Bail out of KGDB when we've been triggered.
+ *	@exception: Exception vector number
+ *	@regs: Current &struct pt_regs.
+ *
+ *	On some architectures we need to skip a breakpoint exception when
+ *	it occurs after a breakpoint has been removed.
+ *
+ */
+int kgdb_skipexception(int exception, struct pt_regs *regs)
+{
+	if (kgdb_isremovedbreak(regs->nip))
+		return 1;
+
+	return 0;
+}
+
 static int kgdb_call_nmi_hook(struct pt_regs *regs)
 {
 	kgdb_nmicallback(raw_smp_processor_id(), regs);