From: daney@mermaid.micro.umn.edu (Dave Daney)
Subject: Installing gdb-4.5 on Interactive 2.2.1
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 15 Apr 1992 13:33:33 GMT

Hi,

These are the things that need to be done to gdb-4.5 to get it to compile and
be able to read core files on Interactive 2.2.1 (Sys V/386 R3.2).

configure i386-none-sysv32

remove #include <memory.h> from gdb/cplus-dem.c I think bfd/sysdep.h has the
same problem.

add #include <sys/types.h> to libiberty/sigsetmask.c before #include <signal.h>


Patch bfd/trad-core.c with the following patch.

compile with these commands:

gmake CC=gcc HDEFINES="-D_POSIX_SOURCE -DTRAD_CORE" HDEPFILES=trad-core.o\
READLINE_DEFINES="-D_POSIX_VERSION -D_POSIX_SOURCE" LOADLIBES=-lcposix

--------------------------<just diffs after this>-----------------------------
*** trad-core.c	Tue Jan 28 16:53:18 1992
--- trad-core.c.new	Mon Feb 10 19:20:40 1992
***************
*** 34,47 ****
  #include <stdio.h>
  #include <sys/types.h>
  #include <sys/param.h>
  #include <sys/dir.h>
  #include <signal.h>
- #include <machine/reg.h>
  
  #include <sys/user.h>		/* After a.out.h  */
! #include <sys/file.h>
  
  #include <errno.h>
  
    struct trad_core_struct 
      {
--- 34,49 ----
  #include <stdio.h>
  #include <sys/types.h>
  #include <sys/param.h>
  #include <sys/dir.h>
  #include <signal.h>
  
+ /*#include <machine/reg.h>*/
+ #include <sys/reg.h>
+ 
  #include <sys/user.h>		/* After a.out.h  */
! /*  #include <sys/file.h> */
  
  #include <errno.h>
  
    struct trad_core_struct 
      {
***************
*** 125,146 ****
  
    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_datasec (abfd)->_raw_size =  NBPG * u.u_dsize;
!   core_stacksec (abfd)->_raw_size = NBPG * u.u_ssize;
!   core_regsec (abfd)->_raw_size = NBPG * UPAGES; /* Larger than sizeof struct u */
  
    /* What a hack... we'd like to steal it from the exec file,
       since the upage does not seem to provide it.  FIXME.  */
  #ifdef HOST_DATA_START_ADDR
    core_datasec (abfd)->vma = HOST_DATA_START_ADDR;
  #else
!   core_datasec (abfd)->vma = HOST_TEXT_START_ADDR + (NBPG * u.u_tsize);
  #endif
!   core_stacksec (abfd)->vma = HOST_STACK_END_ADDR - (NBPG * u.u_ssize);
    /* This is tricky.  As the "register section", we give them the entire
       upage and stack.  u.u_ar0 points to where "register 0" is stored.
       There are two tricks with this, though.  One is that the rest of the
       registers might be at positive or negative (or both) displacements
       from *u_ar0.  The other is that u_ar0 is sometimes an absolute address
--- 127,153 ----
  
    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_datasec (abfd)->_raw_size =  NBPC * u.u_dsize;
!   core_stacksec (abfd)->_raw_size = NBPC * u.u_ssize;
!   core_regsec (abfd)->_raw_size = NBPC * USIZE; /* Larger than sizeof struct u */
  
    /* What a hack... we'd like to steal it from the exec file,
       since the upage does not seem to provide it.  FIXME.  */
+ 
+ #define HOST_DATA_START_ADDR u.u_exdata.ux_datorg
+ #define HOST_STACK_END_ADDR 0x80000000
+ 
  #ifdef HOST_DATA_START_ADDR
    core_datasec (abfd)->vma = HOST_DATA_START_ADDR;
  #else
!   core_datasec (abfd)->vma = HOST_TEXT_START_ADDR + (NBPC * u.u_tsize);
  #endif
!   core_stacksec (abfd)->vma = HOST_STACK_END_ADDR - (NBPC * u.u_ssize);
! 
    /* This is tricky.  As the "register section", we give them the entire
       upage and stack.  u.u_ar0 points to where "register 0" is stored.
       There are two tricks with this, though.  One is that the rest of the
       registers might be at positive or negative (or both) displacements
       from *u_ar0.  The other is that u_ar0 is sometimes an absolute address
***************
*** 153,164 ****
       0 is at the place pointed to by u_ar0 (by setting the vma of the start
       of the section to -u_ar0).  GDB uses this info to locate the regs,
       using minor trickery to get around the offset-or-absolute-addr problem. */
    core_regsec (abfd)->vma = 0 - (int) u.u_ar0;
  
!   core_datasec (abfd)->filepos = NBPG * UPAGES;
!   core_stacksec (abfd)->filepos = (NBPG * UPAGES) + NBPG * u.u_dsize;
    core_regsec (abfd)->filepos = 0; /* Register segment is the upage */
  
    /* Align to word at least */
    core_stacksec (abfd)->alignment_power = 2;
    core_datasec (abfd)->alignment_power = 2;
--- 160,171 ----
       0 is at the place pointed to by u_ar0 (by setting the vma of the start
       of the section to -u_ar0).  GDB uses this info to locate the regs,
       using minor trickery to get around the offset-or-absolute-addr problem. */
    core_regsec (abfd)->vma = 0 - (int) u.u_ar0;
  
!   core_datasec (abfd)->filepos = NBPC * USIZE;
!   core_stacksec (abfd)->filepos = (NBPC * USIZE) + NBPC * u.u_dsize;
    core_regsec (abfd)->filepos = 0; /* Register segment is the upage */
  
    /* Align to word at least */
    core_stacksec (abfd)->alignment_power = 2;
    core_datasec (abfd)->alignment_power = 2;



Newsgroups: gnu.gdb.bug