www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/03/07:03:30

From: Robert Hoehne <Robert DOT Hoehne AT Mathematik DOT tu-chemnitz DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Why can't GDB set a variable?
Date: Mon, 03 Feb 1997 11:31:05 +0100
Organization: TU Chemnitz-Zwickau
Lines: 37
Message-ID: <32F5BE69.7BAB@Mathematik.tu-chemnitz.de>
References: <5co52q$hg0 AT news2 DOT delphi DOT com>
NNTP-Posting-Host: cancel.hrz.tu-chemnitz.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

jrubin wrote:
> 
> gcc -g test.c
> gdb a.out
> (gdb) p x
> $1 = 1
> (gdb) set var x = 100
> (gdb) p x
> $2 = 100
> (gdb) r
> Starting program: c:/jsc/runtime/a.out
> test.c: x = 1
> (gdb) q
> warning: cannot close "c:/jsc/runtime/a.out": Permission denied (EACCES)

This comes probably from the fact, that you are changing
the contents of a variable which memory is at this time
not valid. When you start gdb it reads only the symbols
but does not read the program in memory. Normally gdb
should complain that you are trying to access invalid
memory (but it doesn't, why???).

And that 'x' has not the value you have set comes
from the same fact.


BTW: Is that the complete output of gdb or have you snipped
something?

Robert
-- 
*****************************************************************
* Robert Hoehne, Fakultaet fuer Mathematik, TU-Chemnitz-Zwickau *
* Post:    Am Berg 3, D-09573 Dittmannsdorf                     *
* e-Mail:  Robert DOT Hoehne AT Mathematik DOT TU-Chemnitz DOT DE              *
* WWW:     http://www.tu-chemnitz.de/~rho                       *
*****************************************************************

- Raw text -


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