Talk:Debugging Exercises

Revision as of 12:23, 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)

Response from Mark

There's a line that's like "any number of Java expressions".. before this there should be a robust description (and links, including examples) of precisely what java expressions **are**..

Hinerm (talk)

TODO: Emphasize the utility of Exception Breakpoints - that we don't need to know where the failure occurred

Hinerm (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)

Need clearer explanation of when and why to use hit count

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

nope. got it.

but i didn't get the same 'bad' commit as was indicated... mine said something like 'Johannes wants more maths...'