aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-07-02 21:03:56 +0000
committerMark Mitchell <mark@codesourcery.com>1999-07-02 21:03:56 +0000
commit5e38c3b8564f88a243079d4c8b8595aba0be3e87 (patch)
treeb381a628141966c4eda7d6103737d3b32a680027 /bfd
parent4766cbee7a949c75bd0452d6aa09e15aa1131aae (diff)
downloadgdb-5e38c3b8564f88a243079d4c8b8595aba0be3e87.zip
gdb-5e38c3b8564f88a243079d4c8b8595aba0be3e87.tar.gz
gdb-5e38c3b8564f88a243079d4c8b8595aba0be3e87.tar.bz2
* dwarf2.c (parse_comp_unit): Add ABBREV_LENGTH parameter.
(_bfd_dwarf2_find_nearest_line): Add ADDR_SIZE parameter. * elf.c (_bfd_elf_find_nearest_line): Pass it. * elf32-arm.h (elf32_arm_find_nearest_line): Likewise. * elf32-mips.c (ABI_64_P): New macro. (IRIX_COMPAT): We are IRIX6-compatible if ABI_64_P. (_bfd_mips_elf_find_nearest_line): Adjust call to _bfd_dwarf2_find_nearest_line. * libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype. * libbfd.h: Regenerated.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog13
-rw-r--r--bfd/dwarf2.c54
-rw-r--r--bfd/elf.c2
-rw-r--r--bfd/elf32-arm.h2
-rw-r--r--bfd/elf32-mips.c10
-rw-r--r--bfd/libbfd-in.h2
-rw-r--r--bfd/libbfd.h2
7 files changed, 65 insertions, 20 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c3cc021..3ce3af0 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,16 @@
+1999-07-02 Mark Mitchell <mark@codesourcery.com>
+
+ * dwarf2.c (parse_comp_unit): Add ABBREV_LENGTH parameter.
+ (_bfd_dwarf2_find_nearest_line): Add ADDR_SIZE parameter.
+ * elf.c (_bfd_elf_find_nearest_line): Pass it.
+ * elf32-arm.h (elf32_arm_find_nearest_line): Likewise.
+ * elf32-mips.c (ABI_64_P): New macro.
+ (IRIX_COMPAT): We are IRIX6-compatible if ABI_64_P.
+ (_bfd_mips_elf_find_nearest_line): Adjust call to
+ _bfd_dwarf2_find_nearest_line.
+ * libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype.
+ * libbfd.h: Regenerated.
+
1999-07-02 Ian Lance Taylor <ian@zembu.com>
* config.bfd: Add * at the end of i[3456]86-*-unixware.
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index e05dac6..16986ad 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1216,19 +1216,22 @@ scan_unit_for_functions (unit)
-/* Parse a DWARF2 compilation unit starting at INFO_PTR. This includes
- the compilation unit header that proceeds the DIE's, but does not
- include the length field that preceeds each compilation unit header.
- END_PTR points one past the end of this comp unit.
+/* Parse a DWARF2 compilation unit starting at INFO_PTR. This
+ includes the compilation unit header that proceeds the DIE's, but
+ does not include the length field that preceeds each compilation
+ unit header. END_PTR points one past the end of this comp unit.
+ If ABBREV_LENGTH is 0, then the length of the abbreviation offset
+ is assumed to be four bytes. Otherwise, it it is the size given.
This routine does not read the whole compilation unit; only enough
to get to the line number information for the compilation unit. */
static struct comp_unit *
-parse_comp_unit (abfd, info_ptr, end_ptr)
+parse_comp_unit (abfd, info_ptr, end_ptr, abbrev_length)
bfd* abfd;
char* info_ptr;
char* end_ptr;
+ unsigned int abbrev_length;
{
struct comp_unit* unit;
@@ -1243,8 +1246,14 @@ parse_comp_unit (abfd, info_ptr, end_ptr)
version = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
- abbrev_offset = read_4_bytes (abfd, info_ptr);
- info_ptr += 4;
+ BFD_ASSERT (abbrev_length == 0
+ || abbrev_length == 4
+ || abbrev_length == 8);
+ if (abbrev_length == 0 || abbrev_length == 4)
+ abbrev_offset = read_4_bytes (abfd, info_ptr);
+ else if (abbrev_length == 8)
+ abbrev_offset = read_8_bytes (abfd, info_ptr);
+ info_ptr += abbrev_length;
addr_size = read_1_byte (abfd, info_ptr);
info_ptr += 1;
@@ -1435,12 +1444,17 @@ comp_unit_find_nearest_line (unit, addr,
return line_p || func_p;
}
-/* The DWARF2 version of find_nearest line.
- Return true if the line is found without error. */
+/* The DWARF2 version of find_nearest line. Return true if the line
+ is found without error. ADDR_SIZE is the number of bytes in the
+ initial .debug_info length field and in the abbreviation offset.
+ You may use zero to indicate that the default value should be
+ used. */
boolean
_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr, linenumber_ptr)
+ filename_ptr, functionname_ptr,
+ linenumber_ptr,
+ addr_size)
bfd *abfd;
asection *section;
asymbol **symbols;
@@ -1448,6 +1462,7 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
const char **filename_ptr;
const char **functionname_ptr;
unsigned int *linenumber_ptr;
+ unsigned int addr_size;
{
/* Read each compilation unit from the section .debug_info, and check
to see if it contains the address we are searching for. If yes,
@@ -1470,6 +1485,13 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
*functionname_ptr = NULL;
*linenumber_ptr = 0;
+ /* The DWARF2 spec says that the initial length field, and the
+ offset of the abbreviation table, should both be 4-byte values.
+ However, some compilers do things differently. */
+ if (addr_size == 0)
+ addr_size = 4;
+ BFD_ASSERT (addr_size == 4 || addr_size == 8);
+
if (! stash)
{
asection *msec;
@@ -1540,16 +1562,20 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
while (stash->info_ptr < stash->info_ptr_end)
{
struct comp_unit* each;
- unsigned int length;
+ bfd_vma length;
boolean found;
- length = read_4_bytes (abfd, stash->info_ptr);
- stash->info_ptr += 4;
+ if (addr_size == 4)
+ length = read_4_bytes (abfd, stash->info_ptr);
+ else
+ length = read_8_bytes (abfd, stash->info_ptr);
+ stash->info_ptr += addr_size;
if (length > 0)
{
each = parse_comp_unit (abfd, stash->info_ptr,
- stash->info_ptr + length);
+ stash->info_ptr + length,
+ addr_size);
stash->info_ptr += length;
if (each)
diff --git a/bfd/elf.c b/bfd/elf.c
index 8ff02e4..f3d23c4 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4616,7 +4616,7 @@ _bfd_elf_find_nearest_line (abfd,
if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
filename_ptr, functionname_ptr,
- line_ptr))
+ line_ptr, 0))
return true;
if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h
index b0de611..ce2eea7 100644
--- a/bfd/elf32-arm.h
+++ b/bfd/elf32-arm.h
@@ -2396,7 +2396,7 @@ elf32_arm_find_nearest_line
if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
filename_ptr, functionname_ptr,
- line_ptr))
+ line_ptr, 0))
return true;
if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 50d2f23..8800423 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -235,12 +235,17 @@ typedef enum {
#define ABI_N32_P(abfd) \
((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
+/* Nonzero if ABFD is using the 64-bit ABI. FIXME: This is never
+ true, yet. */
+#define ABI_64_P(abfd) \
+ ((elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) != 0)
+
/* What version of Irix we are trying to be compatible with. FIXME:
At the moment, we never generate "normal" MIPS ELF ABI executables;
we always use some version of Irix. */
#define IRIX_COMPAT(abfd) \
- (ABI_N32_P (abfd) ? ict_irix6 : ict_irix5)
+ ((ABI_N32_P (abfd) || ABI_64_P (abfd)) ? ict_irix6 : ict_irix5)
/* Whether we are trying to be compatible with IRIX at all. */
@@ -3517,7 +3522,8 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
filename_ptr, functionname_ptr,
- line_ptr))
+ line_ptr,
+ ABI_64_P (abfd) ? 8 : 0))
return true;
msec = bfd_get_section_by_name (abfd, ".mdebug");
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index dd6b72c..f2ac823 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -365,7 +365,7 @@ extern boolean _bfd_dwarf1_find_nearest_line
/* Find the nearest line using DWARF 2 debugging information. */
extern boolean _bfd_dwarf2_find_nearest_line
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
+ const char **, unsigned int *, unsigned int));
/* A routine to create entries for a bfd_link_hash_table. */
extern struct bfd_hash_entry *_bfd_link_hash_newfunc
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index c2f0a15..45bf9d7 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -365,7 +365,7 @@ extern boolean _bfd_dwarf1_find_nearest_line
/* Find the nearest line using DWARF 2 debugging information. */
extern boolean _bfd_dwarf2_find_nearest_line
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
+ const char **, unsigned int *, unsigned int));
/* A routine to create entries for a bfd_link_hash_table. */
extern struct bfd_hash_entry *_bfd_link_hash_newfunc