This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Properly set low_pc in dwarf2.c
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 9 Jun 2005 14:18:42 +0930
- Subject: Re: PATCH: Properly set low_pc in dwarf2.c
- References: <20050605001108.GA13651@lucon.org>
On Sat, Jun 04, 2005 at 05:11:08PM -0700, H. J. Lu wrote:
> decode_line_info assumes low_pc == 0 means low_pc is unset, which is
> wrong. low_pc can set to 0. This patch fixes it.
>
>
> H.J.
> ----
> 2005-06-04 H.J. Lu <hongjiu.lu@intel.com>
>
> * dwarf2.c (decode_line_info): Properly set low_pc.
Who approved this patch? I'm reverting it and applying the following
instead.
* dwarf2.c (decode_line_info): Revert last change. Instead set
initial low_pc to -1 to avoid need to test whether loc_pc has
been set.
Index: bfd/dwarf2.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf2.c,v
retrieving revision 1.72
diff -u -p -r1.72 dwarf2.c
--- bfd/dwarf2.c 6 Jun 2005 14:28:30 -0000 1.72
+++ bfd/dwarf2.c 9 Jun 2005 04:44:29 -0000
@@ -1090,9 +1090,8 @@ decode_line_info (struct comp_unit *unit
order using DW_LNE_set_address (e.g. Intel C++ 6.0 compiler
for ia64-Linux). Thus, to determine the low and high
address, we must compare on every DW_LNS_copy, etc. */
- bfd_vma low_pc = 0;
+ bfd_vma low_pc = (bfd_vma) -1;
bfd_vma high_pc = 0;
- bfd_boolean low_pc_set = FALSE;
/* Decode the table. */
while (! end_sequence)
@@ -1110,11 +1109,8 @@ decode_line_info (struct comp_unit *unit
/* Append row to matrix using current values. */
add_line_info (table, address, filename, line, column, 0);
basic_block = 1;
- if (!low_pc_set || address < low_pc)
- {
- low_pc_set = TRUE;
- low_pc = address;
- }
+ if (address < low_pc)
+ low_pc = address;
if (address > high_pc)
high_pc = address;
}
@@ -1132,11 +1128,8 @@ decode_line_info (struct comp_unit *unit
end_sequence = 1;
add_line_info (table, address, filename, line, column,
end_sequence);
- if (!low_pc_set || address < low_pc)
- {
- low_pc_set = TRUE;
- low_pc = address;
- }
+ if (address < low_pc)
+ low_pc = address;
if (address > high_pc)
high_pc = address;
arange_add (unit->abfd, &unit->arange, low_pc, high_pc);
@@ -1188,11 +1181,8 @@ decode_line_info (struct comp_unit *unit
case DW_LNS_copy:
add_line_info (table, address, filename, line, column, 0);
basic_block = 0;
- if (!low_pc_set || address < low_pc)
- {
- low_pc_set = TRUE;
- low_pc = address;
- }
+ if (address < low_pc)
+ low_pc = address;
if (address > high_pc)
high_pc = address;
break;
--
Alan Modra
IBM OzLabs - Linux Technology Centre