reverse execution

Jan Kratochvil jan.kratochvil@redhat.com
Mon Apr 8 14:47:00 GMT 2013


On Mon, 08 Apr 2013 16:34:37 +0200, ishare wrote:
> I record at 0x40000000 , then I nexti 10 instructions , then I want reverse execute 
> these 10 instructions one by one, So I type reverse-nexti ,but unexpectly ,gdb directly
> goes back to the addresss 0x40000000 ,where I start record .
> 
> What I need is 10->9->8->7->6->5->4->3->2->1 ,not execute again from begin to end .

It is safer during troubleshooting to use *stepi instead of *nexti (where
there is no difference as there is no call instruction).

It works for me with 7.5.1 so it would be needed to have a reproducer.

Additionally there ware some 7.6 (pre-release available now) fixes to these
issues but it should not affect this case as long as there are no calls.


Regards,
Jan


GNU gdb (GDB) 7.5.1.20130125-cvs
Copyright (C) 2012 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 "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/jkratoch/t/nops...done.
(gdb) disas _start
Dump of assembler code for function _start:
   0x00000000004000d4 <+0>:	nop
   0x00000000004000d5 <+1>:	nop
   0x00000000004000d6 <+2>:	nop
   0x00000000004000d7 <+3>:	nop
   0x00000000004000d8 <+4>:	nop
   0x00000000004000d9 <+5>:	nop
   0x00000000004000da <+6>:	nop
   0x00000000004000db <+7>:	nop
   0x00000000004000dc <+8>:	nop
   0x00000000004000dd <+9>:	nop
   0x00000000004000de <+10>:	int3   
End of assembler dump.
(gdb) info files 
Symbols from "/home/jkratoch/t/nops".
Local exec file:
	`/home/jkratoch/t/nops', file type elf64-x86-64.
	Entry point: 0x4000d4
	0x00000000004000b0 - 0x00000000004000d4 is .note.gnu.build-id
	0x00000000004000d4 - 0x00000000004000df is .text
(gdb) b *0x4000d4
Breakpoint 1 at 0x4000d4: file nops.S, line 2.
(gdb) r
Starting program: /home/jkratoch/t/nops 
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffd000

Breakpoint 1, _start () at nops.S:2
2	nop
(gdb) record 
(gdb) nexti
3	nop
(gdb) 
4	nop
(gdb) 
5	nop
(gdb) 
6	nop
(gdb) 
7	nop
(gdb) 
8	nop
(gdb) 
9	nop
(gdb) 
10	nop
(gdb) 
11	nop
(gdb) 
12	int3
(gdb) reverse-nexti
11	nop
(gdb) 
10	nop
(gdb) 
9	nop
(gdb) 
8	nop
(gdb) 
7	nop
(gdb) 
6	nop
(gdb) 
5	nop
(gdb) 
4	nop
(gdb) 
3	nop
(gdb) 

No more reverse-execution history.
_start () at nops.S:2
2	nop
(gdb) 
-------------- next part --------------
_start: .globl _start
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
int3


More information about the Gdb mailing list