[gold patch trivial] Fix problem with --gdb-index and DW_AT_low_pc

Cary Coutant ccoutant@google.com
Mon Apr 9 23:36:00 GMT 2012


I've committed the following trivial patch to fix a simple logic
mistake in building the gdb index. When scanning a compilation unit
DIE to build the ranges table, it was ignoring a
DW_AT_low_pc/DW_AT_high_pc pair because DW_AT_low_pc was set to a
section offset of 0.

-cary


2012-04-09  Cary Coutant  <ccoutant@google.com>

	* gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
	low_pc == 0.


commit 0e126d57cb56aafdfd7f3f9b65abda15c2ab9b2b
Author: Cary Coutant <ccoutant@google.com>
Date:   Mon Apr 9 14:18:33 2012 -0700

    Fix problem where DW_AT_low_pc/high_pc range is not recorded in gdb index.

diff --git a/gold/gdb-index.cc b/gold/gdb-index.cc
index 02e8173..bcf927b 100644
--- a/gold/gdb-index.cc
+++ b/gold/gdb-index.cc
@@ -825,7 +825,7 @@ Gdb_index_info_reader::record_cu_ranges(Dwarf_die* die)

   off_t low_pc = die->ref_attribute(elfcpp::DW_AT_low_pc, &shndx);
   off_t high_pc = die->ref_attribute(elfcpp::DW_AT_high_pc, &shndx2);
-  if (low_pc != 0 && high_pc != 0 && low_pc != -1 && high_pc != -1)
+  if ((low_pc != 0 || high_pc != 0) && low_pc != -1 && high_pc != -1)
     {
       if (shndx != shndx2)
         {



More information about the Binutils mailing list