This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/8] gdb/s390: Fill write_guessed_tracepoint_pc hook.
- From: Andreas Arnez <arnez at linux dot vnet dot ibm dot com>
- To: Marcin KoÅcielnicki <koriakin at 0x04 dot net>
- Cc: gdb-patches at sourceware dot org, Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Fri, 29 Jan 2016 19:57:18 +0100
- Subject: Re: [PATCH 2/8] gdb/s390: Fill write_guessed_tracepoint_pc hook.
- Authentication-results: sourceware.org; auth=none
- References: <1453637529-26972-1-git-send-email-koriakin at 0x04 dot net> <1453637529-26972-3-git-send-email-koriakin at 0x04 dot net> <m3vb6gdxbf dot fsf at oc1027705133 dot ibm dot com> <56A7C855 dot 6090806 at 0x04 dot net>
On Tue, Jan 26 2016, Marcin KoÅcielnicki wrote:
> If write_guessed_tracepoint_pc is called, we explicitely have no
> registers data other than PC itself - there's no original PSWA to
> speak of. The state of PSWA high bit probably doesn't matter all that
> much, but since we want to mark PSWA as known, we'd better write the
> reasonable value to it.
That's true if the new gdbarch method implements a very specific
semantic, tailored to the singular use in tracefile_fetch_registers and
not necessarily usable for any other purposes. But I interpreted the
semantic more generically: "Supply VAL as the new PC to the given
REGCACHE".
Maybe the generic approach could be implemented like this (completely
untested):
/* Adjust PSWA high bit if in 31-bit mode. */
if (sz == 4)
{
if (regcache_register_status (regcache, S390_PSWA_REGNUM)
== REG_VALID)
{
gdb_byte pswa[4];
regcache_raw_collect (regcache, S390_PSWA_REGNUM, pswa);
pc |= 0x80000000 & extract_unsigned_integer (pswa, 4, byte_order);
}
else
pc |= 0x80000000;
}
BTW, even this may be considered a special case of a hypothetical
gdbarch method pseudo_register_supply(). *Or* we might think of it as
writing to a "cache-only" (rather than read-only) regcache via a usual
regcache_cooked_write(). In this case no new gdbarch method would be
needed. Such a feature might also come handy when trying to support the
modification of cooked registers during core file debugging, such as
discussed in this thread:
https://www.sourceware.org/ml/gdb/2011-02/msg00042.html
--
Andreas