This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: path for gdb/dwarf2read.c, support 16-bit targets in dwarf-2


Stephane Carrez wrote:
> 
> Hi!
> 
> The following patch fixes GDB dwarf-2 reader to support 16-bit address
> targets.
> 
> 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?
> 
> Thanks,
>         Stephane
> 
> 2000-02-22  Stephane Carrez  <stcarrez@worldnet.fr>
> 
>         * dwarf2read.c (dwarf2_build_psymtabs_hard): Use
>         bfd_arch_bits_per_address to get the size of addresses.

FYI,

I've applied this bit:

>         (read_address): Read 16-bits addresses.

As for the change:

> -  address_significant_size = get_elf_backend_data (abfd)->s->arch_size / 8;
> +  address_significant_size = bfd_arch_bits_per_address (abfd) / 8;

I'm not so sure.  Does bfd_arch_bits_per_address() return 16 while the
elf data arch_size indicate something else (elf32 vs elf16?)

I've attatched some references to when a similar problem was discussed
for a 64 bit target with 32 bit ELF binaries.

Jim?

	Andrew

http://sourceware.cygnus.com/ml/gdb-patches/1999-q4/msg00267.html
http://sourceware.cygnus.com/ml/gdb-patches/1999-q4/msg00263.html
Tue Feb 29 15:14:56 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	From 2000-02-22 Stephane Carrez <stcarrez@worldnet.fr>:
        * dwarf2read.c (read_address): Read 16-bits addresses.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.2
diff -p -r1.2 dwarf2read.c
*** dwarf2read.c	2000/02/14 04:37:06	1.2
--- dwarf2read.c	2000/02/29 05:06:26
*************** read_address (abfd, buf)
*** 3487,3492 ****
--- 3487,3495 ----
  
    switch (address_size)
      {
+     case 2:
+       retval = bfd_get_16 (abfd, (bfd_byte *) buf);
+       break;
      case 4:
        retval = bfd_get_32 (abfd, (bfd_byte *) buf);
        break;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]