Re: gdb darwin target on Linux host?

Peter Steiner
2010-10-20T14:42:34Z

On Wed, 2010-10-20 at 16:20 +0200, Tristan Gingold wrote:
> Could you post the log messages ? I suppose that if no binary is
> built, then an error has occurred.
>
> Not sure why you try to build such a tool, as it would be basically
> useless to debug.
>
Hi

found the bug - there must be some typo/bug in your build system as it
does not build the gdb/ directory at all with --target=x86_64-darwin!

I had to run configure in topdir first then after it finishes cd gdb,
then rerun same configure (--target=x86_64-darwin) in gdb dir, make,
cd .. && make install.

This worked and gives me:

l /usr/local/gdb/bin/
total 44032
drwxr-xr-x 2 root root 4096 2010-10-20 16:22 ./
drwxr-xr-x 6 root root 4096 2010-10-20 16:05 ../
-rwxr-xr-x 1 root root 17567402 2010-10-20 16:22
x86_64-apple-darwin-gdb*
-rwxr-xr-x 1 root root 17567431 2010-10-20 16:22
x86_64-apple-darwin-gdbtui*

BUT, there is another issue now. The so generated
x86_64-apple-darwin-gdb* does not recognize 64bit binaries:

(e.g. /home/exchange/ls is the binary I want to debug)

/usr/local/gdb/bin/x86_64-apple-darwin-gdb /home/exchange/ls

GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show
copying"
and "show warranty" for details.
This GDB was configured as "--host= --target=x86_64-apple-darwin".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
"/home/exchange/ls": not in executable format: File format not
recognized
Setting up the environment for debugging gdb.

WHY it says:

"/home/exchange/ls": not in executable format: File format not
recognized

?

as I built for the darwin target?

file /home/exchange/ls
/home/exchange/ls: Mach-O fat file with 2 architectures