This is the mail archive of the gdb-patches@sources.redhat.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]
Other format: [Raw text]

Re: [RFA] Take III, part 2: am33 linux corefile support


On Mon, Jun 27, 2005 at 05:40:20PM -0700, Michael Snyder wrote:
> OK, here's this part again.  Mark, I used the osabi mechanism
> to register my corefile handlers, and I changed the typedefs
> from unsigned char to gdb_byte.

Could you explain why you needed a sniffer?

> + /* "Sniff" a bfd, claim it if it's ours.
> +    It's ours if it's am33 flavor.  */
> + 
> + static enum gdb_osabi
> + am33_linux_elf_osabi_sniffer (bfd *abfd)
> + {
> +   const struct bfd_arch_info *info = bfd_get_arch_info (abfd);
> +   int eflags = elf_elfheader (abfd) -> e_flags;
> +   /* We'll want to have a look at those, anyway... */
> + 
> +   if (info->arch == bfd_arch_mn10300)
> +     if (info->mach == bfd_mach_am33 || info->mach == bfd_mach_am33_2)
> +       if (eflags & (E_MN10300_MACH_AM33 | E_MN10300_MACH_AM33_2)
> + 	  return GDB_OSABI_LINUX;
> + 
> +     return GDB_OSABI_UNKNOWN;
> + }

i.e. what's this covering that the generic sniffer won't.  I can work
out the answer to the question in terms of ELF header flags, but I
assume you've got .note.ABI-tag like other Linux ports do.

> + void
> + _initialize_mn10300_linux_tdep (void)
> + {
> +   gdbarch_register_osabi (bfd_arch_mn10300, 0, 
> + 			  GDB_OSABI_LINUX, am33_linux_init_osabi);
> +   gdbarch_register_osabi_sniffer (bfd_arch_mn10300, 
> + 				  bfd_target_elf_flavour, 
> + 				  am33_linux_elf_osabi_sniffer);
> + }

If it's just to handle the am33 vs mn10300, you can use bfd_mach_am33
and bfd_mach_am33_2 as the second argument to gdbarch_register_osabi.

Otherwise I've no complaints.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


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