Stream: git-cranelift

Topic: cranelift / Issue #426 Debugging in Cranelift


view this post on Zulip GitHub (Feb 28 2020 at 23:24):

alexcrichton transferred Issue #426:

It's become clear that Cranelift needs the facilities to debug the compiled code.

I propose implementing a trait DebugSink that looks something like this:

trait DebugSink {
  fn insert_inst(&mut self, inst: InstructionData, source_loc: SourceLoc, code_offset: CodeOffset);
  fn insert_func(&mut self, name: String, source_loc: SourceLoc, code_offset: CodeOffset);
}

Once insert_func is called, all instructions afterwards (until another function is inserted) belong to that function.

It could also take on the form of two traits:

trait DebugSinkFunc {
  fn insert_inst(&mut self, inst: InstructionData, source_loc: SourceLoc, code_offset: CodeOffset);
}

trait DebugSink {
  fn insert_func(&mut self, name: String, source_loc: SourceLoc, code_offset: CodeOffset) -> &mut DebugSinkFunc
}

Last updated: Dec 23 2024 at 13:07 UTC