* gdb cannot call help function in replay mode
@ 2013-06-25 4:11 jian shen
2013-06-26 18:45 ` Jan Kratochvil
0 siblings, 1 reply; 3+ messages in thread
From: jian shen @ 2013-06-25 4:11 UTC (permalink / raw)
To: gdb
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gdb cannot call help function in replay mode
2013-06-25 4:11 gdb cannot call help function in replay mode jian shen
@ 2013-06-26 18:45 ` Jan Kratochvil
2013-06-27 1:48 ` jian shen
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2013-06-26 18:45 UTC (permalink / raw)
To: jian shen; +Cc: gdb
On Tue, 25 Jun 2013 06:11:26 +0200, jian shen wrote:
> 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.
The function writes to stack and registers.
> 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?
You should use Python Pretty Printer instead. This will also work for core
file analysis where you also cannot call inferior functions.
Jan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gdb cannot call help function in replay mode
2013-06-26 18:45 ` Jan Kratochvil
@ 2013-06-27 1:48 ` jian shen
0 siblings, 0 replies; 3+ messages in thread
From: jian shen @ 2013-06-27 1:48 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb
On Thu, Jun 27, 2013 at 2:45 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
>> 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?
>
> You should use Python Pretty Printer instead. This will also work for core
> file analysis where you also cannot call inferior functions.
>
>
> Jan
Thanks, I got it.
But sometimes the code is from another library which I don't have the
source code.
They only provide a set of API to query or process the handles. In
this way it's not
easy to write Python Pretty Printer.
Is it possible that gdb could be enhanced that in replay mode, when
the function is
interactively called from gdb, it pretend to write the necessary info
to continue the call,
but after the call is finished, every written memory is rolled back,
and nothing is
actually written, and no execution log is changed. Is it doable?
In my understanding, it's always meaningless to write anything in replay mode.
So it's not perfect just give warning that it will make the replay
mode unusable.
It's better that the written is completely not allowed in replay mode.
Or anyone has better idea?
Thanks,
Jian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-27 1:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-25 4:11 gdb cannot call help function in replay mode jian shen
2013-06-26 18:45 ` Jan Kratochvil
2013-06-27 1:48 ` jian shen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox