Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* GDB Scripting
@ 2001-10-20  5:25 Robert Graulich
  2001-10-21 10:50 ` Fernando Nasser
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Graulich @ 2001-10-20  5:25 UTC (permalink / raw)
  To: GDB Mailing List

Hi all,

is it possible, to store the result of a gdb command like 'frame' in a variable?
I like to write someting like

  define hook-stop
    set $FRAME=frame
    if $FRAME=="main"
      ...
    else
      ...
    end
  end

How to do that?

Robert


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

* Re: GDB Scripting
  2001-10-20  5:25 GDB Scripting Robert Graulich
@ 2001-10-21 10:50 ` Fernando Nasser
  0 siblings, 0 replies; 2+ messages in thread
From: Fernando Nasser @ 2001-10-21 10:50 UTC (permalink / raw)
  To: Robert Graulich; +Cc: GDB Mailing List

Robert Graulich wrote:
> 
> Hi all,
> 
> is it possible, to store the result of a gdb command like 'frame' in a variable?
> I like to write someting like
> 
>   define hook-stop
>     set $FRAME=frame
>     if $FRAME=="main"
>       ...
>     else
>       ...
>     end
>   end
> 
> How to do that?
> 

Unfortunately the "frame" command does not set any convenience variable
automatically (which is the only way to obtain data from a GDB command 
execution).  So, the way to do this is:

Set a breakpoint at main.
Use the "commands" command and add
print $main_fp=$<reg>
continue

where <reg> is the FP register in your architecture.


Then just make your if compare the $<reg> at the
point you've stopped with $main_fp


I hope this helps.

Regards,
Fernando



-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


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

end of thread, other threads:[~2001-10-21 10:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-20  5:25 GDB Scripting Robert Graulich
2001-10-21 10:50 ` Fernando Nasser

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