summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2006-01-17 17:12:58 +0000
committerH.J. Lu <hjl.tools@gmail.com>2006-01-17 17:12:58 +0000
commit6dd55cb711112860860407fe47f18e1ddb17c599 (patch)
tree04ed3e9e2afe21d8b8cc83d2c1b7ee04ab039590
parent64d03ab565d55c20bfa7267bc669876a8fbea912 (diff)
downloadppe42-binutils-6dd55cb711112860860407fe47f18e1ddb17c599.tar.gz
ppe42-binutils-6dd55cb711112860860407fe47f18e1ddb17c599.zip
2006-01-17 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/2096 * dwarf2.c (comp_unit_contains_address): Update comment. (_bfd_dwarf2_find_nearest_line): Use section's vma, instead of lma. Return TRUE only if both comp_unit_contains_address and comp_unit_find_nearest_line return TRUE. (_bfd_dwarf2_find_line): Use section's vma, instead of lma.
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/dwarf2.c51
2 files changed, 31 insertions, 29 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 63925c33f4..3012ba7c2f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2006-01-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/2096
+ * dwarf2.c (comp_unit_contains_address): Update comment.
+ (_bfd_dwarf2_find_nearest_line): Use section's vma, instead of
+ lma. Return TRUE only if both comp_unit_contains_address and
+ comp_unit_find_nearest_line return TRUE.
+ (_bfd_dwarf2_find_line): Use section's vma, instead of lma.
+
2006-01-18 Alan Modra <amodra@bigpond.net.au>
* elf-bfd.h (struct elf_backend_data): Add gc_mark_dynamic_ref.
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 123dd9c430..1d55e9ecb1 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -2006,7 +2006,11 @@ parse_comp_unit (bfd *abfd,
return unit;
}
-/* Return TRUE if UNIT contains the address given by ADDR. */
+/* Return TRUE if UNIT may contain the address given by ADDR. When
+ there are functions written entirely with inline asm statements, the
+ range info in the compilation unit header may not be correct. We
+ need to consult the line info table to see if a compilation unit
+ really contains the given address. */
static bfd_boolean
comp_unit_contains_address (struct comp_unit *unit, bfd_vma addr)
@@ -2210,9 +2214,9 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
stash = *pinfo;
addr = offset;
if (section->output_section)
- addr += section->output_section->lma + section->output_offset;
+ addr += section->output_section->vma + section->output_offset;
else
- addr += section->lma;
+ addr += section->vma;
*filename_ptr = NULL;
*functionname_ptr = NULL;
*linenumber_ptr = 0;
@@ -2293,16 +2297,16 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
/* Check the previously read comp. units first. */
for (each = stash->all_comp_units; each; each = each->next_unit)
- if (comp_unit_contains_address (each, addr))
- return comp_unit_find_nearest_line (each, addr, filename_ptr,
- functionname_ptr, linenumber_ptr,
- stash);
+ if (comp_unit_contains_address (each, addr)
+ && comp_unit_find_nearest_line (each, addr, filename_ptr,
+ functionname_ptr,
+ linenumber_ptr, stash))
+ return TRUE;
/* Read each remaining comp. units checking each as they are read. */
while (stash->info_ptr < stash->info_ptr_end)
{
bfd_vma length;
- bfd_boolean found;
unsigned int offset_size = addr_size;
bfd_byte *info_ptr_unit = stash->info_ptr;
@@ -2358,25 +2362,14 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
unit->high == 0), we need to consult the line info
table to see if a compilation unit contains the given
address. */
- if (each->arange.high > 0)
- {
- if (comp_unit_contains_address (each, addr))
- return comp_unit_find_nearest_line (each, addr,
- filename_ptr,
- functionname_ptr,
- linenumber_ptr,
- stash);
- }
- else
- {
- found = comp_unit_find_nearest_line (each, addr,
- filename_ptr,
- functionname_ptr,
- linenumber_ptr,
- stash);
- if (found)
- return TRUE;
- }
+ if ((each->arange.high == 0
+ || comp_unit_contains_address (each, addr))
+ && comp_unit_find_nearest_line (each, addr,
+ filename_ptr,
+ functionname_ptr,
+ linenumber_ptr,
+ stash))
+ return TRUE;
}
}
}
@@ -2419,9 +2412,9 @@ _bfd_dwarf2_find_line (bfd *abfd,
addr = symbol->value;
if (section->output_section)
- addr += section->output_section->lma + section->output_offset;
+ addr += section->output_section->vma + section->output_offset;
else
- addr += section->lma;
+ addr += section->vma;
*filename_ptr = NULL;
stash = *pinfo;
OpenPOWER on IntegriCloud