www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/30/18:49:39

From: elf AT netcom DOT com (Marc Singer)
Message-Id: <199701302346.PAA23802@netcom10.netcom.com>
Subject: Re: Why can't GDB set a variable?
To: kagel AT dg1 DOT bloomberg DOT com
Date: Thu, 30 Jan 1997 15:46:20 -0800 (PST)
In-Reply-To: <9701301626.AA16799@quasar.bloomberg.com > from "kagel@quasar.bloomberg.com" at Jan 30, 97 11:26:06 am
MIME-Version: 1.0
Sender: elf AT netcom DOT com

> No, no.  When you entered the run (r) command GDB reloaded the executable from disk 
> and wiped out your change to 'x'.  Try this:
> 
> 
> gdb a.out
> (gdb) b main
> Breakpoint 1 at 0x101a88
> (gdb) r
> Starting program: c:/jsc/runtime/a.out
> (gdb) p x
> $1 = 1
> (gdb) set var x = 100

You can also use the form:

  p x=100

to set variables.

> (gdb) p x
> $2 = 100
> (gdb) step
> (gdb) p x
> $2 = 100
> (gdb) cont
> test.c: x = 100
> (gdb) q
> 
> -- 
> Art S. Kagel, kagel AT quasar DOT bloomberg DOT com
> 
> A proverb is no proverb to you 'till life has illustrated it.  -- John Keats
> 


-- Marc Singer

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019