[program-java] Re: Eclipse: Debugging Part II

  • From: "Stanzel, Susan - Kansas City, MO" <susan.stanzel@xxxxxxxxxxxx>
  • To: "program-java@xxxxxxxxxxxxx" <program-java@xxxxxxxxxxxxx>
  • Date: Thu, 17 Jun 2010 14:36:44 -0500

I just looked and now I remember. It was about how to put a break point in a 
program. It talked about HelloWorld. 

I should have thanked you at the time, especially knowing blood was flowing all 
over your keyboard (grin).

Susie Stanzel

-----Original Message-----
From: program-java-bounce@xxxxxxxxxxxxx 
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Corbett, James
Sent: Thursday, June 17, 2010 2:28 PM
To: 'program-java@xxxxxxxxxxxxx'
Subject: [program-java] Re: Eclipse: Debugging Part II

"Eclipse: Debugging Part I" was the subject tag.

J.


-----Original Message-----
From: program-java-bounce@xxxxxxxxxxxxx 
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Stanzel, Susan - Kansas 
City, MO
Sent: June 17, 2010 15:27
To: program-java@xxxxxxxxxxxxx
Subject: [program-java] Re: Eclipse: Debugging Part II

I probably already filed it. What was the subject?

Susie

-----Original Message-----
From: program-java-bounce@xxxxxxxxxxxxx 
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Corbett, James
Sent: Thursday, June 17, 2010 2:26 PM
To: 'program-java@xxxxxxxxxxxxx'
Subject: [program-java] Re: Eclipse: Debugging Part II

...about a month ago, I can resend it if you would like.

J.


-----Original Message-----
From: program-java-bounce@xxxxxxxxxxxxx 
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Stanzel, Susan - Kansas 
City, MO
Sent: June 17, 2010 15:10
To: program-java@xxxxxxxxxxxxx
Subject: [program-java] Re: Eclipse: Debugging Part II

Please, please don't stop with these. I just read part two and have kept the 
instructions. They make perfect sense. When did you send the first part?



Susie Stanzel



From: program-java-bounce@xxxxxxxxxxxxx 
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Corbett, James
Sent: Wednesday, June 16, 2010 3:39 PM
To: 'program-java@xxxxxxxxxxxxx'
Subject: [program-java] Eclipse: Debugging Part II



The last time I wrote  about  breaking a program at a specific line of 
execution. Remember that there can be more than a single break point in your 
application and via other tools on the market, it is possible to debug with in 
other processes.



So now that we have broken the execution, where do we go from here?...as 
previously mentioned we can inspect / interrogate other members that are in 
scope. Usually "In Scope" applies to members that have public visibility to a 
class e.g.



Private String myString;



myString can be seen through out the life cycle of a class. Members of a method 
on the other hand only have scope while with in their method and depending upon 
where the line of suspension is, they may or may not have been initialized.



An easy mistake to fall into is to inspect a member that was set to null as 
part of its initialization. E.g.



RecordSet rs = null;



If this member is inspected prior to it being used, it will return a value of 
null therefore confusing you at times.



So, what is "Inspection" and how do I use it. If you bring your cursor to a 
member such as rs in the above example and then pressing CTRL + SHIFT + I will 
bring you to the Inspection View / Window. ...by default you are placed on a 
tree view and there will usually be a single parent node on the tree. Pressing 
the down arrow once will identify the member you have selected and usually will 
announce some meaningful data.... One thing to note is that if you press the 
TAB key once to view the content of the member, you will need to use the key 
combination TAB + CTRL + SHIFT in order to bring your focus back to the tree 
view.



Members of primitive data types will display differing bits of information and 
that is also confusing. Strings on the other hand are not primitive and are 
objects so they will display other information such as the size of the member 
if hydrated.



Another extremely powerful view is the Variable View / Window. If you have 
halted the application you can view the values of members that are with in the 
scope of a class.... ALT + W + V + V while in the Debug Perspective and then 
press the enter key. A Tree view will be displayed and depending upon how many 
objects / members you have instantiated you could have a large number of parent 
nodes. Each node then can have a one to many relationship and therefore each of 
these children can have a one to many relationship. It can be overwhelming but 
with a little bit of practice the navigation becomes rather straight forward. 
The Variables view navigates in the same manner as the Inspection Window so 
there is no additional key strokes to use. I set a number of options on my 
project and so far I haven't been able to isolate which option has the spill 
over affect but I can close many of these views with a single press of the ESC 
key. If anyone has determined the option that causes this affect I would be 
happy to know.



One thing to note is that either an array / collection or Hash Map are quite 
cumbersome to navigate, for example you may have an array that is:



Double [12][31] by default you could have as many as 372 elements for 
inspection.



When I'm debugging an application, I generally stay away from multiple Break 
Points" due to my limited brain capacity. However I no for sure that there are 
some of you that insist on having multiple halts in your debugging, but how do 
you keep track of them. Well Eclipse does offer a means. Using the key 
combination: ALT + W + V + B will display a view with a list of Break Points" 
if any. Simply scroll the list and press enter to locate the area of interest.



So next time I'm planning to write about other ways of debugging in Part III.



Jim







James M. Corbett



Programmer / Analyst |

Canada Revenue Agency | Agence du revenue du Canada

875 Heron Rd.

Ottawa, On.

K1A0L5



James.Corbett@xxxxxxxxxxxxx

Telephone | Téléphone: (613) 941-1338

Facsimile | Télécopieur: (613) 941-2261



Government of Canada | Gouvernement du Canada









Other related posts: