Article View: gnu.gdb.bug
Article #127core file patches for ISC and perhaps SCO
From: Dave Daney
Date: Mon, 27 Jul 1992 06:13
Date: Mon, 27 Jul 1992 06:13
131 lines
5757 bytes
5757 bytes
I posted a patch for this problem a while ago but here it is again. In association
with my patches for debug register use on Interactive 2.2.1
Here is what I did to get core files working on Interactive 2.2.1. Patch
the file bfd/trad-core.c then make like this. People tell me this works
on SCO also, but I am not sure of this.
gmake CC=gcc HDEFINES="-D_POSIX_SOURCE -DTRAD_CORE" HDEPFILES=trad-core.o\
READLINE_DEFINES="-D_POSIX_VERSION -D_POSIX_SOURCE" LOADLIBES=-lcposix\
USER_CFLAGS=-DHAVE_MEM_BREAKPOINT CFLAGS="-g -O2"
*** 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;
--------------------------------------------------------------------------
David S. Daney daney@mermaid.micro.mun.edu
Technical Details
Message-ID:
<199207271613.AA07749@mermaid.micro.umn.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!mips!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!mermaid.micro.umn.edu!daneyShow Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!mips!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!mermaid.micro.umn.edu!daney From: daney@mermaid.micro.umn.edu (Dave Daney) Subject: core file patches for ISC and perhaps SCO Message-ID: <199207271613.AA07749@mermaid.micro.umn.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Mon, 27 Jul 1992 06:13:27 GMT Approved: bug-gdb@prep.ai.mit.edu Lines: 132