Talk:Debugging Exercises

Revision as of 09:34, 30 November 2015 by Hinerm (talk | contribs) (Response from Mark)

Exercise 8: Profiling

Used when we need information about performance

exercise: two methods, which takes more time to run?

  • open jvisualvm
  • run E8 program
  • double-click in jvisualvm
  • open “profile” tab
  • click “Settings”
  • change package to net.imagej.trouble.**
  • start profiling.

question box: which method took longer?

Exercise 9: Multiple threads

Even though no code changes, sometimes debugging affects code execution

exercise: debug once where breakpoint stops thread, once where it stops vm

  • Run E9 with no breakpoint. Note that it works fine
  • Now set a breakpoint in the “getName” method of either the Even or Odd LonelyRunnable
  • Set the breakpoints property to “Suspend thread”
  • Debug E9. After hitting the breakpoint, wait for a few seconds. Eventually you should see that a different thread is paused and “Expecting Exception”.
  • resume the threads and see the stack trace.
  • Now modify the breakpoint and tell it to suspend VM instead of just the thread
  • Debug again. When you hit a breakpoint, make sure you resume the VM and not just the thread.

Hinerm (talk)

Exercise 2 - Ellen's Questions

Sorry guys... can you just clarify the final part of this exercise? I get the point of expressions - just not necessarily how to implement them correctly and then go through the debugging process... I'm missing something here...

"To complete this exercise: 1. Write an expression that calls the size() method of our list. 2. Write a 2nd expression that evaluates to the value of the index variable"

For these two steps... wording is weird and confusing - so I'm not sure exactly what I need to do... (note: this could just be an Ellen-exclusive issue)

maybe another image - snapshot - would be helpful here?? something a bit more concrete - since this is really the point of this exercise - expressions...

Etarena (talk)

Exercise 3 - Ellen's Questions

Sorry - again... maybe because it is 'me'...

Can you give me a concrete conditional statement as an example in the conditional breakpoints example step 5???

As a first-first-first timer... I have no idea what to even write! Sorry. I know... stupid, but true.

Etarena (talk)

Response from Mark

I think my adding "any java conditional statement" is confusing.. and maybe it shouldn't be so vague? Before the instruction steps is a blurb "a breakpoint that stops in the loop when the everythingIsOK flag is set to false" which is the hint to what the condition should be. But it's probably not worth making the user deduce the statement.

Or at the least, we could have an expand/hide box that provides the conditional statement

Hinerm (talk)

Exercise 4 - Ellen's Questions

That's right! I've made it to #4... but not without some more 'simple' questions...

I have NO idea what to do with : --debugger=8000


That's right. In this case... even the link did not help me.


I'll finish this exercise at a later point then...

Response from Mark

So this command is intended to be run from the command line, to launch ImageJ from a terminal so you can add the "debugger" configuration flag.

I wonder if there is a general scheme that could be used to quickly and unambiguously convey this kind of instruction.. like.. green = do this in eclipse, red = do this on the command line, etc...?

Hinerm (talk)

Also should add a link to Troubleshooting#Launching_ImageJ_from_the_console

Hinerm (talk)

Exercise 5 - Ellen's Questions

Well - yup. It happened... I hit a wall for today.

And I have no idea what I'm doing to get this git bisect working... for whatever reason (again, probably Ellen-specific here) - I cannot get a list of any commits.


I'm done for today. Goodness Gracious!  :)