aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1992-04-24 21:39:01 +0000
committerStu Grossman <grossman@cygnus>1992-04-24 21:39:01 +0000
commit54847287d93404a8d6adea8d3761b07f71019280 (patch)
treeda1663ab24fe6accba75ba25aeb7d3544b09a074
parent57d32184c31cc959925e36c0d7d0546c5c0822c8 (diff)
downloadgdb-54847287d93404a8d6adea8d3761b07f71019280.zip
gdb-54847287d93404a8d6adea8d3761b07f71019280.tar.gz
gdb-54847287d93404a8d6adea8d3761b07f71019280.tar.bz2
* remote-udi.c (udi_insert/remove_breakpoint): Completely
rewrite, only leave out the bugs.
-rw-r--r--gdb/ChangeLog3
-rw-r--r--gdb/remote-udi.c79
2 files changed, 37 insertions, 45 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a37d1e4..fcd156d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,8 @@
Fri Apr 24 07:41:19 1992 Stu Grossman (grossman at cygnus.com)
+ * remote-udi.c (udi_insert/remove_breakpoint): Completely
+ rewrite, only leave out the bugs.
+
* Makefile.in: Add 29k/UDI support. Improve depend.
* .Sanitize, alldeps.mak, configure.in, depend: Add 29k/UDI support.
diff --git a/gdb/remote-udi.c b/gdb/remote-udi.c
index d1233f4..95613ed 100644
--- a/gdb/remote-udi.c
+++ b/gdb/remote-udi.c
@@ -125,8 +125,8 @@ typedef struct bkpt_entry_str
UDIBreakType Type;
unsigned int BreakId;
} bkpt_entry_t;
-#define MAX_BKPT 40
-bkpt_entry_t bkpt_table[MAX_BKPT];
+#define BKPT_TABLE_SIZE 40
+static bkpt_entry_t bkpt_table[BKPT_TABLE_SIZE];
extern char dfe_errmsg[]; /* error string */
/*********************************************************** SIGNAL SUPPORT */
@@ -882,35 +882,30 @@ udi_insert_breakpoint (addr, contents_cache)
CORE_ADDR addr;
char *contents_cache;
{
- int cnt = 0;
- DENTER("udi_insert_breakpoint()");
+ int cnt;
+ UDIError err;
+
+ for (cnt = 0; cnt < BKPT_TABLE_SIZE; cnt++)
+ if (bkpt_table[cnt].Type == 0) /* Find first free slot */
+ break;
+
+ if(cnt >= BKPT_TABLE_SIZE)
+ error("Too many breakpoints set");
- while( cnt < MAX_BKPT) /* find BKPT slot in table */
- if( !(bkpt_table[cnt].Type) )
- break;
- else cnt++;
- if(cnt >= MAX_BKPT)
- { error("Too many breakpoints set");
- DEXIT("udi_insert_breakpoint() failure");
- return 1; /* Failure */
- }
bkpt_table[cnt].Addr.Offset = addr;
bkpt_table[cnt].Addr.Space = UDI29KIRAMSpace;
bkpt_table[cnt].PassCount = 1;
bkpt_table[cnt].Type = UDIBreakFlagExecute;
- if( UDISetBreakpoint(bkpt_table[cnt].Addr,
- bkpt_table[cnt].PassCount,
- bkpt_table[cnt].Type,
- &bkpt_table[cnt].BreakId) )
- { error("UDISetBreakpoint() failed in udi_insert_breakpoint");
- bkpt_table[cnt].Type = 0;
- DEXIT("udi_insert_breakpoint() failure");
- return 1; /* Failure */
- } else
- { DEXIT("udi_insert_breakpoint() success");
- return 0; /* Success */
- }
+ err = UDISetBreakpoint(bkpt_table[cnt].Addr,
+ bkpt_table[cnt].PassCount,
+ bkpt_table[cnt].Type,
+ &bkpt_table[cnt].BreakId);
+
+ if (err == 0) return 0; /* Success */
+
+ bkpt_table[cnt].Type = 0;
+ error("UDISetBreakpoint returned error code %d\n", err);
}
/**************************************************** UDI_REMOVE_BREAKPOINT */
@@ -919,29 +914,23 @@ udi_remove_breakpoint (addr, contents_cache)
CORE_ADDR addr;
char *contents_cache;
{
- int cnt = 0;
- DENTER("udi_remove_breakpoint()");
-
- while( cnt < MAX_BKPT) /* find BKPT slot in table */
- if(bkpt_table[cnt].Addr.Offset = addr ) break;
- else cnt++;
- if(cnt >= MAX_BKPT)
- { error("Can't find breakpoint in table");
- DEXIT("udi_remove_breakpoint() failure");
- return 1; /* Failure */
- }
+ int cnt;
+ UDIError err;
+
+ for (cnt = 0; cnt < BKPT_TABLE_SIZE; cnt++)
+ if (bkpt_table[cnt].Addr.Offset == addr) /* Find matching breakpoint */
+ break;
+
+ if(cnt >= BKPT_TABLE_SIZE)
+ error("Can't find breakpoint in table");
+
bkpt_table[cnt].Type = 0;
- if ( !UDIClearBreakpoint(bkpt_table[cnt].BreakId)) {
- DEXIT("udi_remove_breakpoint()");
- return 0; /* Success */
- } else {
- DEXIT("udi_remove_breakpoint()");
- error("UDIClearBreakpoint() failed in udi_remove_breakpoint");
- return 1; /* Failure */
- }
-}
+ err = UDIClearBreakpoint(bkpt_table[cnt].BreakId);
+ if (err == 0) return 0; /* Success */
+ error("UDIClearBreakpoint returned error code %d\n", err);
+}
/***************************************************************** UDI_KILL */
static void