mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-10-06 07:55:42 +00:00
major clean-up pass over unwinding/module-info abstraction, + usage in the debug engine. simplified / cleaned up DWARF helpers for unwind info & expressions. decoupling unwinding / DWARF evaluation from memory read callbacks. light module info now prepared by demon layer - debug engine no longer duplicates per-backend parsing. unwind abstraction layer now does thin abstraction over unwinding backends, debug engine only calls abstraction. clean up demon to have fewer ad-hoc 'queries' on handles, and prefer sending info over debug events when possible / when it fits the usage pattern. move DWARF enum specifications to metacode, generate enums/xlists/tables/etc. decouple raddbg/radbin completely from old parsing helpers. replace portion of DWARF dumping; pull out some new parsing helpers from converter / dumper.
This commit is contained in:
+72
-27
@@ -1476,7 +1476,7 @@ str8_from_version(Arena *arena, U64 version)
|
||||
//~ rjf: String Path Helpers
|
||||
|
||||
internal String8
|
||||
default_exe_name_suffix_from_os(OperatingSystem os)
|
||||
program_ext_postfix_from_os(OperatingSystem os, B32 require_ext)
|
||||
{
|
||||
String8 result = {0};
|
||||
switch(os)
|
||||
@@ -1486,36 +1486,15 @@ default_exe_name_suffix_from_os(OperatingSystem os)
|
||||
{
|
||||
result = s(".exe");
|
||||
}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
program_data_folder_prefix_from_os(OperatingSystem os)
|
||||
{
|
||||
String8 result = {0};
|
||||
switch(os)
|
||||
{
|
||||
default:{}break;
|
||||
case OperatingSystem_Linux:
|
||||
case OperatingSystem_Mac:
|
||||
if(require_ext)
|
||||
{
|
||||
result = s(".");
|
||||
result = s(".elf");
|
||||
}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
program_ext_postfix_from_os(OperatingSystem os)
|
||||
{
|
||||
String8 result = {0};
|
||||
switch(os)
|
||||
{
|
||||
default:{}break;
|
||||
case OperatingSystem_Windows:
|
||||
case OperatingSystem_Mac:
|
||||
if(require_ext)
|
||||
{
|
||||
result = s(".exe");
|
||||
result = s(".macho");
|
||||
}break;
|
||||
}
|
||||
return result;
|
||||
@@ -3038,6 +3017,72 @@ str8_deserial_read_block(String8 string, U64 off, U64 size, String8 *block_out)
|
||||
return block_out->size;
|
||||
}
|
||||
|
||||
internal U64
|
||||
str8_deserial_read_uleb128(String8 string, U64 off, U64 *value_out)
|
||||
{
|
||||
U64 value = 0;
|
||||
U64 shift = 0;
|
||||
U64 cursor = off;
|
||||
for(;;)
|
||||
{
|
||||
U8 byte = 0;
|
||||
U64 bytes_read = str8_deserial_read_struct(string, cursor, &byte);
|
||||
if(bytes_read != sizeof(byte))
|
||||
{
|
||||
break;
|
||||
}
|
||||
U8 val = byte & 0x7fu;
|
||||
value |= ((U64)val) << shift;
|
||||
cursor += bytes_read;
|
||||
shift += 7u;
|
||||
if((byte & 0x80u) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(value_out != 0)
|
||||
{
|
||||
*value_out = value;
|
||||
}
|
||||
U64 bytes_read = cursor - off;
|
||||
return bytes_read;
|
||||
}
|
||||
|
||||
internal U64
|
||||
str8_deserial_read_sleb128(String8 string, U64 off, S64 *value_out)
|
||||
{
|
||||
U64 value = 0;
|
||||
U64 shift = 0;
|
||||
U64 cursor = off;
|
||||
for(;;)
|
||||
{
|
||||
U8 byte;
|
||||
U64 bytes_read = str8_deserial_read_struct(string, cursor, &byte);
|
||||
if(bytes_read != sizeof(byte))
|
||||
{
|
||||
break;
|
||||
}
|
||||
U8 val = byte & 0x7fu;
|
||||
value |= ((U64)val) << shift;
|
||||
cursor += bytes_read;
|
||||
shift += 7u;
|
||||
if((byte & 0x80u) == 0)
|
||||
{
|
||||
if(shift < sizeof(value) * 8 && (byte & 0x40u) != 0)
|
||||
{
|
||||
value |= -(S64)(1ull << shift);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(value_out != 0)
|
||||
{
|
||||
*value_out = value;
|
||||
}
|
||||
U64 bytes_read = cursor - off;
|
||||
return bytes_read;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
internal int
|
||||
|
||||
Reference in New Issue
Block a user