From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22165 invoked by alias); 7 Oct 2003 23:00:30 -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 22157 invoked from network); 7 Oct 2003 23:00:29 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 7 Oct 2003 23:00:29 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h97N0S127814 for ; Tue, 7 Oct 2003 19:00:28 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h97N0RD11543; Tue, 7 Oct 2003 19:00:27 -0400 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id h97N0Rw08806; Tue, 7 Oct 2003 16:00:27 -0700 Message-ID: <3F83458B.7020709@redhat.com> Date: Tue, 07 Oct 2003 23:00:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Buettner CC: gdb-patches@sources.redhat.com Subject: Re: [PATCH] TARGET_ADJUST_BREAKPOINT_ADDRESS - patch 4 of 4 References: <1031004065453.ZM25497@localhost.localdomain> In-Reply-To: <1031004065453.ZM25497@localhost.localdomain> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-10/txt/msg00180.txt.bz2 Kevin Buettner wrote: > Below is patch 4 of 4 of my current TARGET_ADJUST_BREAKPOINT_ADDRESS > patch set. To better understand what this is all about, see patch 3 > at: > > http://sources.redhat.com/ml/gdb-patches/2003-10/msg00073.html > > I'll commit this patch sometime after patch 1 is committed. (In order > to actually be used, it depends on patch 3, but no harm will occur if > it goes in before patch 3.) > > * frv-tdep.c (frv_target_adjust_breakpoint_address): New function. > (frv_gdbarch_init): Initialize TARGET_ADJUST_BREAKPOINT_ADDRESS > method. Hi Kevin, My first feedback is that "count" should be set to a const rather than to 8 -- since we've seen it change from 4 to 8 just recently, and who knows when it will change again. That'll also provide an opportunity to explain (via the name of the const, if nothing else) what 'count' is. Maybe "bpaddr - 4" could also be "bpaddr - sizeof (something)". Michael > > Index: frv-tdep.c > =================================================================== > RCS file: /cvs/src/src/gdb/frv-tdep.c,v > retrieving revision 1.53 > diff -u -p -r1.53 frv-tdep.c > --- frv-tdep.c 19 Sep 2003 16:22:38 -0000 1.53 > +++ frv-tdep.c 3 Oct 2003 23:38:25 -0000 > @@ -37,6 +37,7 @@ static gdbarch_init_ftype frv_gdbarch_in > > static gdbarch_register_name_ftype frv_register_name; > static gdbarch_breakpoint_from_pc_ftype frv_breakpoint_from_pc; > +static gdbarch_target_adjust_breakpoint_address_ftype frv_target_adjust_breakpoint_address; > static gdbarch_skip_prologue_ftype frv_skip_prologue; > static gdbarch_deprecated_extract_return_value_ftype frv_extract_return_value; > static gdbarch_deprecated_extract_struct_value_address_ftype frv_extract_struct_value_address; > @@ -272,6 +273,42 @@ frv_breakpoint_from_pc (CORE_ADDR *pcptr > } > > > +static CORE_ADDR > +frv_target_adjust_breakpoint_address (CORE_ADDR bpaddr) > +{ > + int count = 8; > + CORE_ADDR addr = bpaddr - 4; > + CORE_ADDR func_start = get_pc_function_start (bpaddr); > + > + /* Find the end of the previous packing sequence. This will be indicated > + by either attempting to access some inaccessible memory or by finding > + an instruction word whose packing bit is set to one. */ > + while (count-- > 0 && addr >= func_start) > + { > + int status; > + char instr[4]; > + > + status = read_memory_nobpt (addr, instr, sizeof instr); > + > + if (status != 0) > + break; > + > + /* This is a big endian architecture, so byte zero will have most > + significant byte. The most significant bit of this byte is the > + packing bit. */ > + if (instr[0] & 0x80) > + break; > + > + addr -= 4; > + } > + > + if (count > 0) > + bpaddr = addr + 4; > + > + return bpaddr; > +} > + > + > /* Return true if REG is a caller-saves ("scratch") register, > false otherwise. */ > static int > @@ -1114,6 +1151,7 @@ frv_gdbarch_init (struct gdbarch_info in > > set_gdbarch_skip_prologue (gdbarch, frv_skip_prologue); > set_gdbarch_breakpoint_from_pc (gdbarch, frv_breakpoint_from_pc); > + set_gdbarch_target_adjust_breakpoint_address (gdbarch, frv_target_adjust_breakpoint_address); > > set_gdbarch_frame_args_skip (gdbarch, 0); > set_gdbarch_frameless_function_invocation (gdbarch, frv_frameless_function_invocation); >