+#define MC_DW_CLASS_UNKNOWN 0
+#define MC_DW_CLASS_ADDRESS 1 // Location in the address space of the program
+#define MC_DW_CLASS_BLOCK 2 // Arbitrary block of bytes
+#define MC_DW_CLASS_CONSTANT 3
+#define MC_DW_CLASS_STRING 3 // String
+#define MC_DW_CLASS_FLAG 4 // Boolean
+#define MC_DW_CLASS_REFERENCE 5 // Reference to another DIE
+#define MC_DW_CLASS_EXPRLOC 6 // DWARF expression/location description
+#define MC_DW_CLASS_LINEPTR 7
+#define MC_DW_CLASS_LOCLISTPTR 8
+#define MC_DW_CLASS_MACPTR 9
+#define MC_DW_CLASS_RANGELISTPTR 10
+
+static int MC_dwarf_form_get_class(int form) {
+ switch(form) {
+ case DW_FORM_addr:
+ return MC_DW_CLASS_ADDRESS;
+ case DW_FORM_block2:
+ case DW_FORM_block4:
+ case DW_FORM_block:
+ case DW_FORM_block1:
+ return MC_DW_CLASS_BLOCK;
+ case DW_FORM_data2:
+ case DW_FORM_data4:
+ case DW_FORM_data8:
+ case DW_FORM_udata:
+ case DW_FORM_sdata:
+ return MC_DW_CLASS_CONSTANT;
+ case DW_FORM_string:
+ case DW_FORM_strp:
+ return MC_DW_CLASS_STRING;
+ case DW_FORM_ref_addr:
+ case DW_FORM_ref1:
+ case DW_FORM_ref2:
+ case DW_FORM_ref4:
+ case DW_FORM_ref8:
+ case DW_FORM_ref_udata:
+ return MC_DW_CLASS_REFERENCE;
+ case DW_FORM_flag:
+ case DW_FORM_flag_present:
+ return MC_DW_CLASS_FLAG;
+ case DW_FORM_exprloc:
+ return MC_DW_CLASS_EXPRLOC;
+ // TODO sec offset
+ // TODO indirect
+ default:
+ return MC_DW_CLASS_UNKNOWN;
+ }
+}
+