From: Pedro Alves <palves@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>,
GDB Patches <gdb-patches@sourceware.org>
Cc: Tom Tromey <tom@tromey.com>, Eli Zaretskii <eliz@gnu.org>,
Simon Marchi <simon.marchi@ericsson.com>,
Keith Seitz <keiths@redhat.com>
Subject: Re: [PATCH v6 2/2] Implement pahole-like 'ptype /o' option
Date: Thu, 14 Dec 2017 14:19:00 -0000 [thread overview]
Message-ID: <1db3626e-95b3-45b2-2e2e-dc27e97dda16@redhat.com> (raw)
In-Reply-To: <20171214024816.29629-3-sergiodj@redhat.com>
Something broke in v5 -> v6 in the offset and hole computation.
I'm seeing this:
v6:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(top-gdb) ptype/o minimal_symbol
/* offset | size */ type = struct minimal_symbol {
/* 0 | 32 */ struct general_symbol_info {
/* 0 | 8 */ const char *name;
/* 8 | 8 */ union {
/* 8 */ LONGEST ivalue;
/* 8 */ const block *block;
/* 8 */ const gdb_byte *bytes;
/* 8 */ CORE_ADDR address;
/* 8 */ const common_block *common_block;
/* 8 */ symbol *chain;
/* total size (bytes): 8 */
} value;
/* 24 | 8 */ union {
/* 8 */ obstack *obstack;
/* 8 */ const char *demangled_name;
/* total size (bytes): 8 */
} language_specific;
/* 48:27 | 4 */ language language : 5;
/* 48:26 | 4 */ unsigned int ada_mangled : 1;
/* XXX 2-bit hole */
/* XXX 1-byte hole */
/* 50 | 2 */ short section;
/* total size (bytes): 32 */
} mginfo;
/* 56 | 8 */ unsigned long size;
/* 64 | 8 */ const char *filename;
/* 72:28 | 4 */ minimal_symbol_type type : 4;
/* 72:27 | 4 */ unsigned int created_by_gdb : 1;
/* 72:26 | 4 */ unsigned int target_flag_1 : 1;
/* 72:25 | 4 */ unsigned int target_flag_2 : 1;
/* 72:24 | 4 */ unsigned int has_size : 1;
/* XXX 7-byte hole */
/* 80 | 8 */ minimal_symbol *hash_next;
/* 88 | 8 */ minimal_symbol *demangled_hash_next;
/* total size (bytes): 72 */
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This says that "language_specific" is at 24, with size 8 => next
byte is at 32. "language" is at 48. How come no "XXX hole"
is printed? Similarly in the "8 + 8 -> 24" jump.
It turns out the byte offsets are wrong. Here's the actual
byte offset for language_specific is:
(top-gdb) p /d &((minimal_symbol *) 0) ->mginfo.language_specific
$1 = 16
while v6 says 24.
v5 seemed to get it right. Here's what it would show:
(top-gdb) ptype /o minimal_symbol
/* offset | size */
type = struct minimal_symbol {
/* 0 | 32 */ struct general_symbol_info {
/* 0 | 8 */ const char *name;
/* 8 | 8 */ union {
/* 8 */ LONGEST ivalue;
/* 8 */ const block *block;
/* 8 */ const gdb_byte *bytes;
/* 8 */ CORE_ADDR address;
/* 8 */ const common_block *common_block;
/* 8 */ symbol *chain;
} /* total size: 8 bytes */ value;
/* 16 | 8 */ union {
/* 8 */ obstack *obstack;
/* 8 */ const char *demangled_name;
} /* total size: 8 bytes */ language_specific;
/* 24:27 | 4 */ language language : 5;
/* 24:26 | 4 */ unsigned int ada_mangled : 1;
/* XXX 2-bit hole */
/* XXX 1-byte hole */
/* 26 | 2 */ short section;
} /* total size: 32 bytes */ mginfo;
/* 32 | 8 */ unsigned long size;
/* 40 | 8 */ const char *filename;
/* 48:28 | 4 */ minimal_symbol_type type : 4;
/* 48:27 | 4 */ unsigned int created_by_gdb : 1;
/* 48:26 | 4 */ unsigned int target_flag_1 : 1;
/* 48:25 | 4 */ unsigned int target_flag_2 : 1;
/* 48:24 | 4 */ unsigned int has_size : 1;
/* XXX 7-byte hole */
/* 56 | 8 */ minimal_symbol *hash_next;
/* 64 | 8 */ minimal_symbol *demangled_hash_next;
} /* total size: 72 bytes */
(top-gdb)
Surprised this wasn't caught by the testcases.
I do like the new output format a lot better. Thanks much for
implementing the suggestions!
Pedro Alves
next prev parent reply other threads:[~2017-12-14 14:19 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-21 16:07 [PATCH] " Sergio Durigan Junior
2017-11-21 16:16 ` Sergio Durigan Junior
2017-11-21 16:50 ` Eli Zaretskii
2017-11-21 17:00 ` Sergio Durigan Junior
2017-11-21 19:14 ` Eli Zaretskii
2017-11-26 19:27 ` Tom Tromey
2017-11-27 19:54 ` Sergio Durigan Junior
2017-11-27 22:20 ` Tom Tromey
2017-11-28 0:39 ` Sergio Durigan Junior
2017-11-28 21:21 ` [PATCH v2] " Sergio Durigan Junior
2017-11-29 3:28 ` Eli Zaretskii
2017-12-04 15:03 ` Sergio Durigan Junior
2017-12-04 15:41 ` Eli Zaretskii
2017-12-04 16:47 ` Sergio Durigan Junior
2017-12-08 21:32 ` Sergio Durigan Junior
2017-12-11 15:43 ` Simon Marchi
2017-12-11 18:59 ` Sergio Durigan Junior
2017-12-11 20:45 ` Simon Marchi
2017-12-11 21:07 ` Sergio Durigan Junior
2017-12-11 22:42 ` Pedro Alves
2017-12-11 22:50 ` Sergio Durigan Junior
2017-12-11 23:46 ` Pedro Alves
2017-12-12 0:25 ` Sergio Durigan Junior
2017-12-12 0:52 ` Pedro Alves
2017-12-12 1:25 ` Simon Marchi
2017-12-12 15:50 ` John Baldwin
2017-12-12 17:04 ` Sergio Durigan Junior
2017-12-11 19:58 ` [PATCH v3 0/2] Implement pahole-like 'ptype /o' option (and do some code reorg) Sergio Durigan Junior
2017-12-11 19:58 ` [PATCH v3 2/2] Implement pahole-like 'ptype /o' option Sergio Durigan Junior
2017-12-11 21:50 ` Simon Marchi
2017-12-11 23:24 ` Sergio Durigan Junior
2017-12-12 1:32 ` Simon Marchi
2017-12-12 6:19 ` Sergio Durigan Junior
2017-12-12 18:14 ` Pedro Alves
2017-12-12 18:40 ` Sergio Durigan Junior
2017-12-12 20:12 ` Pedro Alves
2017-12-11 19:58 ` [PATCH v3 1/2] Reorganize code to handle TYPE_CODE_{STRUCT,UNION} on 'c_type_print_base' Sergio Durigan Junior
2017-12-11 20:55 ` Simon Marchi
2017-12-11 23:05 ` Sergio Durigan Junior
2017-12-11 23:43 ` [PATCH v4 0/2] Implement pahole-like 'ptype /o' option (and do some code reorg) Sergio Durigan Junior
2017-12-11 23:44 ` [PATCH v4 1/2] Reorganize code to handle TYPE_CODE_{STRUCT,UNION} on 'c_type_print_base' Sergio Durigan Junior
2017-12-11 23:44 ` [PATCH v4 2/2] Implement pahole-like 'ptype /o' option Sergio Durigan Junior
2017-12-12 0:27 ` Sergio Durigan Junior
2017-12-12 0:29 ` Sergio Durigan Junior
2017-12-12 1:59 ` Simon Marchi
2017-12-12 3:39 ` Eli Zaretskii
2017-12-13 3:17 ` [PATCH v5 0/2] Implement pahole-like 'ptype /o' option (and do some code reorg) Sergio Durigan Junior
2017-12-13 3:17 ` [PATCH v5 2/2] Implement pahole-like 'ptype /o' option Sergio Durigan Junior
2017-12-13 4:50 ` Simon Marchi
2017-12-13 16:42 ` Sergio Durigan Junior
2017-12-13 16:17 ` Eli Zaretskii
2017-12-13 17:14 ` Sergio Durigan Junior
2017-12-13 16:19 ` Pedro Alves
2017-12-13 17:13 ` Sergio Durigan Junior
2017-12-13 20:36 ` Sergio Durigan Junior
2017-12-13 21:22 ` Pedro Alves
2017-12-13 21:30 ` Pedro Alves
2017-12-13 21:34 ` Sergio Durigan Junior
2017-12-13 16:20 ` Pedro Alves
2017-12-13 17:41 ` Sergio Durigan Junior
2017-12-13 3:17 ` [PATCH v5 1/2] Reorganize code to handle TYPE_CODE_{STRUCT,UNION} on 'c_type_print_base' Sergio Durigan Junior
2017-12-14 2:48 ` [PATCH v6 0/2] Implement pahole-like 'ptype /o' option (and do some code reorg) Sergio Durigan Junior
2017-12-14 2:48 ` [PATCH v6 2/2] Implement pahole-like 'ptype /o' option Sergio Durigan Junior
2017-12-14 14:19 ` Pedro Alves [this message]
2017-12-14 20:31 ` Sergio Durigan Junior
2017-12-14 14:50 ` Pedro Alves
2017-12-14 20:29 ` Sergio Durigan Junior
2017-12-14 16:30 ` Eli Zaretskii
2017-12-14 2:48 ` [PATCH v6 1/2] Reorganize code to handle TYPE_CODE_{STRUCT,UNION} on 'c_type_print_base' Sergio Durigan Junior
2017-12-15 1:12 ` [PATCH v7 0/2] Implement pahole-like 'ptype /o' option (and do some code reorg) Sergio Durigan Junior
2017-12-15 1:12 ` [PATCH v7 1/2] Reorganize code to handle TYPE_CODE_{STRUCT,UNION} on 'c_type_print_base' Sergio Durigan Junior
2017-12-15 1:13 ` [PATCH v7 2/2] Implement pahole-like 'ptype /o' option Sergio Durigan Junior
2017-12-15 17:24 ` Pedro Alves
2017-12-15 20:04 ` Sergio Durigan Junior
2017-12-15 20:11 ` [PATCH v7 0/2] Implement pahole-like 'ptype /o' option (and do some code reorg) Sergio Durigan Junior
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=1db3626e-95b3-45b2-2e2e-dc27e97dda16@redhat.com \
--to=palves@redhat.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=keiths@redhat.com \
--cc=sergiodj@redhat.com \
--cc=simon.marchi@ericsson.com \
--cc=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).