Re: How to configure gdb to support '--arch=i386' on Mac OS X

Michael Snyder
2009-10-07T21:07:13Z

Yeahhhh, this isn't going to work.

Your binary is in... I forget what it's called -- oh, "mach-o" format.
Our (fsf) gdb does not know how to read that file format. And it
would be a huge job to port over the changes in apple gdb that tell
it how to read mach-o files (besides the fact that they are "fat"
files, or at least potentially might be).

Sorry, I think you're out of luck.

n179911 wrote:
> I tried Joel Brobecker suggested in adding that option in gdb/main.c.
>
> But my program still won't come up in my debugger.
>
> [Session started at 2009-10-07 13:27:16 -0700.]
> GNU gdb (GDB) 7.0
> Copyright (C) 2009 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 "i386-apple-darwin9.7.0".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> Loading program into debuggerÂ…
> No symbol table is loaded. Use the "file" command.
> No symbol table is loaded. Use the "file" command.
> No symbol table is loaded. Use the "file" command.
> No symbol table is loaded. Use the "file" command.
> Program loaded.
> tty /dev/ttys008
> (gdb) run
> =thread-group-created,id="81191"
> =thread-created,id="1",group-id="81191"
>
>
>
> On Wed, Oct 7, 2009 at 1:10 PM, n179911 <n179911@gmail.com> wrote:
>> Thank you. You are right.
>>
>> The gdb comes with apple has '-arch' option, but gdb 7.0 does not.
>>
>> $ /usr/bin/gdb --help
>> --translate Debug applications running under translation.
>> -arch i386|armv6|x86_64|ppc Specify a gdb targetting a specific
>> architecture
>>
>> So should I do what Joel Brobecker suggested in adding that option in
>> gdb/main.c?
>>
>> Thank you.
>>
>>
>> On Wed, Oct 7, 2009 at 11:31 AM, Michael Snyder <msnyder@vmware.com> wrote:
>>> n179911 wrote:
>>>> Hi,
>>>>
>>>> I have compiled gdb 7.0 on Mac OS X. And I have configured XCode to
>>>> use this new version of gdb 7.0.
>>>>
>>>> But when I start debug my XCode project it said gdb can't recognize
>>>> the option '--arch=i386'. Here is the log of my error:
>>>>
>>>> [Session started at 2009-10-07 11:00:43 -0700.]
>>>> /Users/n179911/bin/gdb/bin/gdb: unrecognized option `--arch=i386'
>>>> Use `/Users/n179911/bin/gdb/bin/gdb --help' for a complete list of
>>>> options.
>>>>
>>>> The Debugger has exited with status 1.The Debugger has exited with status
>>>>
>>>> Can you please tell me how to build gdb to support '--arch-i386' option?
>>> I don't think this has ever been a command line option in fsf gdb.
>>> Maybe it is one that was added to Apple's version of gdb.
>>>
>>> Try running `/Users/n179911/bin/gdb/bin/gdb --help', and
>>> then run the same command using your installed gdb that came
>>> with Mac OS. My guess is that the Mac version will list
>>> "--arch" among the command line options, but the fsf version
>>> will not (mine doesn't).
>>>
>>>