diff options
Diffstat (limited to 'src/cmd/internal/dwarf/dwarf.go')
| -rw-r--r-- | src/cmd/internal/dwarf/dwarf.go | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/cmd/internal/dwarf/dwarf.go b/src/cmd/internal/dwarf/dwarf.go index 6ab83639ac..e1a70ef853 100644 --- a/src/cmd/internal/dwarf/dwarf.go +++ b/src/cmd/internal/dwarf/dwarf.go @@ -101,26 +101,26 @@ func EnableLogging(doit bool) { logDwarf = doit } -// UnifyRanges merges the list of ranges of c into the list of ranges of s -func (s *Scope) UnifyRanges(c *Scope) { - out := make([]Range, 0, len(s.Ranges)+len(c.Ranges)) - +// MergeRanges creates a new range list by merging the ranges from +// its two arguments, then returns the new list. +func MergeRanges(in1, in2 []Range) []Range { + out := make([]Range, 0, len(in1)+len(in2)) i, j := 0, 0 for { var cur Range - if i < len(s.Ranges) && j < len(c.Ranges) { - if s.Ranges[i].Start < c.Ranges[j].Start { - cur = s.Ranges[i] + if i < len(in2) && j < len(in1) { + if in2[i].Start < in1[j].Start { + cur = in2[i] i++ } else { - cur = c.Ranges[j] + cur = in1[j] j++ } - } else if i < len(s.Ranges) { - cur = s.Ranges[i] + } else if i < len(in2) { + cur = in2[i] i++ - } else if j < len(c.Ranges) { - cur = c.Ranges[j] + } else if j < len(in1) { + cur = in1[j] j++ } else { break @@ -133,7 +133,12 @@ func (s *Scope) UnifyRanges(c *Scope) { } } - s.Ranges = out + return out +} + +// UnifyRanges merges the ranges from 'c' into the list of ranges for 's'. +func (s *Scope) UnifyRanges(c *Scope) { + s.Ranges = MergeRanges(s.Ranges, c.Ranges) } // AppendRange adds r to s, if r is non-empty. @@ -378,7 +383,7 @@ func expandPseudoForm(form uint8) uint8 { return form } expandedForm := DW_FORM_udata - if objabi.GOOS == "darwin" { + if objabi.GOOS == "darwin" || objabi.GOOS == "ios" { expandedForm = DW_FORM_data4 } return uint8(expandedForm) |
