This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
rs6000-tdep.c Question
- From: "Roberts, Dennis" <Dennis dot Roberts at sunquestinfo dot com>
- To: "'gdb at sourceware dot org'" <gdb at sourceware dot org>
- Date: Thu, 10 Apr 2008 11:00:25 -0700
- Subject: rs6000-tdep.c Question
- Accept-language: en-US
- Acceptlanguage: en-US
I'm trying to teach gdb to interpret 64-bit executables and core files on AIX 5.3.0.0. I think I've got it working (I haven't found a way to break it yet although I haven't tested it on any other versions of AIX), but I'm a little uncomfortable with one of the code changes. Here's the original code:
if (!from_xcoff_exec)
{
arch = info.bfd_arch_info->arch;
mach = info.bfd_arch_info->mach;
}
else
{
arch = bfd_arch_powerpc;
bfd_default_set_arch_mach (&abfd, arch, 0);
info.bfd_arch_info = bfd_get_arch_info (&abfd);
mach = info.bfd_arch_info->mach;
}
Here's the new code:
if (!from_xcoff_exec || wordsize == 8)
{
arch = info.bfd_arch_info->arch;
mach = info.bfd_arch_info->mach;
}
else
{
arch = bfd_arch_powerpc;
bfd_default_set_arch_mach (&abfd, arch, 0);
info.bfd_arch_info = bfd_get_arch_info (&abfd);
mach = info.bfd_arch_info->mach;
}
This code change was necessary because the BFD architecture that was being selected was 32-bit, which caused a wordsize mismatch and prevented GDB from loading 64-bit executable files.
The reason that I'm uncomfortable with the code change is that someone specifically hard-coded the architecture and machine for xcoff executable files, and I don't know why. I assume that there are at least some cases where the BFD library doesn't set the architecture correctly for xcoff executables, but I'm not certain about that. It seems that the BFD library always sets the BFD architecture correctly for 64-bit executable files, though, so it seemed reasonable to have the code use the BFD architecture whenever the wordsize is 8.
Note: this is the only code change to gdb itself; the rest of the changes were in the BFD library.
Does anyone see any problem with this code change?
Thanks,
Dennis