remote/1966: trust-readonly-sections does not work

Paul Koning pkoning@equallogic.com
Tue Jul 5 22:18:00 GMT 2005


The following reply was made to PR remote/1966; it has been noted by GNATS.

From: Paul Koning <pkoning@equallogic.com>
To: gdb-gnats@sources.redhat.com
Cc:  
Subject: Re: remote/1966: trust-readonly-sections does not work
Date: Tue, 5 Jul 2005 18:16:08 -0400

 This patch (to gdb CVS) appears to fix the problem:
 
 Index: gdb/target.c
 ===================================================================
 RCS file: /cvs/src/src/gdb/target.c,v
 retrieving revision 1.109
 diff -u -r1.109 target.c
 --- gdb/target.c	28 May 2005 16:44:29 -0000	1.109
 +++ gdb/target.c	5 Jul 2005 22:15:55 -0000
 @@ -907,6 +907,8 @@
    return retval;
  }
  
 +static int trust_readonly = 0;
 +
  /* Attempt a transfer all LEN bytes starting at OFFSET between the
     inferior's KIND:ANNEX space and GDB's READBUF/WRITEBUF buffer.  If
     the transfer succeeds, return zero, otherwize the host ERRNO is
 @@ -947,6 +949,20 @@
    if (target_stack == NULL)
      return EIO;
  
 +  if (writebuf == NULL && trust_readonly)
 +    {
 +      struct section_table *secp;
 +      /* User-settable option, "trust-readonly-sections".  If true,
 +         then memory from any SEC_READONLY bfd section may be read
 +         directly from the bfd file.  */
 +      secp = target_section_by_addr (&current_target, offset);
 +      if (secp != NULL
 +	  && (bfd_get_section_flags (secp->bfd, secp->the_bfd_section)
 +	      & SEC_READONLY))
 +	if (xfer_memory (offset, readbuf, len, 0, NULL, &current_target) == len)
 +	  return 0;		/* Success. */
 +    }
 +
    target = target_stack;
    while (1)
      {
 @@ -1033,7 +1049,6 @@
  }
  #endif
  
 -static int trust_readonly = 0;
  static void
  show_trust_readonly (struct ui_file *file, int from_tty,
  		     struct cmd_list_element *c, const char *value)
 



More information about the Gdb-prs mailing list