A mac is used as my develop platform. Format of my kernel binary is elf64, native gdb doesn't recognize this format. I tried to compile the kernel binary into Mach-O format but failed, native g++ on mac doesn't accept option "-mcmodel=large". I also tried to compile a gdb with configure argument --target=x86_64-pc-elf. The binary could be compiled but when I tried to run gdb I get the following error messages:
Code: Select all
torshie:~/lab/src/gdb-build$ x86_64-pc-elf-gdb
../../gdb-6.8/gdb/arch-utils.c:573: internal-error: initialize_current_architecture: Selection of initial architecture failed
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) [answered Y; input not from terminal]
../../gdb-6.8/gdb/arch-utils.c:573: internal-error: initialize_current_architecture: Selection of initial architecture failed
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) [answered Y; input not from terminal]
Abort trap
torshie
=========================
After hours of experiments, I got the answer:
Rebuild the whole cross toolchain(including gdb) with target x86_64-linux-gnu instead of x86_64-pc-elf which is suggested in wiki tutorial