Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Simon Marchi (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: Tom Tromey <tromey@sourceware.org>, gdb-patches@sourceware.org
Subject: [review] Add scalar_storage_order support for floating point
Date: Wed, 27 Nov 2019 22:02:00 -0000	[thread overview]
Message-ID: <20191127220205.B845920AF6@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1574880479000.Ic02eb711d80ce678ef0ecf8c506a626e441b8440@gnutoolchain-gerrit.osci.io>

Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/727
......................................................................


Patch Set 1:

(4 comments)

| --- gdb/dwarf2read.c
| +++ gdb/dwarf2read.c
| @@ -17681,8 +17682,19 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
|    arch = get_objfile_arch (objfile);
| +  enum bfd_endian byte_order = gdbarch_byte_order (arch);
| +  switch (endianity)
| +    {
| +      case DW_END_big:
| +	byte_order = BFD_ENDIAN_BIG;
| +        break;
| +      case DW_END_little:
| +	byte_order = BFD_ENDIAN_LITTLE;
| +        break;

PS1, Line 17691:

Not really related to this patch, since this is pre-exising code, but
what do you think of complaining if `endianity` has another value than
_big or _little?

| +    }
| +
|    switch (encoding)
|      {
|        case DW_ATE_address:
|  	/* Turn DW_ATE_address into a void * pointer.  */
|  	type = init_type (objfile, TYPE_CODE_VOID, TARGET_CHAR_BIT, NULL);
|  	type = init_pointer_type (objfile, bits, name, type);
|  	break;
| --- gdb/gdbtypes.c
| +++ gdb/gdbtypes.c
| @@ -2898,18 +2898,15 @@ init_boolean_type (struct objfile *objfile,
|    if (unsigned_p)
|      TYPE_UNSIGNED (t) = 1;
|  
|    return t;
|  }
|  
|  /* Allocate a TYPE_CODE_FLT type structure associated with OBJFILE.
|     BIT is the type size in bits; if BIT equals -1, the size is
|     determined by the floatformat.  NAME is the type name.  Set the
|     TYPE_FLOATFORMAT from FLOATFORMATS.  */

PS1, Line 2907:

Could you document the new parameter (especially the behavior for
_UNKNOWN)?

|  
|  struct type *
|  init_float_type (struct objfile *objfile,
|  		 int bit, const char *name,
| -		 const struct floatformat **floatformats)
| -{
| -  struct gdbarch *gdbarch = get_objfile_arch (objfile);
| -  const struct floatformat *fmt = floatformats[gdbarch_byte_order (gdbarch)];
| +		 const struct floatformat **floatformats,
| --- gdb/testsuite/gdb.base/endianity.c
| +++ gdb/testsuite/gdb.base/endianity.c
| @@ -15,17 +15,19 @@ /* This testcase is part of GDB, the GNU debugger.
|     You should have received a copy of the GNU General Public License
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
|  
|  /* This tests the handling of dwarf attributes:
|      DW_AT_endianity, DW_END_big, and DW_END_little.  */
|  struct otherendian
|  {
|    int v;
|    short w;
| +  float f;

PS1, Line 24:

I wonder if we should test double too, or if it would be superfluous?

| +  __complex__ float cplx;
|  }
|  #if defined __GNUC__ && (__GNUC__ >= 6)
|  #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|  __attribute__( ( scalar_storage_order( "big-endian" ) ) )
|  #else
|  __attribute__( ( scalar_storage_order( "little-endian" ) ) )
|  #endif
|  #endif
| --- gdb/testsuite/gdb.base/endianity.exp
| +++ gdb/testsuite/gdb.base/endianity.exp
| @@ -25,16 +25,17 @@ if ![runto "endianity.c:$bp_location" ] then {
|    return -1
|  }
|  
| -gdb_test "print o" "= {v = 3, w = 2}" "print o before assignment"
| +gdb_test "print o" "= {v = 3, w = 2, f = 23.5, cplx = 1.25 \\+ 7.25 \\* I}" \
| +    "print o before assignment"
|  
|  gdb_test "print o.v = 4" "= 4"
|  gdb_test "print o.w = 3" "= 3"
| +gdb_test "print o.f = 1.5" "= 1.5"

PS1, Line 33:

Just wondering why we don't set cplx, does gdb not offer a way to set
complex?

|  
|  # scalar_storage_order requires gcc >= 6
|  if { ([test_compiler_info {gcc-[0-5]-*}] || ![test_compiler_info gcc*]) } {
|    setup_xfail "*-*-*"
|  }
|  gdb_test "x/x &o.v" "0x04000000"
|  gdb_test "x/xh &o.w" "0x0300"
|  
| -gdb_test "print o" "= {v = 4, w = 3}" "print o after assignment"

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ic02eb711d80ce678ef0ecf8c506a626e441b8440
Gerrit-Change-Number: 727
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Wed, 27 Nov 2019 22:02:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


  reply	other threads:[~2019-11-27 22:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27 18:48 Tom Tromey (Code Review)
2019-11-27 22:02 ` Simon Marchi (Code Review) [this message]
2019-12-03 21:30 ` Tom Tromey (Code Review)
2019-12-04 14:36 ` [review v2] " Tom Tromey (Code Review)
2019-12-04 15:33 ` Simon Marchi (Code Review)
2019-12-04 16:41 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-04 16:41 ` 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=20191127220205.B845920AF6@gnutoolchain-gerrit.osci.io \
    --to=gerrit@gnutoolchain-gerrit.osci.io \
    --cc=gdb-patches@sourceware.org \
    --cc=gnutoolchain-gerrit@osci.io \
    --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