TweetFollow Us on Twitter

Apr 97 Tips

Volume Number: 13 (1997)
Issue Number: 4
Column Tag: Tips & Tidbits

Tips & Tidbits

By Steve Sisak

Debugging 68K Code Resources with MacsBug

I'm using a CDEF as an example here, but this technique can be quite useful in many situations.

I recently had the pleasure of writing a tiny application for an old client. There was actually more code in the custom CDEF than the app itself. Once it was all polished and "bug free" I took it to the client's site for a demo. Naturally, it crashed immediately on launch. Everything froze up and I had to do a hard reset. I strongly suspected my CDEF was the problem. Normally, I would put a DebugStr in the CDEF, recompile, and use MacsBug to find the problem. But this was a 4MB LCII. There was no chance of installing CodeWarrior and rebuilding the CDEF. However, the computer did have an old copy of ResEdit. The following is what I did.

1) I opened my application in ResEdit and used the GetInfo dialog to make my CDEF preloaded and locked. I then saved the file and quit ResEdit.

2) In MacsBug, I set an A-trap break on InitGraf.

atb _InitGraf

3) I launched my app. Since initializing QuickDraw is one of the first things my program does, my A-trap break fired and I dropped into MacsBug.

4) The MacOS automatically loads preloaded resources when the resource file is open, so I found my CDEF in memory and set a breakpoint. To find the resource, I typed "hd RS" (list all resources in the current heap).

The screen looked something like this

hd RS

Displaying the "Quick Launch" heap at 00192830

Start Length Tag Mstr Ptr Lock Prg Type ID

00194890 00000544 R 00192A00 L CODE 0001

00196872 00000A44 R 00192A04 L CDEF 0080

etc...

5) Since my CDEF was already loaded in memory, and locked down, I set a breakpoint at the beginning of the CDEF.

br 00196872

I then typed command-g to continue. My breakpoint was soon hit and the bug identified. I fixed the problem the next day and got paid. This technique can be used to set a breakpoint at the beginning of nearly any code resource.

Damon Cokenias
http://www.netgate.net/~cokenias

In the MacTech 13.02 (February 1997) we printed a tip from Bill Hayden that System 7.5.3 made it possible to navigate the Standard File dialog box by clicking items visible on the desktop. Since then, a number of readers have written to report they could not reproduce this behavior.

After trying a variety of system software releases, we have not found a publicly released version of the system exhibiting this behavior, although one reader has reported reproducing it on a version of System 7.5.3 release 2 but not 7.5.5.

We offer two possible explanations for the source of the tip. First is a freeware utility called "Click, there it is!", by Richard Cardona Utilities Group (now in version 1.0.7), which enables the behavior described in the tip. A second possible explanation is that the reported functionality may have been enabled in a developer release of system software, but removed from the final, public release.

In any case, we apologize for the error and thank everyone who took the time to report it, as well as those who have taken the time to submit tips - please keep them coming.

Best wishes,

--Steve

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Combo Quest (Games)
Combo Quest 1.0 Device: iOS Universal Category: Games Price: $.99, Version: 1.0 (iTunes) Description: Combo Quest is an epic, time tap role-playing adventure. In this unique masterpiece, you are a knight on a heroic quest to retrieve... | Read more »
Hero Emblems (Games)
Hero Emblems 1.0 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: ** 25% OFF for a limited time to celebrate the release ** ** Note for iPhone 6 user: If it doesn't run fullscreen on your device... | Read more »
Puzzle Blitz (Games)
Puzzle Blitz 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: Puzzle Blitz is a frantic puzzle solving race against the clock! Solve as many puzzles as you can, before time runs out! You have... | Read more »
Sky Patrol (Games)
Sky Patrol 1.0.1 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0.1 (iTunes) Description: 'Strategic Twist On The Classic Shooter Genre' - Indie Game Mag... | Read more »
The Princess Bride - The Official Game...
The Princess Bride - The Official Game 1.1 Device: iOS Universal Category: Games Price: $3.99, Version: 1.1 (iTunes) Description: An epic game based on the beloved classic movie? Inconceivable! Play the world of The Princess Bride... | Read more »
Frozen Synapse (Games)
Frozen Synapse 1.0 Device: iOS iPhone Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: Frozen Synapse is a multi-award-winning tactical game. (Full cross-play with desktop and tablet versions) 9/10 Edge 9/10 Eurogamer... | Read more »
Space Marshals (Games)
Space Marshals 1.0.1 Device: iOS Universal Category: Games Price: $4.99, Version: 1.0.1 (iTunes) Description: ### IMPORTANT ### Please note that iPhone 4 is not supported. Space Marshals is a Sci-fi Wild West adventure taking place... | Read more »
Battle Slimes (Games)
Battle Slimes 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: BATTLE SLIMES is a fun local multiplayer game. Control speedy & bouncy slime blobs as you compete with friends and family.... | Read more »
Spectrum - 3D Avenue (Games)
Spectrum - 3D Avenue 1.0 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: "Spectrum is a pretty cool take on twitchy/reaction-based gameplay with enough complexity and style to stand out from the... | Read more »
Drop Wizard (Games)
Drop Wizard 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: Bring back the joy of arcade games! Drop Wizard is an action arcade game where you play as Teo, a wizard on a quest to save his... | Read more »

Price Scanner via MacPrices.net

Apple’s M4 Mac minis on sale for record-low p...
B&H Photo has M4 and M4 Pro Mac minis in stock and on sale right now for up to $150 off Apple’s MSRP, each including free 1-2 day shipping to most US addresses. Prices start at only $469: – M4... Read more
Deal Alert! Mac Studio with M4 Max CPU on sal...
B&H Photo has the standard-configuration Mac Studio model with Apple’s M4 Max CPU in stock today and on sale for $300 off MSRP, now $1699 (10-Core CPU and 32GB RAM/512GB SSD). B&H also... Read more

Jobs Board

All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.