Allow GDB to patch object files.
authorJohn Gilmore <gnu@cygnus>
Wed, 4 Sep 1991 07:52:46 +0000 (07:52 +0000)
committerJohn Gilmore <gnu@cygnus>
Wed, 4 Sep 1991 07:52:46 +0000 (07:52 +0000)
Makefile.in:  Add crude dependencies.

bfd/ChangeLog
bfd/Makefile.in
bfd/aoutf1.h
bfd/aoutx.h

index fca4b95..503747c 100644 (file)
@@ -1,3 +1,14 @@
+Wed Sep  4 00:44:52 1991  John Gilmore  (gnu at cygint.cygnus.com)
+
+       Allow GDB to patch object files.
+
+       * aoutf1.h (sunos_core_file_p):  Set SEC_HAS_CONTENTS on all sections.
+       * trad-core.h (trad_unix_core_file_p):  Ditto.
+       * aoutx.h (aout_set_section_contents):  On first output, check
+       abfd->direction and complain if erroneous.
+
+       * Makefile.in:  Add crude dependencies.
+
 Tue Sep  3 13:46:19 1991  Steve Chamberlain  (steve at cygint.cygnus.com)
 
        * config/* aoutx.h configure* shortened all the h/tmake-xxxx
index 1f91491..8167818 100644 (file)
@@ -23,6 +23,7 @@
 srcdir = .
 destdir = /usr/local
 libdir = $(destdir)/lib
+docdir = $(srcdir)/doc
 
 RANLIB = ranlib
 AR = ar
@@ -30,6 +31,8 @@ AR_FLAGS = clq
 INCDIR = $(srcdir)/../include
 CSEARCH = -I$(INCDIR)
 DEP = mkdep
+
+
 #### host and target dependent Makefile fragments come in here.
 ###
 
@@ -193,74 +196,81 @@ dep: $(CFILES)
        mkdep $(CFLAGS) $?
 
 
-# Stuff to make the documentation for bfd.
-#
-# make docs
-#      rebuilds the documentation. Has to be done when the source is
-#      modified until I work out how to do this properly
-# 
-# make docs headers
-#      rebuilds the header files from the source
-#
-# make docs texdoc
-#      rebuilds the bfd.dvi manual
-#
-# make docs texinfo
-#      rebuilds the bfdinfo manual
-
-
-.SUFFIXES: .texi .o .c .h .p .ip
-
-.c.texi:
-       scanit $< 
-
-.h.texi:
-       scanit $< 
-
-.c.p:
-       scanph $<
-
-.h.p:
-       scanph $<
-
-.c.ip:
-       scanph -i $<
-
-
-DSRC=$(CFILES)
-
-docs: syms.texi bfd.texi cache.texi format.texi section.texi \
-       archive.texi core.texi libbfd.texi archures.texi reloc.texi \
-        opncls.texi targets.texi aoutx.texi coffcode.texi
-
-
-PROTOS = opncls.p archures.p libbfd.p section.p syms.p bfd.p \
-       archive.p reloc.p targets.p format.p coffcode.p core.p
-
-IPROTOS = libbfd.ip cache.ip 
 
-headers : $(PROTOS) $(IPROTOS)
+headers:
+       cp $(srcdir)/bfd-in.h $(docdir)
+       cp $(srcdir)/libbfd-in.h $(docdir)
+       cp $(srcdir)/libcoff-in.h $(docdir)
+       (cd $(docdir); make protos)
        # Rebuild prototypes in bfd.h
-       mv $(BFD_H) $(BFD_H).old
-       sed -f $(srcdir)/intobfd $(srcdir)/bfd-in.h > $(BFD_H)
-       # and libbfd.h
-       mv $(srcdir)/libbfd.h libbfd.h.old
-       sed -f $(srcdir)/tolibbfd $(srcdir)/libbfd-in.h >$(srcdir)/libbfd.h
-       # and libcoff.h
-       mv $(srcdir)/libcoff.h libcoff.h.old
-       sed -f $(srcdir)/tolibcoff $(srcdir)/libcoff-in.h >$(srcdir)/libcoff.h
-
-
-texinfo:
-       makeinfo +no-validate bfd.texinfo
-
-texdoc:
-       tex bfd.texinfo
-       texindex bfd.??
-       tex bfd.texinfo
-
-psdoc:
-       dvips -f bfd.dvi >bfd.texi.ps
-       
-quickdoc: $(DSRC) docs
-       tex bfd.texinfo
+       cp $(docdir)/bfd.h $(BFD_H)
+       cp $(docdir)/libbfd.h $(srcdir)/libbfd.h
+       cp $(docdir)/libcoff.h $(srcdir)/libcoff.h
+
+bfd.info:
+       ( cd doc; make bfd.info)
+
+bfd.dvi:
+       (cd doc; make bfd.dvi)
+
+bfd.ps: 
+       (cd doc; make bfd.ps)
+
+# What appears below is generated by a hacked mkdep using gcc -MM.
+
+# DO NOT DELETE THIS LINE -- mkdep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+libbfd.o : libbfd.c ../include/bfd.h ../include/obstack.h libbfd.h 
+opncls.o : opncls.c ../include/bfd.h ../include/obstack.h libbfd.h 
+bfd.o : bfd.c ../include/bfd.h ../include/obstack.h libbfd.h 
+archive.o : archive.c ../include/bfd.h ../include/obstack.h libbfd.h \
+  ../include/ar.h ../include/ranlib.h 
+targets.o : targets.c ../include/bfd.h ../include/obstack.h libbfd.h 
+cache.o : cache.c ../include/bfd.h ../include/obstack.h libbfd.h 
+archures.o : archures.c ../include/bfd.h ../include/obstack.h 
+i386coff.o : i386coff.c ../include/bfd.h ../include/obstack.h libbfd.h \
+  ../include/i386coff.h ../include/internalcoff.h libcoff.h coffcode.h 
+aout64.o : aout64.c 
+aout32.o : aout32.c aoutx.h ../include/bfd.h ../include/ansidecl.h \
+  ../include/obstack.h libaout.h libbfd.h ../include/aout64.h \
+  ../include/stab.gnu.h ../include/stab.def ../include/ar.h 
+sunos.o : sunos.c aoutf1.h ../include/bfd.h ../include/obstack.h \
+  libaout.h libbfd.h ../include/aout64.h ../include/stab.gnu.h \
+  ../include/stab.def ../include/ar.h 
+demo64.o : demo64.c 
+icoff.o : icoff.c ../include/bfd.h ../include/obstack.h libbfd.h \
+  ../include/intel-coff.h ../include/internalcoff.h libcoff.h coffcode.h 
+srec.o : srec.c ../include/bfd.h ../include/obstack.h libbfd.h 
+oasys.o : oasys.c ../include/bfd.h ../include/obstack.h libbfd.h \
+  ../include/oasys.h liboasys.h 
+ieee.o : ieee.c ../include/bfd.h ../include/obstack.h libbfd.h \
+  ../include/ieee.h libieee.h 
+m68kcoff.o : m68kcoff.c ../include/bfd.h ../include/obstack.h libbfd.h \
+  ../include/m68kcoff.h ../include/internalcoff.h libcoff.h coffcode.h 
+amdcoff.o : amdcoff.c ../include/bfd.h ../include/obstack.h libbfd.h \
+  ../include/amdcoff.h ../include/internalcoff.h libcoff.h coffcode.h 
+format.o : format.c ../include/sysdep.h ../include/bfd.h \
+  ../include/obstack.h libbfd.h 
+section.o : section.c ../include/sysdep.h ../include/bfd.h \
+  ../include/obstack.h libbfd.h 
+core.o : core.c ../include/sysdep.h ../include/bfd.h \
+  ../include/obstack.h libbfd.h 
+syms.o : syms.c ../include/sysdep.h ../include/bfd.h \
+  ../include/obstack.h libbfd.h 
+reloc.o : reloc.c ../include/sysdep.h ../include/bfd.h \
+  ../include/obstack.h libbfd.h 
+m88k-bcs.o : m88k-bcs.c ../include/bfd.h ../include/obstack.h libbfd.h \
+  ../include/m88k-bcs.h ../include/internalcoff.h libcoff.h coffcode.h 
+ecoff.o : ecoff.c ../include/bfd.h ../include/obstack.h libbfd.h \
+  ../include/ecoff.h ../include/internalcoff.h libcoff.h trad-core.h \
+  coffcode.h 
+trad-core.o : trad-core.c ../include/bfd.h ../include/obstack.h \
+  libbfd.h libaout.h 
+newsos3.o : newsos3.c ../include/bfd.h ../include/obstack.h libbfd.h \
+  ../include/aout64.h ../include/stab.gnu.h ../include/stab.def \
+  ../include/ar.h libaout.h 
+bout.o : bout.c ../include/bfd.h ../include/obstack.h libbfd.h \
+  ../include/bout.h ../include/stab.gnu.h ../include/stab.def libaout.h 
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
index 27ac892..50393df 100644 (file)
@@ -305,7 +305,7 @@ struct internal_sunos_core {
 static void
 DEFUN(swapcore_sun3,(abfd, ext, intcore),
       bfd *abfd AND
-      char *ext;
+      char *ext AND
       struct internal_sunos_core *intcore)
 {
   struct external_exec exec_bytes;
@@ -336,7 +336,7 @@ DEFUN(swapcore_sun3,(abfd, ext, intcore),
 static void
 DEFUN(swapcore_sparc,(abfd, ext, intcore),
       bfd *abfd AND
-      char *ext;
+      char *ext AND
       struct internal_sunos_core *intcore)
 {
   struct external_sparc_core *extcore = (struct external_sparc_core *)ext;
@@ -483,10 +483,10 @@ DEFUN(sunos4_core_file_p,(abfd),
   core_regsec (abfd)->name = ".reg";
   core_reg2sec (abfd)->name = ".reg2";
 
-  core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD;
-  core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD;
-  core_regsec (abfd)->flags = SEC_ALLOC;
-  core_reg2sec (abfd)->flags = SEC_ALLOC;
+  core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+  core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+  core_regsec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
+  core_reg2sec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
 
   core_stacksec (abfd)->size = core->c_ssize;
   core_datasec (abfd)->size = core->c_dsize;
index b6d7e41..08c5c99 100644 (file)
@@ -703,26 +703,37 @@ DEFUN(NAME(aout,set_section_contents),(abfd, section, location, offset, count),
       bfd_size_type count)
 {
   if (abfd->output_has_begun == false)
-      {                                /* set by bfd.c handler */
-       if ((obj_textsec (abfd) == NULL) || (obj_datasec (abfd) == NULL)) 
-           {
-             bfd_error = invalid_operation;
-             return false;
+    {                          /* set by bfd.c handler */
+      switch (abfd->direction)
+       {
+         case read_direction:
+         case no_direction:
+           bfd_error = invalid_operation;
+           return false;
+
+         case both_direction:
+           break;
+
+         case write_direction:
+           if ((obj_textsec (abfd) == NULL) || (obj_datasec (abfd) == NULL)) 
+               {
+                 bfd_error = invalid_operation;
+                 return false;
+               }
+           /*if (abfd->flags & D_PAGED) {        
+             obj_textsec(abfd)->filepos = 0;
            }
-/*     if (abfd->flags & D_PAGED) {      
-         obj_textsec(abfd)->filepos = 0;
-       }
-       else*/ {
-         obj_textsec(abfd)->filepos = EXEC_BYTES_SIZE;
+           else*/ {
+             obj_textsec(abfd)->filepos = EXEC_BYTES_SIZE;
+           }
+           obj_textsec(abfd)->size = align_power(obj_textsec(abfd)->size,
+                                                 obj_textsec(abfd)->alignment_power);
+           obj_datasec(abfd)->filepos =  obj_textsec (abfd)->size + EXEC_BYTES_SIZE;
+           obj_datasec(abfd)->size = align_power(obj_datasec(abfd)->size,
+                                               obj_datasec(abfd)->alignment_power);
        }
-       obj_textsec(abfd)->size = align_power(obj_textsec(abfd)->size,
-                                             obj_textsec(abfd)->alignment_power);
-       obj_datasec(abfd)->filepos =  obj_textsec (abfd)->size + EXEC_BYTES_SIZE;
-       obj_datasec(abfd)->size = align_power(obj_datasec(abfd)->size,
-                                             obj_datasec(abfd)->alignment_power);
-         
-         
-      }
+    }
+
   /* regardless, once we know what we're doing, we might as well get going */
   if (section != obj_bsssec(abfd)) 
       {