From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6075 invoked by alias); 13 Jan 2004 13:43:31 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 6062 invoked from network); 13 Jan 2004 13:43:28 -0000 Received: from unknown (HELO bowmore.compxs.com) (194.153.106.198) by sources.redhat.com with SMTP; 13 Jan 2004 13:43:28 -0000 Received: from Kindrogan ([192.168.189.6]) by bowmore.compxs.com (8.12.5/8.12.5) with ESMTP id i0DDsLBo010756 for ; Tue, 13 Jan 2004 13:54:29 GMT Reply-To: From: "Jon Beniston" To: Subject: Falling back to h/w breakpoints on ROM targets Date: Tue, 13 Jan 2004 13:43:00 -0000 Organization: CompXs Message-ID: <002601c3d9db$35a050f0$06bda8c0@Kindrogan> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-SW-Source: 2004-01/txt/msg00343.txt.bz2 I've been working on a remote target where the code runs from ROM. Obviously, trying to set s/w breakpoints always fails. The following patch therefore trys inserting h/w breakpoints when s/w breakpoints fail. Cheers, Jon Index: ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.5195 diff -c -p -r1.5195 ChangeLog *** ChangeLog 12 Jan 2004 20:33:21 -0000 1.5195 --- ChangeLog 13 Jan 2004 13:36:08 -0000 *************** *** 1,3 **** --- 1,9 ---- + 2004-01-13 Jon Beniston + + * remote.c (remote_insert/remove_breakpoint): Try using + h/w breakpoints when s/w breakpoints fail for targets + running from ROM. + 2004-01-12 Andrew Cagney * exec.h (exec_ops): Make "extern". Index: remote.c =================================================================== RCS file: /cvs/src/src/gdb/remote.c,v retrieving revision 1.124 diff -c -p -r1.124 remote.c *** remote.c 8 Dec 2003 17:00:06 -0000 1.124 --- remote.c 13 Jan 2004 13:36:20 -0000 *************** static int remote_insert_breakpoint (COR *** 145,150 **** --- 145,154 ---- static int remote_remove_breakpoint (CORE_ADDR, char *); + static int remote_insert_hw_breakpoint (CORE_ADDR, char *); + + static int remote_remove_hw_breakpoint (CORE_ADDR, char *); + static int hexnumlen (ULONGEST num); static void init_remote_ops (void); *************** static int *** 4679,4687 **** remote_insert_breakpoint (CORE_ADDR addr, char *contents_cache) { struct remote_state *rs = get_remote_state (); - #ifdef DEPRECATED_REMOTE_BREAKPOINT int val; - #endif int bp_size; /* Try the "Z" s/w breakpoint packet if it is not already disabled. --- 4683,4689 ---- *************** remote_insert_breakpoint (CORE_ADDR addr *** 4708,4714 **** switch (packet_ok (buf, &remote_protocol_Z[Z_PACKET_SOFTWARE_BP])) { case PACKET_ERROR: ! return -1; case PACKET_OK: return 0; case PACKET_UNKNOWN: --- 4710,4719 ---- switch (packet_ok (buf, &remote_protocol_Z[Z_PACKET_SOFTWARE_BP])) { case PACKET_ERROR: ! if (remote_protocol_Z[Z_PACKET_HARDWARE_BP].support != PACKET_DISABLE) ! return remote_insert_hw_breakpoint (addr, contents_cache); ! else ! return -1; case PACKET_OK: return 0; case PACKET_UNKNOWN: *************** remote_insert_breakpoint (CORE_ADDR addr *** 4728,4743 **** val = target_write_memory (addr, (char *) little_break_insn, sizeof little_break_insn); } - - return val; #else ! return memory_insert_breakpoint (addr, contents_cache); #endif /* DEPRECATED_REMOTE_BREAKPOINT */ } static int remote_remove_breakpoint (CORE_ADDR addr, char *contents_cache) { struct remote_state *rs = get_remote_state (); int bp_size; --- 4733,4753 ---- val = target_write_memory (addr, (char *) little_break_insn, sizeof little_break_insn); } #else ! val = memory_insert_breakpoint (addr, contents_cache); #endif /* DEPRECATED_REMOTE_BREAKPOINT */ + + if ((val != 0) + && (remote_protocol_Z[Z_PACKET_HARDWARE_BP].support != PACKET_DISABLE)) + val = remote_insert_hw_breakpoint (addr, contents_cache); + + return val; } static int remote_remove_breakpoint (CORE_ADDR addr, char *contents_cache) { + int val; struct remote_state *rs = get_remote_state (); int bp_size; *************** remote_remove_breakpoint (CORE_ADDR addr *** 4758,4771 **** putpkt (buf); getpkt (buf, (rs->remote_packet_size), 0); ! return (buf[0] == 'E'); } #ifdef DEPRECATED_REMOTE_BREAKPOINT ! return target_write_memory (addr, contents_cache, sizeof big_break_insn); #else ! return memory_remove_breakpoint (addr, contents_cache); #endif /* DEPRECATED_REMOTE_BREAKPOINT */ } static int --- 4768,4790 ---- putpkt (buf); getpkt (buf, (rs->remote_packet_size), 0); ! if (buf[0] == 'E') ! return remote_remove_hw_breakpoint (addr, contents_cache); ! else ! return 0; } #ifdef DEPRECATED_REMOTE_BREAKPOINT ! val = target_write_memory (addr, contents_cache, sizeof big_break_insn); #else ! val = memory_remove_breakpoint (addr, contents_cache); #endif /* DEPRECATED_REMOTE_BREAKPOINT */ + + if ((val != 0) + && (remote_protocol_Z[Z_PACKET_HARDWARE_BP].support != PACKET_DISABLE)) + val = remote_remove_hw_breakpoint (addr, contents_cache); + + return val; } static int