(m SyncMarker)
| 227 | } |
| 228 | |
| 229 | func (w *Encoder) Sync(m SyncMarker) { |
| 230 | if !w.p.SyncMarkers() { |
| 231 | return |
| 232 | } |
| 233 | |
| 234 | // Writing out stack frame string references requires working |
| 235 | // relocations, but writing out the relocations themselves involves |
| 236 | // sync markers. To prevent infinite recursion, we simply trim the |
| 237 | // stack frame for sync markers within the relocation header. |
| 238 | var frames []string |
| 239 | if !w.encodingRelocHeader && w.p.syncFrames > 0 { |
| 240 | pcs := make([]uintptr, w.p.syncFrames) |
| 241 | n := runtime.Callers(2, pcs) |
| 242 | frames = fmtFrames(pcs[:n]...) |
| 243 | } |
| 244 | |
| 245 | // TODO(mdempsky): Save space by writing out stack frames as a |
| 246 | // linked list so we can share common stack frames. |
| 247 | w.rawUvarint(uint64(m)) |
| 248 | w.rawUvarint(uint64(len(frames))) |
| 249 | for _, frame := range frames { |
| 250 | w.rawUvarint(uint64(w.rawReloc(RelocString, w.p.StringIdx(frame)))) |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | // Bool encodes and writes a bool value into the element bitstream, |
| 255 | // and then returns the bool value. |
no test coverage detected