Fix the correct_hw_break() method for both i386 and x86_64 to update DR3 and
the corresponding bits in DR7. While at it:
- somewhat clarify the code setting the enable/type/length fileds in DR7;
- initilize the 'correctit' variable right when declaring it;
- fix the mangled initializer for the 'breakinfo' array in the x86_64 version.
Signed-off-by: Sergey Shtylyov <[EMAIL PROTECTED]>
---
Noticed some more cleanup possibilities. :-)
This patch is against the linux_2_6_21_uprev branch...
arch/i386/kernel/kgdb.c | 12 ++++++------
arch/x86_64/kernel/kgdb.c | 23 ++++++++++++-----------
2 files changed, 18 insertions(+), 17 deletions(-)
Index: linux-2.6/arch/i386/kernel/kgdb.c
===================================================================
--- linux-2.6.orig/arch/i386/kernel/kgdb.c
+++ linux-2.6/arch/i386/kernel/kgdb.c
@@ -15,6 +15,7 @@
/*
* Copyright (C) 2000-2001 VERITAS Software Corporation.
* Copyright (C) 2007 Wind River Systems, Inc.
+ * Copyright (C) 2007 MontaVista Software, Inc.
*/
/*
* Contributor: Lake Stevens Instrument Division$
@@ -131,21 +132,20 @@ static struct hw_breakpoint {
static void kgdb_correct_hw_break(void)
{
int breakno;
- int correctit;
int breakbit;
+ int correctit = 0;
unsigned long dr7;
get_debugreg(dr7, 7);
- correctit = 0;
- for (breakno = 0; breakno < 3; breakno++) {
+ for (breakno = 0; breakno < 4; breakno++) {
breakbit = 2 << (breakno << 1);
if (!(dr7 & breakbit) && breakinfo[breakno].enabled) {
correctit = 1;
dr7 |= breakbit;
dr7 &= ~(0xf0000 << (breakno << 2));
- dr7 |= (((breakinfo[breakno].len << 2) |
- breakinfo[breakno].type) << 16) <<
- (breakno << 2);
+ dr7 |= ((breakinfo[breakno].len << 2) |
+ breakinfo[breakno].type) <<
+ ((breakno << 2) + 16);
switch (breakno) {
case 0:
set_debugreg(breakinfo[breakno].addr, 0);
Index: linux-2.6/arch/x86_64/kernel/kgdb.c
===================================================================
--- linux-2.6.orig/arch/x86_64/kernel/kgdb.c
+++ linux-2.6/arch/x86_64/kernel/kgdb.c
@@ -18,6 +18,7 @@
* Copyright (C) 2002 Andi Kleen, SuSE Labs
* Copyright (C) 2004 LinSysSoft Technologies Pvt. Ltd.
* Copyright (C) 2007 Jason Wessel, Wind River Systems, Inc.
+ * Copyright (C) 2007 MontaVista Software, Inc.
*/
/****************************************************************************
* Contributor: Lake Stevens Instrument Division$
@@ -131,30 +132,30 @@ struct hw_breakpoint {
unsigned type;
unsigned len;
unsigned long addr;
-} breakinfo[4] = { {
-enabled:0}, {
-enabled:0}, {
-enabled:0}, {
-enabled:0}};
+} breakinfo[4] = {
+ { .enabled = 0 },
+ { .enabled = 0 },
+ { .enabled = 0 },
+ { .enabled = 0 },
+};
static void kgdb_correct_hw_break(void)
{
int breakno;
- int correctit;
int breakbit;
+ int correctit = 0;
unsigned long dr7;
get_debugreg(dr7, 7);
- correctit = 0;
- for (breakno = 0; breakno < 3; breakno++) {
+ for (breakno = 0; breakno < 4; breakno++) {
breakbit = 2 << (breakno << 1);
if (!(dr7 & breakbit) && breakinfo[breakno].enabled) {
correctit = 1;
dr7 |= breakbit;
dr7 &= ~(0xf0000 << (breakno << 2));
- dr7 |= (((breakinfo[breakno].len << 2) |
- breakinfo[breakno].type) << 16) <<
- (breakno << 2);
+ dr7 |= ((breakinfo[breakno].len << 2) |
+ breakinfo[breakno].type) <<
+ ((breakno << 2) + 16);
switch (breakno) {
case 0:
set_debugreg(breakinfo[breakno].addr, 0);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport