File tree 2 files changed +8
-5
lines changed 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,10 @@ type FuncDebug struct {
42
42
OptDcl []* ir.Name
43
43
44
44
// Filled in by the user. Translates Block and Value ID to PC.
45
- GetPC func (ID , ID ) int64
45
+ //
46
+ // NOTE: block is only used if value is BlockStart.ID or BlockEnd.ID.
47
+ // Otherwise, it is ignored.
48
+ GetPC func (block , value ID ) int64
46
49
}
47
50
48
51
type BlockDebug struct {
@@ -1368,7 +1371,7 @@ func (state *debugState) buildLocationLists(blockLocs []*BlockDebug) {
1368
1371
1369
1372
// Flush any leftover entries live at the end of the last block.
1370
1373
for varID := range state .lists {
1371
- state .writePendingEntry (VarID (varID ), state . f . Blocks [ len ( state . f . Blocks ) - 1 ]. ID , FuncEnd .ID )
1374
+ state .writePendingEntry (VarID (varID ), - 1 , FuncEnd .ID )
1372
1375
list := state .lists [varID ]
1373
1376
if state .loggingLevel > 0 {
1374
1377
if len (list ) == 0 {
Original file line number Diff line number Diff line change @@ -7578,9 +7578,9 @@ func genssa(f *ssa.Func, pp *objw.Progs) {
7578
7578
for i , b := range f .Blocks {
7579
7579
idToIdx [b .ID ] = i
7580
7580
}
7581
- // Note that at this moment, Prog.Pc is a sequence number; it's
7582
- // not a real PC until after assembly, so this mapping has to
7583
- // be done later .
7581
+ // Register a callback that will be used later to fill in PCs into location
7582
+ // lists. At the moment, Prog.Pc is a sequence number; it's not a real PC
7583
+ // until after assembly, so the translation needs to be deferred .
7584
7584
debugInfo .GetPC = func (b , v ssa.ID ) int64 {
7585
7585
switch v {
7586
7586
case ssa .BlockStart .ID :
You can’t perform that action at this time.
0 commit comments