From Ubtms@prlng.co.uk  Sat Mar 11 22:27:19 1995
Received: from eros.britain.eu.net (eros.Britain.EU.net [192.91.199.2]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id WAA07914 for <FreeBSD-gnats-submit@freebsd.org>; Sat, 11 Mar 1995 22:27:18 -0800
Received: from proling by eros.britain.eu.net with UUCP 
          id <g.09124-0@eros.britain.eu.net>; Sun, 12 Mar 1995 06:27:11 +0000
Received: by prolingua.co.uk id AA04265; Sat, 11 Mar 95 16:30:12 GMT
Received: by severn.prolingua.co.uk id QAA01388; Sat, 11 Mar 1995 16:02:08 GMT
Message-Id: <199503111602.QAA01388@severn.prolingua.co.uk>
Date: Sat, 11 Mar 1995 16:02:08 GMT
From: dave@prlng.co.uk
Reply-To: dave@prlng.co.uk
To: FreeBSD-gnats-submit@freebsd.org
Subject: Fix for gdb to read stack from core dump
X-Send-Pr-Version: 3.2

>Number:         240
>Category:       gnu
>Synopsis:       gdb does not correctly find the stack in a core dump
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 11 22:30:01 1995
>Closed-Date:    Thu Mar 30 15:29:18 PST 1995
>Last-Modified:
>Originator:     Dave Matthews
>Release:        FreeBSD 2.0-RELEASE i386
>Organization:
Prolingua Ltd
>Environment:

>Description:

Gdb was using the wrong addresses for the location of the stack when
examining a core dump, so it wasn't possible to see a proper stack
trace.

>How-To-Repeat:


>Fix:
Apply the diffs below.  The previous values were right, I think, for older
versions of FreeBSD, but these new ones seem correct for FreeBSD 2.0.

diff -c /usr/src/gnu/usr.bin/gdb/bfd/sysdep.h{.ORIG,}
*** /usr/src/gnu/usr.bin/gdb/bfd/sysdep.h.ORIG  Thu Mar  2 19:45:51 1995
--- /usr/src/gnu/usr.bin/gdb/bfd/sysdep.h       Thu Mar  2 21:14:02 1995
***************
*** 27,34 ****
     (u.u_kproc.kp_eproc.e_vm.vm_maxsaddr + MAXSSIZ), which should work on
     both BSDI and 386BSD, but that is believed not to work for BSD 4.4.  */
  
! #ifdef __bsdi__
  /* This seems to be the right thing for BSDI.  */
  #define       HOST_STACK_END_ADDR             USRSTACK
  #else
  /* This seems to be the right thing for 386BSD release 0.1.  */
--- 27,35 ----
     (u.u_kproc.kp_eproc.e_vm.vm_maxsaddr + MAXSSIZ), which should work on
     both BSDI and 386BSD, but that is believed not to work for BSD 4.4.  */
  
! #if (defined(__bsdi__) | defined(__FreeBSD__))
  /* This seems to be the right thing for BSDI.  */
+ /* ..and also for FreeBSD, at least FreeBSD > 2. */
  #define       HOST_STACK_END_ADDR             USRSTACK
  #else
  /* This seems to be the right thing for 386BSD release 0.1.  */

diff -c /usr/src/gnu/usr.bin/gdb/bfd/trad-core.c{.ORIG,}
*** /usr/src/gnu/usr.bin/gdb/bfd/trad-core.c.ORIG       Fri Jun 10 14:33:39 1994
--- /usr/src/gnu/usr.bin/gdb/bfd/trad-core.c    Thu Mar  2 22:11:17 1995
***************
*** 192,198 ****
--- 192,200 ----
  #else
    core_datasec (abfd)->vma = HOST_TEXT_START_ADDR + (NBPG * u.u_tsize);
  #endif
+ #ifndef __FreeBSD__
  /* a hack, but it works for FreeBSD !! */
+ /* Actually, it's not needed for FreeBSD 2.0, only for older versions. */
  #include <vm/vm_param.h>
  /* this should really be in <vm/vm_param.h>, but somebody forgot it */
  #ifndef vm_page_size
***************
*** 200,205 ****
--- 202,209 ----
  #endif
  #define HOST_STACK_START_ADDR trunc_page(u.u_kproc.kp_eproc.e_vm.vm_maxsaddr \
  + MAXSSIZ - ctob(u.u_ssize))
+ #endif
+ 
  #ifdef HOST_STACK_START_ADDR
    core_stacksec (abfd)->vma = HOST_STACK_START_ADDR;
  #else

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: jkh 
State-Changed-When: Thu Mar 30 15:29:18 PST 1995 
State-Changed-Why:  
Gary Jennejohn reports that the bug has been fixed in -current. 
>Unformatted:




