2010-07-08 08:17:29 +08:00
|
|
|
"""
|
|
|
|
Test that debug symbols have the correct order as specified by the order file.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import os, time
|
|
|
|
import re
|
2010-08-06 07:42:46 +08:00
|
|
|
import unittest2
|
2010-07-08 08:17:29 +08:00
|
|
|
import lldb
|
2010-08-10 07:44:24 +08:00
|
|
|
from lldbtest import *
|
2010-07-08 08:17:29 +08:00
|
|
|
|
2010-08-10 07:44:24 +08:00
|
|
|
class TestOrderFile(TestBase):
|
2010-07-08 08:17:29 +08:00
|
|
|
|
|
|
|
mydir = "order"
|
|
|
|
|
2010-07-28 05:03:55 +08:00
|
|
|
def test_order_file(self):
|
2010-07-08 08:17:29 +08:00
|
|
|
"""Test debug symbols follow the correct order by the order file."""
|
|
|
|
res = self.res
|
|
|
|
exe = os.path.join(os.getcwd(), "a.out")
|
|
|
|
self.ci.HandleCommand("file " + exe, res)
|
2010-08-10 07:44:24 +08:00
|
|
|
self.assertTrue(res.Succeeded(), CURRENT_EXECUTABLE_SET)
|
2010-07-08 08:17:29 +08:00
|
|
|
|
|
|
|
# Test that the debug symbols have Function f3 before Function f1.
|
|
|
|
self.ci.HandleCommand("image dump symtab a.out", res)
|
2010-08-20 02:17:48 +08:00
|
|
|
self.assertTrue(res.Succeeded(), CMD_MSG('image dump'))
|
2010-07-08 08:17:29 +08:00
|
|
|
output = res.GetOutput()
|
|
|
|
mo_f3 = re.search("Function +.+f3", output)
|
|
|
|
mo_f1 = re.search("Function +.+f1", output)
|
|
|
|
|
|
|
|
# Match objects for f3 and f1 must exist and f3 must come before f1.
|
2010-08-10 07:44:24 +08:00
|
|
|
self.assertTrue(mo_f3 and mo_f1 and mo_f3.start() < mo_f1.start(),
|
|
|
|
"Symbols have correct order by the order file")
|
2010-07-08 08:17:29 +08:00
|
|
|
|
|
|
|
self.ci.HandleCommand("run", res)
|
2010-08-17 05:28:10 +08:00
|
|
|
self.runStarted = True
|
2010-08-10 07:44:24 +08:00
|
|
|
self.assertTrue(res.Succeeded(), RUN_COMPLETED)
|
2010-07-08 08:17:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2010-08-06 05:23:45 +08:00
|
|
|
import atexit
|
2010-07-08 08:17:29 +08:00
|
|
|
lldb.SBDebugger.Initialize()
|
2010-08-06 05:23:45 +08:00
|
|
|
atexit.register(lambda: lldb.SBDebugger.Terminate())
|
2010-08-06 07:42:46 +08:00
|
|
|
unittest2.main()
|