aboutsummaryrefslogtreecommitdiff
path: root/gdb/v850ice.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-07-07 20:19:36 +0000
committerJason Molenda <jmolenda@apple.com>1999-07-07 20:19:36 +0000
commitc5aa993b1f4add48fbdc6cc3117059f616e49875 (patch)
treec809d06515a34428cc8df5f758fbc1b6117d4c30 /gdb/v850ice.c
parent3a4b77d8bee950afce6f9702aa65dc0e60817a82 (diff)
downloadgdb-c5aa993b1f4add48fbdc6cc3117059f616e49875.zip
gdb-c5aa993b1f4add48fbdc6cc3117059f616e49875.tar.gz
gdb-c5aa993b1f4add48fbdc6cc3117059f616e49875.tar.bz2
import gdb-1999-07-07 post reformat
Diffstat (limited to 'gdb/v850ice.c')
-rw-r--r--gdb/v850ice.c603
1 files changed, 302 insertions, 301 deletions
diff --git a/gdb/v850ice.c b/gdb/v850ice.c
index da2b4c9..fc04e28 100644
--- a/gdb/v850ice.c
+++ b/gdb/v850ice.c
@@ -1,21 +1,22 @@
/* ICE interface for the NEC V850 for GDB, the GNU debugger.
Copyright 1996, Free Software Foundation, Inc.
-This file is part of GDB.
+ This file is part of GDB.
-This program is free software; you can redistribute it and/or 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
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or 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
+ (at your option) 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.
+ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "gdb_string.h"
@@ -31,17 +32,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "command.h"
#include <windows.h>
-#include <winuser.h> /* for WM_USER */
+#include <winuser.h> /* for WM_USER */
+
+extern unsigned long int strtoul (const char *nptr, char **endptr,
+ int base);
-extern unsigned long int strtoul(const char *nptr, char **endptr,
- int base);
-
/* Local data definitions */
struct MessageIO
-{
- int size; /* length of input or output in bytes */
- char * buf; /* buffer having the input/output information */
-};
+ {
+ int size; /* length of input or output in bytes */
+ char *buf; /* buffer having the input/output information */
+ };
/* Prototypes for functions located in other files */
extern void break_command PARAMS ((char *, int));
@@ -59,18 +60,18 @@ static int init_hidden_window PARAMS ((void));
static LRESULT CALLBACK v850ice_wndproc PARAMS ((HWND, UINT, WPARAM, LPARAM));
-static void v850ice_files_info PARAMS ((struct target_ops *ignore));
+static void v850ice_files_info PARAMS ((struct target_ops * ignore));
static int v850ice_xfer_memory PARAMS ((CORE_ADDR memaddr, char *myaddr,
int len, int should_write,
- struct target_ops *target));
+ struct target_ops * target));
static void v850ice_prepare_to_store PARAMS ((void));
static void v850ice_fetch_registers PARAMS ((int regno));
static void v850ice_resume PARAMS ((int pid, int step,
- enum target_signal siggnal));
+ enum target_signal siggnal));
static void v850ice_open PARAMS ((char *name, int from_tty));
@@ -82,7 +83,7 @@ static void v850ice_store_registers PARAMS ((int regno));
static void v850ice_mourn PARAMS ((void));
-static int v850ice_wait PARAMS ((int pid, struct target_waitstatus *status));
+static int v850ice_wait PARAMS ((int pid, struct target_waitstatus * status));
static void v850ice_kill PARAMS ((void));
@@ -122,49 +123,49 @@ static void do_gdb (char *, char *, void (*func) PARAMS ((char *, int)), int);
/* Globals */
-static HWND hidden_hwnd; /* HWND for messages */
+static HWND hidden_hwnd; /* HWND for messages */
-long (__stdcall *ExeAppReq) PARAMS ((char *, long, char *, struct MessageIO *));
+long (__stdcall * ExeAppReq) PARAMS ((char *, long, char *, struct MessageIO *));
-long (__stdcall *RegisterClient) PARAMS ((HWND));
+long (__stdcall * RegisterClient) PARAMS ((HWND));
-long (__stdcall *UnregisterClient) PARAMS ((void));
+long (__stdcall * UnregisterClient) PARAMS ((void));
/* Globals local to this file only */
-static int ice_open = 0; /* Is ICE open? */
+static int ice_open = 0; /* Is ICE open? */
-static char * v850_CB_Result; /* special char array for saving 'callback' results */
+static char *v850_CB_Result; /* special char array for saving 'callback' results */
-static int SimulateCallback; /* simulate a callback event */
+static int SimulateCallback; /* simulate a callback event */
-#define MAX_BLOCK_SIZE 64*1024 /* Cannot transfer memory in blocks bigger
- than this */
+#define MAX_BLOCK_SIZE 64*1024 /* Cannot transfer memory in blocks bigger
+ than this */
/* MDI/ICE Message IDs */
-#define GSINGLESTEP 0x200 /* single-step target */
-#define GRESUME 0x201 /* resume target */
-#define GREADREG 0x202 /* read a register */
-#define GWRITEREG 0x203 /* write a register */
-#define GWRITEBLOCK 0x204 /* write a block of memory */
-#define GREADBLOCK 0x205 /* read a block of memory */
-#define GSETBREAK 0x206 /* set a breakpoint */
-#define GREMOVEBREAK 0x207 /* remove a breakpoint */
-#define GHALT 0x208 /* ??? */
-#define GCHECKSTATUS 0x209 /* check status of ICE */
-#define GMDIREPLY 0x210 /* Reply for previous query - NOT USED */
-#define GDOWNLOAD 0x211 /* something for MDI */
-#define GCOMMAND 0x212 /* execute command in ice */
-#define GLOADFILENAME 0x213 /* retrieve load filename */
-#define GWRITEMEM 0x214 /* write word, half-word, or byte */
+#define GSINGLESTEP 0x200 /* single-step target */
+#define GRESUME 0x201 /* resume target */
+#define GREADREG 0x202 /* read a register */
+#define GWRITEREG 0x203 /* write a register */
+#define GWRITEBLOCK 0x204 /* write a block of memory */
+#define GREADBLOCK 0x205 /* read a block of memory */
+#define GSETBREAK 0x206 /* set a breakpoint */
+#define GREMOVEBREAK 0x207 /* remove a breakpoint */
+#define GHALT 0x208 /* ??? */
+#define GCHECKSTATUS 0x209 /* check status of ICE */
+#define GMDIREPLY 0x210 /* Reply for previous query - NOT USED */
+#define GDOWNLOAD 0x211 /* something for MDI */
+#define GCOMMAND 0x212 /* execute command in ice */
+#define GLOADFILENAME 0x213 /* retrieve load filename */
+#define GWRITEMEM 0x214 /* write word, half-word, or byte */
/* GCHECKSTATUS return codes: */
#define ICE_Idle 0x00
-#define ICE_Breakpoint 0x01 /* hit a breakpoint */
-#define ICE_Stepped 0x02 /* have stepped */
-#define ICE_Exception 0x03 /* have exception */
-#define ICE_Halted 0x04 /* hit a user halt */
-#define ICE_Exited 0x05 /* called exit */
-#define ICE_Terminated 0x06 /* user terminated */
+#define ICE_Breakpoint 0x01 /* hit a breakpoint */
+#define ICE_Stepped 0x02 /* have stepped */
+#define ICE_Exception 0x03 /* have exception */
+#define ICE_Halted 0x04 /* hit a user halt */
+#define ICE_Exited 0x05 /* called exit */
+#define ICE_Terminated 0x06 /* user terminated */
#define ICE_Running 0x07
#define ICE_Unknown 0x99
@@ -176,13 +177,13 @@ static int SimulateCallback; /* simulate a callback event */
#define WM_SOURCE WM_USER+105
/* STATE_CHANGE codes */
-#define STATE_CHANGE_REGS 1 /* Register(s) changed */
-#define STATE_CHANGE_LOAD 2 /* HW reset */
-#define STATE_CHANGE_RESET 3 /* Load new file */
-#define STATE_CHANGE_CONT 4 /* Run target */
-#define STATE_CHANGE_STOP 5 /* Stop target */
-#define STATE_CHANGE_STEPI 6 /* Stepi target */
-#define STATE_CHANGE_NEXTI 7 /* Nexti target */
+#define STATE_CHANGE_REGS 1 /* Register(s) changed */
+#define STATE_CHANGE_LOAD 2 /* HW reset */
+#define STATE_CHANGE_RESET 3 /* Load new file */
+#define STATE_CHANGE_CONT 4 /* Run target */
+#define STATE_CHANGE_STOP 5 /* Stop target */
+#define STATE_CHANGE_STEPI 6 /* Stepi target */
+#define STATE_CHANGE_NEXTI 7 /* Nexti target */
static struct target_ops v850ice_ops; /* Forward decl */
@@ -206,12 +207,12 @@ init_hidden_window ()
class.hIcon = NULL;
class.hCursor = NULL;
- if (! RegisterClass (&class))
+ if (!RegisterClass (&class))
return 0;
hidden_hwnd = CreateWindow ("gdb_v850ice", "gdb_v850ice", WS_TILED,
- 0, 0, 0, 0, NULL, NULL, class.hInstance,
- NULL);
+ 0, 0, 0, 0, NULL, NULL, class.hInstance,
+ NULL);
if (hidden_hwnd == NULL)
{
char buf[200];
@@ -219,7 +220,7 @@ init_hidden_window ()
err = GetLastError ();
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
- 0, buf, 200, NULL);
+ 0, buf, 200, NULL);
printf_unfiltered ("Could not create window: %s", buf);
return 0;
}
@@ -236,7 +237,7 @@ init_hidden_window ()
WM_ADDR_TO_SYM | Not implemented at NEC's request
WM_DISASSEMBLY /
WM_STATE_CHANGE - tells us that a state change has occured in the ICE
-*/
+ */
static LRESULT CALLBACK
v850ice_wndproc (hwnd, message, wParam, lParam)
HWND hwnd;
@@ -258,50 +259,50 @@ v850ice_wndproc (hwnd, message, wParam, lParam)
break;
case WM_STATE_CHANGE:
switch (wParam)
- {
- case STATE_CHANGE_LOAD:
- {
- struct MessageIO iob;
- char buf[128];
-
- iob.buf = buf;
- iob.size = 128;
-
- /* Load in a new file... Need filename */
- ExeAppReq ("GDB", GLOADFILENAME, NULL, &iob);
- if (!catch_errors ((catch_errors_ftype *) ice_file, iob.buf, "", RETURN_MASK_ALL))
- printf_unfiltered ("load errored\n");
- }
- break;
- case STATE_CHANGE_RESET:
- registers_changed ();
- flush_cached_frames ();
- togdb_force_update ();
- result = TRUE;
- break;
- case STATE_CHANGE_REGS:
- registers_changed ();
- togdb_force_update ();
- result = TRUE;
- break;
- case STATE_CHANGE_CONT:
- if (!catch_errors ((catch_errors_ftype *)ice_cont, NULL, "", RETURN_MASK_ALL))
- printf_unfiltered ("continue errored\n");
- result = TRUE;
- break;
- case STATE_CHANGE_STEPI:
- if (!catch_errors ((catch_errors_ftype *)ice_stepi, (PTR)(int) lParam, "",
- RETURN_MASK_ALL))
- printf_unfiltered ("stepi errored\n");
- result = TRUE;
- break;
- case STATE_CHANGE_NEXTI:
- if (!catch_errors ((catch_errors_ftype *)ice_nexti, (PTR)(int) lParam, "",
- RETURN_MASK_ALL))
- printf_unfiltered ("nexti errored\n");
- result = TRUE;
- break;
- }
+ {
+ case STATE_CHANGE_LOAD:
+ {
+ struct MessageIO iob;
+ char buf[128];
+
+ iob.buf = buf;
+ iob.size = 128;
+
+ /* Load in a new file... Need filename */
+ ExeAppReq ("GDB", GLOADFILENAME, NULL, &iob);
+ if (!catch_errors ((catch_errors_ftype *) ice_file, iob.buf, "", RETURN_MASK_ALL))
+ printf_unfiltered ("load errored\n");
+ }
+ break;
+ case STATE_CHANGE_RESET:
+ registers_changed ();
+ flush_cached_frames ();
+ togdb_force_update ();
+ result = TRUE;
+ break;
+ case STATE_CHANGE_REGS:
+ registers_changed ();
+ togdb_force_update ();
+ result = TRUE;
+ break;
+ case STATE_CHANGE_CONT:
+ if (!catch_errors ((catch_errors_ftype *) ice_cont, NULL, "", RETURN_MASK_ALL))
+ printf_unfiltered ("continue errored\n");
+ result = TRUE;
+ break;
+ case STATE_CHANGE_STEPI:
+ if (!catch_errors ((catch_errors_ftype *) ice_stepi, (PTR) (int) lParam, "",
+ RETURN_MASK_ALL))
+ printf_unfiltered ("stepi errored\n");
+ result = TRUE;
+ break;
+ case STATE_CHANGE_NEXTI:
+ if (!catch_errors ((catch_errors_ftype *) ice_nexti, (PTR) (int) lParam, "",
+ RETURN_MASK_ALL))
+ printf_unfiltered ("nexti errored\n");
+ result = TRUE;
+ break;
+ }
}
if (result == FALSE)
@@ -339,20 +340,20 @@ v850ice_open (name, from_tty)
{
handle = LoadLibrary ("necmsg.dll");
if (handle == NULL)
- error ("Cannot load necmsg.dll");
+ error ("Cannot load necmsg.dll");
- ExeAppReq = (long (*) PARAMS ((char *, long, char *, struct MessageIO *)))
- GetProcAddress (handle, "ExeAppReq");
- RegisterClient = (long (*) PARAMS ((HWND)))
- GetProcAddress (handle, "RegisterClient");
- UnregisterClient = (long (*) PARAMS ((void)))
- GetProcAddress (handle, "UnregisterClient");
+ ExeAppReq = (long (*)PARAMS ((char *, long, char *, struct MessageIO *)))
+ GetProcAddress (handle, "ExeAppReq");
+ RegisterClient = (long (*)PARAMS ((HWND)))
+ GetProcAddress (handle, "RegisterClient");
+ UnregisterClient = (long (*)PARAMS ((void)))
+ GetProcAddress (handle, "UnregisterClient");
if (ExeAppReq == NULL || RegisterClient == NULL || UnregisterClient == NULL)
- error ("Could not find requisite functions in necmsg.dll.");
+ error ("Could not find requisite functions in necmsg.dll.");
if (!init_hidden_window ())
- error ("could not initialize message handling");
+ error ("could not initialize message handling");
}
/* Tell the DLL we are here */
@@ -415,12 +416,12 @@ v850ice_resume (pid, step, siggnal)
int pid, step;
enum target_signal siggnal;
{
- long retval;
- char buf[256];
- struct MessageIO iob;
+ long retval;
+ char buf[256];
+ struct MessageIO iob;
iob.size = 0;
- iob.buf = buf;
+ iob.buf = buf;
if (step)
retval = ExeAppReq ("GDB", GSINGLESTEP, "step", &iob);
@@ -443,54 +444,54 @@ v850ice_wait (pid, status)
{
long v850_status;
char buf[256];
- struct MessageIO iob;
+ struct MessageIO iob;
int done = 0;
int count = 0;
iob.size = 0;
- iob.buf = buf;
-
+ iob.buf = buf;
+
do
{
if (count++ % 100000)
- {
- ui_loop_hook (0);
+ {
+ ui_loop_hook (0);
count = 0;
- }
+ }
v850_status = ExeAppReq ("GDB", GCHECKSTATUS, NULL, &iob);
switch (v850_status)
- {
- case ICE_Idle:
- case ICE_Breakpoint:
- case ICE_Stepped:
- case ICE_Halted:
- status->kind = TARGET_WAITKIND_STOPPED;
- status->value.sig = TARGET_SIGNAL_TRAP;
- done = 1;
- break;
- case ICE_Exception:
- status->kind = TARGET_WAITKIND_SIGNALLED;
- status->value.sig = TARGET_SIGNAL_SEGV;
- done = 1;
- break;
- case ICE_Exited:
- status->kind = TARGET_WAITKIND_EXITED;
- status->value.integer = 0;
- done = 1;
- break;
- case ICE_Terminated:
- status->kind = TARGET_WAITKIND_SIGNALLED;
- status->value.sig = TARGET_SIGNAL_KILL;
- done = 1;
- break;
- default:
- break;
- }
+ {
+ case ICE_Idle:
+ case ICE_Breakpoint:
+ case ICE_Stepped:
+ case ICE_Halted:
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = TARGET_SIGNAL_TRAP;
+ done = 1;
+ break;
+ case ICE_Exception:
+ status->kind = TARGET_WAITKIND_SIGNALLED;
+ status->value.sig = TARGET_SIGNAL_SEGV;
+ done = 1;
+ break;
+ case ICE_Exited:
+ status->kind = TARGET_WAITKIND_EXITED;
+ status->value.integer = 0;
+ done = 1;
+ break;
+ case ICE_Terminated:
+ status->kind = TARGET_WAITKIND_SIGNALLED;
+ status->value.sig = TARGET_SIGNAL_KILL;
+ done = 1;
+ break;
+ default:
+ break;
+ }
}
while (!done);
-
+
return inferior_pid;
}
@@ -529,7 +530,7 @@ v850ice_fetch_registers (regno)
if (regno == -1)
{
for (regno = 0; regno < NUM_REGS; regno++)
- v850ice_fetch_registers (regno);
+ v850ice_fetch_registers (regno);
return;
}
@@ -546,7 +547,7 @@ v850ice_fetch_registers (regno)
regval = strtoul (val, NULL, 16);
if (regval == 0 && p == val)
error ("v850ice_fetch_registers (%d): bad value from ICE: %s.",
- regno, val);
+ regno, val);
store_unsigned_integer (val, REGISTER_RAW_SIZE (regno), regval);
supply_register (regno, val);
@@ -575,7 +576,7 @@ v850ice_store_registers (regno)
}
regval = extract_unsigned_integer (&registers[REGISTER_BYTE (regno)],
- REGISTER_RAW_SIZE (regno));
+ REGISTER_RAW_SIZE (regno));
strcpy (cmd, "reg ");
if (!convert_register (regno, &cmd[4]))
return;
@@ -589,7 +590,7 @@ v850ice_store_registers (regno)
/* Prepare to store registers. Nothing to do here, since the ICE can write one
register at a time. */
-static void
+static void
v850ice_prepare_to_store ()
{
}
@@ -607,7 +608,7 @@ v850ice_xfer_memory (memaddr, myaddr, len, should_write, target)
char *myaddr;
int len;
int should_write;
- struct target_ops *target; /* ignored */
+ struct target_ops *target; /* ignored */
{
long retval;
char cmd[100];
@@ -617,102 +618,102 @@ v850ice_xfer_memory (memaddr, myaddr, len, should_write, target)
if (should_write)
{
if (len == 4 || len == 2 || len == 1)
- {
- long value = 0;
- char buf[256];
- char c;
-
- iob.size = 0;
- iob.buf = buf;
-
- sent = 0;
- switch (len)
- {
- case 4:
- c = 'w';
- value |= (long) ((myaddr[3] << 24) & 0xff000000);
- value |= (long) ((myaddr[2] << 16) & 0x00ff0000);
- value |= (long) ((myaddr[1] << 8) & 0x0000ff00);
- value |= (long) (myaddr[0] & 0x000000ff);
+ {
+ long value = 0;
+ char buf[256];
+ char c;
+
+ iob.size = 0;
+ iob.buf = buf;
+
+ sent = 0;
+ switch (len)
+ {
+ case 4:
+ c = 'w';
+ value |= (long) ((myaddr[3] << 24) & 0xff000000);
+ value |= (long) ((myaddr[2] << 16) & 0x00ff0000);
+ value |= (long) ((myaddr[1] << 8) & 0x0000ff00);
+ value |= (long) (myaddr[0] & 0x000000ff);
+ break;
+ case 2:
+ c = 'h';
+ value |= (long) ((myaddr[1] << 8) & 0xff00);
+ value |= (long) (myaddr[0] & 0x00ff);
break;
- case 2:
- c = 'h';
- value |= (long) ((myaddr[1] << 8) & 0xff00);
- value |= (long) (myaddr[0] & 0x00ff);
- break;
- case 1:
- c = 'b';
- value |= (long) (myaddr[0] & 0xff);
- break;
- }
-
- sprintf (cmd, "memory %c c 0x%x=0x%x", c, (int) memaddr, value);
- retval = ExeAppReq ("GDB", GWRITEMEM, cmd, &iob);
- if (retval == 0)
- sent = len;
- }
- else
- {
- sent = 0;
- do
- {
- iob.size = len > MAX_BLOCK_SIZE ? MAX_BLOCK_SIZE : len;
- iob.buf = myaddr;
- sprintf (cmd, "memory b c 0x%x=0x00 l=%d", (int) memaddr, iob.size);
- retval = ExeAppReq ("GDB", GWRITEBLOCK, cmd, &iob);
- if (retval != 0)
- break;
- len -= iob.size;
- memaddr += iob.size;
- myaddr += iob.size;
- sent += iob.size;
- }
- while (len > 0);
- }
+ case 1:
+ c = 'b';
+ value |= (long) (myaddr[0] & 0xff);
+ break;
+ }
+
+ sprintf (cmd, "memory %c c 0x%x=0x%x", c, (int) memaddr, value);
+ retval = ExeAppReq ("GDB", GWRITEMEM, cmd, &iob);
+ if (retval == 0)
+ sent = len;
+ }
+ else
+ {
+ sent = 0;
+ do
+ {
+ iob.size = len > MAX_BLOCK_SIZE ? MAX_BLOCK_SIZE : len;
+ iob.buf = myaddr;
+ sprintf (cmd, "memory b c 0x%x=0x00 l=%d", (int) memaddr, iob.size);
+ retval = ExeAppReq ("GDB", GWRITEBLOCK, cmd, &iob);
+ if (retval != 0)
+ break;
+ len -= iob.size;
+ memaddr += iob.size;
+ myaddr += iob.size;
+ sent += iob.size;
+ }
+ while (len > 0);
+ }
}
else
{
unsigned char *tmp;
unsigned char *t;
int i;
-
+
tmp = alloca (len + 100);
t = tmp;
memset (tmp + len, 0xff, 100);
sent = 0;
do
- {
- iob.size = len > MAX_BLOCK_SIZE ? MAX_BLOCK_SIZE : len;
- iob.buf = tmp;
- sprintf (cmd, "memory b 0x%x l=%d", (int)memaddr, iob.size);
- retval = ExeAppReq ("GDB", GREADBLOCK, cmd, &iob);
- if (retval != 0)
- break;
- len -= iob.size;
- memaddr += iob.size;
- sent += iob.size;
- tmp += iob.size;
- }
+ {
+ iob.size = len > MAX_BLOCK_SIZE ? MAX_BLOCK_SIZE : len;
+ iob.buf = tmp;
+ sprintf (cmd, "memory b 0x%x l=%d", (int) memaddr, iob.size);
+ retval = ExeAppReq ("GDB", GREADBLOCK, cmd, &iob);
+ if (retval != 0)
+ break;
+ len -= iob.size;
+ memaddr += iob.size;
+ sent += iob.size;
+ tmp += iob.size;
+ }
while (len > 0);
if (retval == 0)
- {
- for (i = 0; i < 100; i++)
- {
- if (t[sent + i] != 0xff)
- {
- warning ("GREADBLOCK trashed bytes after transfer area.");
- break;
- }
- }
- memcpy (myaddr, t, sent);
- }
+ {
+ for (i = 0; i < 100; i++)
+ {
+ if (t[sent + i] != 0xff)
+ {
+ warning ("GREADBLOCK trashed bytes after transfer area.");
+ break;
+ }
+ }
+ memcpy (myaddr, t, sent);
+ }
}
-
+
if (retval != 0)
error ("3: ExeAppReq returned %d: cmd = %s", retval, cmd);
-
+
return sent;
}
@@ -734,7 +735,7 @@ v850ice_insert_breakpoint (addr, contents_cache)
struct MessageIO iob;
iob.size = 0;
- iob.buf = buf;
+ iob.buf = buf;
sprintf (cmd, "%d, ", addr);
retval = ExeAppReq ("GDB", GSETBREAK, cmd, &iob);
@@ -755,7 +756,7 @@ v850ice_remove_breakpoint (addr, contents_cache)
struct MessageIO iob;
iob.size = 0;
- iob.buf = buf;
+ iob.buf = buf;
sprintf (cmd, "%d, ", addr);
@@ -780,15 +781,15 @@ v850ice_mourn ()
static void
v850ice_load (filename, from_tty)
- char * filename;
- int from_tty;
+ char *filename;
+ int from_tty;
{
struct MessageIO iob;
char buf[256];
iob.size = 0;
- iob.buf = buf;
- generic_load(filename, from_tty);
+ iob.buf = buf;
+ generic_load (filename, from_tty);
ExeAppReq ("GDB", GDOWNLOAD, filename, &iob);
}
@@ -797,7 +798,7 @@ ice_file (arg)
char *arg;
{
char *s;
-
+
target_detach (NULL, 0);
pop_target ();
@@ -807,12 +808,12 @@ ice_file (arg)
while (*s != '\0')
{
if (*s == '\\')
- *s = '/';
+ *s = '/';
s++;
}
/* Safegaurd against confusing the breakpoint routines... */
- delete_command(NULL, 0);
+ delete_command (NULL, 0);
/* Must supress from_tty, otherwise we could start asking if the
user really wants to load a new symbol table, etc... */
@@ -831,7 +832,7 @@ ice_file (arg)
static int
ice_cont (c)
- char *c;
+ char *c;
{
printf_filtered ("continue (ice)\n");
ReplyMessage ((LRESULT) 1);
@@ -861,7 +862,7 @@ do_gdb (cmd, str, func, count)
static int
ice_stepi (c)
- char *c;
+ char *c;
{
int count = (int) c;
@@ -871,7 +872,7 @@ ice_stepi (c)
static int
ice_nexti (c)
- char *c;
+ char *c;
{
int count = (int) c;
@@ -881,8 +882,8 @@ ice_nexti (c)
static void
v850ice_command (arg, from_tty)
- char *arg;
- int from_tty;
+ char *arg;
+ int from_tty;
{
struct MessageIO iob;
char buf[256];
@@ -900,55 +901,55 @@ togdb_force_update (void)
/* Define the target subroutine names */
-static void
-init_850ice_ops(void)
+static void
+init_850ice_ops (void)
{
- v850ice_ops.to_shortname = "ice";
- v850ice_ops.to_longname = "NEC V850 ICE interface";
- v850ice_ops.to_doc = "Debug a system controlled by a NEC 850 ICE.";
- v850ice_ops.to_open = v850ice_open;
- v850ice_ops.to_close = v850ice_close;
- v850ice_ops.to_attach = NULL;
- v850ice_ops.to_post_attach = NULL;
- v850ice_ops.to_require_attach = NULL;
- v850ice_ops.to_detach = v850ice_detach;
- v850ice_ops.to_require_detach = NULL;
- v850ice_ops.to_resume = v850ice_resume;
- v850ice_ops.to_wait = v850ice_wait;
- v850ice_ops.to_post_wait = NULL;
- v850ice_ops.to_fetch_registers = v850ice_fetch_registers;
- v850ice_ops.to_store_registers = v850ice_store_registers;
- v850ice_ops.to_prepare_to_store = v850ice_prepare_to_store;
- v850ice_ops.to_xfer_memory = v850ice_xfer_memory;
- v850ice_ops.to_files_info = v850ice_files_info;
- v850ice_ops.to_insert_breakpoint = v850ice_insert_breakpoint;
- v850ice_ops.to_remove_breakpoint = v850ice_remove_breakpoint;
- v850ice_ops.to_terminal_init = NULL;
- v850ice_ops.to_terminal_inferior = NULL;
- v850ice_ops.to_terminal_ours_for_output = NULL;
- v850ice_ops.to_terminal_ours = NULL;
- v850ice_ops.to_terminal_info = NULL;
- v850ice_ops.to_kill = v850ice_kill;
- v850ice_ops.to_load = v850ice_load;
- v850ice_ops.to_lookup_symbol = NULL;
- v850ice_ops.to_create_inferior = NULL;
- v850ice_ops.to_mourn_inferior = v850ice_mourn;
- v850ice_ops.to_can_run = 0;
- v850ice_ops.to_notice_signals = 0;
- v850ice_ops.to_thread_alive = NULL;
- v850ice_ops.to_stop = v850ice_stop;
+ v850ice_ops.to_shortname = "ice";
+ v850ice_ops.to_longname = "NEC V850 ICE interface";
+ v850ice_ops.to_doc = "Debug a system controlled by a NEC 850 ICE.";
+ v850ice_ops.to_open = v850ice_open;
+ v850ice_ops.to_close = v850ice_close;
+ v850ice_ops.to_attach = NULL;
+ v850ice_ops.to_post_attach = NULL;
+ v850ice_ops.to_require_attach = NULL;
+ v850ice_ops.to_detach = v850ice_detach;
+ v850ice_ops.to_require_detach = NULL;
+ v850ice_ops.to_resume = v850ice_resume;
+ v850ice_ops.to_wait = v850ice_wait;
+ v850ice_ops.to_post_wait = NULL;
+ v850ice_ops.to_fetch_registers = v850ice_fetch_registers;
+ v850ice_ops.to_store_registers = v850ice_store_registers;
+ v850ice_ops.to_prepare_to_store = v850ice_prepare_to_store;
+ v850ice_ops.to_xfer_memory = v850ice_xfer_memory;
+ v850ice_ops.to_files_info = v850ice_files_info;
+ v850ice_ops.to_insert_breakpoint = v850ice_insert_breakpoint;
+ v850ice_ops.to_remove_breakpoint = v850ice_remove_breakpoint;
+ v850ice_ops.to_terminal_init = NULL;
+ v850ice_ops.to_terminal_inferior = NULL;
+ v850ice_ops.to_terminal_ours_for_output = NULL;
+ v850ice_ops.to_terminal_ours = NULL;
+ v850ice_ops.to_terminal_info = NULL;
+ v850ice_ops.to_kill = v850ice_kill;
+ v850ice_ops.to_load = v850ice_load;
+ v850ice_ops.to_lookup_symbol = NULL;
+ v850ice_ops.to_create_inferior = NULL;
+ v850ice_ops.to_mourn_inferior = v850ice_mourn;
+ v850ice_ops.to_can_run = 0;
+ v850ice_ops.to_notice_signals = 0;
+ v850ice_ops.to_thread_alive = NULL;
+ v850ice_ops.to_stop = v850ice_stop;
v850ice_ops.to_pid_to_exec_file = NULL;
- v850ice_ops.to_core_file_to_sym_file = NULL;
- v850ice_ops.to_stratum = process_stratum;
- v850ice_ops.DONT_USE = NULL;
- v850ice_ops.to_has_all_memory = 1;
- v850ice_ops.to_has_memory = 1;
- v850ice_ops.to_has_stack = 1;
- v850ice_ops.to_has_registers = 1;
- v850ice_ops.to_has_execution = 1;
- v850ice_ops.to_sections = NULL;
- v850ice_ops.to_sections_end = NULL;
- v850ice_ops.to_magic = OPS_MAGIC ;
+ v850ice_ops.to_core_file_to_sym_file = NULL;
+ v850ice_ops.to_stratum = process_stratum;
+ v850ice_ops.DONT_USE = NULL;
+ v850ice_ops.to_has_all_memory = 1;
+ v850ice_ops.to_has_memory = 1;
+ v850ice_ops.to_has_stack = 1;
+ v850ice_ops.to_has_registers = 1;
+ v850ice_ops.to_has_execution = 1;
+ v850ice_ops.to_sections = NULL;
+ v850ice_ops.to_sections_end = NULL;
+ v850ice_ops.to_magic = OPS_MAGIC;
}
void
@@ -958,5 +959,5 @@ _initialize_v850ice ()
add_target (&v850ice_ops);
add_com ("ice", class_obscure, v850ice_command,
- "Send command to ICE");
+ "Send command to ICE");
}