Finding the class represented by a Class instance

Keith McGuigan Keith.McGuigan at Sun.COM
Mon Aug 18 07:00:05 PDT 2008


David Holmes - Sun Microsystems wrote:
> Well it's in k of course! So my real problem is that I want to trace 
> Class object creation. But k->name()->as_C_string() crashes with a 
> SIGSEGV. So I made this conditional on Universe::is_fully_initialized(), 
> but it still crashes the first time I try to print the type name. It's 
> crashing inside as_C_string but I haven't determined exactly where.

There's a comment in klass.hpp which says that the _name field is only 
non-null for instance and array klasses.  Could it be that you're trying 
to print a non-instance or non-array klass?  Perhaps just check to see 
if k->name() is non-null before trying to print it?

--
- Keith



More information about the hotspot-dev mailing list