mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 13:58:40 +00:00
codeview: inline binary annot format and decode helpers
This commit is contained in:
committed by
Ryan Fleury
parent
8319850666
commit
db737941d8
@@ -165,6 +165,74 @@ cv_f64_from_numeric(CV_NumericParsed *num){
|
|||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ Inline Binary Annotation Helpers
|
||||||
|
|
||||||
|
internal U64
|
||||||
|
cv_decode_inline_annot_u32(String8 data, U64 offset, U32 *out_value)
|
||||||
|
{
|
||||||
|
U32 value;
|
||||||
|
|
||||||
|
U64 cursor = offset;
|
||||||
|
|
||||||
|
U8 header = 0;
|
||||||
|
cursor += str8_deserial_read_struct(data, cursor, &header);
|
||||||
|
|
||||||
|
// 1 byte
|
||||||
|
if((header & 0x80) == 0)
|
||||||
|
{
|
||||||
|
value = header;
|
||||||
|
}
|
||||||
|
// 2 bytes
|
||||||
|
else if((header & 0xC0) == 0x80)
|
||||||
|
{
|
||||||
|
Assert(cursor + sizeof(U8) * 2 <= data.size);
|
||||||
|
U8 second_byte;
|
||||||
|
cursor += str8_deserial_read_struct(data, cursor, &second_byte);
|
||||||
|
value = ((header & 0x3F) << 8) | second_byte;
|
||||||
|
}
|
||||||
|
// 4 bytes
|
||||||
|
else if((header & 0xE0) == 0xC0)
|
||||||
|
{
|
||||||
|
Assert(cursor + sizeof(U8) * 3 <= data.size);
|
||||||
|
U8 second_byte, third_byte, fourth_byte;
|
||||||
|
cursor += str8_deserial_read_struct(data, cursor, &second_byte);
|
||||||
|
cursor += str8_deserial_read_struct(data, cursor, &third_byte);
|
||||||
|
cursor += str8_deserial_read_struct(data, cursor, &fourth_byte);
|
||||||
|
value = (((U32)header & 0x1F) << 24) | ((U32)second_byte << 16) | ((U32)third_byte << 8) | (U32)fourth_byte;
|
||||||
|
}
|
||||||
|
// bad encode
|
||||||
|
else if((header & 0xE0) == 0xE0)
|
||||||
|
{
|
||||||
|
value = max_U32;
|
||||||
|
}
|
||||||
|
|
||||||
|
*out_value = value;
|
||||||
|
|
||||||
|
U64 read_size = cursor - offset;
|
||||||
|
return read_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal U64
|
||||||
|
cv_decode_inline_annot_s32(String8 data, U64 offset, S32 *out_value)
|
||||||
|
{
|
||||||
|
U32 value;
|
||||||
|
|
||||||
|
U64 read_size = cv_decode_inline_annot_u32(data, offset, &value);
|
||||||
|
|
||||||
|
if(value & 1)
|
||||||
|
{
|
||||||
|
value = -(value >> 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value = value >> 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*out_value = (S32)value;
|
||||||
|
|
||||||
|
return read_size;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ CodeView Sym Parser Functions
|
//~ CodeView Sym Parser Functions
|
||||||
|
|||||||
+45
-13
@@ -1761,13 +1761,51 @@ struct CV_SymBuildInfo
|
|||||||
|
|
||||||
//- (SymKind: INLINESITE)
|
//- (SymKind: INLINESITE)
|
||||||
|
|
||||||
|
typedef U32 CV_InlineBinaryAnnotaiton;
|
||||||
|
typedef enum CV_InlineBinaryAnnotationenum
|
||||||
|
{
|
||||||
|
CV_InlineBinaryAnnotation_Null,
|
||||||
|
CV_InlineBinaryAnnotation_CodeOffset,
|
||||||
|
CV_InlineBinaryAnnotation_ChangeCodeOffsetBase,
|
||||||
|
CV_InlineBinaryAnnotation_ChangeCodeOffset,
|
||||||
|
CV_InlineBinaryAnnotation_ChangeCodeLength,
|
||||||
|
CV_InlineBinaryAnnotation_ChnageFile,
|
||||||
|
CV_InlineBinaryAnnotation_ChangeLineOffset,
|
||||||
|
CV_InlineBinaryAnnotation_ChnageLineEndDelta,
|
||||||
|
CV_InlineBinaryAnnotation_ChangeRangeKind,
|
||||||
|
CV_InlineBinaryAnnotation_ChangeColumnStart,
|
||||||
|
CV_InlineBinaryAnnotation_ChangeColumnEndDelta,
|
||||||
|
CV_InlineBinaryAnnotation_ChangeCodeOffsetAndLineOffset,
|
||||||
|
CV_InlineBinaryAnnotation_ChangeCodeLengthAndCodeOffset,
|
||||||
|
CV_InlineBinaryAnnotaiton_ChangeColumnEnd
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef U32 CV_InlineRangeKind;
|
||||||
|
typedef enum CV_InlnineRangeKindEnum
|
||||||
|
{
|
||||||
|
CV_InlineRangeKind_Expr,
|
||||||
|
CV_InlineRangeKind_Stmt
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct CV_SymInlineSite CV_SymInlineSite;
|
typedef struct CV_SymInlineSite CV_SymInlineSite;
|
||||||
struct CV_SymInlineSite
|
struct CV_SymInlineSite
|
||||||
{
|
{
|
||||||
U32 parent;
|
U32 parent;
|
||||||
U32 end;
|
U32 end;
|
||||||
CV_ItemId inlinee;
|
CV_ItemId inlinee;
|
||||||
// CV_BinaryAnnotation annotations (rest of data)
|
// U8 annotations[] (rest of data)
|
||||||
|
};
|
||||||
|
|
||||||
|
//- (SymKind: INLINESITE2)
|
||||||
|
|
||||||
|
typedef struct CV_SymInlineSite2 CV_SymInlineSite2;
|
||||||
|
struct CV_SymInlineSite2
|
||||||
|
{
|
||||||
|
U32 parent_off;
|
||||||
|
U32 end_off;
|
||||||
|
CV_ItemId inlinee;
|
||||||
|
U32 invocations;
|
||||||
|
// U8 annotations[] (rest of data)
|
||||||
};
|
};
|
||||||
|
|
||||||
//- (SymKind: INLINESITE_END) (empty)
|
//- (SymKind: INLINESITE_END) (empty)
|
||||||
@@ -1835,18 +1873,6 @@ struct CV_SymPogoInfo
|
|||||||
U32 post_inline_static_inst_count;
|
U32 post_inline_static_inst_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
//- (SymKind: INLINESITE2)
|
|
||||||
|
|
||||||
typedef struct CV_SymInlineSite2 CV_SymInlineSite2;
|
|
||||||
struct CV_SymInlineSite2
|
|
||||||
{
|
|
||||||
U32 parent_off;
|
|
||||||
U32 end_off;
|
|
||||||
CV_ItemId inlinee;
|
|
||||||
U32 invocations;
|
|
||||||
// CV_BinaryAnnotation annotations (rest of data)
|
|
||||||
};
|
|
||||||
|
|
||||||
//- (SymKind: HEAPALLOCSITE)
|
//- (SymKind: HEAPALLOCSITE)
|
||||||
|
|
||||||
typedef struct CV_SymHeapAllocSite CV_SymHeapAllocSite;
|
typedef struct CV_SymHeapAllocSite CV_SymHeapAllocSite;
|
||||||
@@ -2905,6 +2931,12 @@ internal U64 cv_u64_from_numeric(CV_NumericParsed *num);
|
|||||||
internal S64 cv_s64_from_numeric(CV_NumericParsed *num);
|
internal S64 cv_s64_from_numeric(CV_NumericParsed *num);
|
||||||
internal F64 cv_f64_from_numeric(CV_NumericParsed *num);
|
internal F64 cv_f64_from_numeric(CV_NumericParsed *num);
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ Inline Binary Annotation Helpers
|
||||||
|
|
||||||
|
internal U64 cv_decode_inline_annot_u32(String8 data, U64 offset, U32 *out_value);
|
||||||
|
internal U64 cv_decode_inline_annot_s32(String8 data, U64 offset, S32 *out_value);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ CodeView Sym/Leaf Parser Functions
|
//~ CodeView Sym/Leaf Parser Functions
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user