This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to show instructions in one record


2016-09-06 11:00 GMT-04:00 Jan Kratochvil <jan.kratochvil@redhat.com>:
> On Tue, 06 Sep 2016 16:13:52 +0200, 慕冬亮 wrote:
>> So how to show instructions in one record?
>
> I do not fully understand what "instructions in one record" mean but some
> demo:
>
I just want all the instructions which have already executed in one
execution path. Take the following demo as example,

What I need is the instruction list:

203             movq     %r9, 16(%rdi)
203             movq     %r9, 16(%rdi)
202             movq     %r8,  8(%rdi)
201             movq    %rax,   (%rdi)
199             movq    24(%rsi), %r10
198             movq    16(%rsi), %r9
......
If there are loops, I need all the instructions in the loop.
I don't know whether process record/replay could achieve this goal.

> (gdb) start
> [...]
> (gdb) record
> (gdb) c
> Continuing.
> Program received signal SIGINT, Interrupt.
> __memcpy_sse2 () at ../sysdeps/x86_64/memcpy.S:203
> 203             movq     %r9, 16(%rdi)
> (gdb) info record
> Active record target: record-full
> Record mode:
> Lowest recorded instruction number is 1.
> Highest recorded instruction number is 100092.
> Log contains 100092 instructions.
> Max logged instructions is 10000000.
> (gdb) reverse-stepi
> 203             movq     %r9, 16(%rdi)
> (gdb)
> 202             movq     %r8,  8(%rdi)
> (gdb)
> 201             movq    %rax,   (%rdi)
> (gdb)
> 199             movq    24(%rsi), %r10
> (gdb)
> 198             movq    16(%rsi), %r9
> (gdb) info record
> Active record target: record-full
> Replay mode:
> Lowest recorded instruction number is 1.
> Current instruction number is 100087.
> Highest recorded instruction number is 100092.
> Log contains 100092 instructions.
> Max logged instructions is 10000000.
> (gdb) frame
> #0  __memcpy_sse2 () at ../sysdeps/x86_64/memcpy.S:198
> 198             movq    16(%rsi), %r9
> (gdb) x/i $pc
> => 0x7ffff50311e9 <__memcpy_sse2+217>:  mov    0x10(%rsi),%r9
> (gdb) _


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]