blob: ab164c9bb09711c7745992279a83a13aea52c900 [file] [log] [blame]
Johnny Chenacfbeff2010-07-08 00:17:29 +00001"""
2Test that debug symbols have the correct order as specified by the order file.
3"""
4
5import os, time
6import re
7import unittest
8import lldb
9import lldbtest
10
Johnny Chen3c39a982010-07-27 21:03:55 +000011class TestOrderFile(lldbtest.TestBase):
Johnny Chenacfbeff2010-07-08 00:17:29 +000012
13 mydir = "order"
14
Johnny Chen3c39a982010-07-27 21:03:55 +000015 def test_order_file(self):
Johnny Chenacfbeff2010-07-08 00:17:29 +000016 """Test debug symbols follow the correct order by the order file."""
17 res = self.res
18 exe = os.path.join(os.getcwd(), "a.out")
19 self.ci.HandleCommand("file " + exe, res)
20 self.assertTrue(res.Succeeded())
21
22 # Test that the debug symbols have Function f3 before Function f1.
23 self.ci.HandleCommand("image dump symtab a.out", res)
24 self.assertTrue(res.Succeeded())
25 output = res.GetOutput()
26 mo_f3 = re.search("Function +.+f3", output)
27 mo_f1 = re.search("Function +.+f1", output)
28
29 # Match objects for f3 and f1 must exist and f3 must come before f1.
30 self.assertTrue(mo_f3 and mo_f1 and mo_f3.start() < mo_f1.start())
31
32 self.ci.HandleCommand("run", res)
33 self.assertTrue(res.Succeeded())
34
35
36if __name__ == '__main__':
37 lldb.SBDebugger.Initialize()
38 unittest.main()
39 lldb.SBDebugger.Terminate()