Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: "Metzger, Markus T" <markus.t.metzger@intel.com>
Cc: "palves@redhat.com" <palves@redhat.com>,
	       "tromey@redhat.com" <tromey@redhat.com>,
	       "kettenis@gnu.org" <kettenis@gnu.org>,
	       "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	       "markus.t.metzger@gmail.com" <markus.t.metzger@gmail.com>
Subject: Re: [patch v6 00/12] branch tracing support for Atom
Date: Fri, 21 Dec 2012 19:12:00 -0000	[thread overview]
Message-ID: <20121221191205.GA341@host2.jankratochvil.net> (raw)
In-Reply-To: <A78C989F6D9628469189715575E55B2307B43C8A@IRSMSX102.ger.corp.intel.com>

On Thu, 20 Dec 2012 16:20:13 +0100, Metzger, Markus T wrote:
> My use case is to start with looking at the last 20 or so instructions. If
> that's not enough, I want to look at the next 20. This would not be
> supported by just adding "record list last <n>".

I believe the current "view" style command of btrace should behave like normal
"list" for the native GDB behavior.

"btrace 2" shows:
	(gdb) btrace 2
	   0x000000000048bda0 <poll@plt+0>:	jmpq   *0x17a599a(%rip)        # 0x1c31740 <poll@got.plt>
	(gdb) 
	   0x000000000048bda0 <poll@plt+0>:	jmpq   *0x17a599a(%rip)        # 0x1c31740 <poll@got.plt>
	(gdb) 

But then hitting just enter does not go further (to "btrace 3"), it repeats
still the same output.  In such case there should have been at least
"dont_repeat ();".  But I believe it would be more convenient to list the next
btrace records.

"btrace list" behaves the same, repeating the same content.  And after
"btrace list 1-9" one has to add the numbers to display "btrace list 1-19",
single newline could advance on its own.  "btrace list -" could go backwards,
"btrace list" forward - like the "list" command does.  But here is the
question of positive/negative numbers direction, discussed below.

I am fine with changing the cosmetic issues above in an additional patchset,
as long as it is all done before the next release 7.6.


> I wanted to keep the numbering of record/replay. That's why I added those
> variables to be able to express what I want.
> 
> Personally, I find the opposite numbering, i.e. from newest to oldest, more
> intuitive and more useful, since I'm typically more interested in the tail
> of the trace than the head.

I agree one is interested in the tail but there is at least the established
standard of "record" numbering direction.  (+FYI I find the existing "record"
direction more logical myself.)


> Is the instruction number used anywhere outside "record goto"?

From record.c also in "info record" and for bookmarks ("info bookmark",
"goto-bookmark" etc.).


> > Probably not at all.  Just there should remain the same to_resume/to_wait
> > hooking.
> 
> I'm not familiar with the implementation. I would expect, though, that it
> won't be enough to implement to_resume and to_wait hooks. I would rather
> expect that I will need to implement new stepping commands.

The idea of the "record" implementation is that the same standard stepping
commands work the same for "record" history, by emulating the target events.
So that even new commands/features will work with the existing "record"
implementation.

to_wait updates real hardware registers/memory when moving in history so
"everything just works".


> I further expect that I would need to replace frame unwinding.

Just to provide another unwinder, besides the several existing ones.  Some
unwinders are dwarf2_frame_unwind, inline_frame_unwind,
dwarf2_tailcall_frame_unwind, then the hardware ones like i386_frame_unwind.

The other possibility is to use existing unwinder (typically
dwarf2_frame_unwind) and simulate memory as if it had the simulated/expected
frames pointers; but for various reasons I do not find it right for btrace
unwinding - as it already needs to know how the frame looked at that point, so
I find cleaner to create the appropriate GDB frame structures instead of
faking the target memory so that the existing unwinders create them that way.


> For all other commands, I can
> only hope that gdb is OK with a target that can read (not write) RIP but no
> other register and that can access only code memory. 

GDB accesses stack memory each time, so the virtual btrace unwinder would need
to be really ahead of all the other unwinders so that it prevents such
accesses.

GDB also inserts/removes breakpoints each time, this could be reused from
record.c and its record_insert_breakpoint / record_remove_breakpoint.
("set breakpoint always-inserted on" reduces these accesses but it is not
a default yet.)

Then it could work I hope, "set debug target 1" shows the accesses.

I believe one could rather just ask user
	Do you really want to read possibly stale memory? (y or n)
or possibly just to print each time
	warning: The reported memory content may be stale!
as one may want to print just some global variable when already
reverse-stepped in a btrace history.  Doing some "bookmark", "continue",
"print errno", "goto-bookmark 5" may be too inconvenient.



Thanks,
Jan


  reply	other threads:[~2012-12-21 19:12 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17 16:02 markus.t.metzger
2012-12-17 16:02 ` [patch v6 09/12] gdbserver, linux, btrace: add btrace support for linux-low markus.t.metzger
2012-12-17 16:02 ` [patch v6 06/12] remote, btrace: add branch trace remote ops markus.t.metzger
2012-12-17 19:57   ` Jan Kratochvil
2012-12-17 16:02 ` [patch v6 02/12] cli, btrace: add btrace cli markus.t.metzger
2012-12-17 18:32   ` Jan Kratochvil
2012-12-18  7:36     ` Metzger, Markus T
2012-12-18  8:35       ` Jan Kratochvil
2012-12-18  9:04   ` Jan Kratochvil
2012-12-18  9:11     ` Metzger, Markus T
2012-12-17 16:02 ` [patch v6 12/12] btrace, x86: disable on some processors markus.t.metzger
2012-12-17 17:11   ` Mark Kettenis
2012-12-19 16:13     ` Metzger, Markus T
2012-12-19 16:36       ` Mark Kettenis
2012-12-21 10:38       ` Jan Kratochvil
2012-12-17 17:37   ` H.J. Lu
2012-12-19 15:58     ` Metzger, Markus T
2012-12-17 20:35   ` Jan Kratochvil
2012-12-17 16:02 ` [patch v6 01/12] thread, btrace: add generic branch trace support markus.t.metzger
2012-12-17 16:02 ` [patch v6 08/12] gdbserver, btrace: add generic btrace support markus.t.metzger
2012-12-17 20:43   ` Jan Kratochvil
2012-12-17 16:03 ` [patch v6 10/12] test, btrace: add branch tracing tests markus.t.metzger
2012-12-17 20:26   ` Jan Kratochvil
2012-12-17 16:03 ` [patch v6 04/12] linux, i386, amd64: enable btrace for 32bit and 64bit linux native markus.t.metzger
2012-12-17 16:03 ` [patch v6 05/12] xml, btrace: define btrace xml document style markus.t.metzger
2012-12-17 19:53   ` Jan Kratochvil
2012-12-18  7:43     ` Metzger, Markus T
2012-12-17 16:03 ` [patch v6 11/12] test, btrace: more branch tracing tests markus.t.metzger
2012-12-17 16:03 ` [patch v6 07/12] btrace, doc: document remote serial protocol markus.t.metzger
2012-12-17 16:03 ` [patch v6 03/12] linux, btrace: perf_event based branch tracing markus.t.metzger
2012-12-17 18:45 ` [patch v6 00/12] branch tracing support for Atom Jan Kratochvil
2012-12-17 19:34   ` Tom Tromey
2012-12-18  7:24     ` Metzger, Markus T
2012-12-18  9:20 ` Jan Kratochvil
2012-12-18 10:14   ` Metzger, Markus T
2012-12-18 13:55     ` Jan Kratochvil
2012-12-19  9:59       ` Metzger, Markus T
2012-12-19 12:13         ` Mark Kettenis
2012-12-19 12:37           ` Jan Kratochvil
2012-12-20  7:17         ` Jan Kratochvil
2012-12-20  9:14           ` Metzger, Markus T
2012-12-20 11:43             ` Jan Kratochvil
2012-12-20 15:20               ` Metzger, Markus T
2012-12-21 19:12                 ` Jan Kratochvil [this message]
2012-12-22 13:08         ` Jan Kratochvil
2013-01-01 16: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=20121221191205.GA341@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kettenis@gnu.org \
    --cc=markus.t.metzger@gmail.com \
    --cc=markus.t.metzger@intel.com \
    --cc=palves@redhat.com \
    --cc=tromey@redhat.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