mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
Shrinking debug info.
This commit is contained in:
parent
00c1b5fbbc
commit
0f14575592
|
|
@ -104,8 +104,8 @@ void X64Assembler::DumpMachineCode(DebugInfo* debug_info, void* machine_code,
|
||||||
uint64_t prev_source_offset = 0;
|
uint64_t prev_source_offset = 0;
|
||||||
while (disasm.EIP < eip_end) {
|
while (disasm.EIP < eip_end) {
|
||||||
// Look up source offset.
|
// Look up source offset.
|
||||||
auto map_entry =
|
auto map_entry = debug_info->LookupCodeOffset(
|
||||||
debug_info->LookupCodeOffset(disasm.EIP - (BE::UIntPtr)machine_code);
|
static_cast<uint32_t>(disasm.EIP - (BE::UIntPtr)machine_code));
|
||||||
if (map_entry) {
|
if (map_entry) {
|
||||||
if (map_entry->source_offset == prev_source_offset) {
|
if (map_entry->source_offset == prev_source_offset) {
|
||||||
str->Append(" ");
|
str->Append(" ");
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ void X64Emitter::MarkSourceOffset(const Instr* i) {
|
||||||
auto entry = source_map_arena_.Alloc<SourceMapEntry>();
|
auto entry = source_map_arena_.Alloc<SourceMapEntry>();
|
||||||
entry->source_offset = static_cast<uint32_t>(i->src1.offset);
|
entry->source_offset = static_cast<uint32_t>(i->src1.offset);
|
||||||
entry->hir_offset = uint32_t(i->block->ordinal << 16) | i->ordinal;
|
entry->hir_offset = uint32_t(i->block->ordinal << 16) | i->ordinal;
|
||||||
entry->code_offset = getSize();
|
entry->code_offset = static_cast<uint32_t>(getSize());
|
||||||
source_map_count_++;
|
source_map_count_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ SourceMapEntry* DebugInfo::LookupSourceOffset(uint32_t offset) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceMapEntry* DebugInfo::LookupHIROffset(uint64_t offset) {
|
SourceMapEntry* DebugInfo::LookupHIROffset(uint32_t offset) {
|
||||||
// TODO(benvanik): binary search? We know the list is sorted by code order.
|
// TODO(benvanik): binary search? We know the list is sorted by code order.
|
||||||
for (size_t n = 0; n < source_map_count_; n++) {
|
for (size_t n = 0; n < source_map_count_; n++) {
|
||||||
auto entry = &source_map_[n];
|
auto entry = &source_map_[n];
|
||||||
|
|
@ -60,7 +60,7 @@ SourceMapEntry* DebugInfo::LookupHIROffset(uint64_t offset) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceMapEntry* DebugInfo::LookupCodeOffset(uint64_t offset) {
|
SourceMapEntry* DebugInfo::LookupCodeOffset(uint32_t offset) {
|
||||||
// TODO(benvanik): binary search? We know the list is sorted by code order.
|
// TODO(benvanik): binary search? We know the list is sorted by code order.
|
||||||
for (int64_t n = source_map_count_ - 1; n >= 0; n--) {
|
for (int64_t n = source_map_count_ - 1; n >= 0; n--) {
|
||||||
auto entry = &source_map_[n];
|
auto entry = &source_map_[n];
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ enum DebugInfoFlags {
|
||||||
|
|
||||||
typedef struct SourceMapEntry_s {
|
typedef struct SourceMapEntry_s {
|
||||||
uint32_t source_offset; // Original source address/offset.
|
uint32_t source_offset; // Original source address/offset.
|
||||||
uint64_t hir_offset; // Block ordinal (16b) | Instr ordinal (16b)
|
uint32_t hir_offset; // Block ordinal (16b) | Instr ordinal (16b)
|
||||||
uint64_t code_offset; // Offset from emitted code start.
|
uint32_t code_offset; // Offset from emitted code start.
|
||||||
} SourceMapEntry;
|
} SourceMapEntry;
|
||||||
|
|
||||||
class DebugInfo {
|
class DebugInfo {
|
||||||
|
|
@ -49,8 +49,8 @@ class DebugInfo {
|
||||||
|
|
||||||
void InitializeSourceMap(size_t source_map_count, SourceMapEntry* source_map);
|
void InitializeSourceMap(size_t source_map_count, SourceMapEntry* source_map);
|
||||||
SourceMapEntry* LookupSourceOffset(uint32_t offset);
|
SourceMapEntry* LookupSourceOffset(uint32_t offset);
|
||||||
SourceMapEntry* LookupHIROffset(uint64_t offset);
|
SourceMapEntry* LookupHIROffset(uint32_t offset);
|
||||||
SourceMapEntry* LookupCodeOffset(uint64_t offset);
|
SourceMapEntry* LookupCodeOffset(uint32_t offset);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char* source_disasm_;
|
char* source_disasm_;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue