summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil')
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/TestSwigVersion.py27
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/frame/Makefile4
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py63
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/frame/main.c46
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/Makefile6
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py126
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py105
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/main.cpp133
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/process/Makefile6
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py25
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/process/main.cpp20
11 files changed, 561 insertions, 0 deletions
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/TestSwigVersion.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/TestSwigVersion.py
new file mode 100644
index 00000000000..8c5c6efda53
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/TestSwigVersion.py
@@ -0,0 +1,27 @@
+"""
+Test that we embed the swig version into the lldb module
+"""
+
+
+"""
+import os
+import time
+import re
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test import lldbutil
+"""
+from lldbsuite.test.lldbtest import *
+
+class SwigVersionTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def test(self):
+ self.assertTrue(getattr(lldb, "swig_version"))
+ self.assertIsInstance(lldb.swig_version, tuple)
+ self.assertEqual(len(lldb.swig_version), 3)
+ self.assertGreaterEqual(lldb.swig_version[0], 1)
+ for v in lldb.swig_version:
+ self.assertGreaterEqual(v, 0)
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/frame/Makefile b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/frame/Makefile
new file mode 100644
index 00000000000..c5fa38429c6
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/frame/Makefile
@@ -0,0 +1,4 @@
+C_SOURCES := main.c
+MAKE_DSYM :=NO
+
+include Makefile.rules
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py
new file mode 100644
index 00000000000..ec8d1f84ded
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py
@@ -0,0 +1,63 @@
+"""
+Test utility functions for the frame object.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class FrameUtilsTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # Find the line number to break inside main().
+ self.line = line_number('main.c',
+ "// Find the line number here.")
+
+ @add_test_categories(['pyapi'])
+ def test_frame_utils(self):
+ """Test utility functions for the frame object."""
+ self.build()
+ exe = self.getBuildArtifact("a.out")
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ breakpoint = target.BreakpointCreateByLocation("main.c", self.line)
+ self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+ # Now launch the process, and do not stop at entry point.
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+
+ if not process:
+ self.fail("SBTarget.LaunchProcess() failed")
+ self.assertTrue(process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+
+ import lldbsuite.test.lldbutil as lldbutil
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(thread)
+ frame0 = thread.GetFrameAtIndex(0)
+ self.assertTrue(frame0)
+ frame1 = thread.GetFrameAtIndex(1)
+ self.assertTrue(frame1)
+ parent = lldbutil.get_parent_frame(frame0)
+ self.assertTrue(parent and parent.GetFrameID() == frame1.GetFrameID())
+ frame0_args = lldbutil.get_args_as_string(frame0)
+ parent_args = lldbutil.get_args_as_string(parent)
+ self.assertTrue(
+ frame0_args and parent_args and "(int)val=1" in frame0_args)
+ if self.TraceOn():
+ lldbutil.print_stacktrace(thread)
+ print("Current frame: %s" % frame0_args)
+ print("Parent frame: %s" % parent_args)
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/frame/main.c b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/frame/main.c
new file mode 100644
index 00000000000..f83709616e5
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/frame/main.c
@@ -0,0 +1,46 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#include <stdio.h>
+
+int a(int);
+int b(int);
+int c(int);
+
+int a(int val)
+{
+ if (val <= 1)
+ return b(val);
+ else if (val >= 3)
+ return c(val);
+
+ return val;
+}
+
+int b(int val)
+{
+ return c(val);
+}
+
+int c(int val)
+{
+ return val + 3; // Find the line number here.
+}
+
+int main (int argc, char const *argv[])
+{
+ int A1 = a(1); // a(1) -> b(1) -> c(1)
+ printf("a(1) returns %d\n", A1);
+
+ int B2 = b(2); // b(2) -> c(2)
+ printf("b(2) returns %d\n", B2);
+
+ int A3 = a(3); // a(3) -> c(3)
+ printf("a(3) returns %d\n", A3);
+
+ return 0;
+}
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/Makefile b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/Makefile
new file mode 100644
index 00000000000..4d11bbc8b6a
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/Makefile
@@ -0,0 +1,6 @@
+CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS
+ENABLE_THREADS := YES
+CXX_SOURCES := main.cpp
+MAKE_DSYM := NO
+
+include Makefile.rules
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py
new file mode 100644
index 00000000000..050ec87fb2b
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py
@@ -0,0 +1,126 @@
+"""
+Test the iteration protocol for some lldb container objects.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class LLDBIteratorTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # Find the line numbers to break inside main().
+ self.line1 = line_number(
+ 'main.cpp', '// Set break point at this line.')
+ self.line2 = line_number('main.cpp', '// And that line.')
+
+ @add_test_categories(['pyapi'])
+ def test_lldb_iter_module(self):
+ """Test module_iter works correctly for SBTarget -> SBModule."""
+ self.build()
+ exe = self.getBuildArtifact("a.out")
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line1)
+ self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+ # Now launch the process, and do not stop at entry point.
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+
+ if not process:
+ self.fail("SBTarget.LaunchProcess() failed")
+
+ from lldbsuite.test.lldbutil import get_description
+ yours = []
+ for i in range(target.GetNumModules()):
+ yours.append(target.GetModuleAtIndex(i))
+ mine = []
+ for m in target.module_iter():
+ mine.append(m)
+
+ self.assertTrue(len(yours) == len(mine))
+ for i in range(len(yours)):
+ if self.TraceOn():
+ print("yours[%d]='%s'" % (i, get_description(yours[i])))
+ print("mine[%d]='%s'" % (i, get_description(mine[i])))
+ self.assertTrue(
+ yours[i] == mine[i],
+ "UUID+FileSpec of yours[{0}] and mine[{0}] matches".format(i))
+
+ @add_test_categories(['pyapi'])
+ def test_lldb_iter_breakpoint(self):
+ """Test breakpoint_iter works correctly for SBTarget -> SBBreakpoint."""
+ self.build()
+ exe = self.getBuildArtifact("a.out")
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line1)
+ self.assertTrue(breakpoint, VALID_BREAKPOINT)
+ breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line2)
+ self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+ self.assertTrue(target.GetNumBreakpoints() == 2)
+
+ from lldbsuite.test.lldbutil import get_description
+ yours = []
+ for i in range(target.GetNumBreakpoints()):
+ yours.append(target.GetBreakpointAtIndex(i))
+ mine = []
+ for b in target.breakpoint_iter():
+ mine.append(b)
+
+ self.assertTrue(len(yours) == len(mine))
+ for i in range(len(yours)):
+ if self.TraceOn():
+ print("yours[%d]='%s'" % (i, get_description(yours[i])))
+ print("mine[%d]='%s'" % (i, get_description(mine[i])))
+ self.assertTrue(yours[i] == mine[i],
+ "ID of yours[{0}] and mine[{0}] matches".format(i))
+
+ @add_test_categories(['pyapi'])
+ def test_lldb_iter_frame(self):
+ """Test iterator works correctly for SBProcess->SBThread->SBFrame."""
+ self.build()
+ exe = self.getBuildArtifact("a.out")
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line1)
+ self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+ # Now launch the process, and do not stop at entry point.
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+
+ if not process:
+ self.fail("SBTarget.LaunchProcess() failed")
+
+ from lldbsuite.test.lldbutil import print_stacktrace
+ stopped_due_to_breakpoint = False
+ for thread in process:
+ if self.TraceOn():
+ print_stacktrace(thread)
+ ID = thread.GetThreadID()
+ if thread.GetStopReason() == lldb.eStopReasonBreakpoint:
+ stopped_due_to_breakpoint = True
+ for frame in thread:
+ self.assertTrue(frame.GetThread().GetThreadID() == ID)
+ if self.TraceOn():
+ print(frame)
+
+ self.assertTrue(stopped_due_to_breakpoint)
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
new file mode 100644
index 00000000000..fbb8bff4128
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
@@ -0,0 +1,105 @@
+"""
+Test the iteration protocol for frame registers.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class RegistersIteratorTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # Find the line number to break inside main().
+ self.line1 = line_number(
+ 'main.cpp', '// Set break point at this line.')
+
+ @add_test_categories(['pyapi'])
+ def test_iter_registers(self):
+ """Test iterator works correctly for lldbutil.iter_registers()."""
+ self.build()
+ exe = self.getBuildArtifact("a.out")
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line1)
+ self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+ # Now launch the process, and do not stop at entry point.
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+
+ if not process:
+ self.fail("SBTarget.LaunchProcess() failed")
+
+ import lldbsuite.test.lldbutil as lldbutil
+ for thread in process:
+ if thread.GetStopReason() == lldb.eStopReasonBreakpoint:
+ for frame in thread:
+ # Dump the registers of this frame using
+ # lldbutil.get_GPRs() and friends.
+ if self.TraceOn():
+ print(frame)
+
+ REGs = lldbutil.get_GPRs(frame)
+ num = len(REGs)
+ if self.TraceOn():
+ print(
+ "\nNumber of general purpose registers: %d" %
+ num)
+ for reg in REGs:
+ self.assertTrue(reg)
+ if self.TraceOn():
+ print("%s => %s" % (reg.GetName(), reg.GetValue()))
+
+ REGs = lldbutil.get_FPRs(frame)
+ num = len(REGs)
+ if self.TraceOn():
+ print("\nNumber of floating point registers: %d" % num)
+ for reg in REGs:
+ self.assertTrue(reg)
+ if self.TraceOn():
+ print("%s => %s" % (reg.GetName(), reg.GetValue()))
+
+ REGs = lldbutil.get_ESRs(frame)
+ if self.platformIsDarwin():
+ if self.getArchitecture() != 'armv7' and self.getArchitecture() != 'armv7k':
+ num = len(REGs)
+ if self.TraceOn():
+ print(
+ "\nNumber of exception state registers: %d" %
+ num)
+ for reg in REGs:
+ self.assertTrue(reg)
+ if self.TraceOn():
+ print(
+ "%s => %s" %
+ (reg.GetName(), reg.GetValue()))
+ else:
+ self.assertIsNone(REGs)
+
+ # And these should also work.
+ for kind in ["General Purpose Registers",
+ "Floating Point Registers"]:
+ REGs = lldbutil.get_registers(frame, kind)
+ self.assertTrue(REGs)
+
+ REGs = lldbutil.get_registers(
+ frame, "Exception State Registers")
+ if self.platformIsDarwin():
+ if self.getArchitecture() != 'armv7' and self.getArchitecture() != 'armv7k':
+ self.assertIsNotNone(REGs)
+ else:
+ self.assertIsNone(REGs)
+
+ # We've finished dumping the registers for frame #0.
+ break
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/main.cpp b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/main.cpp
new file mode 100644
index 00000000000..6823ccc4eb8
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/main.cpp
@@ -0,0 +1,133 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// C includes
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+// C++ includes
+#include <chrono>
+#include <mutex>
+#include <random>
+#include <thread>
+
+std::thread g_thread_1;
+std::thread g_thread_2;
+std::thread g_thread_3;
+std::mutex g_mask_mutex;
+
+enum MaskAction {
+ eGet,
+ eAssign,
+ eClearBits
+};
+
+uint32_t mask_access (MaskAction action, uint32_t mask = 0);
+
+uint32_t
+mask_access (MaskAction action, uint32_t mask)
+{
+ static uint32_t g_mask = 0;
+
+ std::lock_guard<std::mutex> lock(g_mask_mutex);
+ switch (action)
+ {
+ case eGet:
+ break;
+
+ case eAssign:
+ g_mask |= mask;
+ break;
+
+ case eClearBits:
+ g_mask &= ~mask;
+ break;
+ }
+ return g_mask;
+}
+
+void *
+thread_func (void *arg)
+{
+ uint32_t thread_index = *((uint32_t *)arg);
+ uint32_t thread_mask = (1u << (thread_index));
+ printf ("%s (thread index = %u) startng...\n", __FUNCTION__, thread_index);
+
+ std::default_random_engine generator;
+ std::uniform_int_distribution<int> distribution(0, 3000000);
+
+ while (mask_access(eGet) & thread_mask)
+ {
+ // random micro second sleep from zero to 3 seconds
+ int usec = distribution(generator);
+ printf ("%s (thread = %u) doing a usleep (%d)...\n", __FUNCTION__, thread_index, usec);
+
+ std::chrono::microseconds duration(usec);
+ std::this_thread::sleep_for(duration);
+ printf ("%s (thread = %u) after usleep ...\n", __FUNCTION__, thread_index); // Set break point at this line.
+ }
+ printf ("%s (thread index = %u) exiting...\n", __FUNCTION__, thread_index);
+ return NULL;
+}
+
+
+int main (int argc, char const *argv[])
+{
+ uint32_t thread_index_1 = 1;
+ uint32_t thread_index_2 = 2;
+ uint32_t thread_index_3 = 3;
+ uint32_t thread_mask_1 = (1u << thread_index_1);
+ uint32_t thread_mask_2 = (1u << thread_index_2);
+ uint32_t thread_mask_3 = (1u << thread_index_3);
+
+ // Make a mask that will keep all threads alive
+ mask_access (eAssign, thread_mask_1 | thread_mask_2 | thread_mask_3); // And that line.
+
+ // Create 3 threads
+ g_thread_1 = std::thread(thread_func, (void*)&thread_index_1);
+ g_thread_2 = std::thread(thread_func, (void*)&thread_index_2);
+ g_thread_3 = std::thread(thread_func, (void*)&thread_index_3);
+
+ char line[64];
+ while (mask_access(eGet) != 0)
+ {
+ printf ("Enter thread index to kill or ENTER for all:\n");
+ fflush (stdout);
+ // Kill threads by index, or ENTER for all threads
+
+ if (fgets (line, sizeof(line), stdin))
+ {
+ if (line[0] == '\n' || line[0] == '\r' || line[0] == '\0')
+ {
+ printf ("Exiting all threads...\n");
+ break;
+ }
+ int32_t index = strtoul (line, NULL, 0);
+ switch (index)
+ {
+ case 1: mask_access (eClearBits, thread_mask_1); break;
+ case 2: mask_access (eClearBits, thread_mask_2); break;
+ case 3: mask_access (eClearBits, thread_mask_3); break;
+ }
+ continue;
+ }
+
+ break;
+ }
+
+ // Clear all thread bits to they all exit
+ mask_access (eClearBits, UINT32_MAX);
+
+ // Join all of our threads
+ g_thread_1.join();
+ g_thread_2.join();
+ g_thread_3.join();
+
+ return 0;
+}
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/process/Makefile b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/process/Makefile
new file mode 100644
index 00000000000..6b33049a78b
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/process/Makefile
@@ -0,0 +1,6 @@
+CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS
+ENABLE_THREADS := YES
+CXX_SOURCES := main.cpp
+MAKE_DSYM :=NO
+
+include Makefile.rules
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py
new file mode 100644
index 00000000000..123b60e4cd7
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py
@@ -0,0 +1,25 @@
+"""
+Test SBprocess and SBThread APIs with printing of the stack traces using lldbutil.
+"""
+
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class ThreadsStackTracesTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @add_test_categories(['pyapi'])
+ def test_stack_traces(self):
+ """Test SBprocess and SBThread APIs with printing of the stack traces."""
+ self.build()
+ (_, process, _, _) = lldbutil.run_to_source_breakpoint(self,
+ "// BREAK HERE", lldb.SBFileSpec("main.cpp"))
+ stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
+ self.expect(stacktraces, exe=False,
+ substrs=['(int)x=4', '(int)y=6', '(int)x=3', '(int)argc=1'])
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/process/main.cpp b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/process/main.cpp
new file mode 100644
index 00000000000..a490d8f9900
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/process/main.cpp
@@ -0,0 +1,20 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+static int foo(int x, int y) {
+ return x + y; // BREAK HERE
+}
+
+static int bar(int x) {
+ return foo(x + 1, x * 2);
+}
+
+int main (int argc, char const *argv[])
+{
+ return bar(argc + 2);
+}