public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Remove dwarf2_cu::base_known
Date: Fri, 10 Apr 2020 07:01:42 -0400	[thread overview]
Message-ID: <2b24b6e4a6d03efc3e76ce6912394e4a86cc387b@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 2b24b6e4a6d03efc3e76ce6912394e4a86cc387b ***

commit 2b24b6e4a6d03efc3e76ce6912394e4a86cc387b
Author:     Tom Tromey <tom@tromey.com>
AuthorDate: Thu Mar 26 09:28:08 2020 -0600
Commit:     Tom Tromey <tom@tromey.com>
CommitDate: Thu Mar 26 09:28:21 2020 -0600

    Remove dwarf2_cu::base_known
    
    This removes dwarf2_cu::base_known, changing base_address to be a
    gdb::optional.
    
    gdb/ChangeLog
    2020-03-26  Tom Tromey  <tom@tromey.com>
    
            * dwarf2/read.c (struct dwarf2_cu) <base_known>: Remove.
            <base_address>: Now an optional.
            (dwarf2_find_base_address, dwarf2_rnglists_process)
            (dwarf2_ranges_process, fill_in_loclist_baton)
            (dwarf2_symbol_mark_computed): Update.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 51ebd3c52b..2ebdab350a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2020-03-26  Tom Tromey  <tom@tromey.com>
+
+	* dwarf2/read.c (struct dwarf2_cu) <base_known>: Remove.
+	<base_address>: Now an optional.
+	(dwarf2_find_base_address, dwarf2_rnglists_process)
+	(dwarf2_ranges_process, fill_in_loclist_baton)
+	(dwarf2_symbol_mark_computed): Update.
+
 2020-03-26  Tom Tromey  <tom@tromey.com>
 
 	* dwarf2/read.c (struct die_info): Move to die.h.
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index bdf3a89aa2..d4cfb865fe 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -393,10 +393,7 @@ struct dwarf2_cu
   struct comp_unit_head header {};
 
   /* Base address of this compilation unit.  */
-  CORE_ADDR base_address = 0;
-
-  /* Non-zero if base_address has been set.  */
-  int base_known = 0;
+  gdb::optional<CORE_ADDR> base_address;
 
   /* The language we are debugging.  */
   enum language language = language_unknown;
@@ -5783,23 +5780,16 @@ dwarf2_find_base_address (struct die_info *die, struct dwarf2_cu *cu)
 {
   struct attribute *attr;
 
-  cu->base_known = 0;
-  cu->base_address = 0;
+  cu->base_address.reset ();
 
   attr = dwarf2_attr (die, DW_AT_entry_pc, cu);
   if (attr != nullptr)
-    {
-      cu->base_address = attr->value_as_address ();
-      cu->base_known = 1;
-    }
+    cu->base_address = attr->value_as_address ();
   else
     {
       attr = dwarf2_attr (die, DW_AT_low_pc, cu);
       if (attr != nullptr)
-	{
-	  cu->base_address = attr->value_as_address ();
-	  cu->base_known = 1;
-	}
+	cu->base_address = attr->value_as_address ();
     }
 }
 
@@ -13441,13 +13431,11 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
   struct objfile *objfile = dwarf2_per_objfile->objfile;
   bfd *obfd = objfile->obfd;
   /* Base address selection entry.  */
-  CORE_ADDR base;
-  int found_base;
+  gdb::optional<CORE_ADDR> base;
   const gdb_byte *buffer;
   CORE_ADDR baseaddr;
   bool overflow = false;
 
-  found_base = cu->base_known;
   base = cu->base_address;
 
   dwarf2_per_objfile->rnglists.read (objfile);
@@ -13486,7 +13474,6 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
 	      break;
 	    }
 	  base = cu->header.read_address (obfd, buffer, &bytes_read);
-	  found_base = 1;
 	  buffer += bytes_read;
 	  break;
 	case DW_RLE_start_length:
@@ -13544,7 +13531,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
       if (rlet == DW_RLE_base_address)
 	continue;
 
-      if (!found_base)
+      if (!base.has_value ())
 	{
 	  /* We have no valid base address for the ranges
 	     data.  */
@@ -13563,8 +13550,8 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
       if (range_beginning == range_end)
 	continue;
 
-      range_beginning += base;
-      range_end += base;
+      range_beginning += *base;
+      range_end += *base;
 
       /* A not-uncommon case of bad debug info.
 	 Don't pollute the addrmap with bad data.  */
@@ -13608,8 +13595,7 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu,
   unsigned int addr_size = cu_header->addr_size;
   CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
   /* Base address selection entry.  */
-  CORE_ADDR base;
-  int found_base;
+  gdb::optional<CORE_ADDR> base;
   unsigned int dummy;
   const gdb_byte *buffer;
   CORE_ADDR baseaddr;
@@ -13617,7 +13603,6 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu,
   if (cu_header->version >= 5)
     return dwarf2_rnglists_process (offset, cu, callback);
 
-  found_base = cu->base_known;
   base = cu->base_address;
 
   dwarf2_per_objfile->ranges.read (objfile);
@@ -13654,11 +13639,10 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu,
 	  /* If we found the largest possible address, then we already
 	     have the base address in range_end.  */
 	  base = range_end;
-	  found_base = 1;
 	  continue;
 	}
 
-      if (!found_base)
+      if (!base.has_value ())
 	{
 	  /* We have no valid base address for the ranges
 	     data.  */
@@ -13677,8 +13661,8 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu,
       if (range_beginning == range_end)
 	continue;
 
-      range_beginning += base;
-      range_end += base;
+      range_beginning += *base;
+      range_end += *base;
 
       /* A not-uncommon case of bad debug info.
 	 Don't pollute the addrmap with bad data.  */
@@ -22756,7 +22740,10 @@ fill_in_loclist_baton (struct dwarf2_cu *cu,
      don't run off the edge of the section.  */
   baton->size = section->size - DW_UNSND (attr);
   baton->data = section->buffer + DW_UNSND (attr);
-  baton->base_address = cu->base_address;
+  if (cu->base_address.has_value ())
+    baton->base_address = *cu->base_address;
+  else
+    baton->base_address = 0;
   baton->from_dwo = cu->dwo_unit != NULL;
 }
 
@@ -22781,7 +22768,7 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym,
 
       fill_in_loclist_baton (cu, baton, attr);
 
-      if (cu->base_known == 0)
+      if (!cu->base_address.has_value ())
 	complaint (_("Location list used without "
 		     "specifying the CU base address."));
 


             reply	other threads:[~2020-04-10 11:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-10 11:01 gdb-buildbot [this message]
2020-04-10 11:01 ` Failures on Fedora-i686, branch master gdb-buildbot
2020-04-10 11:29 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2020-04-10 11:47 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-04-10 12:20 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-04-10 12:46 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-04-13 22:15 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2020-04-14 16:45 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot
2020-04-16  2:59 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot
2020-04-16  4:47 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot

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=2b24b6e4a6d03efc3e76ce6912394e4a86cc387b@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@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).