From: Stu Grossman Date: Fri, 24 Apr 1992 21:39:01 +0000 (+0000) Subject: * remote-udi.c (udi_insert/remove_breakpoint): Completely X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=54847287d93404a8d6adea8d3761b07f71019280;p=binutils-gdb.git * remote-udi.c (udi_insert/remove_breakpoint): Completely rewrite, only leave out the bugs. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a37d1e459a5..fcd156d740d 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 d1233f4bce8..95613edd318 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