mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-30 19:10:01 +00:00
rdi: first pass of eliminating remainder of non-top-level sections; simplification/cleanup of rdi parsing layer
This commit is contained in:
@@ -10,6 +10,88 @@
|
||||
#ifndef RDI_FORMAT_C
|
||||
#define RDI_FORMAT_C
|
||||
|
||||
RDI_U16 rdi_section_element_size_table[37] =
|
||||
{
|
||||
sizeof(RDI_U8),
|
||||
sizeof(RDI_TopLevelInfo),
|
||||
sizeof(RDI_U8),
|
||||
sizeof(RDI_U32),
|
||||
sizeof(RDI_U32),
|
||||
sizeof(RDI_BinarySection),
|
||||
sizeof(RDI_FilePathNode),
|
||||
sizeof(RDI_SourceFile),
|
||||
sizeof(RDI_LineTable),
|
||||
sizeof(RDI_U64),
|
||||
sizeof(RDI_Line),
|
||||
sizeof(RDI_Column),
|
||||
sizeof(RDI_SourceLineMap),
|
||||
sizeof(RDI_U32),
|
||||
sizeof(RDI_U32),
|
||||
sizeof(RDI_U64),
|
||||
sizeof(RDI_Unit),
|
||||
sizeof(RDI_VMapEntry),
|
||||
sizeof(RDI_TypeNode),
|
||||
sizeof(RDI_UDT),
|
||||
sizeof(RDI_Member),
|
||||
sizeof(RDI_EnumMember),
|
||||
sizeof(RDI_GlobalVariable),
|
||||
sizeof(RDI_VMapEntry),
|
||||
sizeof(RDI_ThreadVariable),
|
||||
sizeof(RDI_Procedure),
|
||||
sizeof(RDI_Scope),
|
||||
sizeof(RDI_U64),
|
||||
sizeof(RDI_VMapEntry),
|
||||
sizeof(RDI_InlineSite),
|
||||
sizeof(RDI_Local),
|
||||
sizeof(RDI_LocationBlock),
|
||||
sizeof(RDI_U8),
|
||||
sizeof(RDI_NameMap),
|
||||
sizeof(RDI_NameMapBucket),
|
||||
sizeof(RDI_NameMapNode),
|
||||
sizeof(RDI_U8),
|
||||
};
|
||||
|
||||
RDI_U8 rdi_section_is_required_table[37] =
|
||||
{
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
RDI_U8 rdi_eval_op_ctrlbits_table[45] =
|
||||
{
|
||||
RDI_EVAL_CTRLBITS(0, 0, 0),
|
||||
|
||||
+219
-102
@@ -40,65 +40,71 @@ typedef int32_t RDI_S32;
|
||||
typedef int64_t RDI_S64;
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//~ Overridable Enabling/Disabling Of Table Index Typechecking
|
||||
|
||||
#if !defined(RDI_DISABLE_TABLE_INDEX_TYPECHECKING)
|
||||
# define RDI_DISABLE_TABLE_INDEX_TYPECHECKING 0
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//~ Format Constants
|
||||
|
||||
// \"raddbg\0\0\"
|
||||
#define RDI_MAGIC_CONSTANT 0x0000676264646172
|
||||
#define RDI_ENCODING_VERSION 3
|
||||
#define RDI_ENCODING_VERSION 4
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//~ Format Types & Functions
|
||||
|
||||
typedef RDI_U32 RDI_DataSectionTag;
|
||||
typedef enum RDI_DataSectionTagEnum
|
||||
typedef RDI_U32 RDI_SectionKind;
|
||||
typedef enum RDI_SectionKindEnum
|
||||
{
|
||||
RDI_DataSectionTag_NULL = 0x0000,
|
||||
RDI_DataSectionTag_TopLevelInfo = 0x0001,
|
||||
RDI_DataSectionTag_StringData = 0x0002,
|
||||
RDI_DataSectionTag_StringTable = 0x0003,
|
||||
RDI_DataSectionTag_IndexRuns = 0x0004,
|
||||
RDI_DataSectionTag_BinarySections = 0x0005,
|
||||
RDI_DataSectionTag_FilePathNodes = 0x0006,
|
||||
RDI_DataSectionTag_SourceFiles = 0x0007,
|
||||
RDI_DataSectionTag_LineTables = 0x0008,
|
||||
RDI_DataSectionTag_LineInfoVoffs = 0x0009,
|
||||
RDI_DataSectionTag_LineInfoLines = 0x000A,
|
||||
RDI_DataSectionTag_LineInfoColumns = 0x000B,
|
||||
RDI_DataSectionTag_SourceLineMaps = 0x000C,
|
||||
RDI_DataSectionTag_SourceLineMapNumbers = 0x000D,
|
||||
RDI_DataSectionTag_SourceLineMapRanges = 0x000E,
|
||||
RDI_DataSectionTag_SourceLineMapVOffs = 0x000F,
|
||||
RDI_DataSectionTag_Units = 0x0010,
|
||||
RDI_DataSectionTag_UnitVmap = 0x0011,
|
||||
RDI_DataSectionTag_TypeNodes = 0x0012,
|
||||
RDI_DataSectionTag_UDTs = 0x0013,
|
||||
RDI_DataSectionTag_Members = 0x0014,
|
||||
RDI_DataSectionTag_EnumMembers = 0x0015,
|
||||
RDI_DataSectionTag_GlobalVariables = 0x0016,
|
||||
RDI_DataSectionTag_GlobalVmap = 0x0017,
|
||||
RDI_DataSectionTag_ThreadVariables = 0x0018,
|
||||
RDI_DataSectionTag_Procedures = 0x0019,
|
||||
RDI_DataSectionTag_Scopes = 0x001A,
|
||||
RDI_DataSectionTag_ScopeVoffData = 0x001B,
|
||||
RDI_DataSectionTag_ScopeVmap = 0x001C,
|
||||
RDI_DataSectionTag_InlineSites = 0x001D,
|
||||
RDI_DataSectionTag_Locals = 0x001E,
|
||||
RDI_DataSectionTag_LocationBlocks = 0x001F,
|
||||
RDI_DataSectionTag_LocationData = 0x0020,
|
||||
RDI_DataSectionTag_NameMaps = 0x0021,
|
||||
RDI_DataSectionTag_PRIMARY_COUNT = 0x0022,
|
||||
RDI_DataSectionTag_SECONDARY = 0x80000000,
|
||||
RDI_DataSectionTag_NameMapBuckets = RDI_DataSectionTag_SECONDARY|0x0001,
|
||||
RDI_DataSectionTag_NameMapNodes = RDI_DataSectionTag_SECONDARY|0x0002,
|
||||
} RDI_DataSectionTagEnum;
|
||||
RDI_SectionKind_NULL = 0x0000,
|
||||
RDI_SectionKind_TopLevelInfo = 0x0001,
|
||||
RDI_SectionKind_StringData = 0x0002,
|
||||
RDI_SectionKind_StringTable = 0x0003,
|
||||
RDI_SectionKind_IndexRuns = 0x0004,
|
||||
RDI_SectionKind_BinarySections = 0x0005,
|
||||
RDI_SectionKind_FilePathNodes = 0x0006,
|
||||
RDI_SectionKind_SourceFiles = 0x0007,
|
||||
RDI_SectionKind_LineTables = 0x0008,
|
||||
RDI_SectionKind_LineInfoVOffs = 0x0009,
|
||||
RDI_SectionKind_LineInfoLines = 0x000A,
|
||||
RDI_SectionKind_LineInfoColumns = 0x000B,
|
||||
RDI_SectionKind_SourceLineMaps = 0x000C,
|
||||
RDI_SectionKind_SourceLineMapNumbers = 0x000D,
|
||||
RDI_SectionKind_SourceLineMapRanges = 0x000E,
|
||||
RDI_SectionKind_SourceLineMapVOffs = 0x000F,
|
||||
RDI_SectionKind_Units = 0x0010,
|
||||
RDI_SectionKind_UnitVMap = 0x0011,
|
||||
RDI_SectionKind_TypeNodes = 0x0012,
|
||||
RDI_SectionKind_UDTs = 0x0013,
|
||||
RDI_SectionKind_Members = 0x0014,
|
||||
RDI_SectionKind_EnumMembers = 0x0015,
|
||||
RDI_SectionKind_GlobalVariables = 0x0016,
|
||||
RDI_SectionKind_GlobalVMap = 0x0017,
|
||||
RDI_SectionKind_ThreadVariables = 0x0018,
|
||||
RDI_SectionKind_Procedures = 0x0019,
|
||||
RDI_SectionKind_Scopes = 0x001A,
|
||||
RDI_SectionKind_ScopeVOffData = 0x001B,
|
||||
RDI_SectionKind_ScopeVMap = 0x001C,
|
||||
RDI_SectionKind_InlineSites = 0x001D,
|
||||
RDI_SectionKind_Locals = 0x001E,
|
||||
RDI_SectionKind_LocationBlocks = 0x001F,
|
||||
RDI_SectionKind_LocationData = 0x0020,
|
||||
RDI_SectionKind_NameMaps = 0x0021,
|
||||
RDI_SectionKind_NameMapBuckets = 0x0022,
|
||||
RDI_SectionKind_NameMapNodes = 0x0023,
|
||||
RDI_SectionKind_COUNT = 0x0024,
|
||||
} RDI_SectionKindEnum;
|
||||
|
||||
typedef RDI_U32 RDI_DataSectionEncoding;
|
||||
typedef enum RDI_DataSectionEncodingEnum
|
||||
typedef RDI_U32 RDI_SectionEncoding;
|
||||
typedef enum RDI_SectionEncodingEnum
|
||||
{
|
||||
RDI_DataSectionEncoding_Unpacked = 0,
|
||||
RDI_DataSectionEncoding_LZB = 1,
|
||||
} RDI_DataSectionEncodingEnum;
|
||||
RDI_SectionEncoding_Unpacked = 0,
|
||||
RDI_SectionEncoding_LZB = 1,
|
||||
} RDI_SectionEncodingEnum;
|
||||
|
||||
typedef RDI_U32 RDI_Arch;
|
||||
typedef enum RDI_ArchEnum
|
||||
@@ -494,53 +500,51 @@ X(RDI_U32, encoding_version)\
|
||||
X(RDI_U32, data_section_off)\
|
||||
X(RDI_U32, data_section_count)\
|
||||
|
||||
#define RDI_DataSectionTag_XList \
|
||||
X(NULL)\
|
||||
X(TopLevelInfo)\
|
||||
X(StringData)\
|
||||
X(StringTable)\
|
||||
X(IndexRuns)\
|
||||
X(BinarySections)\
|
||||
X(FilePathNodes)\
|
||||
X(SourceFiles)\
|
||||
X(LineTables)\
|
||||
X(LineInfoVoffs)\
|
||||
X(LineInfoLines)\
|
||||
X(LineInfoColumns)\
|
||||
X(SourceLineMaps)\
|
||||
X(SourceLineMapNumbers)\
|
||||
X(SourceLineMapRanges)\
|
||||
X(SourceLineMapVOffs)\
|
||||
X(Units)\
|
||||
X(UnitVmap)\
|
||||
X(TypeNodes)\
|
||||
X(UDTs)\
|
||||
X(Members)\
|
||||
X(EnumMembers)\
|
||||
X(GlobalVariables)\
|
||||
X(GlobalVmap)\
|
||||
X(ThreadVariables)\
|
||||
X(Procedures)\
|
||||
X(Scopes)\
|
||||
X(ScopeVoffData)\
|
||||
X(ScopeVmap)\
|
||||
X(InlineSites)\
|
||||
X(Locals)\
|
||||
X(LocationBlocks)\
|
||||
X(LocationData)\
|
||||
X(NameMaps)\
|
||||
X(PRIMARY_COUNT)\
|
||||
X(SECONDARY)\
|
||||
X(NameMapBuckets)\
|
||||
X(NameMapNodes)\
|
||||
#define RDI_SectionKind_XList \
|
||||
X(NULL, null, RDI_U8)\
|
||||
X(TopLevelInfo, top_level_info, RDI_TopLevelInfo)\
|
||||
X(StringData, string_data, RDI_U8)\
|
||||
X(StringTable, string_table, RDI_U32)\
|
||||
X(IndexRuns, index_runs, RDI_U32)\
|
||||
X(BinarySections, binary_sections, RDI_BinarySection)\
|
||||
X(FilePathNodes, file_path_nodes, RDI_FilePathNode)\
|
||||
X(SourceFiles, source_files, RDI_SourceFile)\
|
||||
X(LineTables, line_tables, RDI_LineTable)\
|
||||
X(LineInfoVOffs, line_info_voffs, RDI_U64)\
|
||||
X(LineInfoLines, line_info_lines, RDI_Line)\
|
||||
X(LineInfoColumns, line_info_columns, RDI_Column)\
|
||||
X(SourceLineMaps, source_line_maps, RDI_SourceLineMap)\
|
||||
X(SourceLineMapNumbers, source_line_map_numbers, RDI_U32)\
|
||||
X(SourceLineMapRanges, source_line_map_ranges, RDI_U32)\
|
||||
X(SourceLineMapVOffs, source_line_map_voffs, RDI_U64)\
|
||||
X(Units, units, RDI_Unit)\
|
||||
X(UnitVMap, unit_vmap, RDI_VMapEntry)\
|
||||
X(TypeNodes, type_nodes, RDI_TypeNode)\
|
||||
X(UDTs, udts, RDI_UDT)\
|
||||
X(Members, members, RDI_Member)\
|
||||
X(EnumMembers, enum_members, RDI_EnumMember)\
|
||||
X(GlobalVariables, global_variables, RDI_GlobalVariable)\
|
||||
X(GlobalVMap, global_vmap, RDI_VMapEntry)\
|
||||
X(ThreadVariables, thread_variables, RDI_ThreadVariable)\
|
||||
X(Procedures, procedures, RDI_Procedure)\
|
||||
X(Scopes, scopes, RDI_Scope)\
|
||||
X(ScopeVOffData, scope_voff_data, RDI_U64)\
|
||||
X(ScopeVMap, scope_vmap, RDI_VMapEntry)\
|
||||
X(InlineSites, inline_sites, RDI_InlineSite)\
|
||||
X(Locals, locals, RDI_Local)\
|
||||
X(LocationBlocks, location_blocks, RDI_LocationBlock)\
|
||||
X(LocationData, location_data, RDI_U8)\
|
||||
X(NameMaps, name_maps, RDI_NameMap)\
|
||||
X(NameMapBuckets, name_map_buckets, RDI_NameMapBucket)\
|
||||
X(NameMapNodes, name_map_nodes, RDI_NameMapNode)\
|
||||
|
||||
#define RDI_DataSectionEncoding_XList \
|
||||
#define RDI_SectionEncoding_XList \
|
||||
X(Unpacked)\
|
||||
X(LZB)\
|
||||
|
||||
#define RDI_DataSection_XList \
|
||||
X(RDI_DataSectionTag, tag)\
|
||||
X(RDI_DataSectionEncoding, encoding)\
|
||||
#define RDI_Section_XList \
|
||||
X(RDI_SectionEncoding, encoding)\
|
||||
X(RDI_U32, pad)\
|
||||
X(RDI_U64, off)\
|
||||
X(RDI_U64, encoded_size)\
|
||||
X(RDI_U64, unpacked_size)\
|
||||
@@ -885,8 +889,10 @@ X(COUNT)\
|
||||
|
||||
#define RDI_NameMap_XList \
|
||||
X(RDI_NameMapKind, kind)\
|
||||
X(RDI_U32, bucket_data_idx)\
|
||||
X(RDI_U32, node_data_idx)\
|
||||
X(RDI_U32, bucket_base_idx)\
|
||||
X(RDI_U32, node_base_idx)\
|
||||
X(RDI_U32, bucket_count)\
|
||||
X(RDI_U32, node_count)\
|
||||
|
||||
#define RDI_NameMapBucket_XList \
|
||||
X(RDI_U32, first_node)\
|
||||
@@ -897,6 +903,72 @@ X(RDI_U32, string_idx)\
|
||||
X(RDI_U32, match_count)\
|
||||
X(RDI_U32, match_idx_or_idx_run_first)\
|
||||
|
||||
#if !RDI_DISABLE_TABLE_INDEX_TYPECHECKING
|
||||
typedef struct RDI_U32_StringTable { RDI_U32 v; } RDI_U32_StringTable;
|
||||
typedef struct RDI_U32_IndexRuns { RDI_U32 v; } RDI_U32_IndexRuns;
|
||||
typedef struct RDI_U32_BinarySections { RDI_U32 v; } RDI_U32_BinarySections;
|
||||
typedef struct RDI_U32_FilePathNodes { RDI_U32 v; } RDI_U32_FilePathNodes;
|
||||
typedef struct RDI_U32_SourceFiles { RDI_U32 v; } RDI_U32_SourceFiles;
|
||||
typedef struct RDI_U32_LineTables { RDI_U32 v; } RDI_U32_LineTables;
|
||||
typedef struct RDI_U32_LineInfoVOffs { RDI_U32 v; } RDI_U32_LineInfoVOffs;
|
||||
typedef struct RDI_U32_LineInfoLines { RDI_U32 v; } RDI_U32_LineInfoLines;
|
||||
typedef struct RDI_U32_LineInfoColumns { RDI_U32 v; } RDI_U32_LineInfoColumns;
|
||||
typedef struct RDI_U32_SourceLineMaps { RDI_U32 v; } RDI_U32_SourceLineMaps;
|
||||
typedef struct RDI_U32_SourceLineMapNumbers { RDI_U32 v; } RDI_U32_SourceLineMapNumbers;
|
||||
typedef struct RDI_U32_SourceLineMapRanges { RDI_U32 v; } RDI_U32_SourceLineMapRanges;
|
||||
typedef struct RDI_U32_SourceLineMapVOffs { RDI_U32 v; } RDI_U32_SourceLineMapVOffs;
|
||||
typedef struct RDI_U32_Units { RDI_U32 v; } RDI_U32_Units;
|
||||
typedef struct RDI_U32_TypeNodes { RDI_U32 v; } RDI_U32_TypeNodes;
|
||||
typedef struct RDI_U32_UDTs { RDI_U32 v; } RDI_U32_UDTs;
|
||||
typedef struct RDI_U32_Members { RDI_U32 v; } RDI_U32_Members;
|
||||
typedef struct RDI_U32_EnumMembers { RDI_U32 v; } RDI_U32_EnumMembers;
|
||||
typedef struct RDI_U32_GlobalVariables { RDI_U32 v; } RDI_U32_GlobalVariables;
|
||||
typedef struct RDI_U32_ThreadVariables { RDI_U32 v; } RDI_U32_ThreadVariables;
|
||||
typedef struct RDI_U32_Procedures { RDI_U32 v; } RDI_U32_Procedures;
|
||||
typedef struct RDI_U32_Scopes { RDI_U32 v; } RDI_U32_Scopes;
|
||||
typedef struct RDI_U32_ScopeVOffData { RDI_U32 v; } RDI_U32_ScopeVOffData;
|
||||
typedef struct RDI_U32_InlineSites { RDI_U32 v; } RDI_U32_InlineSites;
|
||||
typedef struct RDI_U32_Locals { RDI_U32 v; } RDI_U32_Locals;
|
||||
typedef struct RDI_U32_LocationBlocks { RDI_U32 v; } RDI_U32_LocationBlocks;
|
||||
typedef struct RDI_U32_LocationData { RDI_U32 v; } RDI_U32_LocationData;
|
||||
typedef struct RDI_U32_NameMaps { RDI_U32 v; } RDI_U32_NameMaps;
|
||||
typedef struct RDI_U32_NameMapBuckets { RDI_U32 v; } RDI_U32_NameMapBuckets;
|
||||
typedef struct RDI_U32_NameMapNodes { RDI_U32 v; } RDI_U32_NameMapNodes;
|
||||
#else
|
||||
typedef struct RDI_U32_Table { RDI_U32 v; } RDI_U32_Table;
|
||||
typedef struct RDI_U64_Table { RDI_U64 v; } RDI_U64_Table;
|
||||
typedef RDI_U32_Table RDI_U32_StringTable;
|
||||
typedef RDI_U32_Table RDI_U32_IndexRuns;
|
||||
typedef RDI_U32_Table RDI_U32_BinarySections;
|
||||
typedef RDI_U32_Table RDI_U32_FilePathNodes;
|
||||
typedef RDI_U32_Table RDI_U32_SourceFiles;
|
||||
typedef RDI_U32_Table RDI_U32_LineTables;
|
||||
typedef RDI_U32_Table RDI_U32_LineInfoVOffs;
|
||||
typedef RDI_U32_Table RDI_U32_LineInfoLines;
|
||||
typedef RDI_U32_Table RDI_U32_LineInfoColumns;
|
||||
typedef RDI_U32_Table RDI_U32_SourceLineMaps;
|
||||
typedef RDI_U32_Table RDI_U32_SourceLineMapNumbers;
|
||||
typedef RDI_U32_Table RDI_U32_SourceLineMapRanges;
|
||||
typedef RDI_U32_Table RDI_U32_SourceLineMapVOffs;
|
||||
typedef RDI_U32_Table RDI_U32_Units;
|
||||
typedef RDI_U32_Table RDI_U32_TypeNodes;
|
||||
typedef RDI_U32_Table RDI_U32_UDTs;
|
||||
typedef RDI_U32_Table RDI_U32_Members;
|
||||
typedef RDI_U32_Table RDI_U32_EnumMembers;
|
||||
typedef RDI_U32_Table RDI_U32_GlobalVariables;
|
||||
typedef RDI_U32_Table RDI_U32_ThreadVariables;
|
||||
typedef RDI_U32_Table RDI_U32_Procedures;
|
||||
typedef RDI_U32_Table RDI_U32_Scopes;
|
||||
typedef RDI_U32_Table RDI_U32_ScopeVOffData;
|
||||
typedef RDI_U32_Table RDI_U32_InlineSites;
|
||||
typedef RDI_U32_Table RDI_U32_Locals;
|
||||
typedef RDI_U32_Table RDI_U32_LocationBlocks;
|
||||
typedef RDI_U32_Table RDI_U32_LocationData;
|
||||
typedef RDI_U32_Table RDI_U32_NameMaps;
|
||||
typedef RDI_U32_Table RDI_U32_NameMapBuckets;
|
||||
typedef RDI_U32_Table RDI_U32_NameMapNodes;
|
||||
#endif
|
||||
|
||||
#define RDI_EVAL_CTRLBITS(decodeN,popN,pushN) ((decodeN) | ((popN) << 4) | ((pushN) << 6))
|
||||
#define RDI_DECODEN_FROM_CTRLBITS(ctrlbits) ((ctrlbits) & 0xf)
|
||||
#define RDI_POPN_FROM_CTRLBITS(ctrlbits) (((ctrlbits) >> 4) & 0x3)
|
||||
@@ -912,11 +984,11 @@ RDI_U32 data_section_off;
|
||||
RDI_U32 data_section_count;
|
||||
};
|
||||
|
||||
typedef struct RDI_DataSection RDI_DataSection;
|
||||
struct RDI_DataSection
|
||||
typedef struct RDI_Section RDI_Section;
|
||||
struct RDI_Section
|
||||
{
|
||||
RDI_DataSectionTag tag;
|
||||
RDI_DataSectionEncoding encoding;
|
||||
RDI_SectionEncoding encoding;
|
||||
RDI_U32 pad;
|
||||
RDI_U64 off;
|
||||
RDI_U64 encoded_size;
|
||||
RDI_U64 unpacked_size;
|
||||
@@ -1034,13 +1106,15 @@ RDI_U32 byte_size;
|
||||
{
|
||||
RDI_U32 direct_type_idx;
|
||||
RDI_U32 count;
|
||||
union{
|
||||
union
|
||||
{
|
||||
// when kind is 'Function' or 'Method'
|
||||
RDI_U32 param_idx_run_first;
|
||||
// when kind is 'MemberPtr'
|
||||
RDI_U32 owner_type_idx;
|
||||
};
|
||||
} constructed;
|
||||
}
|
||||
constructed;
|
||||
|
||||
// kind is 'user defined'
|
||||
struct
|
||||
@@ -1048,7 +1122,8 @@ RDI_U32 byte_size;
|
||||
RDI_U32 name_string_idx;
|
||||
RDI_U32 direct_type_idx;
|
||||
RDI_U32 udt_idx;
|
||||
} user_defined;
|
||||
}
|
||||
user_defined;
|
||||
|
||||
// (kind = Bitfield)
|
||||
struct
|
||||
@@ -1056,7 +1131,8 @@ RDI_U32 byte_size;
|
||||
RDI_U32 direct_type_idx;
|
||||
RDI_U32 off;
|
||||
RDI_U32 size;
|
||||
} bitfield;
|
||||
}
|
||||
bitfield;
|
||||
}
|
||||
;
|
||||
};
|
||||
@@ -1193,8 +1269,10 @@ typedef struct RDI_NameMap RDI_NameMap;
|
||||
struct RDI_NameMap
|
||||
{
|
||||
RDI_NameMapKind kind;
|
||||
RDI_U32 bucket_data_idx;
|
||||
RDI_U32 node_data_idx;
|
||||
RDI_U32 bucket_base_idx;
|
||||
RDI_U32 node_base_idx;
|
||||
RDI_U32 bucket_count;
|
||||
RDI_U32 node_count;
|
||||
};
|
||||
|
||||
typedef struct RDI_NameMapBucket RDI_NameMapBucket;
|
||||
@@ -1212,6 +1290,43 @@ RDI_U32 match_count;
|
||||
RDI_U32 match_idx_or_idx_run_first;
|
||||
};
|
||||
|
||||
typedef RDI_U8 RDI_SectionElementType_NULL;
|
||||
typedef RDI_TopLevelInfo RDI_SectionElementType_TopLevelInfo;
|
||||
typedef RDI_U8 RDI_SectionElementType_StringData;
|
||||
typedef RDI_U32 RDI_SectionElementType_StringTable;
|
||||
typedef RDI_U32 RDI_SectionElementType_IndexRuns;
|
||||
typedef RDI_BinarySection RDI_SectionElementType_BinarySections;
|
||||
typedef RDI_FilePathNode RDI_SectionElementType_FilePathNodes;
|
||||
typedef RDI_SourceFile RDI_SectionElementType_SourceFiles;
|
||||
typedef RDI_LineTable RDI_SectionElementType_LineTables;
|
||||
typedef RDI_U64 RDI_SectionElementType_LineInfoVOffs;
|
||||
typedef RDI_Line RDI_SectionElementType_LineInfoLines;
|
||||
typedef RDI_Column RDI_SectionElementType_LineInfoColumns;
|
||||
typedef RDI_SourceLineMap RDI_SectionElementType_SourceLineMaps;
|
||||
typedef RDI_U32 RDI_SectionElementType_SourceLineMapNumbers;
|
||||
typedef RDI_U32 RDI_SectionElementType_SourceLineMapRanges;
|
||||
typedef RDI_U64 RDI_SectionElementType_SourceLineMapVOffs;
|
||||
typedef RDI_Unit RDI_SectionElementType_Units;
|
||||
typedef RDI_VMapEntry RDI_SectionElementType_UnitVMap;
|
||||
typedef RDI_TypeNode RDI_SectionElementType_TypeNodes;
|
||||
typedef RDI_UDT RDI_SectionElementType_UDTs;
|
||||
typedef RDI_Member RDI_SectionElementType_Members;
|
||||
typedef RDI_EnumMember RDI_SectionElementType_EnumMembers;
|
||||
typedef RDI_GlobalVariable RDI_SectionElementType_GlobalVariables;
|
||||
typedef RDI_VMapEntry RDI_SectionElementType_GlobalVMap;
|
||||
typedef RDI_ThreadVariable RDI_SectionElementType_ThreadVariables;
|
||||
typedef RDI_Procedure RDI_SectionElementType_Procedures;
|
||||
typedef RDI_Scope RDI_SectionElementType_Scopes;
|
||||
typedef RDI_U64 RDI_SectionElementType_ScopeVOffData;
|
||||
typedef RDI_VMapEntry RDI_SectionElementType_ScopeVMap;
|
||||
typedef RDI_InlineSite RDI_SectionElementType_InlineSites;
|
||||
typedef RDI_Local RDI_SectionElementType_Locals;
|
||||
typedef RDI_LocationBlock RDI_SectionElementType_LocationBlocks;
|
||||
typedef RDI_U8 RDI_SectionElementType_LocationData;
|
||||
typedef RDI_NameMap RDI_SectionElementType_NameMaps;
|
||||
typedef RDI_NameMapBucket RDI_SectionElementType_NameMapBuckets;
|
||||
typedef RDI_NameMapNode RDI_SectionElementType_NameMapNodes;
|
||||
|
||||
RDI_PROC RDI_U64 rdi_hash(RDI_U8 *ptr, RDI_U64 size);
|
||||
RDI_PROC RDI_U32 rdi_size_from_basic_type_kind(RDI_TypeKind kind);
|
||||
RDI_PROC RDI_U32 rdi_addr_size_from_arch(RDI_Arch arch);
|
||||
@@ -1219,6 +1334,8 @@ RDI_PROC RDI_EvalConversionKind rdi_eval_conversion_kind_from_typegroups(RDI_Eva
|
||||
RDI_PROC RDI_S32 rdi_eval_op_typegroup_are_compatible(RDI_EvalOp op, RDI_EvalTypeGroup group);
|
||||
RDI_PROC RDI_U8 *rdi_explanation_string_from_eval_conversion_kind(RDI_EvalConversionKind kind, RDI_U64 *size_out);
|
||||
|
||||
extern RDI_U16 rdi_section_element_size_table[37];
|
||||
extern RDI_U8 rdi_section_is_required_table[37];
|
||||
extern RDI_U8 rdi_eval_op_ctrlbits_table[45];
|
||||
|
||||
#endif // RDI_FORMAT_H
|
||||
|
||||
@@ -34,14 +34,14 @@ rdi_parse(RDI_U8 *data, RDI_U64 size, RDI_Parsed *out)
|
||||
//////////////////////////////
|
||||
//- rjf: extract data sections
|
||||
//
|
||||
RDI_DataSection *dsecs = 0;
|
||||
RDI_Section *dsecs = 0;
|
||||
RDI_U32 dsec_count = 0;
|
||||
if(result == RDI_ParseStatus_Good)
|
||||
{
|
||||
RDI_U64 opl = (RDI_U64)hdr->data_section_off + (RDI_U64)hdr->data_section_count*sizeof(*dsecs);
|
||||
if(opl <= size)
|
||||
{
|
||||
dsecs = (RDI_DataSection*)(data + hdr->data_section_off);
|
||||
dsecs = (RDI_Section*)(data + hdr->data_section_off);
|
||||
dsec_count = hdr->data_section_count;
|
||||
}
|
||||
if(dsecs == 0)
|
||||
@@ -51,211 +51,146 @@ rdi_parse(RDI_U8 *data, RDI_U64 size, RDI_Parsed *out)
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: extract primary data section indexes
|
||||
//
|
||||
RDI_U32 dsec_idx[RDI_DataSectionTag_PRIMARY_COUNT] = {0};
|
||||
if(result == RDI_ParseStatus_Good)
|
||||
{
|
||||
RDI_DataSection *sec_ptr = dsecs;
|
||||
for(RDI_U32 i = 0; i < dsec_count; i += 1, sec_ptr += 1)
|
||||
{
|
||||
if(sec_ptr->tag < RDI_DataSectionTag_PRIMARY_COUNT)
|
||||
{
|
||||
dsec_idx[sec_ptr->tag] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: fill out raw data info
|
||||
//- rjf: fill result
|
||||
//
|
||||
if(result == RDI_ParseStatus_Good)
|
||||
{
|
||||
out->raw_data = data;
|
||||
out->raw_data_size = size;
|
||||
out->dsecs = dsecs;
|
||||
out->dsec_count = dsec_count;
|
||||
for(RDI_U32 i = 0; i < RDI_DataSectionTag_PRIMARY_COUNT; i += 1)
|
||||
{
|
||||
out->dsec_idx[i] = dsec_idx[i];
|
||||
}
|
||||
out->sections = dsecs;
|
||||
out->sections_count = dsec_count;
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: extract string table info
|
||||
//
|
||||
RDI_U8 *string_data = 0;
|
||||
RDI_U64 string_opl = 0;
|
||||
RDI_U32 *string_offs = 0;
|
||||
RDI_U64 string_count = 0;
|
||||
if(result == RDI_ParseStatus_Good)
|
||||
{
|
||||
RDI_U64 table_entry_count = 0;
|
||||
rdi_parse__extract_primary(out, string_offs, &table_entry_count, RDI_DataSectionTag_StringTable);
|
||||
rdi_parse__extract_primary(out, string_data, &string_opl, RDI_DataSectionTag_StringData);
|
||||
if(table_entry_count > 0)
|
||||
{
|
||||
string_count = table_entry_count - 1;
|
||||
}
|
||||
if(string_data == 0)
|
||||
{
|
||||
result = RDI_ParseStatus_MissingStringDataSection;
|
||||
}
|
||||
else if (string_offs == 0)
|
||||
{
|
||||
result = RDI_ParseStatus_MissingStringTableSection;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: extract index run table info
|
||||
//
|
||||
RDI_U32 *idx_run_data = 0;
|
||||
RDI_U64 idx_run_count = 0;
|
||||
if(result == RDI_ParseStatus_Good)
|
||||
{
|
||||
rdi_parse__extract_primary(out, idx_run_data, &idx_run_count, RDI_DataSectionTag_IndexRuns);
|
||||
if(idx_run_data == 0)
|
||||
{
|
||||
result = RDI_ParseStatus_MissingIndexRunSection;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: extract info tables
|
||||
//- rjf: validate results
|
||||
//
|
||||
if(result == RDI_ParseStatus_Good)
|
||||
{
|
||||
out->string_data = string_data;
|
||||
out->string_offs = string_offs;
|
||||
out->string_data_size = string_opl;
|
||||
out->string_count = string_count;
|
||||
out->idx_run_data = idx_run_data;
|
||||
out->idx_run_count = idx_run_count;
|
||||
for(RDI_SectionKind k = (RDI_SectionKind)(RDI_SectionKind_NULL+1); k < RDI_SectionKind_COUNT; k = (RDI_SectionKind)(k+1))
|
||||
{
|
||||
RDI_TopLevelInfo *tli = 0;
|
||||
RDI_U64 dummy = 0;
|
||||
rdi_parse__extract_primary(out, tli, &dummy, RDI_DataSectionTag_TopLevelInfo);
|
||||
if (dummy != 1){
|
||||
tli = 0;
|
||||
}
|
||||
out->top_level_info = tli;
|
||||
}
|
||||
rdi_parse__extract_primary(out, out->binary_sections, &out->binary_sections_count, RDI_DataSectionTag_BinarySections);
|
||||
rdi_parse__extract_primary(out, out->file_paths, &out->file_paths_count, RDI_DataSectionTag_FilePathNodes);
|
||||
rdi_parse__extract_primary(out, out->source_files, &out->source_files_count, RDI_DataSectionTag_SourceFiles);
|
||||
rdi_parse__extract_primary(out, out->line_tables, &out->line_tables_count, RDI_DataSectionTag_LineTables);
|
||||
rdi_parse__extract_primary(out, out->source_line_maps, &out->source_line_maps_count, RDI_DataSectionTag_SourceLineMaps);
|
||||
rdi_parse__extract_primary(out, out->line_info_voffs, &out->line_info_voffs_count, RDI_DataSectionTag_LineInfoVoffs);
|
||||
rdi_parse__extract_primary(out, out->line_info_lines, &out->line_info_lines_count, RDI_DataSectionTag_LineInfoLines);
|
||||
rdi_parse__extract_primary(out, out->line_info_columns, &out->line_info_columns_count, RDI_DataSectionTag_LineInfoColumns);
|
||||
rdi_parse__extract_primary(out, out->units, &out->units_count, RDI_DataSectionTag_Units);
|
||||
rdi_parse__extract_primary(out, out->unit_vmap, &out->unit_vmap_count, RDI_DataSectionTag_UnitVmap);
|
||||
rdi_parse__extract_primary(out, out->unit_vmap, &out->unit_vmap_count, RDI_DataSectionTag_UnitVmap);
|
||||
rdi_parse__extract_primary(out, out->type_nodes, &out->type_nodes_count, RDI_DataSectionTag_TypeNodes);
|
||||
rdi_parse__extract_primary(out, out->udts, &out->udts_count, RDI_DataSectionTag_UDTs);
|
||||
rdi_parse__extract_primary(out, out->members, &out->members_count, RDI_DataSectionTag_Members);
|
||||
rdi_parse__extract_primary(out, out->enum_members, &out->enum_members_count, RDI_DataSectionTag_EnumMembers);
|
||||
rdi_parse__extract_primary(out, out->global_variables, &out->global_variables_count, RDI_DataSectionTag_GlobalVariables);
|
||||
rdi_parse__extract_primary(out, out->global_vmap, &out->global_vmap_count, RDI_DataSectionTag_GlobalVmap);
|
||||
rdi_parse__extract_primary(out, out->thread_variables, &out->thread_variables_count, RDI_DataSectionTag_ThreadVariables);
|
||||
rdi_parse__extract_primary(out, out->procedures, &out->procedures_count, RDI_DataSectionTag_Procedures);
|
||||
rdi_parse__extract_primary(out, out->scopes, &out->scopes_count, RDI_DataSectionTag_Scopes);
|
||||
rdi_parse__extract_primary(out, out->scope_voffs, &out->scope_voffs_count, RDI_DataSectionTag_ScopeVoffData);
|
||||
rdi_parse__extract_primary(out, out->scope_vmap, &out->scope_vmap_count, RDI_DataSectionTag_ScopeVmap);
|
||||
rdi_parse__extract_primary(out, out->locals, &out->locals_count, RDI_DataSectionTag_Locals);
|
||||
rdi_parse__extract_primary(out, out->location_blocks, &out->location_blocks_count, RDI_DataSectionTag_LocationBlocks);
|
||||
rdi_parse__extract_primary(out, out->location_data, &out->location_data_size, RDI_DataSectionTag_LocationData);
|
||||
rdi_parse__extract_primary(out, out->name_maps, &out->name_maps_count, RDI_DataSectionTag_NameMaps);
|
||||
{
|
||||
RDI_NameMap *name_map_ptr = out->name_maps;
|
||||
RDI_NameMap *name_map_opl = out->name_maps + out->name_maps_count;
|
||||
for (; name_map_ptr < name_map_opl; name_map_ptr += 1){
|
||||
if (out->name_maps_by_kind[name_map_ptr->kind] == 0){
|
||||
out->name_maps_by_kind[name_map_ptr->kind] = name_map_ptr;
|
||||
if(rdi_section_is_required_table[k])
|
||||
{
|
||||
RDI_U64 data_size = 0;
|
||||
RDI_SectionEncoding encoding = 0;
|
||||
void *data = rdi_section_raw_data_from_kind(out, k, &encoding, &data_size);
|
||||
if(data == 0 || data == &rdi_nil_element_union || data_size == 0)
|
||||
{
|
||||
result = RDI_ParseStatus_MissingRequiredSection;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: fill any missing tables with nil elements
|
||||
//
|
||||
#if !defined(RDI_DISABLE_NILS)
|
||||
if(out->top_level_info == 0) { out->top_level_info = &rdi_top_level_info_nil; }
|
||||
if(out->binary_sections == 0) { out->binary_sections = &rdi_binary_section_nil; out->binary_sections_count = 1; }
|
||||
if(out->file_paths == 0) { out->file_paths = &rdi_file_path_node_nil; out->file_paths_count = 1; }
|
||||
if(out->source_files == 0) { out->source_files = &rdi_source_file_nil; out->source_files_count = 1; }
|
||||
if(out->line_tables == 0) { out->line_tables = &rdi_line_table_nil; out->line_tables_count = 1; }
|
||||
if(out->source_line_maps == 0) { out->source_line_maps = &rdi_source_line_map_nil; out->source_line_maps_count = 1; }
|
||||
if(out->units == 0) { out->units = &rdi_unit_nil; out->units_count = 1; }
|
||||
if(out->unit_vmap == 0) { out->unit_vmap = &rdi_vmap_entry_nil; out->unit_vmap_count = 1; }
|
||||
if(out->type_nodes == 0) { out->type_nodes = &rdi_type_node_nil; out->type_nodes_count = 1; }
|
||||
if(out->udts == 0) { out->udts = &rdi_udt_nil; out->udts_count = 1; }
|
||||
if(out->members == 0) { out->members = &rdi_member_nil; out->members_count = 1; }
|
||||
if(out->enum_members == 0) { out->enum_members = &rdi_enum_member_nil; out->enum_members_count = 1; }
|
||||
if(out->global_variables == 0) { out->global_variables = &rdi_global_variable_nil; out->global_variables_count = 1; }
|
||||
if(out->global_vmap == 0) { out->global_vmap = &rdi_vmap_entry_nil; out->global_vmap_count = 1; }
|
||||
if(out->thread_variables == 0) { out->thread_variables = &rdi_thread_variable_nil; out->thread_variables_count = 1; }
|
||||
if(out->procedures == 0) { out->procedures = &rdi_procedure_nil; out->procedures_count = 1; }
|
||||
if(out->scopes == 0) { out->scopes = &rdi_scope_nil; out->scopes_count = 1; }
|
||||
if(out->scope_voffs == 0) { out->scope_voffs = &rdi_voff_nil; out->scope_voffs_count = 1; }
|
||||
if(out->scope_vmap == 0) { out->scope_vmap = &rdi_vmap_entry_nil; out->scope_vmap_count = 1; }
|
||||
if(out->locals == 0) { out->locals = &rdi_local_nil; out->locals_count = 1; }
|
||||
if(out->location_blocks == 0) { out->location_blocks = &rdi_location_block_nil; out->location_blocks_count = 1; }
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ Parsed Info Extraction Helpers
|
||||
//~ Base Parsed Info Extraction Helpers
|
||||
|
||||
//- top-level info
|
||||
//- section table/element raw data extraction
|
||||
|
||||
RDI_PROC void *
|
||||
rdi_section_raw_data_from_kind(RDI_Parsed *rdi, RDI_SectionKind kind, RDI_SectionEncoding *encoding_out, RDI_U64 *size_out)
|
||||
{
|
||||
void *result = 0;
|
||||
#if !defined(RDI_DISABLE_NILS)
|
||||
result = &rdi_nil_element_union;
|
||||
*size_out = rdi_section_element_size_table[kind];
|
||||
#endif
|
||||
if(0 <= kind && kind < rdi->sections_count)
|
||||
{
|
||||
result = rdi->raw_data+rdi->sections[kind].off;
|
||||
*size_out = rdi->sections[kind].encoded_size;
|
||||
*encoding_out = rdi->sections[kind].encoding;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
RDI_PROC void *
|
||||
rdi_section_raw_table_from_kind(RDI_Parsed *rdi, RDI_SectionKind kind, RDI_U64 *count_out)
|
||||
{
|
||||
void *result = 0;
|
||||
RDI_U64 all_elements_size = 0;
|
||||
RDI_SectionEncoding all_elements_encoding = 0;
|
||||
void *all_elements = rdi_section_raw_data_from_kind(rdi, kind, &all_elements_encoding, &all_elements_size);
|
||||
if(all_elements_encoding == RDI_SectionEncoding_Unpacked)
|
||||
{
|
||||
RDI_U64 element_size = (RDI_U64)rdi_section_element_size_table[kind];
|
||||
RDI_U64 all_elements_count = all_elements_size/element_size;
|
||||
result = all_elements;
|
||||
*count_out = all_elements_count;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
RDI_PROC void *
|
||||
rdi_section_raw_element_from_kind_idx(RDI_Parsed *rdi, RDI_SectionKind kind, RDI_U64 idx)
|
||||
{
|
||||
RDI_U64 count = 0;
|
||||
void *table = rdi_section_raw_table_from_kind(rdi, kind, &count);
|
||||
void *result = table;
|
||||
if(idx < count)
|
||||
{
|
||||
RDI_U64 element_size = (RDI_U64)rdi_section_element_size_table[kind];
|
||||
result = (RDI_U8 *)table + element_size*idx;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//- info about whole parse
|
||||
|
||||
RDI_PROC RDI_U64
|
||||
rdi_decompressed_size_from_parsed(RDI_Parsed *rdi)
|
||||
{
|
||||
RDI_U64 decompressed_size = rdi->raw_data_size;
|
||||
for(RDI_U64 dsec_idx = 0; dsec_idx < rdi->dsec_count; dsec_idx += 1)
|
||||
for(RDI_U64 section_idx = 0; section_idx < rdi->sections_count; section_idx += 1)
|
||||
{
|
||||
decompressed_size += (rdi->dsecs[dsec_idx].unpacked_size - rdi->dsecs[dsec_idx].encoded_size);
|
||||
decompressed_size += (rdi->sections[section_idx].unpacked_size - rdi->sections[section_idx].encoded_size);
|
||||
}
|
||||
return decompressed_size;
|
||||
}
|
||||
|
||||
//- strings
|
||||
|
||||
RDI_PROC RDI_U8*
|
||||
rdi_string_from_idx(RDI_Parsed *parsed, RDI_U32 idx, RDI_U64 *len_out)
|
||||
RDI_PROC RDI_U8 *
|
||||
rdi_string_from_idx(RDI_Parsed *rdi, RDI_U32 idx, RDI_U64 *len_out)
|
||||
{
|
||||
RDI_U8 *result = 0;
|
||||
RDI_U64 len_result = 0;
|
||||
if(idx < parsed->string_count)
|
||||
RDI_U8 *result_base = 0;
|
||||
RDI_U64 result_size = 0;
|
||||
{
|
||||
RDI_U32 off_raw = parsed->string_offs[idx];
|
||||
RDI_U32 opl_raw = parsed->string_offs[idx + 1];
|
||||
RDI_U32 opl = rdi_parse__min(opl_raw, parsed->string_data_size);
|
||||
RDI_U32 off = rdi_parse__min(off_raw, opl);
|
||||
result = parsed->string_data + off;
|
||||
len_result = opl - off;
|
||||
RDI_U64 string_offs_count = 0;
|
||||
RDI_U32 *string_offs = rdi_table_from_name(rdi, StringTable, &string_offs_count);
|
||||
if(idx < string_offs_count)
|
||||
{
|
||||
RDI_U64 string_data_size = 0;
|
||||
RDI_U8 *string_data = rdi_table_from_name(rdi, StringData, &string_data_size);
|
||||
RDI_U32 off_raw = string_offs[idx];
|
||||
RDI_U32 opl_raw = string_offs[idx + 1];
|
||||
RDI_U32 opl = rdi_parse__min(opl_raw, string_data_size);
|
||||
RDI_U32 off = rdi_parse__min(off_raw, opl);
|
||||
result_base = string_data + off;
|
||||
result_size = opl - off;
|
||||
}
|
||||
}
|
||||
*len_out = len_result;
|
||||
return result;
|
||||
*len_out = result_size;
|
||||
return result_base;
|
||||
}
|
||||
|
||||
//- index runs
|
||||
|
||||
RDI_PROC RDI_U32*
|
||||
rdi_idx_run_from_first_count(RDI_Parsed *parsed, RDI_U32 raw_first, RDI_U32 raw_count, RDI_U32 *n_out)
|
||||
rdi_idx_run_from_first_count(RDI_Parsed *rdi, RDI_U32 raw_first, RDI_U32 raw_count, RDI_U32 *n_out)
|
||||
{
|
||||
RDI_U64 idx_run_count = 0;
|
||||
RDI_U32 *idx_run_data = rdi_table_from_name(rdi, IndexRuns, &idx_run_count);
|
||||
RDI_U32 raw_opl = raw_first + raw_count;
|
||||
RDI_U32 opl = rdi_parse__min(raw_opl, parsed->idx_run_count);
|
||||
RDI_U32 opl = rdi_parse__min(raw_opl, idx_run_count);
|
||||
RDI_U32 first = rdi_parse__min(raw_first, opl);
|
||||
RDI_U32 *result = 0;
|
||||
if(first < parsed->idx_run_count)
|
||||
if(first < idx_run_count)
|
||||
{
|
||||
result = parsed->idx_run_data + first;
|
||||
result = idx_run_data + first;
|
||||
}
|
||||
*n_out = opl - first;
|
||||
return result;
|
||||
@@ -264,17 +199,17 @@ rdi_idx_run_from_first_count(RDI_Parsed *parsed, RDI_U32 raw_first, RDI_U32 raw_
|
||||
//- line info
|
||||
|
||||
RDI_PROC void
|
||||
rdi_parsed_from_line_table(RDI_Parsed *p, RDI_LineTable *line_table, RDI_ParsedLineTable *out)
|
||||
rdi_parsed_from_line_table(RDI_Parsed *rdi, RDI_LineTable *line_table, RDI_ParsedLineTable *out)
|
||||
{
|
||||
//- rjf: extract top-level line info tables
|
||||
RDI_U64 all_voffs_count = 0;
|
||||
RDI_U64 *all_voffs = (RDI_U64 *)rdi_data_from_dsec(p, p->dsec_idx[RDI_DataSectionTag_LineInfoVoffs], sizeof(RDI_U64), RDI_DataSectionTag_LineInfoVoffs, &all_voffs_count);
|
||||
RDI_U64 *all_voffs = rdi_table_from_name(rdi, LineInfoVOffs, &all_voffs_count);
|
||||
RDI_U64 *all_voffs_opl = all_voffs + all_voffs_count;
|
||||
RDI_U64 all_lines_count = 0;
|
||||
RDI_Line *all_lines = (RDI_Line *)rdi_data_from_dsec(p, p->dsec_idx[RDI_DataSectionTag_LineInfoLines], sizeof(RDI_Line), RDI_DataSectionTag_LineInfoLines, &all_lines_count);
|
||||
RDI_Line *all_lines = rdi_table_from_name(rdi, LineInfoLines, &all_lines_count);
|
||||
RDI_Line *all_lines_opl = all_lines + all_lines_count;
|
||||
RDI_U64 all_cols_count = 0;
|
||||
RDI_Column *all_cols = (RDI_Column *)rdi_data_from_dsec(p, p->dsec_idx[RDI_DataSectionTag_LineInfoColumns], sizeof(RDI_Column), RDI_DataSectionTag_LineInfoColumns, &all_cols_count);
|
||||
RDI_Column *all_cols = rdi_table_from_name(rdi, LineInfoColumns, &all_cols_count);
|
||||
RDI_Column *all_cols_opl = all_cols + all_cols_count;
|
||||
|
||||
//- rjf: extract ranges of top-level tables belonging to this line table
|
||||
@@ -332,17 +267,17 @@ rdi_line_info_idx_from_voff(RDI_ParsedLineTable *line_info, RDI_U64 voff)
|
||||
}
|
||||
|
||||
RDI_PROC void
|
||||
rdi_parsed_from_source_line_map(RDI_Parsed *p, RDI_SourceLineMap *map, RDI_ParsedSourceLineMap *out)
|
||||
rdi_parsed_from_source_line_map(RDI_Parsed *rdi, RDI_SourceLineMap *map, RDI_ParsedSourceLineMap *out)
|
||||
{
|
||||
//- rjf: extract top-level line info tables
|
||||
RDI_U64 all_nums_count = 0;
|
||||
RDI_U32 *all_nums = (RDI_U32 *)rdi_data_from_dsec(p, p->dsec_idx[RDI_DataSectionTag_SourceLineMapNumbers], sizeof(RDI_U32), RDI_DataSectionTag_SourceLineMapNumbers, &all_nums_count);
|
||||
RDI_U32 *all_nums = rdi_table_from_name(rdi, SourceLineMapNumbers, &all_nums_count);
|
||||
RDI_U32 *all_nums_opl = all_nums + all_nums_count;
|
||||
RDI_U64 all_rngs_count = 0;
|
||||
RDI_U32 *all_rngs = (RDI_U32 *)rdi_data_from_dsec(p, p->dsec_idx[RDI_DataSectionTag_SourceLineMapRanges], sizeof(RDI_U32), RDI_DataSectionTag_SourceLineMapRanges, &all_rngs_count);
|
||||
RDI_U32 *all_rngs = rdi_table_from_name(rdi, SourceLineMapRanges, &all_rngs_count);
|
||||
RDI_U32 *all_rngs_opl = all_rngs + all_rngs_count;
|
||||
RDI_U64 all_voffs_count = 0;
|
||||
RDI_U64 *all_voffs = (RDI_U64 *)rdi_data_from_dsec(p, p->dsec_idx[RDI_DataSectionTag_SourceLineMapVOffs], sizeof(RDI_U64), RDI_DataSectionTag_SourceLineMapVOffs, &all_voffs_count);
|
||||
RDI_U64 *all_voffs = rdi_table_from_name(rdi, SourceLineMapVOffs, &all_voffs_count);
|
||||
RDI_U64 *all_voffs_opl = all_voffs + all_voffs_count;
|
||||
|
||||
//- rjf: extract ranges of top-level tables belonging to this line map
|
||||
@@ -363,7 +298,7 @@ rdi_parsed_from_source_line_map(RDI_Parsed *p, RDI_SourceLineMap *map, RDI_Parse
|
||||
out->voff_count = voffs_count;
|
||||
}
|
||||
|
||||
RDI_PROC RDI_U64*
|
||||
RDI_PROC RDI_U64 *
|
||||
rdi_line_voffs_from_num(RDI_ParsedSourceLineMap *map, RDI_U32 linenum, RDI_U32 *n_out)
|
||||
{
|
||||
RDI_U64 *result = 0;
|
||||
@@ -424,7 +359,7 @@ rdi_line_voffs_from_num(RDI_ParsedSourceLineMap *map, RDI_U32 linenum, RDI_U32 *
|
||||
//- vmap lookups
|
||||
|
||||
RDI_PROC RDI_U64
|
||||
rdi_vmap_idx_from_voff(RDI_VMapEntry *vmap, RDI_U32 vmap_count, RDI_U64 voff)
|
||||
rdi_vmap_idx_from_voff(RDI_VMapEntry *vmap, RDI_U64 vmap_count, RDI_U64 voff)
|
||||
{
|
||||
RDI_U64 result = 0;
|
||||
if(vmap_count > 0 && vmap[0].voff <= voff && voff < vmap[vmap_count - 1].voff)
|
||||
@@ -459,27 +394,42 @@ rdi_vmap_idx_from_voff(RDI_VMapEntry *vmap, RDI_U32 vmap_count, RDI_U64 voff)
|
||||
return result;
|
||||
}
|
||||
|
||||
//- name maps
|
||||
|
||||
RDI_PROC RDI_NameMap*
|
||||
rdi_name_map_from_kind(RDI_Parsed *p, RDI_NameMapKind kind){
|
||||
RDI_NameMap *result = 0;
|
||||
if(0 < kind && kind < RDI_NameMapKind_COUNT)
|
||||
{
|
||||
result = p->name_maps_by_kind[kind];
|
||||
}
|
||||
RDI_PROC RDI_U64
|
||||
rdi_vmap_idx_from_section_kind_voff(RDI_Parsed *rdi, RDI_SectionKind kind, RDI_U64 voff)
|
||||
{
|
||||
RDI_U64 vmaps_count = 0;
|
||||
RDI_VMapEntry *vmaps = rdi_section_raw_table_from_kind(rdi, kind, &vmaps_count);
|
||||
RDI_U64 result = rdi_vmap_idx_from_voff(vmaps, vmaps_count, voff);
|
||||
return result;
|
||||
}
|
||||
|
||||
//- name maps
|
||||
|
||||
RDI_PROC void
|
||||
rdi_name_map_parse(RDI_Parsed *p, RDI_NameMap *mapptr, RDI_ParsedNameMap *out)
|
||||
rdi_parsed_from_name_map(RDI_Parsed *rdi, RDI_NameMap *mapptr, RDI_ParsedNameMap *out)
|
||||
{
|
||||
out->buckets = 0;
|
||||
out->bucket_count = 0;
|
||||
if(mapptr != 0)
|
||||
{
|
||||
out->buckets = (RDI_NameMapBucket*)rdi_data_from_dsec(p, mapptr->bucket_data_idx, sizeof(RDI_NameMapBucket), RDI_DataSectionTag_NameMapBuckets, &out->bucket_count);
|
||||
out->nodes = (RDI_NameMapNode*)rdi_data_from_dsec(p, mapptr->node_data_idx, sizeof(RDI_NameMapNode), RDI_DataSectionTag_NameMapNodes, &out->node_count);
|
||||
RDI_U64 all_buckets_count = 0;
|
||||
RDI_NameMapBucket *all_buckets = rdi_table_from_name(rdi, NameMapBuckets, &all_buckets_count);
|
||||
RDI_U64 all_nodes_count = 0;
|
||||
RDI_NameMapNode *all_nodes = rdi_table_from_name(rdi, NameMapNodes, &all_nodes_count);
|
||||
out->buckets = all_buckets+mapptr->bucket_base_idx;
|
||||
out->nodes = all_nodes+mapptr->node_base_idx;
|
||||
out->bucket_count = mapptr->bucket_count;
|
||||
out->node_count = mapptr->node_count;
|
||||
if(mapptr->bucket_base_idx > all_buckets_count)
|
||||
{
|
||||
out->buckets = 0;
|
||||
out->bucket_count = 0;
|
||||
}
|
||||
if(mapptr->node_base_idx > all_nodes_count)
|
||||
{
|
||||
out->nodes = 0;
|
||||
out->node_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,49 +495,20 @@ rdi_matches_from_map_node(RDI_Parsed *p, RDI_NameMapNode *node, RDI_U32 *n_out)
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ High-Level Composite Lookup Functions
|
||||
|
||||
//- procedures
|
||||
|
||||
RDI_PROC RDI_U64
|
||||
rdi_first_voff_from_proc(RDI_Parsed *p, RDI_U32 proc_id)
|
||||
rdi_first_voff_from_proc_idx(RDI_Parsed *rdi, RDI_U32 proc_idx)
|
||||
{
|
||||
RDI_U64 result = 0;
|
||||
if(0 < proc_id && proc_id < p->procedures_count)
|
||||
{
|
||||
RDI_Procedure *proc = p->procedures + proc_id;
|
||||
RDI_U32 scope_id = proc->root_scope_idx;
|
||||
if(0 < scope_id && scope_id < p->scopes_count)
|
||||
{
|
||||
RDI_Scope *scope = p->scopes + scope_id;
|
||||
if(scope->voff_range_first < scope->voff_range_opl && scope->voff_range_first < p->scope_voffs_count)
|
||||
{
|
||||
result = p->scope_voffs[scope->voff_range_first];
|
||||
}
|
||||
}
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, proc_idx);
|
||||
RDI_Scope *scope = rdi_element_from_name_idx(rdi, Scopes, procedure->root_scope_idx);
|
||||
RDI_U64 *voffs = rdi_element_from_name_idx(rdi, ScopeVOffData, scope->voff_range_first);
|
||||
result = *voffs;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ Parser Helpers
|
||||
|
||||
RDI_PROC void*
|
||||
rdi_data_from_dsec(RDI_Parsed *parsed, RDI_U32 idx, RDI_U32 item_size, RDI_DataSectionTag expected_tag, RDI_U64 *count_out)
|
||||
{
|
||||
void *result = 0;
|
||||
RDI_U32 count_result = 0;
|
||||
if(0 < idx && idx < parsed->dsec_count)
|
||||
{
|
||||
RDI_DataSection *ds = parsed->dsecs + idx;
|
||||
if(ds->tag == expected_tag)
|
||||
{
|
||||
RDI_U64 encoded_opl = ds->off + ds->encoded_size;
|
||||
if(encoded_opl <= parsed->raw_data_size)
|
||||
{
|
||||
count_result = ds->unpacked_size/item_size;
|
||||
result = (parsed->raw_data + ds->off);
|
||||
}
|
||||
}
|
||||
}
|
||||
*count_out = count_result;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -19,83 +19,17 @@ typedef enum RDI_ParseStatus
|
||||
RDI_ParseStatus_HeaderDoesNotMatch = 1,
|
||||
RDI_ParseStatus_UnsupportedVersionNumber = 2,
|
||||
RDI_ParseStatus_InvalidDataSecionLayout = 3,
|
||||
RDI_ParseStatus_MissingStringDataSection = 4,
|
||||
RDI_ParseStatus_MissingStringTableSection = 5,
|
||||
RDI_ParseStatus_MissingIndexRunSection = 6,
|
||||
RDI_ParseStatus_MissingRequiredSection = 4,
|
||||
}
|
||||
RDI_ParseStatus;
|
||||
|
||||
typedef struct RDI_Parsed RDI_Parsed;
|
||||
struct RDI_Parsed
|
||||
{
|
||||
// raw data & primary data sections
|
||||
RDI_U8 *raw_data;
|
||||
RDI_U64 raw_data_size;
|
||||
RDI_DataSection *dsecs;
|
||||
RDI_U64 dsec_count;
|
||||
RDI_U32 dsec_idx[RDI_DataSectionTag_PRIMARY_COUNT];
|
||||
|
||||
// parsed universal data structures (strings, index runs)
|
||||
RDI_U8* string_data;
|
||||
RDI_U64 string_data_size;
|
||||
RDI_U32* string_offs;
|
||||
RDI_U64 string_count;
|
||||
RDI_U32* idx_run_data;
|
||||
RDI_U32 idx_run_count;
|
||||
|
||||
// extracted info & tables (any of these may be empty or null, even with a successful parse)
|
||||
RDI_TopLevelInfo* top_level_info;
|
||||
RDI_BinarySection* binary_sections;
|
||||
RDI_U64 binary_sections_count;
|
||||
RDI_FilePathNode* file_paths;
|
||||
RDI_U64 file_paths_count;
|
||||
RDI_SourceFile* source_files;
|
||||
RDI_U64 source_files_count;
|
||||
RDI_LineTable* line_tables;
|
||||
RDI_U64 line_tables_count;
|
||||
RDI_SourceLineMap* source_line_maps;
|
||||
RDI_U64 source_line_maps_count;
|
||||
RDI_U64* line_info_voffs;
|
||||
RDI_U64 line_info_voffs_count;
|
||||
RDI_Line* line_info_lines;
|
||||
RDI_U64 line_info_lines_count;
|
||||
RDI_Column* line_info_columns;
|
||||
RDI_U64 line_info_columns_count;
|
||||
RDI_Unit* units;
|
||||
RDI_U64 units_count;
|
||||
RDI_VMapEntry* unit_vmap;
|
||||
RDI_U64 unit_vmap_count;
|
||||
RDI_TypeNode* type_nodes;
|
||||
RDI_U64 type_nodes_count;
|
||||
RDI_UDT* udts;
|
||||
RDI_U64 udts_count;
|
||||
RDI_Member* members;
|
||||
RDI_U64 members_count;
|
||||
RDI_EnumMember* enum_members;
|
||||
RDI_U64 enum_members_count;
|
||||
RDI_GlobalVariable* global_variables;
|
||||
RDI_U64 global_variables_count;
|
||||
RDI_VMapEntry* global_vmap;
|
||||
RDI_U64 global_vmap_count;
|
||||
RDI_ThreadVariable* thread_variables;
|
||||
RDI_U64 thread_variables_count;
|
||||
RDI_Procedure* procedures;
|
||||
RDI_U64 procedures_count;
|
||||
RDI_Scope* scopes;
|
||||
RDI_U64 scopes_count;
|
||||
RDI_U64* scope_voffs;
|
||||
RDI_U64 scope_voffs_count;
|
||||
RDI_VMapEntry* scope_vmap;
|
||||
RDI_U64 scope_vmap_count;
|
||||
RDI_Local* locals;
|
||||
RDI_U64 locals_count;
|
||||
RDI_LocationBlock* location_blocks;
|
||||
RDI_U64 location_blocks_count;
|
||||
RDI_U8* location_data;
|
||||
RDI_U64 location_data_size;
|
||||
RDI_NameMap* name_maps;
|
||||
RDI_U64 name_maps_count;
|
||||
RDI_NameMap* name_maps_by_kind[RDI_NameMapKind_COUNT];
|
||||
RDI_Section *sections;
|
||||
RDI_U64 sections_count;
|
||||
};
|
||||
|
||||
typedef struct RDI_ParsedLineTable RDI_ParsedLineTable;
|
||||
@@ -142,29 +76,31 @@ struct RDI_ParsedNameMap
|
||||
////////////////////////////////
|
||||
//~ Global Nils
|
||||
|
||||
#if !defined(RDI_DISABLE_NILS)
|
||||
static RDI_TopLevelInfo rdi_top_level_info_nil = {0};
|
||||
static RDI_BinarySection rdi_binary_section_nil = {0};
|
||||
static RDI_FilePathNode rdi_file_path_node_nil = {0};
|
||||
static RDI_SourceFile rdi_source_file_nil = {0};
|
||||
static RDI_LineTable rdi_line_table_nil = {0};
|
||||
static RDI_SourceLineMap rdi_source_line_map_nil = {0};
|
||||
static RDI_Line rdi_line_nil = {0};
|
||||
static RDI_Column rdi_column_nil = {0};
|
||||
static RDI_Unit rdi_unit_nil = {0};
|
||||
static RDI_VMapEntry rdi_vmap_entry_nil = {0};
|
||||
static RDI_TypeNode rdi_type_node_nil = {0};
|
||||
static RDI_UDT rdi_udt_nil = {0};
|
||||
static RDI_Member rdi_member_nil = {0};
|
||||
static RDI_EnumMember rdi_enum_member_nil = {0};
|
||||
static RDI_GlobalVariable rdi_global_variable_nil = {0};
|
||||
static RDI_ThreadVariable rdi_thread_variable_nil = {0};
|
||||
static RDI_Procedure rdi_procedure_nil = {0};
|
||||
static RDI_Scope rdi_scope_nil = {0};
|
||||
static RDI_U64 rdi_voff_nil = 0;
|
||||
static RDI_LocationBlock rdi_location_block_nil = {0};
|
||||
static RDI_Local rdi_local_nil = {0};
|
||||
#endif
|
||||
static union
|
||||
{
|
||||
RDI_TopLevelInfo top_level_info;
|
||||
RDI_BinarySection binary_section;
|
||||
RDI_FilePathNode file_path_node;
|
||||
RDI_SourceFile source_file;
|
||||
RDI_LineTable line_table;
|
||||
RDI_SourceLineMap source_line_map;
|
||||
RDI_Line line;
|
||||
RDI_Column column;
|
||||
RDI_Unit unit;
|
||||
RDI_VMapEntry vmap_entry;
|
||||
RDI_TypeNode type_node;
|
||||
RDI_UDT udt;
|
||||
RDI_Member member;
|
||||
RDI_EnumMember enum_member;
|
||||
RDI_GlobalVariable global_variable;
|
||||
RDI_ThreadVariable thread_variable;
|
||||
RDI_Procedure procedure;
|
||||
RDI_Scope scope;
|
||||
RDI_U64 voff;
|
||||
RDI_LocationBlock location_block;
|
||||
RDI_Local local;
|
||||
}
|
||||
rdi_nil_element_union = {0};
|
||||
|
||||
////////////////////////////////
|
||||
//~ Top-Level Parsing API
|
||||
@@ -172,28 +108,32 @@ static RDI_Local rdi_local_nil = {0};
|
||||
RDI_PROC RDI_ParseStatus rdi_parse(RDI_U8 *data, RDI_U64 size, RDI_Parsed *out);
|
||||
|
||||
////////////////////////////////
|
||||
//~ Parsed Info Extraction Helpers
|
||||
//~ Base Parsed Info Extraction Helpers
|
||||
|
||||
//- element extractor
|
||||
#define rdi_element_from_idx(parsed, name, idx) ((0 <= (idx) && (idx) < (parsed)->name##_count) ? &(parsed)->name[idx] : (parsed)->name ? &(parsed)->name[0] : 0)
|
||||
//- section table/element raw data extraction
|
||||
RDI_PROC void *rdi_section_raw_data_from_kind(RDI_Parsed *rdi, RDI_SectionKind kind, RDI_SectionEncoding *encoding_out, RDI_U64 *size_out);
|
||||
RDI_PROC void *rdi_section_raw_table_from_kind(RDI_Parsed *rdi, RDI_SectionKind kind, RDI_U64 *count_out);
|
||||
RDI_PROC void *rdi_section_raw_element_from_kind_idx(RDI_Parsed *rdi, RDI_SectionKind kind, RDI_U64 idx);
|
||||
#define rdi_table_from_name(rdi, name, count_out) (RDI_SectionElementType_##name *)rdi_section_raw_table_from_kind((rdi), RDI_SectionKind_##name, (count_out))
|
||||
#define rdi_element_from_name_idx(rdi, name, idx) (RDI_SectionElementType_##name *)rdi_section_raw_element_from_kind_idx((rdi), RDI_SectionKind_##name, (idx))
|
||||
|
||||
//- top-level info
|
||||
//- info about whole parse
|
||||
RDI_PROC RDI_U64 rdi_decompressed_size_from_parsed(RDI_Parsed *rdi);
|
||||
|
||||
//- strings
|
||||
RDI_PROC RDI_U8 *rdi_string_from_idx(RDI_Parsed *parsed, RDI_U32 idx, RDI_U64 *len_out);
|
||||
RDI_PROC RDI_U8 *rdi_string_from_idx(RDI_Parsed *rdi, RDI_U32 idx, RDI_U64 *len_out);
|
||||
|
||||
//- index runs
|
||||
RDI_PROC RDI_U32 *rdi_idx_run_from_first_count(RDI_Parsed *parsed, RDI_U32 first, RDI_U32 raw_count, RDI_U32 *n_out);
|
||||
RDI_PROC RDI_U32 *rdi_idx_run_from_first_count(RDI_Parsed *rdi, RDI_U32 raw_first, RDI_U32 raw_count, RDI_U32 *n_out);
|
||||
|
||||
//- line info
|
||||
RDI_PROC void rdi_parsed_from_line_table(RDI_Parsed *p, RDI_LineTable *line_table, RDI_ParsedLineTable *out);
|
||||
RDI_PROC void rdi_parsed_from_line_table(RDI_Parsed *rdi, RDI_LineTable *line_table, RDI_ParsedLineTable *out);
|
||||
RDI_PROC RDI_U64 rdi_line_info_idx_from_voff(RDI_ParsedLineTable *line_info, RDI_U64 voff);
|
||||
RDI_PROC void rdi_parsed_from_source_line_map(RDI_Parsed *p, RDI_SourceLineMap *map, RDI_ParsedSourceLineMap *out);
|
||||
RDI_PROC void rdi_parsed_from_source_line_map(RDI_Parsed *rdi, RDI_SourceLineMap *map, RDI_ParsedSourceLineMap *out);
|
||||
RDI_PROC RDI_U64 *rdi_line_voffs_from_num(RDI_ParsedSourceLineMap *map, RDI_U32 linenum, RDI_U32 *n_out);
|
||||
|
||||
//- vmap lookups
|
||||
RDI_PROC RDI_U64 rdi_vmap_idx_from_voff(RDI_VMapEntry *vmap, RDI_U32 vmap_count, RDI_U64 voff);
|
||||
RDI_PROC RDI_U64 rdi_vmap_idx_from_voff(RDI_VMapEntry *vmap, RDI_U64 vmap_count, RDI_U64 voff);
|
||||
|
||||
//- name maps
|
||||
RDI_PROC RDI_NameMap *rdi_name_map_from_kind(RDI_Parsed *p, RDI_NameMapKind kind);
|
||||
@@ -201,16 +141,15 @@ RDI_PROC void rdi_name_map_parse(RDI_Parsed* p, RDI_NameMap *mapptr, RDI_ParsedN
|
||||
RDI_PROC RDI_NameMapNode *rdi_name_map_lookup(RDI_Parsed *p, RDI_ParsedNameMap *map, RDI_U8 *str, RDI_U64 len);
|
||||
RDI_PROC RDI_U32 *rdi_matches_from_map_node(RDI_Parsed *p, RDI_NameMapNode *node, RDI_U32 *n_out);
|
||||
|
||||
////////////////////////////////
|
||||
//~ High-Level Composite Lookup Functions
|
||||
|
||||
//- procedures
|
||||
RDI_PROC RDI_U64 rdi_first_voff_from_proc(RDI_Parsed *p, RDI_U32 proc_id);
|
||||
RDI_PROC RDI_U64 rdi_first_voff_from_proc_idx(RDI_Parsed *rdi, RDI_U32 proc_idx);
|
||||
|
||||
////////////////////////////////
|
||||
//~ Parser Helpers
|
||||
|
||||
#define rdi_parse__min(a,b) (((a)<(b))?(a):(b))
|
||||
#define rdi_parse__extract_primary(p,outptr,outn,pritag) \
|
||||
( (*(void**)&(outptr)) = \
|
||||
rdi_data_from_dsec((p),(p)->dsec_idx[pritag],sizeof(*(outptr)),(pritag),(outn)) )
|
||||
RDI_PROC void *rdi_data_from_dsec(RDI_Parsed *p, RDI_U32 idx, RDI_U32 item_size, RDI_DataSectionTag expected_tag, RDI_U64 *n_out);
|
||||
|
||||
#endif // RDI_FORMAT_PARSE_H
|
||||
|
||||
Reference in New Issue
Block a user