Re: gdb darwin target on Linux host?

Paul Starzetz
2010-10-20T15:45:32Z

On Wed, 2010-10-20 at 17:35 +0200, Peter Steiner wrote:
> > > file /home/exchange/ls
> > > /home/exchange/ls: Mach-O fat file with 2 architectures
> >
> > You can't debug fat binaries. You have to extract the executable you really want to debug.
> >
>
> tried this - no luck at all!
>
> lipo -extract x86_64 /bin/ls -output ls.64
> lipo -extract i386 /bin/ls -output ls.32

ok ok I see my error... I must use -thin:

lipo -thin x86_64 /bin/ls -output ls.64

now I can load it into native box gdb7.2:

gdb-7.2 root# ./gdb/gdb /opt/src/ls.64
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 "x86_64-apple-darwin10.0.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /opt/src/ls.64...(no debugging symbols
found)...done.

BUT: on a cross-gdb compiled on Linux host I get now another error
trying to read the "thinned" ls.64:

gdb-7.2/gdb
# /usr/local/gdb/bin/x86_64-apple-darwin-gdb /home/exchange/ls.64
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/>...
Reading symbols from /home/exchange/ls.64...I'm sorry, Dave, I can't do
that. Symbol format `mach-o-x86-64' unknown.
Setting up the environment for debugging gdb.

why is that? I compiled on native darwin and Linux from the same tarball
7.2.