Shrinking debug info.

This commit is contained in:
Ben Vanik 2015-05-03 22:53:03 -07:00
parent 00c1b5fbbc
commit 0f14575592
4 changed files with 9 additions and 9 deletions

View File

@ -104,8 +104,8 @@ void X64Assembler::DumpMachineCode(DebugInfo* debug_info, void* machine_code,
uint64_t prev_source_offset = 0;
while (disasm.EIP < eip_end) {
// Look up source offset.
auto map_entry =
debug_info->LookupCodeOffset(disasm.EIP - (BE::UIntPtr)machine_code);
auto map_entry = debug_info->LookupCodeOffset(
static_cast<uint32_t>(disasm.EIP - (BE::UIntPtr)machine_code));
if (map_entry) {
if (map_entry->source_offset == prev_source_offset) {
str->Append(" ");

View File

@ -211,7 +211,7 @@ void X64Emitter::MarkSourceOffset(const Instr* i) {
auto entry = source_map_arena_.Alloc<SourceMapEntry>();
entry->source_offset = static_cast<uint32_t>(i->src1.offset);
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_++;
}

View File

@ -49,7 +49,7 @@ SourceMapEntry* DebugInfo::LookupSourceOffset(uint32_t offset) {
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.
for (size_t n = 0; n < source_map_count_; n++) {
auto entry = &source_map_[n];
@ -60,7 +60,7 @@ SourceMapEntry* DebugInfo::LookupHIROffset(uint64_t offset) {
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.
for (int64_t n = source_map_count_ - 1; n >= 0; n--) {
auto entry = &source_map_[n];

View File

@ -29,8 +29,8 @@ enum DebugInfoFlags {
typedef struct SourceMapEntry_s {
uint32_t source_offset; // Original source address/offset.
uint64_t hir_offset; // Block ordinal (16b) | Instr ordinal (16b)
uint64_t code_offset; // Offset from emitted code start.
uint32_t hir_offset; // Block ordinal (16b) | Instr ordinal (16b)
uint32_t code_offset; // Offset from emitted code start.
} SourceMapEntry;
class DebugInfo {
@ -49,8 +49,8 @@ class DebugInfo {
void InitializeSourceMap(size_t source_map_count, SourceMapEntry* source_map);
SourceMapEntry* LookupSourceOffset(uint32_t offset);
SourceMapEntry* LookupHIROffset(uint64_t offset);
SourceMapEntry* LookupCodeOffset(uint64_t offset);
SourceMapEntry* LookupHIROffset(uint32_t offset);
SourceMapEntry* LookupCodeOffset(uint32_t offset);
private:
char* source_disasm_;