2 # Copyright (c) 2013 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
11 class MmapTest(gdb_test.GdbTest):
14 os.environ['NACL_FAULT_INJECTION'] = (
15 'MMAP_BYPASS_DESCRIPTOR_SAFETY_CHECK=GF/@')
16 super(MmapTest, self).setUp()
19 self.gdb.Command('break mmap_breakpoint')
20 self.gdb.ResumeAndExpectStop('continue', 'breakpoint-hit')
21 self.gdb.ResumeAndExpectStop('finish', 'function-finished')
22 # Check that we can read from memory mapped files.
23 self.assertEquals(gdb_test.ParseNumber(self.gdb.Eval('*file_mapping')), 123)
24 self.gdb.ResumeAndExpectStop('continue', 'breakpoint-hit')
25 self.gdb.ResumeAndExpectStop('finish', 'function-finished')
26 file_mapping_str = self.gdb.Eval('file_mapping')
27 file_mapping = gdb_test.ParseNumber(file_mapping_str)
28 self.gdb.Command('break *' + file_mapping_str)
29 self.gdb.ResumeAndExpectStop('continue', 'breakpoint-hit')
30 # Check that breakpoint in memory mapped code is working.
31 self.assertEquals(self.gdb.GetPC(), file_mapping)
32 self.gdb.ResumeAndExpectStop('continue', 'breakpoint-hit')
33 self.gdb.ResumeAndExpectStop('finish', 'function-finished')
34 file_mapping_str = self.gdb.Eval('file_mapping')
35 file_mapping = gdb_test.ParseNumber(file_mapping_str)
36 self.gdb.Command('break *' + file_mapping_str)
37 self.gdb.ResumeAndExpectStop('continue', 'breakpoint-hit')
38 # Check that breakpoint in memory mapped code is working.
39 self.assertEquals(self.gdb.GetPC(), file_mapping)
42 if __name__ == '__main__':