From d6d47976b71187907c1cdeea86fabf7d5534314f Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Fri, 23 Sep 2011 00:54:11 +0000 Subject: Added the ability to restrict breakpoints by function name, function regexp, selector etc to specific source files. Added SB API's to specify these source files & also more than one module. Added an "exact" option to CompileUnit's FindLineEntry API. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140362 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../breakpoint/breakpoint_command/Makefile | 2 +- .../breakpoint_command/TestBreakpointCommand.py | 19 +++++++++++++++++++ .../functionalities/breakpoint/breakpoint_command/a.c | 9 +++++++++ .../functionalities/breakpoint/breakpoint_command/b.c | 9 +++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 test/functionalities/breakpoint/breakpoint_command/a.c create mode 100644 test/functionalities/breakpoint/breakpoint_command/b.c (limited to 'test') diff --git a/test/functionalities/breakpoint/breakpoint_command/Makefile b/test/functionalities/breakpoint/breakpoint_command/Makefile index b09a57915..a6376f9b1 100644 --- a/test/functionalities/breakpoint/breakpoint_command/Makefile +++ b/test/functionalities/breakpoint/breakpoint_command/Makefile @@ -1,5 +1,5 @@ LEVEL = ../../../make -C_SOURCES := main.c +C_SOURCES := main.c a.c b.c include $(LEVEL)/Makefile.rules diff --git a/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py index b96d20d37..616464e21 100644 --- a/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py +++ b/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py @@ -77,6 +77,25 @@ class BreakpointCommandTestCase(TestBase): "print >> here", "here.close()"]) + # Next lets try some other breakpoint kinds. First break with a regular expression + # and then specify only one file. The first time we should get two locations, + # the second time only one: + self.expect ("break set -r ._MyFunction", + patterns = ["Breakpoint created: [0-9]+: regex = '\._MyFunction', locations = 2"]) + + self.expect ("break set -r ._MyFunction -f a.c", + patterns = ["Breakpoint created: [0-9]+: regex = '\._MyFunction', locations = 1"]) + + self.expect ("break set -r ._MyFunction -f a.c -f b.c", + patterns = ["Breakpoint created: [0-9]+: regex = '\._MyFunction', locations = 2"]) + + # Now try a source regex breakpoint: + self.expect ("break set -p \"is about to return [12]0\" -f a.c -f b.c", + patterns = ["Breakpoint created: [0-9]+: source regex = \"is about to return \[12\]0\", locations = 2"]) + + self.expect ("break set -p \"is about to return [12]0\" -f a.c", + patterns = ["Breakpoint created: [0-9]+: source regex = \"is about to return \[12\]0\", locations = 1"]) + # Run the program. Remove 'output.txt' if it exists. if os.path.exists('output.txt'): os.remove('output.txt') diff --git a/test/functionalities/breakpoint/breakpoint_command/a.c b/test/functionalities/breakpoint/breakpoint_command/a.c new file mode 100644 index 000000000..870e4a6ab --- /dev/null +++ b/test/functionalities/breakpoint/breakpoint_command/a.c @@ -0,0 +1,9 @@ +#include + +int +a_MyFunction () +{ + // Set a breakpoint here. + printf ("a is about to return 10.\n"); + return 10; +} diff --git a/test/functionalities/breakpoint/breakpoint_command/b.c b/test/functionalities/breakpoint/breakpoint_command/b.c new file mode 100644 index 000000000..02b78e7bd --- /dev/null +++ b/test/functionalities/breakpoint/breakpoint_command/b.c @@ -0,0 +1,9 @@ +#include + +int +b_MyFunction () +{ + // Set a breakpoint here. + printf ("b is about to return 20.\n"); + return 20; +} -- cgit v1.2.3