tips
[Top] [All Lists]

[REALbasic Tip] Writing to the Mac OS X console for debugging purposes

To: "REALbasic Tips" <realbasic-tips at lists dot realsoftware dot com>
Subject: [REALbasic Tip] Writing to the Mac OS X console for debugging purposes
From: Geoff Perlman <geoff at realsoftware dot com>
Date: Mon, 01 Oct 2001 11:59:38 -0500
For debugging, it's sometimes very convenient to write messages to the
console; for instance, if you have a bug which which occurs only in a
compiled application, writing messages to the console can serve as a
substitute for the inability to step through the code of a compiled
application.

To do this, add the method listed below to a module or your Application
class (if you have one) then call the WriteDebugMessage method and pass it a message you wish to have displayed in the console. Note that messages are
limited to a length of 255 bytes and this is for Mac OS X only:

Sub WriteDebugMessage(msg as String)
   dim msgBlock as MemoryBlock
   Declare Sub DebugStr Lib "CarbonLib" (msg as Ptr)

   msgBlock = NewMemoryBlock(256)
   msgBlock.PString(0) = Left(msg, 255)
   DebugStr msgBlock
End Sub

Thanks to Charles Yeomans for providing this tip.
--

Geoff Perlman
President & CEO
REAL Software, Inc.
http://www.realsoftware.com
mailto:geoff at realsoftware dot com
Phone: 512-263-1233 x711
Fax:   512-263-1441


 - - - - - - - - - -
Got a useful tip to share? Send it to us at:
REALbasic-tips at lists dot realsoftware dot com dot
For list commands, send "Help" in the body of a message to
<requests at lists dot realsoftware dot com>


<Prev in Thread] Current Thread [Next in Thread>
  • [REALbasic Tip] Writing to the Mac OS X console for debugging purposes, Geoff Perlman <=