On 7 May 2005, at 23:23, James Milne wrote:
We can't debug plugins written in Xcode yet, AFAIK. I've just
installed all the latest Xcode 2.0 tools on my Powerbook, so I'm
going to see if the latest GDB can handle the Mach-O binaries
REALbasic generates.
I can now confirm that plugins written in Xcode can be debugged in
the Xcode IDE! :-) The latest GDB is happy with the Mach-O binaries
that REALbasic 5.5.x produces (I'm testing with 5.5.4).
Here are the steps to plugin debugging:
1) Grab the latest Plugin SDK, and install the Xcode REALbasic Plugin
template.
2) Create a new project in Xcode using the REALbasic Plugin template
3) Implement your plugin
4) Write a little command line program in REALbasic that
automatically builds your .dylib into a plugin RBX file. Execute this
tool from Xcode by adding it as a Shell Script Build Phase to your
target.
5) Build your plugin
6) Install your plugin in REALbasic Plugins folder.
7) Create a little shell project which runs uses your plugin, and
build it as a Mach-O executable.
8) Go back to Xcode, and add a New Custom Executable to your project.
In the dialog that appears, select the test app you compiled with
REALbasic as the executable.
9) Double click on this new executable to bring up its properties
window. Go to the Debugging tab, and __uncheck__ "Start executable
after starting debugger"
10) To debug your plugin, simply go to the Debug menu and select
Debug Executable. This should fire up your test app that you wrote
with REALbasic. In the Debugger window, click on Console. A GDB
console window will appear. To set some breakpoints, type "break
<name of function>" into the console. Once you have set some
breakpoints, type "run", and your test application will start up.
When GDB sees your plugin dylib being loaded, it will resolve any
breakpoints you set before you asked GDB to run the app. If GDB hits
any of these breakpoints, it will enter back into the Xcode debugger,
where you can see the source of the code the debugger has stopped at,
and you can single-step through the code, read local variables, etc.
Note that you can't debug an application from both Xcode and
REALbasic at the same time with this method. However, this is also
theoretically possible. Rather than typing "run" after you have set
your breakpoints, go into REALbasic, and tell it to run your RB
project. The RB app will start up. Go into the Terminal application,
and type "ps -ax" to get a list of all running processes.
Alternatively, use the Activity Viewer application. Find the
'pid' (Process ID) of the debug app REALbasic created and has started
up. Go back into Xcode, and in the GDB console, type 'attach <pid>',
where PID is the process ID of the debug app REALbasic created. Xcode
should attempt to attach to this process, and in the process of
attaching it should resolve any breakpoints related to your plugin.
You should then be able to step through your REALbasic code and your
plugin code at the same time.
However, I have yet to get attaching to a running process to work.
GDB attaches to the process, and successfully resolves the addresses
of the breakpoints, but the running process seems to have after
you've attached to it. I wonder if it's because REALbasic and GDB are
feuding over who gets to debug the process. I'll experiment further,
though.
Mac OS X 10.4 really is the bomb for developers.
--
James Milne
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|