forked from OSchip/llvm-project
Added a test case to test that break on a struct declaration has no effect.
Instead, the first executable statement is set as the breakpoint. llvm-svn: 109552
This commit is contained in:
parent
c0279a9826
commit
571bfd6a2d
|
@ -0,0 +1,54 @@
|
||||||
|
"""
|
||||||
|
Test that break on a struct declaration has no effect.
|
||||||
|
|
||||||
|
Instead, the first executable statement is set as the breakpoint.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os, time
|
||||||
|
import unittest
|
||||||
|
import lldb
|
||||||
|
import lldbtest
|
||||||
|
|
||||||
|
class TestStructTypes(lldbtest.TestBase):
|
||||||
|
|
||||||
|
mydir = "struct_types"
|
||||||
|
|
||||||
|
def test_struct_types(self):
|
||||||
|
"""Test that break on a struct declaration has no effect."""
|
||||||
|
res = self.res
|
||||||
|
exe = os.path.join(os.getcwd(), "a.out")
|
||||||
|
self.ci.HandleCommand("file " + exe, res)
|
||||||
|
self.assertTrue(res.Succeeded())
|
||||||
|
|
||||||
|
# Break on the ctor function of class C.
|
||||||
|
self.ci.HandleCommand("breakpoint set -f main.c -l 14", res)
|
||||||
|
self.assertTrue(res.Succeeded())
|
||||||
|
self.assertTrue(res.GetOutput().startswith(
|
||||||
|
"Breakpoint created: 1: file ='main.c', line = 14, locations = 1"))
|
||||||
|
|
||||||
|
self.ci.HandleCommand("run", res)
|
||||||
|
time.sleep(0.1)
|
||||||
|
self.assertTrue(res.Succeeded())
|
||||||
|
|
||||||
|
# We should be stopped on the first executable statement within the
|
||||||
|
# function where the original breakpoint was attempted.
|
||||||
|
self.ci.HandleCommand("thread backtrace", res)
|
||||||
|
print "thread backtrace ->", res.GetOutput()
|
||||||
|
self.assertTrue(res.Succeeded())
|
||||||
|
output = res.GetOutput()
|
||||||
|
self.assertTrue(output.find('main.c:20') > 0 and
|
||||||
|
output.find('stop reason = breakpoint') > 0)
|
||||||
|
|
||||||
|
# The breakpoint should have a hit count of 1.
|
||||||
|
self.ci.HandleCommand("breakpoint list", res)
|
||||||
|
self.assertTrue(res.Succeeded())
|
||||||
|
self.assertTrue(res.GetOutput().find(' resolved, hit count = 1') > 0)
|
||||||
|
|
||||||
|
self.ci.HandleCommand("continue", res)
|
||||||
|
self.assertTrue(res.Succeeded())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
lldb.SBDebugger.Initialize()
|
||||||
|
unittest.main()
|
||||||
|
lldb.SBDebugger.Terminate()
|
Loading…
Reference in New Issue