From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: koriakin@0x04.net (Marcin Kościelnicki)
Cc: arnez@linux.vnet.ibm.com, gdb-patches@sourceware.org,
koriakin@0x04.net (Marcin Kościelnicki)
Subject: Re: [PATCH 1/8] gdb: Add supply_pseudo_pc hook to gdbarch.
Date: Tue, 16 Feb 2016 18:28:00 -0000 [thread overview]
Message-ID: <20160216182754.CE86C6BEA@oc7340732750.ibm.com> (raw)
In-Reply-To: <1454853588-17529-1-git-send-email-koriakin@0x04.net> from "=?UTF-8?q?Marcin=20Ko=C5=9Bcielnicki?=" at Feb 07, 2016 02:59:48 PM
Marcin KoÃ
Âcielnicki wrote:
> I don't think generalizing that function to arbitrary pseudo registers
> is a good idea - there's already a pseudo_register_write, which covers
> writing them. The only reason I'm not using it in tracepoint.c is
> that there's no "current register state" to write over, I'm making
> a new one from scratch.
Well, strictly speaking there is already a "current register state"
since tracefile_fetch_registers just initialized all registers to
the "unavailable" state. At this point they could be fetched (and
would read all zeros).
So in principle you could just use regcache_write_pc at this point.
The reason this doesn't work is a different one: that routine would
attempt to *update target state*, i.e. it would call to the target's
to_store_registers method. However, the tracefile target only
provides a to_fetch_registers method, and no to_store_registers,
and the default target to_store_registers method just errors out.
You *could* add a to_store_registers tracefile target method that
would simply ignore writes (in effect, making the tracefile regcache
modifyable without any underlying "real" target); then you could
just use regcache_write_pc.
However, this would not address the fact that there are potentially
target-specific settings beyond a pure PC value that must be
present in order to make a "synthetic" regcache at least minimally
consistent. This includes e.g. the address mode bit on 31-bit.
Note that a default value of 0 isn't really valid for the PSWM
register either, even though probably nobody checks. But there
are a number of bits that have to be set to make it a valid
user-space PSW (e.g. interrupts and address translation must be
enabled etc.). If you'd ever try to load the PSW back to the
hardware via ptrace, a 0 PSWM would get rejected.
> Perhaps a better generalization would be to instead make a hook that's
> supposed to provide a whole regcache based on the tracepoint location,
> not just PC? I can imagine a few uses for that:
>
> - on machines like ARM where you have several instruction encodings,
> you could also supply whatever registers determine the encoding
> (arm vs thumb) based on the location.
> - if you can determine from the debug information that the function
> keeps GOT pointer / literal pool pointer / whatever in some register
> at the tracepoint location, you can also guess the contents of these
> (although that's probably not all that useful, and can be a lie
> if something is horribly buggy).
Given the above, I therefore agree that this is really probably
the preferable level of abstraction here. You want a gdbarch hook
to synthesize a minimally-valid regcache given only information
statically known about the tracepoint. Whether this hook gets
just the PC or a full tracepoint structure is probably not so
important right now; this could still be modified if necessary.
I'd also suggest that this hook doesn't get a predicate, but a
default implementation, which does the current handling of just
setting a real PC register. If overridden by a gdbarch, the
platform can do anything that's necessary there instead.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com
next prev parent reply other threads:[~2016-02-16 18:28 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-24 12:12 [PATCH 0/8] gdb/s390: Add regular and fast tracepoint support Marcin Kościelnicki
2016-01-24 12:12 ` [PATCH 8/8] gdbserver/s390: Add support for compiled agent expressions Marcin Kościelnicki
2016-03-04 10:41 ` [PATCH v2] " Marcin Kościelnicki
2016-03-14 16:19 ` Andreas Arnez
2016-01-24 12:12 ` [PATCH 7/8] gdb.trace: Bump tspeed.exp timeout to 600 seconds Marcin Kościelnicki
2016-01-26 18:17 ` Andreas Arnez
2016-01-29 9:53 ` [PATCH] " Marcin Kościelnicki
2016-02-12 11:20 ` Yao Qi
2016-02-18 18:54 ` Marcin Kościelnicki
2016-01-24 12:12 ` [PATCH 2/8] gdb/s390: Fill write_guessed_tracepoint_pc hook Marcin Kościelnicki
2016-01-26 18:12 ` Andreas Arnez
2016-01-26 19:26 ` Marcin Kościelnicki
2016-01-29 18:57 ` Andreas Arnez
2016-02-07 14:00 ` [PATCH 2/8] gdb/s390: Fill supply_pseudo_pc hook Marcin Kościelnicki
2016-01-24 12:12 ` [PATCH 4/8] gdb/s390: Fill gen_return_address hook Marcin Kościelnicki
2016-02-07 14:02 ` Marcin Kościelnicki
2016-02-25 19:23 ` Marcin Kościelnicki
2016-03-04 10:42 ` Marcin Kościelnicki
2016-03-11 11:20 ` Andreas Arnez
2016-03-11 11:35 ` Marcin Kościelnicki
2016-03-11 12:18 ` Andreas Arnez
2016-03-11 12:26 ` Marcin Kościelnicki
2016-03-11 15:31 ` Andreas Arnez
2016-03-11 15:44 ` Pedro Alves
2016-03-11 16:45 ` Andreas Arnez
2016-03-11 17:02 ` Pedro Alves
2016-03-11 18:17 ` Eli Zaretskii
2016-03-11 18:37 ` Pedro Alves
2016-03-11 19:34 ` Eli Zaretskii
2016-03-15 11:11 ` Pedro Alves
2016-03-15 11:23 ` Andreas Arnez
2016-03-15 11:30 ` Pedro Alves
2016-03-11 18:07 ` Eli Zaretskii
2016-03-13 9:53 ` Marcin Kościelnicki
2016-03-14 10:07 ` Andreas Arnez
2016-01-24 12:12 ` [PATCH 5/8] gdbserver/s390: Switch on tracepoint support Marcin Kościelnicki
2016-02-07 14:04 ` Marcin Kościelnicki
2016-02-22 7:38 ` [PATCH] " Marcin Kościelnicki
2016-03-04 10:39 ` [PATCH v3] " Marcin Kościelnicki
2016-03-15 18:41 ` [PATCH v4] " Marcin Kościelnicki
2016-03-22 9:16 ` Marcin Kościelnicki
2016-03-23 15:25 ` Andreas Arnez
2016-03-24 1:15 ` Marcin Kościelnicki
2016-03-29 18:31 ` Ulrich Weigand
2016-03-29 21:40 ` Marcin Kościelnicki
2016-03-29 21:40 ` [PATCH obv] gdb/NEWS: Add mention of s390*-linux tracepoints Marcin Kościelnicki
2016-03-30 2:49 ` Eli Zaretskii
2016-01-24 12:12 ` [PATCH 3/8] gdb/s390: Fill pseudo register agent expression hooks Marcin Kościelnicki
2016-02-07 14:01 ` Marcin Kościelnicki
2016-02-25 19:23 ` Marcin Kościelnicki
2016-03-04 10:42 ` Marcin Kościelnicki
2016-03-11 2:20 ` Marcin Kościelnicki
2016-03-11 9:58 ` Andreas Arnez
2016-03-11 10:04 ` Marcin Kościelnicki
2016-01-24 12:12 ` [PATCH 1/8] gdb: Add write_guessed_tracepoint_pc hook to gdbarch Marcin Kościelnicki
2016-01-26 14:58 ` Andreas Arnez
2016-02-07 13:59 ` [PATCH 1/8] gdb: Add supply_pseudo_pc " Marcin Kościelnicki
2016-02-16 18:28 ` Ulrich Weigand [this message]
2016-02-16 21:32 ` Marcin Kościelnicki
2016-02-18 10:35 ` [PATCH 1/2] gdb: Add guess_tracepoint_registers " Marcin Kościelnicki
2016-02-18 10:35 ` [PATCH 2/2] gdb/s390: Fill guess_tracepoint_registers hook Marcin Kościelnicki
2016-02-18 16:03 ` Ulrich Weigand
2016-02-18 16:36 ` [PATCH] " Marcin Kościelnicki
2016-02-18 16:48 ` Ulrich Weigand
2016-02-18 16:58 ` Marcin Kościelnicki
2016-02-18 11:38 ` [PATCH 1/2] gdb: Add guess_tracepoint_registers hook to gdbarch Luis Machado
2016-02-18 11:39 ` Marcin Kościelnicki
2016-02-18 11:45 ` [PATCH] " Marcin Kościelnicki
2016-02-18 15:40 ` Ulrich Weigand
2016-02-18 15:41 ` Marcin Kościelnicki
2016-02-18 15:58 ` Ulrich Weigand
2016-02-18 16:01 ` Marcin Kościelnicki
2016-02-18 16:06 ` Ulrich Weigand
2016-02-18 16:11 ` Marcin Kościelnicki
2016-02-18 16:13 ` Ulrich Weigand
2016-02-18 16:22 ` Marcin Kościelnicki
2016-01-24 12:13 ` [PATCH 6/8] gdbserver/s390: Add fast tracepoint support Marcin Kościelnicki
2016-01-25 14:34 ` Antoine Tremblay
2016-02-19 13:41 ` Marcin Kościelnicki
2016-02-19 14:41 ` Antoine Tremblay
2016-03-04 10:40 ` [PATCH v2] " Marcin Kościelnicki
2016-03-14 16:19 ` Andreas Arnez
2016-03-14 16:25 ` Marcin Kościelnicki
2016-01-25 13:27 ` [PATCH 0/8] gdb/s390: Add regular and " Antoine Tremblay
2016-01-25 13:56 ` Pedro Alves
2016-01-25 14:28 ` Marcin Kościelnicki
2016-01-25 15:57 ` Pedro Alves
2016-01-25 16:03 ` Marcin Kościelnicki
2016-02-12 11:04 ` Marcin Kościelnicki
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=20160216182754.CE86C6BEA@oc7340732750.ibm.com \
--to=uweigand@de.ibm.com \
--cc=arnez@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=koriakin@0x04.net \
/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