I am writing a custom debugger for JVM using the JVMTI interface's APIs and i need to get the class name in which the method is declared, i get the method id of the method using error = (*jvmti)->GetMethodName(jvmti,frames[i].method,&methodName,NULL,NULL);
and i am trying to get the class name using error = (*jvmti)->GetMethodDeclaringClass(jvmti,frames[i].method,&declaring_class_ptr);
this returns the jclass reference in the declaring_class_ptr, my question is how to convert this to a string which gives the class name?
To get the class name you need to use GetClassSignature, something like:
char* name;
jvmti->GetClassSignature(class, &name, NULL);
trace(jvmti, "Class prepared: %s", fix_class_name(name));
jvmti->Deallocate((unsigned char*)name);