OptDcl []*ir.Name
// Filled in by the user. Translates Block and Value ID to PC.
- GetPC func(ID, ID) int64
+ //
+ // NOTE: block is only used if value is BlockStart.ID or BlockEnd.ID.
+ // Otherwise, it is ignored.
+ GetPC func(block, value ID) int64
}
type BlockDebug struct {
// Flush any leftover entries live at the end of the last block.
for varID := range state.lists {
- state.writePendingEntry(VarID(varID), state.f.Blocks[len(state.f.Blocks)-1].ID, FuncEnd.ID)
+ state.writePendingEntry(VarID(varID), -1, FuncEnd.ID)
list := state.lists[varID]
if state.loggingLevel > 0 {
if len(list) == 0 {
for i, b := range f.Blocks {
idToIdx[b.ID] = i
}
- // Note that at this moment, Prog.Pc is a sequence number; it's
- // not a real PC until after assembly, so this mapping has to
- // be done later.
+ // Register a callback that will be used later to fill in PCs into location
+ // lists. At the moment, Prog.Pc is a sequence number; it's not a real PC
+ // until after assembly, so the translation needs to be deferred.
debugInfo.GetPC = func(b, v ssa.ID) int64 {
switch v {
case ssa.BlockStart.ID: