Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page >

Troubleshooting

If you are convinced that your application falls into the category of those that should be able to run using Rosetta but it doesn’t run or it has unexpected behavior, you can follow the procedure in this section to debug your application. This procedure works only for PowerPC binaries—not for a universal binary—and is the only way you can debug a PowerPC binary on an Intel-based Macintosh. Xcode debugging does not work for translated applications.

To debug a PowerPC binary on an Intel-based Macintosh, follow these steps:

  1. Open Terminal.

  2. Enter the following two lines:

    For tcsh:

    setenv OAH_GDB YES
    /<path>/<your_application>.app/Contents/MacOS/<your_application>

    For bash:

    export OAH_GDB=YES
    /<path>/<your_application>.app/Contents/MacOS/<your_application>

    You’ll see the Rosetta process launch and wait for a port connection (Figure A-2).


    Figure A-2  Rosetta listens for a port connection

    Figure A-2 Rosetta listens for a port connection
  3. Open a second terminal window and start up GDB with the following command:

    gdb --oah

    Using GDB on an Intel-based Macintosh computer is just like using GDB on a PowerPC Macintosh.

  4. Attach your application.

    attach <your_application>
  5. Press Tab.

    GDB automatically appends the process ID (pid) to your application name.

  6. Press Return.

  7. Type c to execute your application.

    Important: Do not type run. Typing run will not execute your code. It will leave your application in a state that requires you to start over from the first step.

Figure A-3 shows the commands for initiating a debugging session for a PowerPC binary. After you start the session, you can debug in much the same way as you would debug a native process except that you can’t call functions—either explicitly or implicitly—from within GDB. For example, you can’t inspect CF objects by calling CFShow.

Keep in mind that symbol files aren’t loaded at the start of the debugging session. They are loaded after your application is up and running. This means that any breakpoints you set are “pending breakpoints” until the executable and libraries are loaded.


Figure A-3  Terminal windows with the commands for debugging a PowerPC binary on an Intel-based Macintosh computer

Figure A-3 Terminal windows with the commands for debugging a PowerPC binary on an Intel-based Macintosh computer

Note: Debugging Rosetta applications from within either CodeWarrior or Xcode is not supported.



< Previous PageNext Page >


Last updated: 2006-07-24




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2006 Apple Computer, Inc.
All rights reserved. | Terms of use | Privacy Notice