add some commented-out debug code to defineClass

When uncommented, this code will write each defined class to disk,
which allows one to examine e.g. dynamically-generated classes using
e.g. javap.
This commit is contained in:
Joel Dice 2011-04-08 18:46:43 -06:00
parent af9288f4ee
commit 60db8cc047

View File

@ -4287,12 +4287,25 @@ defineClass(Thread* t, object loader, const uint8_t* buffer, unsigned length)
PROTECT(t, loader);
object c = parseClass(t, loader, buffer, length);
// char name[byteArrayLength(t, className(t, c))];
// memcpy(name, &byteArrayBody(t, className(t, c), 0),
// byteArrayLength(t, className(t, c)));
// replace('/', '-', name);
if (c) {
PROTECT(t, c);
// const unsigned BufferSize = 1024;
// char path[BufferSize];
// snprintf(path, BufferSize, "/tmp/avian-define-class/%s.class", name);
saveLoadedClass(t, loader, c);
}
// FILE* file = fopen(path, "wb");
// if (file) {
// fwrite(buffer, length, 1, file);
// fclose(file);
// }
PROTECT(t, c);
saveLoadedClass(t, loader, c);
return c;
}