From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25137 invoked by alias); 12 May 2005 23:14:25 -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 25117 invoked from network); 12 May 2005 23:14:21 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 12 May 2005 23:14:21 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j4CNELDm010169 for ; Thu, 12 May 2005 19:14:21 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j4CNELO04846 for ; Thu, 12 May 2005 19:14:21 -0400 Received: from msnyder8600 (vpn26-4.sfbay.redhat.com [172.16.26.4]) by potter.sfbay.redhat.com (8.12.8/8.12.8) with SMTP id j4CNEIa8002869; Thu, 12 May 2005 19:14:19 -0400 Message-ID: <00e201c55748$533cea10$aaa56b80@msnyder8600> From: "Michael Snyder" To: "Michael Snyder" , "GDB Patches" References: <00c201c55745$a651dd30$aaa56b80@msnyder8600> Subject: Re: [rfa] Restore "trust-readonly-section" Date: Fri, 13 May 2005 11:41:00 -0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_00DF_01C5570D.A69AC780" X-SW-Source: 2005-05/txt/msg00319.txt.bz2 This is a multi-part message in MIME format. ------=_NextPart_000_00DF_01C5570D.A69AC780 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit Content-length: 845 Hmm, tabs fubar -- I'll try again with the patch as an attachment. ----- Original Message ----- From: "Michael Snyder" To: "GDB Patches" Sent: Thursday, May 12, 2005 3:55 PM Subject: [rfa] Restore "trust-readonly-section" > This seems to have succumbed to bit-rot -- there are new target-read > functions > in target.c that don't pay any attention to this user-settable mode bit. > > The purpose of "trust-readonly-sections" is to improve speed on > targets where reading memory is expensive (mostly remote). > It checks to see if a read is from a read-only section, and if so, > reads it from the exec file. It defaults to "off" for safety, but if > users choose to use it, it really speeds up prologue analysis > (and therefore stepping). > > This patch just makes it work again. ------=_NextPart_000_00DF_01C5570D.A69AC780 Content-Type: application/octet-stream; name="trust_readonly" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="trust_readonly" Content-length: 6046 2005-05-12 Michael Snyder =0A= =0A= * target.c (target_read_trusted): New function.=0A= Implements "trust-readonly-section".=0A= (target_xfer_partial): Honor trust-readonly-section.=0A= (do_xfer_memory): Ditto.=0A= (target_xfer_memory_partial): Ditto.=0A= (default_xfer_partial): Ditto.=0A= =0A= Index: target.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/target.c,v=0A= retrieving revision 1.106=0A= diff -p -r1.106 target.c=0A= *** target.c 9 May 2005 21:20:35 -0000 1.106=0A= --- target.c 12 May 2005 22:23:32 -0000=0A= *************** target_section_by_addr (struct target_op=0A= *** 849,854 ****=0A= --- 849,880 ----=0A= return NULL;=0A= }=0A= =20=20=0A= + static int trust_readonly =3D 0;=0A= + static void=0A= + show_trust_readonly (struct ui_file *file, int from_tty,=0A= + struct cmd_list_element *c, const char *value)=0A= + {=0A= + fprintf_filtered (file, _("\=0A= + Mode for reading from readonly sections is %s.\n"),=0A= + value);=0A= + }=0A= +=20=0A= + static int=0A= + target_read_trusted (CORE_ADDR memaddr, char *myaddr, int len)=0A= + {=0A= + struct section_table *secp;=0A= + /* User-settable option, "trust-readonly-sections". If true,=0A= + then memory from any SEC_READONLY bfd section may be read=0A= + directly from the bfd file. */=0A= + secp =3D target_section_by_addr (¤t_target, memaddr);=0A= + if (secp !=3D NULL=0A= + && (bfd_get_section_flags (secp->bfd, secp->the_bfd_section)=0A= + & SEC_READONLY))=0A= + return xfer_memory (memaddr, myaddr, len, 0, NULL, ¤t_target);= =0A= +=20=0A= + return 0;=0A= + }=0A= +=20=0A= /* Return non-zero when the target vector has supplied an xfer_partial=0A= method and it, rather than xfer_memory, should be used. */=0A= static int=0A= *************** target_xfer_partial (struct target_ops *=0A= *** 864,870 ****=0A= void *readbuf, const void *writebuf,=0A= ULONGEST offset, LONGEST len)=0A= {=0A= ! LONGEST retval;=0A= =20=20=0A= gdb_assert (ops->to_xfer_partial !=3D NULL);=0A= retval =3D ops->to_xfer_partial (ops, object, annex, readbuf, writebuf,= =0A= --- 890,904 ----=0A= void *readbuf, const void *writebuf,=0A= ULONGEST offset, LONGEST len)=0A= {=0A= ! LONGEST retval =3D -1;=0A= !=20=0A= ! /* No need to use target method if trusted readonly section can be=0A= ! used (by user's wish). */=0A= ! if (trust_readonly=0A= ! && object =3D=3D TARGET_OBJECT_MEMORY=0A= ! && readbuf !=3D NULL)=0A= ! if ((retval =3D target_read_trusted (offset, readbuf, len)) > 0)=0A= ! return retval;=0A= =20=20=0A= gdb_assert (ops->to_xfer_partial !=3D NULL);=0A= retval =3D ops->to_xfer_partial (ops, object, annex, readbuf, writebuf,= =0A= *************** target_stopped_data_address_p (struct ta=0A= *** 1037,1052 ****=0A= }=0A= #endif=0A= =20=20=0A= - static int trust_readonly =3D 0;=0A= - static void=0A= - show_trust_readonly (struct ui_file *file, int from_tty,=0A= - struct cmd_list_element *c, const char *value)=0A= - {=0A= - fprintf_filtered (file, _("\=0A= - Mode for reading from readonly sections is %s.\n"),=0A= - value);=0A= - }=0A= -=20=0A= /* Move memory to or from the targets. The top target gets priority;=0A= if it cannot handle it, it is offered to the next one down, etc.=0A= =20=20=0A= --- 1071,1076 ----=0A= *************** do_xfer_memory (CORE_ADDR memaddr, char=20=0A= *** 1069,1085 ****=0A= errno =3D 0;=0A= =20=20=0A= if (!write && trust_readonly)=0A= ! {=0A= ! struct section_table *secp;=0A= ! /* User-settable option, "trust-readonly-sections". If true,=0A= ! then memory from any SEC_READONLY bfd section may be read=0A= ! directly from the bfd file. */=0A= ! secp =3D target_section_by_addr (¤t_target, memaddr);=0A= ! if (secp !=3D NULL=0A= ! && (bfd_get_section_flags (secp->bfd, secp->the_bfd_section)=0A= ! & SEC_READONLY))=0A= ! return xfer_memory (memaddr, myaddr, len, 0, attrib, ¤t_target);= =0A= ! }=0A= =20=20=0A= /* The quick case is that the top target can handle the transfer. */= =0A= res =3D current_target.deprecated_xfer_memory=0A= --- 1093,1100 ----=0A= errno =3D 0;=0A= =20=20=0A= if (!write && trust_readonly)=0A= ! if ((res =3D target_read_trusted (memaddr, myaddr, len)) > 0)=0A= ! return res;=0A= =20=20=0A= /* The quick case is that the top target can handle the transfer. */= =0A= res =3D current_target.deprecated_xfer_memory=0A= *************** target_xfer_memory_partial (CORE_ADDR me=0A= *** 1199,1204 ****=0A= --- 1214,1224 ----=0A= return 0;=0A= }=0A= =20=20=0A= + /* No need to use dcache if trusted readonly section can be used. */= =0A= + if (!write_p && trust_readonly)=0A= + if ((res =3D target_read_trusted (memaddr, myaddr, reg_len)) > 0)=0A= + return res;=0A= +=20=0A= region =3D lookup_mem_region(memaddr);=0A= if (memaddr + len < region->hi)=0A= reg_len =3D len;=0A= *************** default_xfer_partial (struct target_ops=20=0A= *** 1308,1313 ****=0A= --- 1328,1343 ----=0A= const char *annex, void *readbuf,=20=0A= const void *writebuf, ULONGEST offset, LONGEST len)=0A= {=0A= + LONGEST retval =3D -1;=0A= +=20=0A= + /* No need to use target method if trusted readonly section can be=0A= + used (by user's wish). */=0A= + if (trust_readonly=0A= + && object =3D=3D TARGET_OBJECT_MEMORY=0A= + && readbuf !=3D NULL)=0A= + if ((retval =3D target_read_trusted (offset, readbuf, len)) > 0)=0A= + return retval;=0A= +=20=0A= if (object =3D=3D TARGET_OBJECT_MEMORY=0A= && ops->deprecated_xfer_memory !=3D NULL)=0A= /* If available, fall back to the target's=0A= ------=_NextPart_000_00DF_01C5570D.A69AC780--