Updated: 10/2/04; 11:45:26 AM.
cremes' blog
An online journal covering my experiences with I/OKit, CoreAudio and OpenDarwin.
        

Sunday, February 15, 2004

Wow, I love learning from other people's experience. I did a search on the coreaudio-api list for some similar keywords ("debug gdb") and found this post on using the graphical gdb for debugging a QT component.

Here's the shorthand version:

Go to your PB/XCode project window and find your Target list on the left-hand side.
Ctrl-click your Target and choose Add->"New Custom Executable" from the pop-up menu.
Set the executable to be the QuickTime Player (find it using the standard file dialogs).

Now you can do option-cmd-Y or Debug->"Debug Executable" to run the code witin the graphical version of gdb. Very nice.

2:51:47 PM    comment []



All of the programming I've done in the past 3 or 4 years has been inside the kernel. (See my other project.) Programming in the kernel is really tough because you can't take advantage of any kind of source-level debugger like gdb (unless you have a second machine and can debug over the network). Therefore, my knowledge and experience with debugging userland applications is nil.

I've made some reasonable progress in the last few hours, so I dropped the newly built QT component into /Library/QuickTime, fired up QuickTime Player and hit cmd-O to open up a new movie. I wanted to see if my component had registered correctly and I could open a FLAC audio file. CRASH! (Just QT Player, not the OS.)

So how do I debug this thing? Before asking for help from the wizards on the quicktime-api mailing list, I did a search of their archives looking for the words "debug breakpoint component" to see what others had done. I didn't get many helpful hints from the results with one exception... this message pointed me in the right direction for catching QT Player when it crashes. The 'bt' command for printing the backtrace is apparently now called "where" so I executed that command and found it crashing in doResolveComponentAlias(RegisteredComponent*, CMCombinedResRef*) with an EXC_BAD_ACCESS signal. Some memory allocation is probably fubar, so I'll take a peek and see what I can see.

Anyone have a good reference for gdb and how to use it?

2:12:43 PM    comment []



I found an important new link for people to take a peek at. On the Apple site they discuss movie import and export data exchange components which are a necessary evil when using QT. For QT to recognize a file, that file must already be a QT file or there must be a component registered with QT that knows how to recognize and translate that file format into the native QT format. The data exchange components take care of that function within QT. The aforementioned link is so important, it now has a place of honor on the left side navigation bar for quicker reference.

Back in the old OS9 days (and before), the component would register a type and creator code with QT. With OSX there is far less reliance on type/creator codes. The emphasis has shifted to filename extensions (like .txt for a text file, for example). The Ogg Vorbis component contains a Movie Importer (data exchange component) that registers the .ogg filename extension. This tells QT who to pass the file off to when opening it up. The Ogg Vorbis component translates the .ogg file into the desired QT format for playing. This conversion is done "in place" without overwriting the original file.

12:33:39 PM    comment []



© Copyright 2004 Chuck Remes.
 
February 2004
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29            
Jan   Mar


My Programming Project Home Pages:

Helpful Radio Links:

Click here to visit the Radio UserLand website.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.