From: "Simon Marchi (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>,
gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@sourceware.org>,
Andrew Burgess <andrew.burgess@embecosm.com>
Subject: [review v2] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
Date: Thu, 31 Oct 2019 17:57:00 -0000 [thread overview]
Message-ID: <20191031175730.B0DE020AF6@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1571406803000.I54192f363115b78ec7435a8563b73fcace420765@gnutoolchain-gerrit.osci.io>
Simon Marchi has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................
Patch Set 2:
(3 comments)
Thanks for the update. Just two minor comments about the validation.
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/2/gdb/dwarf2read.c
File gdb/dwarf2read.c:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/2/gdb/dwarf2read.c@15831
PS2, Line 15831:
15822 | is_valid_DW_AT_calling_convention (ULONGEST value)
| ...
15826 | case DW_CC_normal:
15827 | case DW_CC_program:
15828 | case DW_CC_nocall:
15829 | case DW_CC_pass_by_reference:
15830 | case DW_CC_pass_by_value:
15831 > case DW_CC_lo_user:
15832 > case DW_CC_hi_user:
15833 | /* case DW_CC_GNU_renesas_sh: Duplicate of DW_CC_lo_user. */
15834 | case DW_CC_GNU_borland_fastcall_i386:
15835 | /* case DW_CC_GDB_IBM_OpenCL: Duplicate of DW_CC_hi_user. */
15836 | return true;
15837 | }
I don' think we should include lo_user and hi_user in the switch, since they are not "real" values. They just indicate the range for vendor-specific values.
DW_CC_GNU_renesas_sh and DW_CC_GDB_IBM_OpenCL are "real" values, so they should be included in the switch. In the end, the behavior will be the same, since as you noted, they are duplicates of lo_user and hi_user.
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/2/gdb/dwarf2read.c@15928
PS2, Line 15928:
15857 | read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
| ...
15923 | TYPE_DECLARED_CLASS (type) = 1;
15924 |
15925 | /* Store the calling convention in the type if it's available in
15926 | the die. Otherwise the calling convention remains set to
15927 | the default value DW_CC_normal. */
15928 > attr = dwarf2_attr (die, DW_AT_calling_convention, cu);
15929 | if (attr != nullptr
15930 | && is_valid_DW_AT_calling_convention (DW_UNSND (attr)))
15931 | {
15932 | ALLOCATE_CPLUS_STRUCT_TYPE (type);
15933 | TYPE_CPLUS_CALLING_CONVENTION (type)
According to table 5.5 of DWARF5, the acceptable calling convention values for types are restricted to:
- DW_CC_normal
- DW_CC_pass_by_value
- DW_CC_pass_by_reference
So should we complain and reject the value if it's not one of those? The idea is that if a producer emits an unacceptable value by mistake, the issue is caught as early as possible rather than silently accepted.
In the spot where we read DW_AT_calling_convention for subroutines, we could validate that the value is one of those listed in table 3.3:
- DW_CC_normal
- DW_CC_program
- DW_CC_nocall
... plus the vendor-specific values that we support. So it might be simpler to do two functions, is_valid_DW_AT_calling_convention_for_types and is_valid_DW_AT_calling_convention_for_subprogram. Therefore, in this patch I suggest calling the new function "is_valid_DW_AT_calling_convention_for_types" to leave room to do the same thing for subprograms.
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h
File gdb/gdbtypes.h:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h@1144
PS1, Line 1144:
1137 | struct func_type
| ...
1139 | /* * The calling convention for targets supporting multiple ABIs.
1140 | Right now this is only fetched from the Dwarf-2
1141 | DW_AT_calling_convention attribute. The value is one of the
1142 | DW_CC enum dwarf_calling_convention constants. */
1143 |
1144 > unsigned calling_convention : 8;
1145 |
1146 | /* * Whether this function normally returns to its caller. It is
1147 | set from the DW_AT_noreturn attribute if set on the
1148 | DW_TAG_subprogram. */
1149 |
> This is an existing definition I had aimed to be consistent with.
Ack, let's change it in another patch.
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 2
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Thu, 31 Oct 2019 17:57:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-MessageType: comment
next prev parent reply other threads:[~2019-10-31 17:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 13:53 [review] " Tankut Baris Aktemur (Code Review)
2019-10-18 14:02 ` Tankut Baris Aktemur (Code Review)
2019-10-23 14:31 ` Tom Tromey (Code Review)
2019-10-29 22:20 ` Tom Tromey (Code Review)
2019-10-30 3:30 ` Simon Marchi (Code Review)
2019-10-31 9:43 ` Tankut Baris Aktemur (Code Review)
2019-10-31 14:10 ` Simon Marchi (Code Review)
2019-10-31 17:22 ` Tankut Baris Aktemur (Code Review)
2019-10-31 17:24 ` [review v2] " Tankut Baris Aktemur (Code Review)
2019-10-31 17:57 ` Simon Marchi (Code Review) [this message]
2019-10-31 20:07 ` [review v3] " Tankut Baris Aktemur (Code Review)
2019-10-31 20:12 ` Simon Marchi (Code Review)
2019-10-31 20:12 ` Simon Marchi (Code Review)
2019-10-31 20:13 ` Tankut Baris Aktemur (Code Review)
2019-10-31 20:18 ` Simon Marchi (Code Review)
2019-12-20 16:47 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-20 16:47 ` Sourceware to Gerrit sync (Code Review)
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=20191031175730.B0DE020AF6@gnutoolchain-gerrit.osci.io \
--to=gerrit@gnutoolchain-gerrit.osci.io \
--cc=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=gnutoolchain-gerrit@osci.io \
--cc=tankut.baris.aktemur@intel.com \
--cc=tromey@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