This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch]: Interpret (p->endaddr == 0) as maximum extent of address space


>From target.h:

struct section_table
 {
   CORE_ADDR addr;        /* Lowest address in section */
   CORE_ADDR endaddr;        /* 1+highest address in section */
   ...
 }

Therefore, if the highest address is a word of all 1s, 1+highest address will wrap to zero.

G


2008-05-28 Greg McGary <greg@mcgary.org>


   * exec.c (xfer_memory): Interpret (p->endaddr == 0) as maximum
   extent of address space.

Index: gdb/exec.c
===================================================================
RCS file: /cvs/src/src/gdb/exec.c,v
retrieving revision 1.75
diff -u -p -r1.75 exec.c
--- gdb/exec.c	3 May 2008 18:04:02 -0000	1.75
+++ gdb/exec.c	29 May 2008 01:13:47 -0000
@@ -488,7 +488,10 @@ xfer_memory (CORE_ADDR memaddr, gdb_byte
	continue;		/* not the section we need */
      if (memaddr >= p->addr)
        {
-	  if (memend <= p->endaddr)
+	  /* If a section extends to the end of the address space,
+	     p->endaddr will wrap and become zero, so memend is within
+	     range when p->endaddr is zero.  */
+	  if (memend <= p->endaddr || p->endaddr == 0)
	    {
	      /* Entire transfer is within this section.  */
	      if (write)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]