From: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
To: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Cc: uweigand@de.ibm.com
Subject: Re: [PATCH v5 00/12] GDB support for more powerpc registers on linux
Date: Tue, 23 Oct 2018 18:42:00 -0000 [thread overview]
Message-ID: <878t2old2z.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <dc88e21d-6605-6f29-3660-e619fd0ce9eb@redhat.com>
Pedro Alves <palves@redhat.com> writes:
> I.e., what is the conclusion wrt to the differences in one of the note
> sections generated by the kernel for a core file and the one generated
> by GDB? Was that resolved? Will it be?
Sorry, I really should have explained this better in the cover letter,
and I forgot to update the commit message explaining the solution we
picked for this issue.
I discussed this with Ulrich and we came to the conclusion that it would
be simpler to fill in the data for two of the registers that were
different in the core file using other registers that are available to
GDB, since they are not particularly useful as separate user-visible
registers. This still leaves out some additional registers in this
regset that GDB isn't aware of, which are most of the time 0. I will
explain this in more detail below, but in this patch this is implemented
with a different collect function used
(ppc_linux_collect_core_cpgrregset) used by
ppc_linux_iterate_over_regset_sections.
To give you some background, the checkpointed registers are the values
that are used to restore some of the regular registers to
pre-transactional values in case a hardware transaction fails. This
includes the GPRs, FPRs, vector registers and others.
The kernel uses a pt_regs struct to hold the regular GPRs and various
others registers. It also uses this struct to represent the equivalent
checkpointed registers, and to generate the note section, except that
only a subset of the registers in pt_regs is actually checkpointed by
the processor. All of the registers that are actually checkpointed are
visible to the GDB user and are correctly filled in the note section
generated by GDB.
This leaves out various other registers from pt_regs. One of these is
the NIP (the pc), which the kernel fills in with the value of another
register, TFHAR. Since TFHAR is in fact visible to GDB, GDB uses its
value to fill in the corresponding slot in the core file. The
"checkpointed" MSR (processor status register), is used by the kernel
for some internal state tracking. We use the regular MSR to fill in the
corresponding slot. These usually differ in some bits, and in certain
conditions the checkpointed MSR from the kernel can be zero.
The remaining registers in the checkpointed pt_regs are not filled in by
the kernel and don't represent anything. They will only have non-zero
values in a kernel-generated core file if someone explicitly sets them
with ptrace before the process crashes.
> As for the EBB/PMU patch, about gdbserver writing all registers in one go
> before resuming the inferior, and the error would not being detected at the
> time the user tries to write them, did you try making gdbserver flush
> the regcache after handling 'G' and 'P' packets? From the previous
> discussion, it sounded like that would work?
I haven't tried this yet. I did think about this more and although it
might work using 'P' packets, I'm not sure how to go about handling
unavailable registers in general with the 'G' packet. The problem is
that the server would need to somehow only flush these registers in
response to 'P' packets, and ignore them when they come from 'G'
packets.
This is becasue if the client always uses 'G' packets to store any
registers, including the ones that are always available, and the server
flushes the regcache to detect errors, most 'G' packets would return in
error because the inferior is usually not in a state in which the
unavailable registers can be written.
It's not clear that the 'xxxxx' encoding for unavailable registers can
be used in 'G' packets, like it is for 'g' packets. The gdbserver stub
doesn't handle this and assumes the 'G' packet contents will be properly
encoded register values, it only uses this encoding when replying to 'g'
packets.
Maybe a solution is to prevent writing to these registers on the client
side if the target is remote and print a warning (possibly through
gdbarch_cannot_store_register).
Thanks!!
--
Pedro Franco de Carvalho
next prev parent reply other threads:[~2018-10-23 18:42 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-22 22:33 Pedro Franco de Carvalho
2018-10-22 22:33 ` [PATCH v5 05/12] [PowerPC] Fix two if statements in gdb/ppc-linux-nat.c Pedro Franco de Carvalho
2018-10-22 22:33 ` [PATCH v5 07/12] [PowerPC] Refactor have_ initializers in rs6000-tdep.c Pedro Franco de Carvalho
2018-10-22 22:33 ` [PATCH v5 04/12] [PowerPC] Remove rs6000_pseudo_register_reggroup_p Pedro Franco de Carvalho
2018-10-22 22:33 ` [PATCH v5 03/12] Add decfloat registers to float reggroup Pedro Franco de Carvalho
2018-10-22 22:33 ` [PATCH v5 06/12] [PowerPC] Fix indentation in arch/ppc-linux-common.c Pedro Franco de Carvalho
2018-10-22 22:33 ` [PATCH v5 01/12] Zero-initialize linux note sections Pedro Franco de Carvalho
2018-10-22 22:33 ` [PATCH v5 02/12] [PowerPC] Don't zero-initialize vector register buffers Pedro Franco de Carvalho
2018-10-22 22:54 ` [PATCH v5 10/12] [PowerPC] Add support for EBB and PMU registers Pedro Franco de Carvalho
2018-10-22 22:56 ` [PATCH v5 11/12] [PowerPC] Reject tdescs with VSX and no FPU or Altivec Pedro Franco de Carvalho
2018-10-23 16:05 ` Pedro Alves
2018-10-23 18:46 ` Pedro Franco de Carvalho
2018-10-25 15:45 ` Pedro Alves
2018-10-22 22:58 ` [PATCH v5 09/12] [PowerPC] Add support for TAR Pedro Franco de Carvalho
2018-10-23 2:34 ` Eli Zaretskii
2018-10-23 18:50 ` Pedro Franco de Carvalho
2018-10-22 23:05 ` [PATCH v5 12/12] [PowerPC] Add support for HTM registers Pedro Franco de Carvalho
2019-02-09 5:51 ` Simon Marchi
2019-02-11 19:10 ` Pedro Franco de Carvalho
2018-10-22 23:16 ` [PATCH v5 08/12] [PowerPC] Add support for PPR and DSCR Pedro Franco de Carvalho
2018-10-23 15:37 ` [PATCH v5 00/12] GDB support for more powerpc registers on linux Pedro Alves
2018-10-23 18:42 ` Pedro Franco de Carvalho [this message]
2018-10-24 17:59 ` Ulrich Weigand
2018-10-25 20:05 ` Pedro Franco de Carvalho
2018-10-26 11:01 ` Ulrich Weigand
2018-10-26 10:57 ` Pedro Alves
2018-10-26 11:00 ` Ulrich Weigand
2018-10-26 15:16 ` Pedro Franco de Carvalho
2018-10-29 14:20 ` Regression on old kernels (Re: [PATCH v5 00/12] GDB support for more powerpc registers on linux) Ulrich Weigand
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=878t2old2z.fsf@linux.vnet.ibm.com \
--to=pedromfc@linux.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=uweigand@de.ibm.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