This is the mail archive of the gdb@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: arm core analysis on x86 host


On Wed, Mar 30, 2005 at 03:10:31PM +0000, M.M. Kettenis wrote:
> Secondly, the OS/ABI for core files don't have to match the executable
> exactly, but of course they have to be somewhat compatible. I know
> for sure that 32x64-bit cross debugging works on AMD64, and it is
> assumed to be working on PowerPC too.  There might be some nasty
> side-effects though if you load a core file without the matching
> executable.
> 
> However, if the OS/ABI's differ, be aware that
> regset_from_core_section() will be called for the OS/ABI of the core
> file. That regset_from_core_section() will have to do the proper
> translation on the register sets for the OS/ABI of the executable.
> That OS/ABI can be determined from the regcache that is passed to
> regset_from_core_section().
> 
> I'd suggest looking at the i386/amd64 *BSD code or NetBSD/sparc64 code
> for good examples.

How does this work?  In amd64_init_abi, we only call
set_gdbarch_regset_from_core_section if this OS/ABI has a registered
gregset.  So if the core file is not tagged as Linux, then the right
OS/ABI's code will never be called.

It looks to me from tracing this through on i386, that the reason
it works is because foo-*-linux* configurations default to
GDB_OSABI_LINUX and none of the OS/ABI sniffers trigger on the core
file.  An accident, basically.

The reason this doesn't work for ARM is because the sniffer tags the
core file as GDB_OSABI_ARM_APCS.  I've been meaning to change the way
ARM OS/ABI detection works, which will "fix" this as a side effect;
I will move that up my list and try to do it today.

But I'm left wondering about the overall design.  How are we supposed
to figure out what sort of core file we have?  Is the target
architecture required to arbitrate between possible subtarget core
formats?  Do the sniffers need to become cleverer - if that's even
possible?

-- 
Daniel Jacobowitz
CodeSourcery, LLC


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