improve hash table entry debug prints

This commit is contained in:
Zack Buhman 2024-12-30 09:42:26 -06:00
parent 867a10ac2b
commit 40ab3ddfd3
4 changed files with 13 additions and 3 deletions

View File

@ -7,7 +7,7 @@ CC ?= gcc
ARCH = -m32 ARCH = -m32
CFLAGS += -Wall -Werror -Wfatal-errors -Wno-error=unused-variable -fstack-protector -std=c2x -g CFLAGS += -Wall -Werror -Wfatal-errors -Wno-error=unused-variable -fstack-protector -std=c2x -g
CFLAGS += -DDEBUG CFLAGS += -DDEBUG
#CFLAGS += -DDEBUG_PRINT CFLAGS += -DDEBUG_PRINT
LDFLAGS = -lm LDFLAGS = -lm
OPT ?= -O0 OPT ?= -O0
DEPFLAGS = -MMD -MP DEPFLAGS = -MMD -MP

View File

@ -161,8 +161,8 @@ static void class_resolver_create_methods_hash_table(struct class_entry * class_
struct constant * descriptor_constant = &class_file->constant_pool[descriptor_index - 1]; struct constant * descriptor_constant = &class_file->constant_pool[descriptor_index - 1];
assert(descriptor_constant->tag == CONSTANT_Utf8); assert(descriptor_constant->tag == CONSTANT_Utf8);
debugf("hash table entry for method: "); debugf("hash table entry for method: ");
print_utf8_string(name_constant); debug_print__constant__method_name(name_constant, descriptor_constant);
debugf("\n"); debugc('\n');
hash_table_add2(methods_hash_table_length, hash_table_add2(methods_hash_table_length,
methods_hash_table, methods_hash_table,

View File

@ -30,3 +30,12 @@ void debug_print__method_info__method_name(struct class_entry * class_entry, str
assert(method_descriptor_constant->tag == CONSTANT_Utf8); assert(method_descriptor_constant->tag == CONSTANT_Utf8);
debug_print__constant__utf8_string(method_descriptor_constant); debug_print__constant__utf8_string(method_descriptor_constant);
} }
void debug_print__constant__method_name(struct constant * name_constant, struct constant * descriptor_constant)
{
assert(name_constant->tag == CONSTANT_Utf8);
debug_print__constant__utf8_string(name_constant);
debugc(' ');
assert(descriptor_constant->tag == CONSTANT_Utf8);
debug_print__constant__utf8_string(descriptor_constant);
}

View File

@ -6,3 +6,4 @@
void debug_print__constant__utf8_string(struct constant * constant); void debug_print__constant__utf8_string(struct constant * constant);
void debug_print__class_entry__class_name(struct class_entry * class_entry); void debug_print__class_entry__class_name(struct class_entry * class_entry);
void debug_print__method_info__method_name(struct class_entry * class_entry, struct method_info * method_info); void debug_print__method_info__method_name(struct class_entry * class_entry, struct method_info * method_info);
void debug_print__constant__method_name(struct constant * name_constant, struct constant * descriptor_constant);