This is the mail archive of the
mailing list for the GDB project.
path for gdb/dwarf2read.c, support 16-bit targets in dwarf-2
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: path for gdb/dwarf2read.c, support 16-bit targets in dwarf-2
- From: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Date: Tue, 22 Feb 2000 21:38:43 +0100
The following patch fixes GDB dwarf-2 reader to support 16-bit address
In 'dwarf2_build_psymtabs_hard' there was a hack to guess the size of the
target address. We were using the bfd 'elf_size_info::arch_size' member.
This corresponds to the ELF file arch size, not the target address size.
I suggest to use 'bfd_arch_bits_per_address' which really corresponds to
what we need.
Then, in 'read_address', we just have to read 2-bytes addresses.
I've been using this fix for a while with the 68HC11 port.
Can you integrate it?
2000-02-22 Stephane Carrez <firstname.lastname@example.org>
* dwarf2read.c (dwarf2_build_psymtabs_hard): Use
bfd_arch_bits_per_address to get the size of addresses.
(read_address): Read 16-bits addresses.
--- /src/gnu/cygnus/gdb/gdb/dwarf2read.c Tue Feb 15 21:42:05 2000
+++ gdb/dwarf2read.c Mon Feb 21 21:17:46 2000
@@ -938,7 +938,7 @@ dwarf2_build_psymtabs_hard (objfile, mai
CORE_ADDR lowpc, highpc;
/* Number of bytes of any addresses that are signficant */
- address_significant_size = get_elf_backend_data (abfd)->s->arch_size / 8;
+ address_significant_size = bfd_arch_bits_per_address (abfd) / 8;
info_ptr = dwarf_info_buffer;
abbrev_ptr = dwarf_abbrev_buffer;
@@ -980,6 +980,7 @@ dwarf2_build_psymtabs_hard (objfile, mai
(long) (beg_of_comp_unit - dwarf_info_buffer));
if (address_size < address_significant_size)
error ("Dwarf Error: bad address size (%ld) in compilation unit header (offset 0x%lx + 11).",
@@ -3487,6 +3488,9 @@ read_address (abfd, buf)
+ case 2:
+ retval = bfd_get_16 (abfd, (bfd_byte *) buf);
retval = bfd_get_32 (abfd, (bfd_byte *) buf);