🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #737

unable to get a backtrace on an arbitrary stack

#737
From: Glenn Engel
Date: Tue, 28 Mar 1989 16:15
56 lines
2444 bytes
I have a program which has multiple stacks and switches between them
at run-time.  Because of the multiple stacks I would like to generate
a backtrace for any of the stacks in the system.  My first attempt was to
use the frame command to change the active frame but this does not seem to
work at all.  It seems that frames which are specified as an absolute address
are not handled properly.  The following is a brief gdb session:

GDB 3.1.2, Copyright (C) 1988 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "info copying" to see the conditions.
Reading symbol data from test...done.
Type "help" for a list of commands.
(gdb) b debug20
Breakpoint 1 at 0x84c: file src/debug/debug.c, line 83.
(gdb) run
Starting program: test

Bpt 1, debug20 () (src/debug/debug.c line 83)
83          ch = getCh(stdin);
(gdb) bt
#0  debug20 () (src/debug/debug.c line 83)
#1  0x844 in debug10 () (src/debug/debug.c line 77)
#2  0x83a in debug () (src/debug/debug.c line 72)
(gdb) p/x $fp
$1 = 0x000b23aa

(gdb) info frame 0
Stack frame at 0xb23aa:
 pc = 0x84c in debug20 (src/debug/debug.c line 83); saved pc 0x844
 called by frame at 0xb23b2
 Arglist at 0xb23aa, args:
 Saved registers:
  fp at 0xb23aa, sp at 0xb23b2, pc at 0xb23ae

(gdb) info frame 0xb23aa
Stack frame at 0xb23aa:
 pc = 0x0 in _start; saved pc 0x844
 Arglist at 0xb23aa, args:
 Saved registers:
  fp at 0xb23aa, sp at 0xb23b2, pc at 0xb23ae
(gdb)

Both of the above frame displays say they are at 0xb23aa but they
print different info !   This illustrates the problem with a known stack
frame.  If I specify a frame in a totally separate stack I get similar
results.

What is the proper technique for getting info/backtraces at an arbitrary
stack location ?

--
 |  Glenn R. Engel
 |  Hewlett-Packard 
 |  (206) 335-2066
 |  glenne%hplsla@hplabs.hp.com
Technical Details
Message-ID: <8903281615.AA24018@labgre.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!HP-SDE.SDE.HP.COM!glenne%hplsla

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!HP-SDE.SDE.HP.COM!glenne%hplsla
From: glenne%hplsla@HP-SDE.SDE.HP.COM (Glenn Engel)
Newsgroups: gnu.gdb.bug
Subject: unable to get a backtrace on an arbitrary stack
Message-ID: <8903281615.AA24018@labgre.HP.COM>
Date: 28 Mar 89 16:15:19 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 56