Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: 慕冬亮 <mudongliangabcd@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: How to show instructions in one record
Date: Tue, 06 Sep 2016 16:04:00 -0000	[thread overview]
Message-ID: <20160906160432.GA29307@host1.jankratochvil.net> (raw)
In-Reply-To: <CAD-N9QU9YS0qrcHrt=sNDRv1p4h1NXjfbF2g3LE_Wwa+sSo-xA@mail.gmail.com>

On Tue, 06 Sep 2016 17:43:06 +0200, 慕冬亮 wrote:
> I just want all the instructions which have already executed in one
> execution path. Take the following demo as example,

One can do some:
	start
	record
	cont
	<ctrl-c>
	reverse-continue
	while 1
	stepi
	x/i $pc
	end


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

But I think in thise case you should follow Markus Metzger's advice as the
output from 'record instruction-history' may be more appropriate for your
requirement.

Besides building GDB yourself you can use also Fedora 23 (and better Fedora
24) GDB which does have libipt support.

Be aware with btrace you cannot investigate any data or registers during the
recorded execution.


TBH I see this "display all recorded history" common request from GDB users
but IMO more effective approach is to place there watchpoints, breakpoints and
even breakpoint-attached command lists to catch the interesting moment during
execution.  The recorded history is huge and so one needs to filter it somehow
automatically afterwards anyway which the watchpoints solve on their own
already during execution.  Sure it may not be applicable for your case.


Jan


  reply	other threads:[~2016-09-06 16:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-06 14:14 慕冬亮
2016-09-06 14:59 ` Metzger, Markus T
     [not found] ` <20160906150017.GA22508@host1.jankratochvil.net>
2016-09-06 15:43   ` 慕冬亮
2016-09-06 16:04     ` Jan Kratochvil [this message]
     [not found]       ` <CAD-N9QUaaNjG=rmH+PXyni=KBt7eNcbT54XhAr1bzCXb6KZoTw@mail.gmail.com>
2016-09-06 17:15         ` Jan Kratochvil
     [not found]           ` <CAD-N9QU4Ru6VDLB=bSQt5gpFN_YXgn+it3+PnW4rvYkoANVvNQ@mail.gmail.com>
2016-09-06 17:35             ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160906160432.GA29307@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=mudongliangabcd@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox