@@ -64,12 +64,14 @@ func (ctx *fuchsia) ContainsCrash(output []byte) bool {
6464
6565func (ctx * fuchsia ) Parse (output []byte ) * Report {
6666 // We symbolize here because zircon output does not contain even function names.
67- symbolized := ctx .symbolize (output )
67+ symbolized , l2l := ctx .symbolize (output )
6868 rep := simpleLineParser (symbolized , fuchsiaOopses , fuchsiaStackParams , ctx .ignores )
6969 if rep == nil {
7070 return nil
7171 }
7272 rep .Output = output
73+ rep .StartPos = l2l [rep .StartPos ]
74+ rep .EndPos = l2l [rep .EndPos + 1 ] - 1 // EndPos points to '\n'. Mapping has information about the next symbols.
7375 if report := ctx .shortenReport (rep .Report ); len (report ) != 0 {
7476 rep .Report = report
7577 }
@@ -132,14 +134,19 @@ func (ctx *fuchsia) shortenReport(report []byte) []byte {
132134 return out .Bytes ()
133135}
134136
135- func (ctx * fuchsia ) symbolize (output []byte ) []byte {
137+ // symbolize additionally returns the mapping new_line_pos -> old_line_pos.
138+ func (ctx * fuchsia ) symbolize (output []byte ) ([]byte , map [int ]int ) {
139+ l2l := map [int ]int {}
140+ var inPos int
136141 symb := symbolizer .Make (ctx .config .target )
137142 defer symb .Close ()
138143 out := new (bytes.Buffer )
139144
140145 lines := lines (output )
141146 for i := 0 ; i < len (lines ); i ++ {
142147 line := lines [i ]
148+ l2l [out .Len ()] = inPos
149+ inPos += len (line ) + 1
143150 if bytes .Contains (line , zirconAssertFailed ) && len (line ) == 127 {
144151 // This is super hacky: but zircon splits the most important information in long assert lines
145152 // (and they are always long) into several lines in irreversible way. Try to restore full line.
@@ -163,7 +170,7 @@ func (ctx *fuchsia) symbolize(output []byte) []byte {
163170 out .Write (line )
164171 out .WriteByte ('\n' )
165172 }
166- return out .Bytes ()
173+ return out .Bytes (), l2l
167174}
168175
169176func (ctx * fuchsia ) processPC (out * bytes.Buffer , symb symbolizer.Symbolizer ,
0 commit comments