Why does GDB says “Architecture of file not recognized”?
Question
I m using gdb on a aix shared lib running on aix 5.3? When i try to run gdb for this file i get a error message saying ""Architecture of file not recognized" Don't know how to get this fixed.
Does anybody know why i get this message ""Architecture of file not recognized"?.
gdb runs fine on other executables compiled by xlc.
Is there some option that i might have used while compiling , which is not compatible with GDB.some processor specific option.
I compiled the shared lib w xlc v9.0 for aix.
Thanks.
Solution
void set_gdbarch_from_file (bfd *abfd) { struct gdbarch_info info; struct gdbarch *gdbarch; gdbarch_info_init (&info); info.abfd = abfd; info.target_desc = target_current_description (); gdbarch = gdbarch_find_by_info (info); if (gdbarch == NULL) error (_("Architecture of file not recognized.")); deprecated_current_gdbarch_select_hack (gdbarch); }
This is the actual GDB code in question (gdb/arch-utils.c:530-544).
The information passed to the gdbarch pointer seems to be invalid. This is caused by gdb_find_by_info returning a NULL pointer and that is caused by find_arch_by_info (gdb/gdbarch.c:3656) returning a NULL pointer.
It basically means what it says: GDB could not identify the architecture of the file. This seems to be a common problem for xlc, even on recent gdb versions.
XLC and gdb are, as far i remember and understand, not very good when it comes down to compatability terms (AIX support is minimal), you might try using the Gnu C Compiler .You might look at the GDB sources for VERY specific information (that i can't really give you).
Here is a link to gcc-AIX specifics.
OTHER TIPS
You don't run GDB on a shared library, you run it on an executable.
If the executable loads your shared library, GDB will know about it.