Skip to content

Commit

Permalink
Fix bug where the first map was lost.
Browse files Browse the repository at this point in the history
  • Loading branch information
randall77 committed Nov 8, 2017
1 parent 96a8494 commit b25bc97
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ func Core(coreFile, base string) (*Process, error) {
sort.Slice(p.maps, func(i, j int) bool {
return p.maps[i].min < p.maps[j].min
})
maps := p.maps[1:]
ms := p.maps[1:]
p.maps = p.maps[:1]
for _, m := range maps {
for _, m := range ms {
k := p.maps[len(p.maps)-1]
if m.min == k.max &&
m.perm == k.perm &&
Expand All @@ -49,7 +49,7 @@ func Core(coreFile, base string) (*Process, error) {

// Memory map all the mappings.
pgsize := int64(syscall.Getpagesize())
for _, m := range maps {
for _, m := range p.maps {
size := m.max.Sub(m.min)
if m.f == nil {
// Pretend this is read-as-zero.
Expand Down Expand Up @@ -78,7 +78,7 @@ func Core(coreFile, base string) (*Process, error) {
}

// Build page table for mapping lookup.
for _, m := range maps {
for _, m := range p.maps {
p.addMapping(m)
}

Expand Down

0 comments on commit b25bc97

Please sign in to comment.