Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Metzger, Markus T" <markus.t.metzger@intel.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	"markus.t.metzger@gmail.com" <markus.t.metzger@gmail.com>
Subject: RE: [draft patch] <unavailable> unwinder for btrace  [Re: [rfc 3/5] record: make it build again]
Date: Wed, 27 Mar 2013 18:09:00 -0000	[thread overview]
Message-ID: <A78C989F6D9628469189715575E55B2307BA9030@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <20130211171319.GA17524@host2.jankratochvil.net>

> -----Original Message-----
> From: Jan Kratochvil [mailto:jan.kratochvil@redhat.com]
> Sent: Monday, February 11, 2013 6:13 PM

 [...]

> gdb/
> 2013-02-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	New record unwinder reporting <unavailable>.
> 	* dwarf2-frame.c (dwarf2_frame_cfa): Move UNWIND_UNAVAILABLE check
> 	earlier.
> 	* frame-unwind.c: Include target.h.
> 	(frame_unwind_try_unwinder): New function with code from ...
> 	(frame_unwind_find_by_frame): ... here.  New variable
> 	unwinder_from_target, call also target_get_unwinder and
> 	frame_unwind_try_unwinder for it.
> 	* frame.c (get_frame_unwind_stop_reason): Unconditionally call
> 	get_prev_frame_1.
> 	* record.c: Include frame-unwind.h.
> 	(record_frame_unwind_stop_reason, record_frame_this_id)
> 	(record_frame_prev_register, record_frame_sniffer, record_frame_unwind):
> 	New.
> 	(init_record_ops, init_record_core_ops): Install it.
> 	* target.c (target_get_unwinder): New.
> 	* target.h (struct target_ops): New field to_get_unwinder.
> 	(target_get_unwinder): New declaration.

I've been experimenting with this a bit.  It looks like there will always be
a sentinel frame at the very bottom that is reading the registers directly
from the inferior.  I can only hook in at the second frame.

In order to fake the back trace for btrace replay, I would also need to
replace the sentinel frame, since otherwise, the first frame will always
point to the current location.

Am I doing something wrong?

If not, would you please point me to some code that I would need to
touch to replace the sentinel frame?  Would I maybe provide another
target method to allow targets to overwrite the sentinel frame?


On a related but different topic, I added a btrace frame type and
prologue cache.  The cache holds a pointer to some btrace data
structure that is used to compute the fake back trace.  In order to
unwind a btrace frame, I would need to access the next frame's
location in this btrace data structure.

The easiest would be to check for the next frame's type and then
access it's cache - which doesn't work since struct frame_info is
opaque.  I ended up encoding the pointer into the special_addr
of a btrace frame's frame_id - which is somewhat ugly.  Any better
idea?

Also what's the lifetime of a frame_info and frame_id object?
When the branch trace is cleared, any pointers to it will become
stale.

Thanks,
Markus.
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052


  parent reply	other threads:[~2013-03-27 15:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-08 15:30 [rfc 0/5] record-btrace markus.t.metzger
2013-02-08 15:30 ` [rfc 1/5] target: add add_deprecated_target_alias markus.t.metzger
2013-02-10 22:10   ` Jan Kratochvil
2013-02-08 15:30 ` [rfc 5/5] record, disas: add record disassemble command markus.t.metzger
2013-02-10 22:11   ` Jan Kratochvil
2013-02-08 15:31 ` [rfc 3/5] record: make it build again markus.t.metzger
2013-02-10 22:11   ` Jan Kratochvil
2013-02-11 13:41     ` Metzger, Markus T
2013-02-11 14:15       ` Jan Kratochvil
2013-02-11 17:13         ` [draft patch] <unavailable> unwinder for btrace [Re: [rfc 3/5] record: make it build again] Jan Kratochvil
2013-02-11 21:24           ` Tom Tromey
2013-02-13  7:35           ` Metzger, Markus T
2013-02-13  7:58             ` Jan Kratochvil
2013-02-13  8:08               ` Metzger, Markus T
2013-03-27 18:09           ` Metzger, Markus T [this message]
2013-03-28 12:38             ` Markus Metzger
     [not found]               ` <20130328062747.GA27157@host2.jankratochvil.net>
2013-03-28 14:28                 ` Metzger, Markus T
2013-03-28 14:38                   ` Jan Kratochvil
2013-03-28 17:37                     ` Metzger, Markus T
2013-02-08 15:31 ` [rfc 4/5] record: default target methods markus.t.metzger
2013-02-10 22:11   ` Jan Kratochvil
2013-02-08 15:32 ` [rfc 2/5] record: split record markus.t.metzger
2013-02-10 22:11   ` 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=A78C989F6D9628469189715575E55B2307BA9030@IRSMSX102.ger.corp.intel.com \
    --to=markus.t.metzger@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=markus.t.metzger@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