public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Persitance of .gdbinit variables
@ 2005-04-28 15:20 Alex Bennee
  2005-04-28 15:33 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Bennee @ 2005-04-28 15:20 UTC (permalink / raw)
  To: gdb

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>

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

* Re: Persitance of .gdbinit variables
  2005-04-28 15:20 Persitance of .gdbinit variables Alex Bennee
@ 2005-04-28 15:33 ` Daniel Jacobowitz
  2005-04-28 16:21   ` Alex Bennee
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2005-04-28 15:33 UTC (permalink / raw)
  To: Alex Bennee; +Cc: gdb

On Thu, Apr 28, 2005 at 04:15:59PM +0100, Alex Bennee wrote:
> 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? 

Could you try a newer version of GDB?  If it still doesn't work in 6.3,
I'll need more details on how to reproduce it; because it appears to
work OK for me.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

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

* Re: Persitance of .gdbinit variables
  2005-04-28 15:33 ` Daniel Jacobowitz
@ 2005-04-28 16:21   ` Alex Bennee
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Bennee @ 2005-04-28 16:21 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

On Thu, 2005-04-28 at 11:20 -0400, Daniel Jacobowitz wrote:
> Could you try a newer version of GDB?  If it still doesn't work in 6.3,
> I'll need more details on how to reproduce it; because it appears to
> work OK for me.

Way ahead of you :-)

Unfortunately I can't get it to compile on the Solaris box:

make[1]: Entering directory `/home/alexjb/src/gdb-6.3/libiberty'
make[1]: Warning: File `Makefile' has modification time 3.5e+02 s in the
future
if [ x"" != x ]; then \
  gcc -c -DHAVE_CONFIG_H -g3  -I. -I./../include  -W -Wall -Wtraditional
-pedantic  ./regex.c -o pic/regex.o; \
else true; fi
gcc -c -DHAVE_CONFIG_H -g3  -I. -I./../include  -W -Wall -Wtraditional
-pedantic ./regex.c -o regex.o
make[1]: *** [regex.o] Error 1
make[1]: Leaving directory `/home/alexjb/src/gdb-6.3/libiberty'
make: *** [all-libiberty] Error 2

I'll continue poking...

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

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

end of thread, other threads:[~2005-04-28 15:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-28 15:20 Persitance of .gdbinit variables Alex Bennee
2005-04-28 15:33 ` Daniel Jacobowitz
2005-04-28 16:21   ` Alex Bennee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).