MIDP: Debugging Basics
FORUM NOKIA
Version 1.0; Septembe 6, 2005
r 2
J
ava™
Forum.Nokia.com
Copyright © 2005 Nokia Corporation. All rights reserved.
Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation. Java and all Java-based
marks are trademarks or registered trademarks of Sun Microsystems, Inc. Other product and company names
mentioned herein may be trademarks or trade names of their respective owners.
Disclaimer
The information in this document is provided “as is,” with no warranties whatsoever, including any warranty of
merchantability, fitness for any particular purpose, or any warranty otherwise arising out of any proposal,
specification, or sample. Furthermore, information provided in this document is preliminary, and may be changed
substantially prior to final release. This document is provided for informational purposes only.
Nokia Corporation disclaims all liability, including liability for infringement of any proprietary rights, relating to
implementation of information presented in this document. Nokia Corporation does not warrant or represent
that such use will not infringe such rights.
Nokia Corporation retains the right to make changes to this specification at any time, without notice.
License
A license is hereby granted to download and print a copy of this specification for personal use only. No other
license to any other intellectual property rights is granted herein.
MIDP: Debugging Basics 2
Forum.Nokia.com
Contents
1 Introduction................................................................................................................................................ 5
2 Environment Construction ...................................................................................................................... 6
3 Debugging Process in Eclipse ................................................................................................................. 7
3.1 Breakpoint Setting...................................................................................................................................7
3.1.1 Conditional breakpoints ......................................................................................................8
3.1.2 Method breakpoints..............................................................................................................9
3.1.3 Exception breakpoints..........................................................................................................9
3.2 Debug Session ...........................................................................................................................................9
3.3 Execution Control ..................................................................................................................................10
3.4 Program State Investigation .............................................................................................................11
3.4.1 View field values .................................................................................................................11
3.4.2 Change variable values .....................................................................................................11
3.4.3 Evaluate expressions .........................................................................................................11
3.4.4 Stack follow up ....................................................................................................................13
3.4.5 View program output........................................................................................................13
4 Using Trace Options ................................................................................................................................14
5 Example Application ...............................................................................................................................15
6 Known Issues............................................................................................................................................16
7 References .................................................................................................................................................18
Appendix A HelloMIDlet class...................................................................................................................19
Appendix B TestForm class .......................................................................................................................20
Evaluate This Resource ..................................................................................................................................21
MIDP: Debugging Basics 3
Forum.Nokia.com
Change History
September 26, 2005 Version 1.0 This new document replaces the document Debugging Wireless
J2ME™/MIDP Applications: An Introduction.
MIDP: Debugging Basics 4
Forum.Nokia.com
1 Introduction
Programming requires a lot of logical reasoning and even senior level programmers may write
erroneous code. Nowadays nearly every IDE offers features for code debugging. With a debugger it is
effortless to detect and correct bugs from the code.
The scope of this document is to introduce how to debug CLDC-based J2ME™
applications by using
Eclipse IDE and Nokia SDKs. As a debugging exercise, the document also provides a simple example
application containing a few bugs.
MIDP: Debugging Basics 5