Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* expanding backtrace
@ 2006-06-28  3:05 Cameron Stone
  2006-06-28 14:02 ` Daniel Jacobowitz
  2006-06-29  2:27 ` Andrew STUBBS
  0 siblings, 2 replies; 4+ messages in thread
From: Cameron Stone @ 2006-06-28  3:05 UTC (permalink / raw)
  To: gdb

I'm trying to write a script to print an expanded backtrace. It's basically:

while loop_condition
	print frame
	print local variables
	print list (context)
	up-silently
end

However, I can't figure out how to implement the loop condition. All the 
functions in the manual are about how to print that information, but can't 
figure out how to get it into a variable or something that can be used to 
break the loop.

Apologies if this has already been dealt with. I couldn't find it in the list 
archives.
-- 
===================================================================

"Man is the only animal that blushes -- or needs to." - Mark Twain

Cameron Stone                            <camerons@cse.unsw.edu.au>
===================================================================


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

* Re: expanding backtrace
  2006-06-28  3:05 expanding backtrace Cameron Stone
@ 2006-06-28 14:02 ` Daniel Jacobowitz
  2006-06-29  2:27 ` Andrew STUBBS
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2006-06-28 14:02 UTC (permalink / raw)
  To: Cameron Stone; +Cc: gdb

On Tue, Jun 27, 2006 at 06:25:19PM +1000, Cameron Stone wrote:
> I'm trying to write a script to print an expanded backtrace. It's basically:
> 
> while loop_condition
> 	print frame
> 	print local variables
> 	print list (context)
> 	up-silently
> end
> 
> However, I can't figure out how to implement the loop condition. All the 
> functions in the manual are about how to print that information, but can't 
> figure out how to get it into a variable or something that can be used to 
> break the loop.

You can't; the GDB CLI just doesn't support this sort of thing. 
However, I'm vaguely hopeful that we'll have better scripting support
in time for the next release.

"while 1" might work, since the last "up" will raise an error.

"bt full" handles the frame and local variables already, btw, but I
don't think it lists.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: expanding backtrace
  2006-06-28  3:05 expanding backtrace Cameron Stone
  2006-06-28 14:02 ` Daniel Jacobowitz
@ 2006-06-29  2:27 ` Andrew STUBBS
  2006-06-29  3:48   ` Nick Roberts
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew STUBBS @ 2006-06-29  2:27 UTC (permalink / raw)
  To: Cameron Stone; +Cc: gdb

Cameron Stone wrote:
> I'm trying to write a script to print an expanded backtrace. It's basically:
> 
> while loop_condition
> 	print frame
> 	print local variables
> 	print list (context)
> 	up-silently
> end
> 
> However, I can't figure out how to implement the loop condition. All the 
> functions in the manual are about how to print that information, but can't 
> figure out how to get it into a variable or something that can be used to 
> break the loop.
> 
> Apologies if this has already been dealt with. I couldn't find it in the list 
> archives.

You could write something like

while $pc != 0

or

while $sp <= $topofmem

It depends how your backtraces end.


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

* Re: expanding backtrace
  2006-06-29  2:27 ` Andrew STUBBS
@ 2006-06-29  3:48   ` Nick Roberts
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Roberts @ 2006-06-29  3:48 UTC (permalink / raw)
  To: Andrew STUBBS; +Cc: Cameron Stone, gdb

 > You could write something like
 > 
 > while $pc != 0

I don't think that works.

 > or
 > 
 > while $sp <= $topofmem
 > 
 > It depends how your backtraces end.

If you mean:

  (gdb) start
  ...
  (gdb) set $topofmem=$sp

and use "$sp < $topofmem" for the loop condition, then that looks like a good
idea.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


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

end of thread, other threads:[~2006-06-27 23:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-28  3:05 expanding backtrace Cameron Stone
2006-06-28 14:02 ` Daniel Jacobowitz
2006-06-29  2:27 ` Andrew STUBBS
2006-06-29  3:48   ` Nick Roberts

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