How to debug with gdb on mac?[solved]

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
torshie
Member
Member
Posts: 89
Joined: Sun Jan 11, 2009 7:41 pm

How to debug with gdb on mac?[solved]

Post by torshie »

Hi,
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
Cheers
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
Post Reply