From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21396 invoked by alias); 24 Mar 2005 19:46:38 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 21267 invoked from network); 24 Mar 2005 19:46:28 -0000 Received: from unknown (HELO calvin.codito.co.in) (220.225.32.98) by sourceware.org with SMTP; 24 Mar 2005 19:46:28 -0000 Received: from [192.168.100.52] (ramana.codito.co.in [192.168.100.52]) by calvin.codito.co.in (8.12.10/8.12.10) with ESMTP id j2OJkI89023008; Fri, 25 Mar 2005 01:16:19 +0530 Message-ID: <42431904.7010708@codito.com> Date: Thu, 24 Mar 2005 19:46:00 -0000 From: Ramana Radhakrishnan User-Agent: Mozilla Thunderbird 0.8 (X11/20040926) MIME-Version: 1.0 To: gdb@sources.redhat.com CC: Daniel Jacobowitz , amit bhor Subject: RFC : Handling breakpoints on archs. with imprecise exceptions. Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-03/txt/msg00214.txt.bz2 Hi, While looking at a GDB port to a processor that has imprecise exceptions/ interrupts i.e. the equivalent of a software breakpoint would require 4 instructions to stop. With my research I was unable to find any GDB port that needed to handle such a case. The mechanism that is in mind is the following for setting breakpoints. Description ------------ Maintain a separate breakpoint table to which control would branch to from the debuggee. So gdb's breakpoint instruction is replaced by a branch to the corresponding breakpoint table for the 1 . Replace the instruction with a branch to an entry in a breakpoint table which already contains the necessary instructions for this purpose. So all that breakpoint_from_pc does is to encode this branch instruction and return this as the breakpoint instruction. 2. The breakpoint once hit gets informed to gdb as a breakpoint being hit at some location in the breakpoint table. So when GDB checks for a breakpoint as having been hit the PC it should use should be the value of the PC at which the breakpoint was actually set. GDB specifics.: --------------- a. Define gdbarch_adjust_breakpoint_address in the backend to store the mapping in the backend for the PC at which breakpoint has been set to the actual value for the PC where the breakpoint would be reported to have been hit. b. Define deprecated_target_wait_hook in the backend to restore the actual value of the PC for GDB to continue with its work.However as this is a deprecated hook I would not like to use this in a new port. c. Add a new notify_backend_breakpoint_deleted_hook since the backend needs notification for the breakpoint being deleted and hence free an entry in the breakpoint table. cheers Ramana -- Ramana Radhakrishnan GNU Tools codito ergo sum (www.codito.com)