frontend: disassemble: implement dumping ident, atom, and null constpool values

This commit is contained in:
2025-05-15 12:10:58 +01:00
parent a76525e11f
commit 49d21de894

View File

@@ -12,6 +12,7 @@
#include <ivy/asm/parse.h>
#include <ivy/asm/reader.h>
#include <ivy/file.h>
#include <ivy/ident.h>
#include <ivy/selector.h>
#include <stdio.h>
#include <stdlib.h>
@@ -229,6 +230,18 @@ static enum ivy_status dump_constpool(struct ivy_asm_reader *object)
printf("selector %s", s);
break;
}
case IVY_ASM_CONSTPOOL_TYPE_IDENT: {
char s[256];
ivy_ident_to_string(v->v_ident, s, sizeof s);
printf("ident %s", s);
break;
}
case IVY_ASM_CONSTPOOL_TYPE_NONE:
printf("<null>");
break;
case IVY_ASM_CONSTPOOL_TYPE_ATOM:
printf("atom $%s", v->v_str);
break;
default:
printf("<unknown>");
break;
@@ -553,7 +566,8 @@ B_COMMAND(CMD_DISASSEMBLE, CMD_ROOT)
B_OPTION_SHORT_NAME('p');
B_OPTION_LONG_NAME("pool-data");
B_OPTION_DESC(
"print the constant pool data in the object file.");
"print the constant pool data in the object "
"file.");
}
B_COMMAND_HELP_OPTION();