From: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 31/46] gdbserver: dump 'xx...x' in collect_register_as_string for unavailable register
Date: Tue, 2 Jul 2024 13:43:02 +0200 [thread overview]
Message-ID: <cbc4f60f2cd1c9d7faed714587f0d11d7e26318a.1719919040.git.tankut.baris.aktemur@intel.com> (raw)
In-Reply-To: <cover.1719919039.git.tankut.baris.aktemur@intel.com>
Fix 'collect_register_as_string' so that unavailable registers are
dumped as 'xx...x' instead of arbitrary values. This gives the
opportunity that we can reuse 'collect_register_as_string' in
'registers_to_string' for additional code simplification.
---
gdbserver/regcache.cc | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc
index 0bc9a2efd17..1b4ed174dff 100644
--- a/gdbserver/regcache.cc
+++ b/gdbserver/regcache.cc
@@ -212,24 +212,13 @@ find_register_by_number (const struct target_desc *tdesc, int n)
void
registers_to_string (struct regcache *regcache, char *buf)
{
- unsigned char *registers = regcache->registers;
const struct target_desc *tdesc = regcache->tdesc;
for (int i = 0; i < tdesc->reg_defs.size (); ++i)
{
- if (regcache->register_status[i] == REG_VALID)
- {
- bin2hex (registers, buf, register_size (tdesc, i));
- buf += register_size (tdesc, i) * 2;
- }
- else
- {
- memset (buf, 'x', register_size (tdesc, i) * 2);
- buf += register_size (tdesc, i) * 2;
- }
- registers += register_size (tdesc, i);
+ collect_register_as_string (regcache, i, buf);
+ buf += register_size (tdesc, i) * 2;
}
- *buf = '\0';
}
void
@@ -484,7 +473,15 @@ regcache_raw_get_unsigned_by_name (struct regcache *regcache,
void
collect_register_as_string (struct regcache *regcache, int n, char *buf)
{
- bin2hex (register_data (regcache, n), buf);
+ int reg_size = register_size (regcache->tdesc, n);
+
+ if (regcache->get_register_status (n) == REG_VALID)
+ bin2hex (register_data (regcache, n), buf);
+ else
+ memset (buf, 'x', reg_size * 2);
+
+ buf += reg_size * 2;
+ *buf = '\0';
}
void
--
2.34.1
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next prev parent reply other threads:[~2024-07-02 11:45 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-02 11:42 [PATCH 00/46] A new target to debug Intel GPUs Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 01/46] gdb, intelgt: add intelgt as a basic machine Tankut Baris Aktemur
2024-07-02 15:49 ` Maciej W. Rozycki
2024-07-03 8:01 ` Aktemur, Tankut Baris
2024-07-02 11:42 ` [PATCH 02/46] bfd: add intelgt target to BFD Tankut Baris Aktemur
2024-10-15 22:15 ` Thiago Jung Bauermann
2024-10-25 12:18 ` Aktemur, Tankut Baris
2024-07-02 11:42 ` [PATCH 03/46] ld: add intelgt as a target configuration Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 04/46] opcodes: add intelgt as a configuration Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 05/46] gdb, arch, intelgt: add intelgt arch definitions Tankut Baris Aktemur
2024-07-03 17:17 ` Guinevere Larsen
2024-07-04 6:47 ` Aktemur, Tankut Baris
2024-10-15 22:44 ` Thiago Jung Bauermann
2024-10-15 22:57 ` Thiago Jung Bauermann
2024-10-25 12:18 ` Aktemur, Tankut Baris
2024-07-02 11:42 ` [PATCH 06/46] gdb, intelgt: add the target-dependent definitions for the Intel GT architecture Tankut Baris Aktemur
2024-08-26 16:27 ` Lancelot SIX
2024-08-29 13:09 ` Aktemur, Tankut Baris
2024-08-29 19:11 ` Lancelot SIX
2024-09-06 9:15 ` Aktemur, Tankut Baris
2024-09-30 15:35 ` Alexandra Petlanova Hajkova
2024-10-09 7:55 ` Aktemur, Tankut Baris
2024-10-15 23:35 ` Thiago Jung Bauermann
2024-11-08 13:56 ` Aktemur, Tankut Baris
2024-07-02 11:42 ` [PATCH 07/46] gdb, gdbserver, gdbsupport: add 'device' tag to XML target description Tankut Baris Aktemur
2024-07-02 13:28 ` Eli Zaretskii
2024-07-02 11:42 ` [PATCH 08/46] gdb, intelgt: add disassemble feature for the Intel GT architecture Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 09/46] gdbsupport, filestuff, ze: temporary files Tankut Baris Aktemur
2024-08-31 0:11 ` Lancelot SIX
2024-09-06 14:52 ` Metzger, Markus T
2024-07-02 11:42 ` [PATCH 10/46] gdb, gdbserver, ze: in-memory libraries Tankut Baris Aktemur
2024-07-02 13:20 ` Eli Zaretskii
2024-07-02 11:42 ` [PATCH 11/46] gdb, gdbserver, rsp, ze: acknowledge libraries Tankut Baris Aktemur
2024-07-02 13:25 ` Eli Zaretskii
2024-07-03 7:19 ` Aktemur, Tankut Baris
2024-07-02 11:42 ` [PATCH 12/46] gdb, solib, ze: solib_bfd_open_from_target_memory Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 13/46] gdb, remote, ze: fix "$Hc-1#09...Packet received: E01" during startup Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 14/46] gdb, infrun, ze: allow saving process events Tankut Baris Aktemur
2024-08-31 18:00 ` Lancelot SIX
2024-09-09 14:33 ` Metzger, Markus T
2024-07-02 11:42 ` [PATCH 15/46] gdb, ze: add TARGET_WAITKIND_UNAVAILABLE Tankut Baris Aktemur
2024-09-04 10:47 ` Lancelot SIX
2024-09-10 7:47 ` Metzger, Markus T
2024-07-02 11:42 ` [PATCH 16/46] gdb, infrun, ze: handle stopping unavailable threads Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 17/46] gdb, infrun, ze: allow resuming " Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 18/46] gdb, gdbserver, ze: add U stop reply Tankut Baris Aktemur
2024-07-02 13:29 ` Eli Zaretskii
2024-07-02 11:42 ` [PATCH 19/46] gdb, gdbserver, ze: add library notification to " Tankut Baris Aktemur
2024-07-02 13:30 ` Eli Zaretskii
2024-07-02 11:42 ` [PATCH 20/46] gdbserver, ze: report TARGET_WAITKIND_UNAVAILABLE events Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 21/46] gdb, ze: handle TARGET_WAITKIND_UNAVAILABLE in stop_all_threads Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 22/46] gdb, remote: handle thread unavailability in print_one_stopped_thread Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 23/46] gdb, remote: do 'remote_add_inferior' in 'remote_notice_new_inferior' earlier Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 24/46] gdb, remote: handle a generic process PID in remote_notice_new_inferior Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 25/46] gdb, remote: handle a generic process PID in process_stop_reply Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 26/46] gdb: revise the pid_to_exec_file target op Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 27/46] gdb: use the pid from inferior in setup_inferior Tankut Baris Aktemur
2024-07-02 11:42 ` [PATCH 28/46] gdb: load solibs even when exec_bfd does not exist Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 29/46] gdbserver: import AC_LIB_HAVE_LINKFLAGS macro into the autoconf script Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 30/46] gdbserver: add a pointer to the owner thread in regcache Tankut Baris Aktemur
2024-07-02 11:43 ` Tankut Baris Aktemur [this message]
2024-07-02 11:43 ` [PATCH 32/46] gdbserver: wait for stopped threads in queue_stop_reply_callback Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 33/46] gdbserver: adjust pid after the target attaches Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 34/46] gdb: do not create a thread after a process event Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 35/46] gdb, ze: on a whole process stop, mark all threads as not_resumed Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 36/46] gdb, dwarf, ze: add DW_OP_INTEL_regval_bits Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 37/46] gdbserver, ze, intelgt: introduce ze-low and intel-ze-low targets Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 38/46] testsuite, sycl: add SYCL support Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 39/46] testsuite, sycl: add test for backtracing inside a kernel Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 40/46] testsuite, sycl: add test for 'info locals' and 'info args' Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 41/46] testsuite, sycl: add tests for stepping and accessing data elements Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 42/46] testsuite, sycl: add test for 1-D and 2-D parallel_for kernels Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 43/46] testsuite, sycl: add test for scheduler-locking Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 44/46] testsuite, arch, intelgt: add a disassembly test Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 45/46] testsuite, arch, intelgt: add intelgt-program-bp.exp Tankut Baris Aktemur
2024-07-02 11:43 ` [PATCH 46/46] testsuite, sycl: test canceling a stepping flow Tankut Baris Aktemur
2024-08-23 6:54 ` [PATCH 00/46] A new target to debug Intel GPUs Aktemur, Tankut Baris
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=cbc4f60f2cd1c9d7faed714587f0d11d7e26318a.1719919040.git.tankut.baris.aktemur@intel.com \
--to=tankut.baris.aktemur@intel.com \
--cc=gdb-patches@sourceware.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).