gdb cannot call help function in replay mode

jian shen <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAC5CAUrgKcRcm_WnJigB5UNrDFqnpQhqmh_b+hUj3t-sz1pqGw@mail.gmail.com>
In below example, when I try to call function getA1() in replay mode, gdb give
warning that it will write memory and make the execution log unusable, although
this function does not write memory, only read memory. (here, read the global
variable "_a1")
In real project, I have some helper function to dump what a handle is.  But in
replay mode, I could not call such functions.  This limitation makes the replay
mode almost unusable to me.  Any suggestion?

----- a.c -----
     1  int _a1;
     2  int getA1()
     3  {
     4    return _a1;
     5  }
     6
     7  int main()
     8  {
     9    _a1 = 3;
    10    _a1 ++;
    11    _a1 ++;
    12    return 0;
    13  }
    14
----- a.c end -----

GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/jianshen/t1/t1...done.
(gdb) b main
Breakpoint 1 at 0x80483f9: file a.c, line 9.
(gdb) r
Starting program: /home/jianshen/t1/t1

Breakpoint 1, main () at a.c:9
9         _a1 = 3;
(gdb) record
(gdb) n
10        _a1 ++;
(gdb) n
11        _a1 ++;
(gdb) rn
10        _a1 ++;
(gdb) p getA1()
Because GDB is in replay mode, writing to memory will make the
execution log unusable from this point onward.  Write memory at
address 0xbffff64f?(y or n) y
$1 = 3
(gdb) rs
10        _a1 ++;
(gdb) rs
10        _a1 ++;
(gdb) rs
10        _a1 ++;
(gdb) rs
10        _a1 ++;
(gdb) rs
getA1 () at a.c:5
5       }

Thanks,
Jian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.