Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Mar 1995 22:30:01 -0800
From:      dave@prlng.co.uk
To:        freebsd-bugs
Subject:   gnu/240: Fix for gdb to read stack from core dump
Message-ID:  <199503120630.WAA07957@freefall.cdrom.com>
In-Reply-To: Your message of Sat, 11 Mar 1995 16:02:08 GMT <199503111602.QAA01388@severn.prolingua.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help

>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:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 11 22:30:01 1995
>Originator:     Dave Matthews
>Organization:
Prolingua Ltd
>Release:        FreeBSD 2.0-RELEASE i386
>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

>Audit-Trail:
>Unformatted:






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503120630.WAA07957>