gdbmach.c revision a734c64bff58bda2fa48c2795453e092167b0ff7
/*
* Copyright (C) 2008 Stefan Hajnoczi <stefanha@gmail.com>.
*
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stddef.h>
#include <stdio.h>
#include <assert.h>
#include <gdbmach.h>
/** @file
*
* GDB architecture-specific bits for i386
*
*/
enum {
};
/** Hardware breakpoint, fields stored in x86 bit pattern form */
struct hwbp {
int type; /* type (1=write watchpoint, 3=access watchpoint) */
unsigned long addr; /* linear address */
int enabled;
};
unsigned int i;
return &hwbps [ i ];
}
}
}
return available;
}
/* Set breakpoint address */
switch ( regnum ) {
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
}
/* Set type */
/* Set length */
}
/* Check and convert breakpoint type to x86 type */
switch ( type ) {
case GDBMACH_WATCH:
type = 0x1;
break;
case GDBMACH_AWATCH:
type = 0x3;
break;
default:
return 0; /* unsupported breakpoint type */
}
/* Only lengths 1, 2, and 4 are supported */
len = 1;
}
len--; /* convert to x86 breakpoint length bit pattern */
/* Calculate linear address by adding segment base */
addr += virt_offset;
/* Set up the breakpoint */
if ( !bp ) {
return 0; /* ran out of hardware breakpoints */
}
gdbmach_commit_hwbp ( bp );
return 1;
}
static void gdbmach_disable_hwbps ( void ) {
/* Store and clear hardware breakpoints */
}
static void gdbmach_enable_hwbps ( void ) {
/* Clear breakpoint status register */
/* Restore hardware breakpoints */
}
}