Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Identifying PowerPC architecture
@ 2007-01-11 20:47 Michael Eager
  2007-01-11 20:51 ` Daniel Jacobowitz
  2007-01-11 21:31 ` Mark Kettenis
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Eager @ 2007-01-11 20:47 UTC (permalink / raw)
  To: gdb

I'm looking at how gdb decides which arch/mach it is
working with for PowerPC.  It looks like it always picks up
rs6000:6000 as processor type.

When rs6000_gdbarch_init(struct gdbarch_info info,
struct gdbarch_list *arches) is called, arches is NULL.
As a result, it creates up a default arch/mach based on
info.bfd_arch_info.

The arches data is initialized by gdbarch_register() whichs
sets gdbarch_registry[*]->arches to NULL and I don't see
anywhere that this is changed to point to a list of valid
arches.

Am I missing something somewhere?  How is this supposed to work?

-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Identifying PowerPC architecture
  2007-01-11 20:47 Identifying PowerPC architecture Michael Eager
@ 2007-01-11 20:51 ` Daniel Jacobowitz
  2007-01-11 21:04   ` Michael Eager
  2007-01-11 21:31 ` Mark Kettenis
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-01-11 20:51 UTC (permalink / raw)
  To: Michael Eager; +Cc: gdb

On Thu, Jan 11, 2007 at 12:46:55PM -0800, Michael Eager wrote:
> I'm looking at how gdb decides which arch/mach it is
> working with for PowerPC.  It looks like it always picks up
> rs6000:6000 as processor type.
> 
> When rs6000_gdbarch_init(struct gdbarch_info info,
> struct gdbarch_list *arches) is called, arches is NULL.
> As a result, it creates up a default arch/mach based on
> info.bfd_arch_info.

->arches is a list of previously initialized gdbarches.  They're
initialized by other calls to rs6000_gdbarch_init.

gdbarch_list_lookup_by_info will only return something with the
same bfd_arch_info as it is passed.

So, if you're not getting the right arch, you're probably not
starting with the right bfd_arch_info.  I don't know if PowerPC
tags binaries with the processor; I don't remember any such markings
for PowerPC.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Identifying PowerPC architecture
  2007-01-11 20:51 ` Daniel Jacobowitz
@ 2007-01-11 21:04   ` Michael Eager
  2007-01-11 21:22     ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Eager @ 2007-01-11 21:04 UTC (permalink / raw)
  To: Michael Eager, gdb

Daniel Jacobowitz wrote:
> On Thu, Jan 11, 2007 at 12:46:55PM -0800, Michael Eager wrote:
>> I'm looking at how gdb decides which arch/mach it is
>> working with for PowerPC.  It looks like it always picks up
>> rs6000:6000 as processor type.
>>
>> When rs6000_gdbarch_init(struct gdbarch_info info,
>> struct gdbarch_list *arches) is called, arches is NULL.
>> As a result, it creates up a default arch/mach based on
>> info.bfd_arch_info.
> 
> ->arches is a list of previously initialized gdbarches.  They're
> initialized by other calls to rs6000_gdbarch_init.

I don't see where that happens, but I'll take your word.

> gdbarch_list_lookup_by_info will only return something with the
> same bfd_arch_info as it is passed.
> 
> So, if you're not getting the right arch, you're probably not
> starting with the right bfd_arch_info.  I don't know if PowerPC
> tags binaries with the processor; I don't remember any such markings
> for PowerPC.

Nope, there's no model info for PowerPC in the ELF file.

-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Identifying PowerPC architecture
  2007-01-11 21:04   ` Michael Eager
@ 2007-01-11 21:22     ` Daniel Jacobowitz
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-01-11 21:22 UTC (permalink / raw)
  To: Michael Eager; +Cc: gdb

On Thu, Jan 11, 2007 at 01:03:57PM -0800, Michael Eager wrote:
> >gdbarch_list_lookup_by_info will only return something with the
> >same bfd_arch_info as it is passed.
> >
> >So, if you're not getting the right arch, you're probably not
> >starting with the right bfd_arch_info.  I don't know if PowerPC
> >tags binaries with the processor; I don't remember any such markings
> >for PowerPC.
> 
> Nope, there's no model info for PowerPC in the ELF file.

Then you're always going to get the default processor, unless you
use "set architecture" (or the new XML <architecture> bit I committed
to HEAD this week).

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Identifying PowerPC architecture
  2007-01-11 20:47 Identifying PowerPC architecture Michael Eager
  2007-01-11 20:51 ` Daniel Jacobowitz
@ 2007-01-11 21:31 ` Mark Kettenis
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Kettenis @ 2007-01-11 21:31 UTC (permalink / raw)
  To: eager; +Cc: gdb

> Date: Thu, 11 Jan 2007 12:46:55 -0800
> From: Michael Eager <eager@eagercon.com>
> 
> I'm looking at how gdb decides which arch/mach it is
> working with for PowerPC.  It looks like it always picks up
> rs6000:6000 as processor type.

For what it is worth, I get powerpc:common for OpenBSD.  Probably
because of the fact that the OpenBSD OS/ABI support is registered
with:

  gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_OPENBSD_ELF,
                          ppcobsd_init_abi);

Mark


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-01-11 21:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-11 20:47 Identifying PowerPC architecture Michael Eager
2007-01-11 20:51 ` Daniel Jacobowitz
2007-01-11 21:04   ` Michael Eager
2007-01-11 21:22     ` Daniel Jacobowitz
2007-01-11 21:31 ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox