Project

General

Profile

RE: Minimal possible debug information ยป type.patch

Florian Negele, 01 July 2024 14:56

View differences:

asmgenerator.cpp
break;
case Code::Instruction::ARRAY:
Declare ({Debugging::Type::Array, instruction.operand2.size}).index = instruction.operand1.size;
DeclareCompound ({Debugging::Type::Array, instruction.operand2.size}).index = instruction.operand1.size;
break;
case Code::Instruction::REC:
......
break;
case Code::Instruction::PTR:
Declare (Debugging::Type::Pointer);
DeclareCompound (Debugging::Type::Pointer);
break;
case Code::Instruction::REF:
Declare (Debugging::Type::Reference);
DeclareCompound (Debugging::Type::Reference);
break;
case Code::Instruction::FUNC:
declarations.emplace_back (currentInstruction + instruction.operand1.offset, Declare (Debugging::Type::Function));
declarations.emplace_back (currentInstruction + instruction.operand1.offset, DeclareCompound (Debugging::Type::Function));
break;
case Code::Instruction::ENUM:
declarations.emplace_back (currentInstruction + instruction.operand1.offset, Declare (Debugging::Type::Enumeration));
declarations.emplace_back (currentInstruction + instruction.operand1.offset, DeclareCompound (Debugging::Type::Enumeration));
break;
default:
......
{
if (IsCode (section->type)) AddTypeableEntry (Debugging::Entry::Code); else if (IsData (section->type)) AddTypeableEntry (Debugging::Entry::Data);
if (types.empty ()) if (!declarations.empty () && IsFunction (*declarations.back ().type)) types.push_back (&declarations.back ().type->subtypes.emplace_back ()); else EmitError ("invalid type declaration");
auto& result = *types.back (); result = std::move (type); types.pop_back (); for (auto& subtype: Reverse {result.subtypes}) types.push_back (&subtype); return result;
auto& result = *types.back (); result = std::move (type); types.pop_back (); return result;
}
Debugging::Type& Context::DeclareCompound (Debugging::Type&& type)
{
assert (IsCompound (type)); auto& result = Declare (std::move (type)); for (auto& subtype: Reverse {result.subtypes}) types.push_back (&subtype); return result;
}
void Context::AddEntry (const Debugging::Entry::Model model)
{
if (!entry) entry = &information.entries.emplace_back (model, section->name), entry->size = 0;
......
case Code::Type::Pointer:
return {Debugging::Type::Pointer, 0, Debugging::Type::Void};
case Code::Type::Function:
return {Debugging::Type::Pointer, 0, Debugging::Type::Function};
return {Debugging::Type::Pointer, 0, {Debugging::Type::Function, 0, Debugging::Type::Void}};
default:
assert (Code::Type::Unreachable);
}
asmgeneratorcontext.hpp
Debugging::Index Insert (const Source&);
Debugging::Type& Declare (Debugging::Type&&);
Debugging::Type& DeclareCompound (Debugging::Type&&);
virtual auto Acquire (Code::Register, const Types&) -> void {}
virtual auto FixupInstruction (Span<Byte>, const Byte*, FixupCode) const -> void {}
    (1-1/1)