This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Don't check abbrev is NULL in read_partial_die


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fd0a254f815b133c67230c50dd84eb0d4b31a93d

commit fd0a254f815b133c67230c50dd84eb0d4b31a93d
Author: Yao Qi <yao.qi@linaro.org>
Date:   Mon Feb 26 15:38:00 2018 +0000

    Don't check abbrev is NULL in read_partial_die
    
    'abbrev' won't be NULL, so don't check it.
    
    gdb:
    
    2018-02-26  Yao Qi  <yao.qi@linaro.org>
    
    	* dwarf2read.c (read_partial_die): Remove the code checking abbrev
    	is NULL.

Diff:
---
 gdb/ChangeLog    |  5 +++++
 gdb/dwarf2read.c | 17 +++++++----------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a5238b7..444081d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2018-02-26  Yao Qi  <yao.qi@linaro.org>
 
+	* dwarf2read.c (read_partial_die): Remove the code checking abbrev
+	is NULL.
+
+2018-02-26  Yao Qi  <yao.qi@linaro.org>
+
 	* dwarf2read.c (load_partial_dies): Move the location of XOBNEW.
 
 2018-02-26  Alan Hayward  <alan.hayward@arm.com>
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index ab9bfed..c15ae5b 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1792,7 +1792,7 @@ static struct partial_die_info *load_partial_dies
 
 static const gdb_byte *read_partial_die (const struct die_reader_specs *,
 					 struct partial_die_info *,
-					 struct abbrev_info *,
+					 const struct abbrev_info &,
 					 unsigned int,
 					 const gdb_byte *);
 
@@ -18310,7 +18310,7 @@ load_partial_dies (const struct die_reader_specs *reader,
       struct partial_die_info pdi;
 
       memset (&pdi, 0, sizeof (pdi));
-      info_ptr = read_partial_die (reader, &pdi, abbrev, bytes_read,
+      info_ptr = read_partial_die (reader, &pdi, *abbrev, bytes_read,
 				   info_ptr);
 
       /* This two-pass algorithm for processing partial symbols has a
@@ -18486,7 +18486,7 @@ load_partial_dies (const struct die_reader_specs *reader,
 static const gdb_byte *
 read_partial_die (const struct die_reader_specs *reader,
 		  struct partial_die_info *part_die,
-		  struct abbrev_info *abbrev, unsigned int abbrev_len,
+		  const struct abbrev_info &abbrev, unsigned int abbrev_len,
 		  const gdb_byte *info_ptr)
 {
   struct dwarf2_cu *cu = reader->cu;
@@ -18506,15 +18506,12 @@ read_partial_die (const struct die_reader_specs *reader,
 
   info_ptr += abbrev_len;
 
-  if (abbrev == NULL)
-    return info_ptr;
-
-  part_die->tag = abbrev->tag;
-  part_die->has_children = abbrev->has_children;
+  part_die->tag = abbrev.tag;
+  part_die->has_children = abbrev.has_children;
 
-  for (i = 0; i < abbrev->num_attrs; ++i)
+  for (i = 0; i < abbrev.num_attrs; ++i)
     {
-      info_ptr = read_attribute (reader, &attr, &abbrev->attrs[i], info_ptr);
+      info_ptr = read_attribute (reader, &attr, &abbrev.attrs[i], info_ptr);
 
       /* Store the data if it is of an attribute we want to keep in a
          partial symbol table.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]