Reputation: 1137
I have a running Scala process and want to get the contents of a List in that process. I know the PID of the process and I know the name of the List[String], and I have taken a heap dump with VisualVM. Is there a way for me to find the actual contents of that specific list and save it somewhere?
Upvotes: 1
Views: 340
Reputation: 11244
If the List[String]
instance is referenced by a class (for example via a val
) than you can look for the class that holds it.
Note: the above steps are from the top of my head, so they might not be completely accurate. This should however give you a good sense of direction.
Good luck!
Upvotes: 4
Reputation: 26486
I'm sure in principle it is possible, but surely there's nothing simple or straightforward and off-the-shelf to allow you to do so.
I'd probably go with using the Java Platform Debugger Architecture (JPDA) and its Java Debugging Wire Protocol (JDWP) to get at the raw information you'd need. From there you can use Java and / or Scala reflection to discover what to query in the target JVM.
I don't know how much of this is applicable to heap dumps. In the old days, the C / Unix debugging tools could operate on either core dumps or active processes.
Upvotes: 2