Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Fernando Nasser <fnasser@redhat.com>
To: Robert Graulich <graulich@synopsys.COM>
Cc: GDB Mailing List <gdb@sources.redhat.com>
Subject: Re: GDB Scripting
Date: Sun, 21 Oct 2001 10:50:00 -0000	[thread overview]
Message-ID: <3BD30A62.474E1FFC@redhat.com> (raw)
In-Reply-To: <3BD16CD3.CCF7FB47@synopsys.com>

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


      reply	other threads:[~2001-10-21 10:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-20  5:25 Robert Graulich
2001-10-21 10:50 ` Fernando Nasser [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3BD30A62.474E1FFC@redhat.com \
    --to=fnasser@redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=graulich@synopsys.COM \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox