From: Shahab Vahedi <shahab.vahedi@gmail.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb@sourceware.org
Subject: Re: Custom types in target description XMLs
Date: Thu, 15 Jul 2021 19:21:03 +0200 [thread overview]
Message-ID: <YPBuf8i75F3Q4ama@gmail.com> (raw)
In-Reply-To: <429b4e0f-032b-b946-2f59-ff2f729b1005@polymtl.ca>
Hi Simon,
On Thu, Jul 15, 2021 at 10:37:39AM -0400, Simon Marchi wrote:
> Given the lack of response, I would say that nobody knows that off-hand,
> and you would need to dive into the code to check what is happening, if
> it's a GDB bug or something else.
I was just about to write another email. I have investigated both of the
problems and they seem like a bug to me.
The following change fixes the "field" type issue:
------------------------8<------------------------
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 0749f38983e..91602b41274 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1186,7 +1186,7 @@ val_print_type_code_flags (struct type *type, ...
{
unsigned field_len = TYPE_FIELD_BITSIZE (type, field);
ULONGEST field_val
- = val >> (TYPE_FIELD_BITPOS (type, field) - field_len + 1);
+ = val >> TYPE_FIELD_BITPOS (type, field);
if (field_len < sizeof (ULONGEST) * TARGET_CHAR_BIT)
field_val &= ((ULONGEST) 1 << field_len) - 1;
------------------------>8------------------------
And this one solves the "struct" type problem:
------------------------8<------------------------
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 43c05d344d0..68e65ef8bb5 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -5805,7 +5805,7 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
builtin_type->builtin_string
= arch_type (gdbarch, TYPE_CODE_STRING, TARGET_CHAR_BIT, "string");
builtin_type->builtin_bool
- = arch_type (gdbarch, TYPE_CODE_BOOL, TARGET_CHAR_BIT, "bool");
+ = arch_boolean_type (gdbarch, TARGET_CHAR_BIT, 1, "bool");
/* The following three are about decimal floating point types, which
are 32-bits, 64-bits and 128-bits respectively. */
------------------------>8------------------------
I will file two separate bugs and then submit the two patches with the
explanations.
Cheers,
Shahab
next prev parent reply other threads:[~2021-07-15 17:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-13 19:08 Shahab Vahedi
2021-07-15 14:37 ` Simon Marchi
2021-07-15 17:21 ` Shahab Vahedi [this message]
2021-08-02 11:51 ` Shahab Vahedi
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=YPBuf8i75F3Q4ama@gmail.com \
--to=shahab.vahedi@gmail.com \
--cc=gdb@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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).