File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,28 @@ func (p *Process) Mappings() []*Mapping {
77
77
return p .maps
78
78
}
79
79
80
- // Writeable reports whether the address is writeable (by the inferior at the time of the core dump).
80
+ // Readable reports whether the address a is readable.
81
+ func (p * Process ) Readable (a Address ) bool {
82
+ return p .findMapping (a ) != nil
83
+ }
84
+
85
+ // ReadableN reports whether the n bytes starting at address a are readable.
86
+ func (p * Process ) ReadableN (a Address , n int64 ) bool {
87
+ for {
88
+ m := p .findMapping (a )
89
+ if m == nil || m .perm & Read == 0 {
90
+ return false
91
+ }
92
+ c := m .max .Sub (a )
93
+ if n <= c {
94
+ return true
95
+ }
96
+ n -= c
97
+ a = a .Add (c )
98
+ }
99
+ }
100
+
101
+ // Writeable reports whether the address a was writeable (by the inferior at the time of the core dump).
81
102
func (p * Process ) Writeable (a Address ) bool {
82
103
m := p .findMapping (a )
83
104
if m == nil {
You can’t perform that action at this time.
0 commit comments