Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Alex Bennee <kernel-hacker@bennee.com>
To: gdb@sources.redhat.com
Subject: Persitance of .gdbinit variables
Date: Thu, 28 Apr 2005 15:20:00 -0000	[thread overview]
Message-ID: <1114701359.6341.83.camel@okra.transitives.com> (raw)

Hi,

I'm working on writing a bunch of user commands for my .gdbinit. However
the first time I run the command I want to insert a breakpoint into a
piece of code. I'm using some convenience variables to maintain state
thus:

[extracts from my .gdinit]
#
# Globally set some convenience variables we use to determine state
# and the like.
#
set $gcbp=0
set $gcbp_hook=0
set $foo=1234

printf "Set gcbp to %d\n", $gcbp
printf "Set gcbp_hook to %d\n", $gcbp_hook
printf "Set foo to %d\n", $foo

define gcb
   if $gcbp==0
       set $gcbp=$arg0
       if $gcbp_hook==0
           install_gcbp_hook
       end
   else
       print "Can't set new GC Breakpoint until 0x%x set", $gcbp    
   end
end
[end extracts]

When I start up gdb I can see the variables set however running gcb
fails with an Invalid type test because the variables have lost there
values:

[run]
16:04 alex@xxxxx >gdb -x gdb_dirs --args myprog
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-pc-solaris2.9"...Set gcbp to 0
Set gcbp_hook to 0
Set foo to 1234
 
(gdb) gcb 0xdb570b24
Invalid type combination in equality test.
(gdb) p $gcbp_hook
$1 = void
(gdb) p $gcbp
$2 = void
(gdb)
[end of run]

Is this expected behaviour? 
Is there a way to ensure variables exist after .gdbinit has loaded?
Failing that is there a way to test if a value in undefined/void so I
can just setup at that point?

-- 
Alex Bennee <kernel-hacker@bennee.com>


             reply	other threads:[~2005-04-28 15:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-28 15:20 Alex Bennee [this message]
2005-04-28 15:33 ` Daniel Jacobowitz
2005-04-28 16:21   ` Alex Bennee

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=1114701359.6341.83.camel@okra.transitives.com \
    --to=kernel-hacker@bennee.com \
    --cc=gdb@sources.redhat.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