Skip to content

Commit 73062a8

Browse files
committed
Conditionalize 64-bit test. Add test that works for 32-bit targets.
1 parent 6a0b39d commit 73062a8

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/symbolize/gimli/parse_running_mmaps_unix.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ impl FromStr for MapsEntry {
117117
}
118118
}
119119

120+
// Make sure we can parse 64-bit sample output if we're on a 64-bit target.
121+
#[cfg(target_pointer_width = "64")]
120122
#[test]
121123
fn check_maps_entry_parsing() {
122124
assert_eq!("ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 \
@@ -150,3 +152,43 @@ fn check_maps_entry_parsing() {
150152
pathname: Default::default(),
151153
});
152154
}
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() {
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

Comments
 (0)