Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tricks to Improve Your Brew Handset Debugging  : Page 3

There's more to the Brew Logger than DBGPRINTF. Learn how to interpret the various log messages and even do some debugging without the logger on handsets.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

On-Handset Brew Logging
On the handset, Brew has several debug modes that you can activate to provide additional insight as to what the Brew runtime is doing on your application's behalf. How you activate this differs from handset to handset, so you should check a specific handset's data sheet, but by default, try dialing ###273933284# (which you can remember as ###BREWDEBUG#) at the handset's idle screen. Once this is on, you can dial one of the following codes from the idle screen:
  • Dialing ###1# turns on additional heap debugging on the device, helping you find additional memory errors.
  • Dialing ###2# shows network status on the display during network activity.
  • Dialing ###3# shows the available heap on the device during application execution.
  • Dialing ###4# forces the handset to write each log message synchronously to the Brew Logger, instead of buffering messages.
  • Dialing ###6# dumps an annotated snapshot of the heap to the logger.
  • Dialing ###8# dumps an annotated snapshot of file cache to the logger.
  • Dialing ###10# closes the resource file cache, so that you can delete open resource files.
  • Dialing #### terminates debug mode.
The annotated snapshots (###4# and ###6#) dump information to the Logger, so it's important to be cabled to your PC. ###1# activates additional heap checking, so it will cause your application to run slower, but help you find memory errors. ###4# can be especially handy when debugging defects that crash your device, because often the handset will crash with log entries remaining in the handset's log buffer. Without synchronous debugging you can't see all the messages generated before the handset crashes. Turning on synchronous debugging greatly slows application execution, because the handset writes each log message to the Logger before continuing execution of the next statement.

The network monitoring mode, ###2#, shows socket and PPP status on a region of the display. The handset reports status via a single character, including:

  • ^: The PPP connection is opening.
  • =: The PPP connection is open.
  • v: The PPP connection is closing.
  • #: The PPP connection has closed.
  • ~: The PPP connection is asleep.
  • >: The PPP connection is awakened.
  • c: A socket is connecting.
  • C: A socket has connected.
  • I: A socket is idle.
  • b: A socket request is binding to a socket.
  • B: A socket request has bound to a socket.
  • R: An application is reading from a socket.
  • W: An application is writing to a socket.
  • r: An application is performing a recvfrom on a socket.
  • w: An application is performing a sendto on a socket.
  • x: A socket is closing.
  • X: A socket has closed.
The heap monitoring mode, ###3#, displays a snapshot of the available heap on the upper part of screen, so you can track how much memory is available. It updates periodically, so as your program runs you can get an idea of how much memory your application uses. Note that it reports free memory, not the largest block available. Thus, you might not be able to allocate a block as large as shown by the snapshot, because the heap may be fragmented.

Finally, you can exit this Brew Debug mode by entering ### at the idle screen.

Easier Than You Think
Debugging on the handset—especially without access to source-level debugging on the latest BREW 3.x handsets—has been likened to running hurdles in the dark while blindfolded. In truth, it's not that bad, especially when you can interpret the various Brew debug messages and enable Brew Debug mode on the handset.

Ray Rischpater is the chief architect at Rocket Mobile, Inc., specializing in the design and development of messaging and information access applications for today's wireless devices. Ray is the author of several books on software development including "eBay Application Development" and "Software Development for the QUALCOMM BREW Platform," both available from Apress, and is an active amateur radio operator.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date