9

I'm attempting to use Eclipse to debug a JSP page. Have set breakpoints and would like to know the current value of a couple of variables, e.g. this one:

<c:set var="flows" value="${model.flows}" />

However, hovering over doesn't work so am attempting to use the Variables View, which looks like:

Variables View

Each one of these has a complex tree structure so finding what I need isn't obvious. Is there a quick way to expand all the nodes in the tree without lots of mouse clicking? Or search the whole tree?

Community
  • 1
  • 1
Steve Chambers
  • 37,270
  • 24
  • 156
  • 208
  • From what I remember from when I used eclipse, there is no expand all button when you are in the variable view. There is only a collapse all. – Zzyrk Jan 21 '14 at 14:14
  • 3
    I guess the eclipse developers have not implemented it yet because of cyclic dependencies between objects. How should an expand all work with cyclic dependencies? Where to stop? – René Link Jan 21 '14 at 14:14
  • @RenéLink That would be a good explanation as to why it is not implemented. – Zzyrk Jan 21 '14 at 14:15
  • 1
    I also found this in the eclipse wiki: http://wiki.eclipse.org/Expand_Selected_Variables_Button_in_Debug – René Link Jan 21 '14 at 14:16
  • @RenéLink Fair point but you'd think there might be a way, e.g. stop beyond a certain number of levels or after a certain number of repetitions... – Steve Chambers Jan 21 '14 at 14:16
  • @SteveChambers yes I agree. What you said is also what is proposed in the wiki entry I posted. Maybe there is more to consider. I have to think about it for a while. :) – René Link Jan 21 '14 at 14:18

1 Answers1

4

I fought with the same problem in eclipse. Without finding a short and easy solution I decided to overwrite the toString method for all of my objects. That gaves me the possibility to get a String representation with the most important data inside the Variables tab of the debug mode without step into the complex tree structure. Of course that solution has a high effort but if it is done once the troubleshooting is much easier.

nano_nano
  • 12,351
  • 8
  • 55
  • 83
  • 1
    You don't have to override the `toString` method just for debugging purposes. You can use a `Detail Formatter`. Just right click on a variable and choose `New Detail Formatter...`. – René Link Jan 21 '14 at 14:20
  • PS: A `Detail Formatter` is also useful for third party libraries when you can not override the `toString` method. – René Link Jan 21 '14 at 14:21
  • @René Link: Nice dont know that. Nevertheless I think to overwrite the toString method is always a good approach – nano_nano Jan 21 '14 at 14:22