This is the mail archive of the gdb-patches@sourceware.cygnus.com 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]

change to remote protocol qOffsets response handling


The qOffsets query, which was originally added for NetWare systems, is
used to handle cases where the image being debugged has been relocated
by the target.  It returns the new addresses of the text, data, and
bss sections.  But GDB used the value returned for the data section
for the bss section as well, with the comment:

        /* This is a temporary kludge to force data and bss to use the 
           same offsets because that's what nlmconv does now.  The real 
           solution requires changes to the stub and remote.c that I don't
           have time to do right now. */

But this makes it impossible for other systems that do relocate data
and bss sections separately to communicate that fact to GDB.  IMO, it 
seems better for the NetWare stub to return the same value to GDB for
data and bss offsets, rather than GDB to make that assumption for all
targets.

        --jtc

1999-10-05  J.T. Conklin  <jtc@redback.com>

	* remote.c (get_offsets): Use bss_addr returned by query instead
 	of data_addr when setting bss section offset.
	* nlm/gdbserve.c (handle_exception): Return LDDataImageOffset for
 	bss offset.


Index: remote.c
===================================================================
RCS file: /home/jtc/CVSROOT/gdb/gdb/remote.c,v
retrieving revision 1.9
diff -c -r1.9 remote.c
*** remote.c	1999/10/01 08:56:07	1.9
--- remote.c	1999/10/05 22:33:23
***************
*** 1506,1518 ****
    memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS);
  
    ANOFFSET (offs, SECT_OFF_TEXT) = text_addr;
- 
-   /* This is a temporary kludge to force data and bss to use the same offsets
-      because that's what nlmconv does now.  The real solution requires changes
-      to the stub and remote.c that I don't have time to do right now.  */
- 
    ANOFFSET (offs, SECT_OFF_DATA) = data_addr;
!   ANOFFSET (offs, SECT_OFF_BSS) = data_addr;
  
    objfile_relocate (symfile_objfile, offs);
  }
--- 1506,1513 ----
    memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS);
  
    ANOFFSET (offs, SECT_OFF_TEXT) = text_addr;
    ANOFFSET (offs, SECT_OFF_DATA) = data_addr;
!   ANOFFSET (offs, SECT_OFF_BSS)  = bss_addr;
  
    objfile_relocate (symfile_objfile, offs);
  }
Index: nlm/gdbserve.c
===================================================================
RCS file: /home/jtc/CVSROOT/gdb/gdb/nlm/gdbserve.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 gdbserve.c
*** gdbserve.c	1999/05/19 17:38:50	1.1.1.1
--- gdbserve.c	1999/10/05 22:36:25
***************
*** 750,759 ****
  	case 'q':		/* Query message */
  	  if (strcmp (&remcomInBuffer[1], "Offsets") == 0)
  	    {
  	      sprintf (remcomOutBuffer, "Text=%x;Data=%x;Bss=%x",
  		       ldinfo->LDCodeImageOffset,
  		       ldinfo->LDDataImageOffset,
! 		       ldinfo->LDDataImageOffset + ldinfo->LDDataImageLength);
  	    }
  	  else
  	    sprintf (remcomOutBuffer, "E04, Unknown query %s", &remcomInBuffer[1]);
--- 750,761 ----
  	case 'q':		/* Query message */
  	  if (strcmp (&remcomInBuffer[1], "Offsets") == 0)
  	    {
+ 	      /* This is a temporary kludge to force data and bss to use
+ 		 the same offsets because that's what nlmconv does now. */
  	      sprintf (remcomOutBuffer, "Text=%x;Data=%x;Bss=%x",
  		       ldinfo->LDCodeImageOffset,
  		       ldinfo->LDDataImageOffset,
! 		       ldinfo->LDDataImageOffset);
  	    }
  	  else
  	    sprintf (remcomOutBuffer, "E04, Unknown query %s", &remcomInBuffer[1]);


-- 
J.T. Conklin
RedBack Networks

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