Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* backtrace C-API
@ 2003-04-18 12:33 Gerrit Bruchhäuser
  2003-04-18 13:39 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Gerrit Bruchhäuser @ 2003-04-18 12:33 UTC (permalink / raw)
  To: gdb

Hello,

is there any C-API function in libgdb.a (or some other library) which
returns a call stack (something 'bt' like)?

Many thanks!
// Gerrit

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: backtrace C-API
  2003-04-18 12:33 backtrace C-API Gerrit Bruchhäuser
@ 2003-04-18 13:39 ` Daniel Jacobowitz
  2003-04-21 21:05   ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2003-04-18 13:39 UTC (permalink / raw)
  To: Gerrit Bruchhäuser; +Cc: gdb

On Fri, Apr 18, 2003 at 02:33:27PM +0200, Gerrit Bruchhäuser wrote:
> Hello,
> 
> is there any C-API function in libgdb.a (or some other library) which
> returns a call stack (something 'bt' like)?

No; but you might find backtrace() useful if you're on a
glibc-supported platform.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: backtrace C-API
  2003-04-18 13:39 ` Daniel Jacobowitz
@ 2003-04-21 21:05   ` Andrew Cagney
  2003-04-22  0:51     ` Jason Molenda
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2003-04-21 21:05 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Gerrit Bruchhäuser, gdb

> On Fri, Apr 18, 2003 at 02:33:27PM +0200, Gerrit Bruchhäuser wrote:
> 
>> Hello,
>> 
>> is there any C-API function in libgdb.a (or some other library) which
>> returns a call stack (something 'bt' like)?
> 
> 
> No; but you might find backtrace() useful if you're on a
> glibc-supported platform.

But there probably should.  How hard is it to create a `target-self' 
that uses local memory, and a jump-buf for registers?  The tricky bit, I 
see, is the symbol table assuming a single global structure.

Andrew



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: backtrace C-API
  2003-04-21 21:05   ` Andrew Cagney
@ 2003-04-22  0:51     ` Jason Molenda
  2003-04-22 17:05       ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Jason Molenda @ 2003-04-22  0:51 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Daniel Jacobowitz, Gerrit Bruchhäuser, gdb


On Monday, April 21, 2003, at 02:04  PM, Andrew Cagney wrote:

>> On Fri, Apr 18, 2003 at 02:33:27PM +0200, Gerrit Bruchhäuser wrote:
>>> Hello,
>>> is there any C-API function in libgdb.a (or some other library) which
>>> returns a call stack (something 'bt' like)?
>> No; but you might find backtrace() useful if you're on a
>> glibc-supported platform.
>
> But there probably should.  How hard is it to create a `target-self' 
> that uses local memory, and a jump-buf for registers?  The tricky bit, 
> I see, is the symbol table assuming a single global structure.


This falls into the category of Nasty Hack, but I helped someone on our 
compiler group with a similar problem a long time ago.  I had them add 
a call at the site of interest which (a) got the current process' pid, 
(b) wrote a little gdb command script into a /tmp file which would 
attach to the process, bt, and detach, (c) ran system ("gdb 
--command=/tmp...") in the function, and (d) removed the file from /tmp.

I'm sure there are better ways to handle all this, but it took about 
five minutes to do all this correctly -- for a one-off problem, it 
wasn't a bad solution.  They captured stdout, massaged the output a 
bit, and had the info they needed.

J
From gdb-return-13510-listarch-gdb=sources.redhat.com@sources.redhat.com Tue Apr 22 05:39:21 2003
Return-Path: <gdb-return-13510-listarch-gdb=sources.redhat.com@sources.redhat.com>
Delivered-To: listarch-gdb@sources.redhat.com
Received: (qmail 19022 invoked by alias); 22 Apr 2003 05:39:20 -0000
Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm
Precedence: bulk
List-Subscribe: <mailto:gdb-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/gdb/>
List-Post: <mailto:gdb@sources.redhat.com>
List-Help: <mailto:gdb-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: gdb-owner@sources.redhat.com
Delivered-To: mailing list gdb@sources.redhat.com
Received: (qmail 18983 invoked from network); 22 Apr 2003 05:39:19 -0000
Received: from unknown (HELO rediffmail.com) (203.199.83.245)
  by sources.redhat.com with SMTP; 22 Apr 2003 05:39:19 -0000
Received: (qmail 428 invoked by uid 510); 22 Apr 2003 05:44:44 -0000
Date: Tue, 22 Apr 2003 05:39:00 -0000
Message-ID: <20030422054444.426.qmail@mailweb33.rediffmail.com>
Received: from unknown (219.65.138.221) by rediffmail.com via HTTP; 22 apr 2003 05:44:44 -0000
MIME-Version: 1.0
From: "Nimesh D Chanchani" <nimeshc@rediffmail.com>
Reply-To: "Nimesh D Chanchani" <nimeshc@rediffmail.com>
To: gdb-digest-help@sources.redhat.com
Cc: gdb@sources.redhat.com
Subject: Enhancements/Improvements in GDB 5.2 from GDB 4.18
Content-type: text/plain;
	format=flowed
Content-Disposition: inline
X-SW-Source: 2003-04/txt/msg00242.txt.bz2
Content-length: 469

Hi ,

I am required to upgrade gdb version 4.18 to gdb version 5.2 for
the ZSP processor. Patches have been applied to gdb 5.2 to port it
to the ZSP processor. I am now looking to incorporate the "special
features" / "improvements" of gdb 5.2 in the newer port. Can
anyone lead me to pointers where I can get a chronological list of
enhancements made to gdb from 4.18 to 5.2. Any Help will be
greatly appreciated.

Thaking in advance

Regards,
Nimesh Chanchani



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: backtrace C-API
  2003-04-22  0:51     ` Jason Molenda
@ 2003-04-22 17:05       ` Andrew Cagney
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2003-04-22 17:05 UTC (permalink / raw)
  To: Jason Molenda; +Cc: Daniel Jacobowitz, Gerrit Bruchhäuser, gdb

> 
> On Monday, April 21, 2003, at 02:04  PM, Andrew Cagney wrote:
> 
> On Fri, Apr 18, 2003 at 02:33:27PM +0200, Gerrit Bruchhäuser wrote:
> Hello,
> is there any C-API function in libgdb.a (or some other library) which
> returns a call stack (something 'bt' like)?
> No; but you might find backtrace() useful if you're on a
> glibc-supported platform.
> 
> But there probably should.  How hard is it to create a `target-self' that uses local memory, and a jump-buf for registers?  The tricky bit, I see, is the symbol table assuming a single global structure.
> 
> 
> This falls into the category of Nasty Hack, but I helped someone on our compiler group with a similar problem a long time ago.  I had them add a call at the site of interest which (a) got the current process' pid, (b) wrote a little gdb command script into a /tmp file which would attach to the process, bt, and detach, (c) ran system ("gdb --command=/tmp...") in the function, and (d) removed the file from /tmp.
> 
> I'm sure there are better ways to handle all this, but it took about five minutes to do all this correctly -- for a one-off problem, it wasn't a bad solution.  They captured stdout, massaged the output a bit, and had the info they needed.

It's actually a well accepted technique.  I first learnt about it on a 
web page somewhere.

Andrew



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-04-22 17:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-18 12:33 backtrace C-API Gerrit Bruchhäuser
2003-04-18 13:39 ` Daniel Jacobowitz
2003-04-21 21:05   ` Andrew Cagney
2003-04-22  0:51     ` Jason Molenda
2003-04-22 17:05       ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox