delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/30/02:42:09

From: jrubin AT bix DOT com (jrubin)
Newsgroups: comp.os.msdos.djgpp
Subject: Why can't GDB set a variable?
Date: 29 Jan 1997 18:31:54 GMT
Organization: BIX
Lines: 32
Message-ID: <5co52q$hg0@news2.delphi.com>
NNTP-Posting-Host: ns.delphi.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

GDB claims to be changing the value of the variable 'x',
but the program doesn't seem to notice. When GDB exits,
it reports failure to close the image file.


File test.c:
------------
#include <stdio.h>

int x = 1;

int main(void)
{
  printf("test.c: x = %d\n",x);
  return 0;
}

--------------
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)


- Raw text -


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