@@ -117,8 +117,10 @@ impl FromStr for MapsEntry {
117
117
}
118
118
}
119
119
120
+ // Make sure we can parse 64-bit sample output if we're on a 64-bit target.
121
+ #[ cfg( target_pointer_width = "64" ) ]
120
122
#[ test]
121
- fn check_maps_entry_parsing ( ) {
123
+ fn check_maps_entry_parsing_64bit ( ) {
122
124
assert_eq ! ( "ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 \
123
125
[vsyscall]". parse:: <MapsEntry >( ) . unwrap( ) ,
124
126
MapsEntry {
@@ -150,3 +152,43 @@ fn check_maps_entry_parsing() {
150
152
pathname: Default :: default ( ) ,
151
153
} ) ;
152
154
}
155
+
156
+ // (This output was taken from a 32-bit machine, but will work on any target)
157
+ #[ test]
158
+ fn check_maps_entry_parsing_32bit ( ) {
159
+ /* Example snippet of output:
160
+ 08056000-08077000 rw-p 00000000 00:00 0 [heap]
161
+ b7c79000-b7e02000 r--p 00000000 08:01 60662705 /usr/lib/locale/locale-archive
162
+ b7e02000-b7e03000 rw-p 00000000 00:00 0
163
+ */
164
+ assert_eq ! ( "08056000-08077000 rw-p 00000000 00:00 0 \
165
+ [heap]". parse:: <MapsEntry >( ) . unwrap( ) ,
166
+ MapsEntry {
167
+ address: ( 0x08056000 , 0x08077000 ) ,
168
+ perms: [ 'r' , 'w' , '-' , 'p' ] ,
169
+ offset: 0x00000000 ,
170
+ dev: ( 0x00 , 0x00 ) ,
171
+ inode: 0x0 ,
172
+ pathname: "[heap]" . into( ) ,
173
+ } ) ;
174
+
175
+ assert_eq ! ( "b7c79000-b7e02000 r--p 00000000 08:01 60662705 \
176
+ /usr/lib/locale/locale-archive". parse:: <MapsEntry >( ) . unwrap( ) ,
177
+ MapsEntry {
178
+ address: ( 0xb7c79000 , 0xb7e02000 ) ,
179
+ perms: [ 'r' , '-' , '-' , 'p' ] ,
180
+ offset: 0x00000000 ,
181
+ dev: ( 0x08 , 0x01 ) ,
182
+ inode: 0x60662705 ,
183
+ pathname: "/usr/lib/locale/locale-archive" . into( ) ,
184
+ } ) ;
185
+ assert_eq ! ( "b7e02000-b7e03000 rw-p 00000000 00:00 0" . parse:: <MapsEntry >( ) . unwrap( ) ,
186
+ MapsEntry {
187
+ address: ( 0xb7e02000 , 0xb7e03000 ) ,
188
+ perms: [ 'r' , 'w' , '-' , 'p' ] ,
189
+ offset: 0x00000000 ,
190
+ dev: ( 0x00 , 0x00 ) ,
191
+ inode: 0x0 ,
192
+ pathname: Default :: default ( ) ,
193
+ } ) ;
194
+ }
0 commit comments