diff options
author | dim <dim@FreeBSD.org> | 2016-01-06 20:12:03 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2016-01-06 20:12:03 +0000 |
commit | 78b9749c0a4ea980a8b934645da6ae98fcc665e8 (patch) | |
tree | dd2a1ddf0476664c2b823409c36cbccd52662ca7 /packages/Python/lldbsuite/test/python_api/breakpoint | |
parent | 60cb593f9d55fa5ca7a5372b731f2330345b4b9a (diff) | |
download | FreeBSD-src-78b9749c0a4ea980a8b934645da6ae98fcc665e8.zip FreeBSD-src-78b9749c0a4ea980a8b934645da6ae98fcc665e8.tar.gz |
Vendor import of lldb trunk r256945:
https://llvm.org/svn/llvm-project/lldb/trunk@256945
Diffstat (limited to 'packages/Python/lldbsuite/test/python_api/breakpoint')
3 files changed, 64 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/python_api/breakpoint/Makefile b/packages/Python/lldbsuite/test/python_api/breakpoint/Makefile new file mode 100644 index 0000000..0d70f25 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/breakpoint/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../make + +C_SOURCES := main.c + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py b/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py new file mode 100644 index 0000000..1f4fa20 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py @@ -0,0 +1,45 @@ +""" +Test SBBreakpoint APIs. +""" + +from __future__ import print_function + + + +import os, time +import re +import lldb +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbtest import * + +class BreakpointAPITestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + @add_test_categories(['pyapi']) + def test_breakpoint_is_valid(self): + """Make sure that if an SBBreakpoint gets deleted its IsValid returns false.""" + self.build() + exe = os.path.join(os.getcwd(), "a.out") + + # Create a target by the debugger. + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + + # Now create a breakpoint on main.c by name 'AFunction'. + breakpoint = target.BreakpointCreateByName('AFunction', 'a.out') + #print("breakpoint:", breakpoint) + self.assertTrue(breakpoint and + breakpoint.GetNumLocations() == 1, + VALID_BREAKPOINT) + + # Now delete it: + did_delete = target.BreakpointDelete(breakpoint.GetID()) + self.assertTrue (did_delete, "Did delete the breakpoint we just created.") + + # Make sure we can't find it: + del_bkpt = target.FindBreakpointByID (breakpoint.GetID()) + self.assertTrue (not del_bkpt, "We did delete the breakpoint.") + + # Finally make sure the original breakpoint is no longer valid. + self.assertTrue (not breakpoint, "Breakpoint we deleted is no longer valid.") diff --git a/packages/Python/lldbsuite/test/python_api/breakpoint/main.c b/packages/Python/lldbsuite/test/python_api/breakpoint/main.c new file mode 100644 index 0000000..2677594 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/breakpoint/main.c @@ -0,0 +1,14 @@ +#include <stdio.h> + +void +AFunction() +{ + printf ("I am a function.\n"); +} + +int +main () +{ + AFunction(); + return 0; +} |