mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 17:28:07 +00:00
WIP subprogram conversion test
This commit is contained in:
+16
-5
@@ -130,11 +130,11 @@ typedef enum DW_LanguageEnum
|
|||||||
DW_Language_UserHi = 0xffff,
|
DW_Language_UserHi = 0xffff,
|
||||||
} DW_LanguageEnum;
|
} DW_LanguageEnum;
|
||||||
|
|
||||||
#define DW_Inl_XList \
|
#define DW_Inl_XList \
|
||||||
X(NotInlined, 0) \
|
X(NotInlined, 0x00) \
|
||||||
X(Inlined, 1) \
|
X(Inlined, 0x01) \
|
||||||
X(DeclaredNotInlined, 2) \
|
X(DeclaredNotInlined, 0x02) \
|
||||||
X(DeclaredInlined, 3)
|
X(DeclaredInlined, 0x03)
|
||||||
|
|
||||||
typedef U32 DW_InlKind;
|
typedef U32 DW_InlKind;
|
||||||
typedef enum DW_InlKindEnum
|
typedef enum DW_InlKindEnum
|
||||||
@@ -199,6 +199,17 @@ typedef enum DW_IDCaseKindEnum
|
|||||||
#undef X
|
#undef X
|
||||||
} DW_IDCaseKindEnum;
|
} DW_IDCaseKindEnum;
|
||||||
|
|
||||||
|
#define DW_Vis_XList \
|
||||||
|
X(Local, 0x01) \
|
||||||
|
X(Exported, 0x02) \
|
||||||
|
X(Qualified, 0x03)
|
||||||
|
typedef enum DW_Vis
|
||||||
|
{
|
||||||
|
#define X(_N, _ID) DW_Vis_##_N = _ID,
|
||||||
|
DW_Vis_XList
|
||||||
|
#undef X
|
||||||
|
} DW_Vis;
|
||||||
|
|
||||||
#define DW_TagKind_V3_XList \
|
#define DW_TagKind_V3_XList \
|
||||||
X(ArrayType, 0x01) \
|
X(ArrayType, 0x01) \
|
||||||
X(ClassType, 0x02) \
|
X(ClassType, 0x02) \
|
||||||
|
|||||||
@@ -320,6 +320,64 @@ T_BeginTest(d2r_checksums)
|
|||||||
}
|
}
|
||||||
T_EndTest;
|
T_EndTest;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
T_BeginTest(d2r_subprogram)
|
||||||
|
{
|
||||||
|
DW_Writer *writer = dw_writer_begin(DW_Format_32Bit, DW_Version_5, DW_CompUnitKind_Compile, Arch_x64);
|
||||||
|
|
||||||
|
U64 image_lo = 0x1400000;
|
||||||
|
U64 image_hi = 0x1500000;
|
||||||
|
U64 subprogram_lo = image_lo + 0x1000;
|
||||||
|
U64 subprogram_hi = subprogram_lo + 0x100;
|
||||||
|
U64 subprogram_entry_addr = subprogram_lo + 5;
|
||||||
|
String8 subprogram_link_name = str8_lit("@FOOBAR!");
|
||||||
|
String8 subprogram_name = str8_lit("foobar");
|
||||||
|
|
||||||
|
dw_writer_tag_begin(writer, DW_TagKind_CompileUnit);
|
||||||
|
dw_writer_push_attrib_string(writer, DW_AttribKind_Producer, str8_lit("RAD DWARF WRITER"));
|
||||||
|
dw_writer_push_attrib_address(writer, DW_AttribKind_LowPc, image_lo);
|
||||||
|
dw_writer_push_attrib_address(writer, DW_AttribKind_HighPc, image_hi);
|
||||||
|
dw_writer_tag_end(writer);
|
||||||
|
|
||||||
|
DW_WriterTag *subroutine_type = dw_writer_tag_begin(writer, DW_TagKind_SubroutineType);
|
||||||
|
dw_writer_push_attrib_enum(writer, DW_AttribKind_Accessibility, DW_AccessKind_Private);
|
||||||
|
dw_writer_push_attrib_uint(writer, DW_AttribKind_Alignment, 16);
|
||||||
|
|
||||||
|
dw_writer_tag_end(writer);
|
||||||
|
|
||||||
|
dw_writer_tag_begin(writer, DW_TagKind_SubProgram);
|
||||||
|
dw_writer_push_attrib_enum(writer, DW_AttribKind_Accessibility, DW_AccessKind_Private);
|
||||||
|
dw_writer_push_attrib_enum(writer, DW_AttribKind_AddressClass, DW_AddrClassKind_None);
|
||||||
|
dw_writer_push_attrib_uint(writer, DW_AttribKind_Alignment, 32);
|
||||||
|
dw_writer_push_attrib_flag(writer, DW_AttribKind_Artificial, 1);
|
||||||
|
dw_writer_push_attrib_enum(writer, DW_AttribKind_CallingConvention, DW_CallingConventionKind_Program);
|
||||||
|
dw_writer_push_attrib_flag(writer, DW_AttribKind_Deleted, 1);
|
||||||
|
dw_writer_push_attrib_address(writer, DW_AttribKind_EntryPc, subprogram_entry_addr);
|
||||||
|
dw_writer_push_attrib_flag(writer, DW_AttribKind_Explicit, 1);
|
||||||
|
dw_writer_push_attrib_flag(writer, DW_AttribKind_External, 1);
|
||||||
|
dw_writer_push_attrib_expressionv(writer, DW_AttribKind_FrameBase, DW_ExprEnc_Op(Reg7));
|
||||||
|
dw_writer_push_attrib_address(writer, DW_AttribKind_HighPc, subprogram_hi);
|
||||||
|
dw_writer_push_attrib_flag(writer, DW_AttribKind_Inline, DW_Inl_DeclaredNotInlined);
|
||||||
|
dw_writer_push_attrib_string(writer, DW_AttribKind_LinkageName, subprogram_link_name);
|
||||||
|
dw_writer_push_attrib_address(writer, DW_AttribKind_LowPc, subprogram_lo);
|
||||||
|
dw_writer_push_attrib_flag(writer, DW_AttribKind_MainSubProgram, 1);
|
||||||
|
dw_writer_push_attrib_string(writer, DW_AttribKind_Name, subprogram_name);
|
||||||
|
dw_writer_push_attrib_flag(writer, DW_AttribKind_NoReturn, 1);
|
||||||
|
// TODO: DW_AttribKind_ObjectPointer
|
||||||
|
dw_writer_push_attrib_flag(writer, DW_AttribKind_Prototyped, 1);
|
||||||
|
dw_writer_push_attrib_flag(writer, DW_AttribKind_Pure, 1);
|
||||||
|
// TODO: DW_AttribKind_Ranges
|
||||||
|
dw_writer_push_attrib_flag(writer, DW_AttribKind_Recursive, 1);
|
||||||
|
// TODO: DW_AttribKind_StartScope
|
||||||
|
dw_writer_push_attrib_ref(writer, DW_AttribKind_Type, subroutine_type);
|
||||||
|
dw_writer_push_attrib_enum(writer, DW_AttribKind_Visibility, DW_Vis_Local);
|
||||||
|
dw_writer_tag_end(writer);
|
||||||
|
|
||||||
|
dw_writer_end(&writer);
|
||||||
|
}
|
||||||
|
T_EndTest;
|
||||||
|
#endif
|
||||||
|
|
||||||
T_BeginTest(d2r_general)
|
T_BeginTest(d2r_general)
|
||||||
{
|
{
|
||||||
DW_Writer *writer = dw_writer_begin(DW_Format_32Bit, DW_Version_5, DW_CompUnitKind_Compile, Arch_x64);
|
DW_Writer *writer = dw_writer_begin(DW_Format_32Bit, DW_Version_5, DW_CompUnitKind_Compile, Arch_x64);
|
||||||
|
|||||||
Reference in New Issue
Block a user