summaryrefslogtreecommitdiff
path: root/lldb/test/API/functionalities
diff options
context:
space:
mode:
authorOliver Hunt <oliver@apple.com>2025-10-20 01:38:07 -0700
committerGitHub <noreply@github.com>2025-10-20 01:38:07 -0700
commit7de01aa5d0418bd4e8db2917f831e7383c6863bb (patch)
tree1db866f57c2236573cd4b4c2d141d6d420f87a92 /lldb/test/API/functionalities
parent6bc540043d4c3fed8f44c8f6de86be0d1740582e (diff)
parent46a866ab7735aaa0f89fde209d516271c4825c49 (diff)
Merge branch 'main' into users/ojhunt/ptrauth-additionsusers/ojhunt/ptrauth-additions
Diffstat (limited to 'lldb/test/API/functionalities')
-rw-r--r--lldb/test/API/functionalities/breakpoint/scripted_bkpt/resolver.py1
-rw-r--r--lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/Makefile4
-rw-r--r--lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/TestWasHit.py102
-rw-r--r--lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/bkpt_resolver.py49
-rw-r--r--lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/main.c14
-rw-r--r--lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic-simulators/invalid-atomic/Makefile3
-rw-r--r--lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic-simulators/invalid-atomic/TestDataFormatterInvalidAtomic.py45
-rw-r--r--lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic-simulators/invalid-atomic/main.cpp23
-rw-r--r--lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMap.py5
-rw-r--r--lldb/test/API/functionalities/json/symbol-file/Makefile1
-rw-r--r--lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py28
-rw-r--r--lldb/test/API/functionalities/stats_api/arm64-minidump-build-ids.yaml19
-rw-r--r--lldb/test/API/functionalities/thread/step_out_line0/Makefile3
-rw-r--r--lldb/test/API/functionalities/thread/step_out_line0/TestThreadStepOutLine0.py35
-rw-r--r--lldb/test/API/functionalities/thread/step_out_line0/main.c11
-rw-r--r--lldb/test/API/functionalities/unwind/cortex-m-exception/TestCortexMExceptionUnwind.py26
-rw-r--r--lldb/test/API/functionalities/unwind/cortex-m-exception/armv7m-nofpu-exception.yaml29
-rw-r--r--lldb/test/API/functionalities/unwind/cortex-m-exception/binary.json6
18 files changed, 371 insertions, 33 deletions
diff --git a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/resolver.py b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/resolver.py
index 85c734012761..95868486b8cb 100644
--- a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/resolver.py
+++ b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/resolver.py
@@ -51,7 +51,6 @@ class Resolver:
def get_short_help(self):
return "I am a python breakpoint resolver"
-
class ResolverModuleDepth(Resolver):
def __get_depth__(self):
return lldb.eSearchDepthModule
diff --git a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/Makefile b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/Makefile
new file mode 100644
index 000000000000..695335e068c0
--- /dev/null
+++ b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/Makefile
@@ -0,0 +1,4 @@
+C_SOURCES := main.c
+CFLAGS_EXTRAS := -std=c99
+
+include Makefile.rules
diff --git a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/TestWasHit.py b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/TestWasHit.py
new file mode 100644
index 000000000000..2e176239facf
--- /dev/null
+++ b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/TestWasHit.py
@@ -0,0 +1,102 @@
+"""
+Test the WasHit feature of scripted breakpoints
+"""
+
+import os
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+class TestWasHit(TestBase):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528")
+ def test_was_hit_resolver(self):
+ """Use facade breakpoints to emulate hitting some locations"""
+ self.build()
+ self.do_test()
+
+ def make_target_and_import(self):
+ target = lldbutil.run_to_breakpoint_make_target(self)
+ self.import_resolver_script()
+ return target
+
+ def import_resolver_script(self):
+ interp = self.dbg.GetCommandInterpreter()
+ error = lldb.SBError()
+
+ script_name = os.path.join(self.getSourceDir(), "bkpt_resolver.py")
+
+ command = "command script import " + script_name
+ self.runCmd(command)
+
+ def make_extra_args(self, sym_name, num_locs, loc_to_miss):
+ return f" -k symbol -v {sym_name} -k num_locs -v {num_locs} -k loc_to_miss -v {loc_to_miss} "
+
+ def do_test(self):
+ """This reads in a python file and sets a breakpoint using it."""
+
+ target = self.make_target_and_import()
+ extra_args = self.make_extra_args("stop_symbol", 4, 2)
+
+ bkpt_no = lldbutil.run_break_set_by_script(
+ self, "bkpt_resolver.FacadeExample", extra_args, 4
+ )
+
+ # Make sure the help text shows up in the "break list" output:
+ self.expect(
+ "break list",
+ substrs=["I am a facade resolver - sym: stop_symbol - num_locs: 4"],
+ msg="Help is listed in break list",
+ )
+
+ bkpt = target.FindBreakpointByID(bkpt_no)
+ self.assertTrue(bkpt.IsValid(), "Found the right breakpoint")
+
+ # Now continue. We should hit locations 1, 3 and 4:
+ (target, process, thread, bkpt) = lldbutil.run_to_breakpoint_do_run(
+ self, target, bkpt
+ )
+ # This location should be bkpt_no.1:
+ self.assertEqual(
+ thread.stop_reason_data[0], bkpt_no, "Hit the right breakpoint"
+ )
+ self.assertEqual(thread.stop_reason_data[1], 1, "First location hit is 1")
+
+ for loc in [3, 4]:
+ process.Continue()
+ self.assertEqual(
+ thread.stop_reason, lldb.eStopReasonBreakpoint, "Hit breakpoint"
+ )
+ self.assertEqual(
+ thread.stop_reason_data[0], bkpt_no, "Hit the right breakpoint"
+ )
+ self.assertEqual(
+ thread.stop_reason_data[1], loc, f"Hit the right location: {loc}"
+ )
+
+ # At this point we should have hit three of the four locations, and not location 1.2.
+ # Check that that is true, and that the descriptions for the location are the ones
+ # the resolver provided.
+ self.assertEqual(bkpt.hit_count, 3, "Hit three locations")
+ for loc_id in range(1, 4):
+ bkpt_loc = bkpt.FindLocationByID(loc_id)
+ self.assertTrue(bkpt_loc.IsValid(), f"{loc_id} was invalid.")
+ if loc_id != 2:
+ self.assertEqual(
+ bkpt_loc.hit_count, 1, f"Loc {loc_id} hit count was wrong"
+ )
+ else:
+ self.assertEqual(bkpt_loc.hit_count, 0, "We didn't skip loc 2")
+ stream = lldb.SBStream()
+ self.assertTrue(
+ bkpt_loc.GetDescription(stream, lldb.eDescriptionLevelFull),
+ f"Didn't get description for {loc_id}",
+ )
+ self.assertIn(
+ f"Location index: {loc_id}",
+ stream.GetData(),
+ f"Wrong desciption for {loc_id}",
+ )
diff --git a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/bkpt_resolver.py b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/bkpt_resolver.py
new file mode 100644
index 000000000000..acc8513e3e3e
--- /dev/null
+++ b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/bkpt_resolver.py
@@ -0,0 +1,49 @@
+import lldb
+
+
+class FacadeExample:
+ def __init__(self, bkpt, extra_args, dict):
+ self.bkpt = bkpt
+ self.extra_args = extra_args
+ self.base_sym = None
+ self.facade_locs = []
+ self.facade_locs_desc = []
+ self.cur_facade_loc = 1
+
+ self.sym_name = extra_args.GetValueForKey("symbol").GetStringValue(100)
+ self.num_locs = extra_args.GetValueForKey("num_locs").GetIntegerValue(5)
+ self.loc_to_miss = extra_args.GetValueForKey("loc_to_miss").GetIntegerValue(
+ 10000
+ )
+
+ def __callback__(self, sym_ctx):
+ self.base_sym = sym_ctx.module.FindSymbol(self.sym_name, lldb.eSymbolTypeCode)
+ if self.base_sym.IsValid():
+ self.bkpt.AddLocation(self.base_sym.GetStartAddress())
+ # Locations are 1 based, so to keep things simple, I'm making
+ # the array holding locations 1 based as well:
+ self.facade_locs_desc.append(
+ "This is the zero index, you shouldn't see this"
+ )
+ self.facade_locs.append(None)
+ for i in range(1, self.num_locs + 1):
+ self.facade_locs_desc.append(f"Location index: {i}")
+ self.facade_locs.append(self.bkpt.AddFacadeLocation())
+
+ def get_short_help(self):
+ return f"I am a facade resolver - sym: {self.sym_name} - num_locs: {self.num_locs} - locs_to_miss: {self.loc_to_miss}"
+
+ def was_hit(self, frame, bp_loc):
+ tmp_loc = self.cur_facade_loc
+
+ self.cur_facade_loc = self.cur_facade_loc + 1
+ if self.cur_facade_loc == self.num_locs + 1:
+ self.cur_facade_loc = 1
+
+ if tmp_loc == self.loc_to_miss:
+ return None
+
+ return self.facade_locs[tmp_loc]
+
+ def get_location_description(self, bp_loc, desc_level):
+ return self.facade_locs_desc[bp_loc.id]
diff --git a/lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/main.c b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/main.c
new file mode 100644
index 000000000000..b8f977e49351
--- /dev/null
+++ b/lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/main.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+int stop_symbol() {
+ static int s_cnt = 0;
+ printf("I am in the stop symbol: %d\n", s_cnt++);
+ return s_cnt;
+}
+
+int main() {
+ for (int i = 0; i < 100; i++) {
+ stop_symbol();
+ }
+ return 0;
+}
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic-simulators/invalid-atomic/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic-simulators/invalid-atomic/Makefile
new file mode 100644
index 000000000000..99998b20bcb0
--- /dev/null
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic-simulators/invalid-atomic/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic-simulators/invalid-atomic/TestDataFormatterInvalidAtomic.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic-simulators/invalid-atomic/TestDataFormatterInvalidAtomic.py
new file mode 100644
index 000000000000..76b8e7b40f44
--- /dev/null
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic-simulators/invalid-atomic/TestDataFormatterInvalidAtomic.py
@@ -0,0 +1,45 @@
+"""
+Test formatting of `std::atomic`s not from any STL
+"""
+
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class InvalidAtomicDataFormatterTestCase(TestBase):
+ def test(self):
+ self.build()
+ lldbutil.run_to_source_breakpoint(
+ self, "Set break point at this line.", lldb.SBFileSpec("main.cpp")
+ )
+
+ self.expect_expr(
+ "a",
+ result_children=[
+ ValueCheck(name="foo", value="1"),
+ ValueCheck(name="bar", value="2"),
+ ],
+ )
+ self.expect_expr(
+ "b",
+ result_children=[
+ ValueCheck(name="foo", value="3"),
+ ValueCheck(name="bar", value="4"),
+ ],
+ )
+
+ self.expect_expr(
+ "c",
+ result_children=[
+ ValueCheck(name="foo", value="5"),
+ ValueCheck(name="bar", value="6"),
+ ],
+ )
+ self.expect_expr(
+ "d",
+ result_children=[
+ ValueCheck(name="foo", value="7"),
+ ValueCheck(name="bar", value="8"),
+ ],
+ )
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic-simulators/invalid-atomic/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic-simulators/invalid-atomic/main.cpp
new file mode 100644
index 000000000000..7b4c51c921a9
--- /dev/null
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic-simulators/invalid-atomic/main.cpp
@@ -0,0 +1,23 @@
+namespace std {
+template <typename T> struct atomic {
+ int foo;
+ int bar;
+};
+
+namespace __1 {
+template <typename T> struct atomic {
+ int foo;
+ int bar;
+};
+} // namespace __1
+} // namespace std
+
+int main() {
+ std::atomic<int> a{1, 2};
+ std::atomic<void> b{3, 4};
+
+ std::__1::atomic<int> c{5, 6};
+ std::__1::atomic<void> d{7, 8};
+
+ return 0; // Set break point at this line.
+}
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMap.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMap.py
index 1e920faab639..45f7b5be465c 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMap.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMap.py
@@ -124,11 +124,6 @@ class StdUnorderedMapDataFormatterTestCase(TestBase):
self.check_ptr_ptr("ptr5")
self.check_ptr_ptr("ptr6")
- @expectedFailureAll(
- bugnumber="https://github.com/llvm/llvm-project/issues/146040",
- compiler="clang",
- compiler_version=["<", "21"],
- )
@add_test_categories(["libc++"])
def test_ptr_libcxx(self):
self.build(dictionary={"USE_LIBCPP": 1})
diff --git a/lldb/test/API/functionalities/json/symbol-file/Makefile b/lldb/test/API/functionalities/json/symbol-file/Makefile
index 13bc164582ee..5d05d95fc842 100644
--- a/lldb/test/API/functionalities/json/symbol-file/Makefile
+++ b/lldb/test/API/functionalities/json/symbol-file/Makefile
@@ -1,4 +1,5 @@
C_SOURCES := main.c
+CFLAGS_EXTRAS := -no-pie
all: stripped.out
diff --git a/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py b/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py
index f06c9ae14bb7..d7249df350fc 100644
--- a/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py
+++ b/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py
@@ -1,6 +1,7 @@
# Test the SBAPI for GetStatistics()
import json
+
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
@@ -54,6 +55,11 @@ class TestStatsAPI(TestBase):
stats_json,
'Make sure the "frameVariable" key in in target.GetStatistics()["targets"][0]',
)
+ self.assertNotIn(
+ "loadCoreTime",
+ stats_json,
+ "LoadCoreTime should not be present in a live, non-coredump target",
+ )
expressionEvaluation = stats_json["expressionEvaluation"]
self.assertIn(
"successes",
@@ -157,3 +163,25 @@ class TestStatsAPI(TestBase):
stats_force.GetAsJSON(stream_force)
debug_stats_force = json.loads(stream_force.GetData())
self.assertEqual(debug_stats_force["totalDebugInfoByteSize"], 445)
+
+ def test_core_load_time(self):
+ """
+ Test to see if the coredump path is included in statistics dump.
+ """
+ yaml_file = "arm64-minidump-build-ids.yaml"
+ src_dir = self.getSourceDir()
+ minidump_path = self.getBuildArtifact(os.path.basename(yaml_file) + ".dmp")
+ self.yaml2obj(os.path.join(src_dir, yaml_file), minidump_path)
+ target = self.dbg.CreateTarget(None)
+ process = target.LoadCore(minidump_path)
+ self.assertTrue(process.IsValid())
+
+ stats_options = lldb.SBStatisticsOptions()
+ stats = target.GetStatistics(stats_options)
+ stream = lldb.SBStream()
+ stats.GetAsJSON(stream)
+ debug_stats = json.loads(stream.GetData())
+ self.assertTrue("targets" in debug_stats)
+ target_info = debug_stats["targets"][0]
+ self.assertTrue("loadCoreTime" in target_info)
+ self.assertTrue(float(target_info["loadCoreTime"]) > 0.0)
diff --git a/lldb/test/API/functionalities/stats_api/arm64-minidump-build-ids.yaml b/lldb/test/API/functionalities/stats_api/arm64-minidump-build-ids.yaml
new file mode 100644
index 000000000000..4acbc409d808
--- /dev/null
+++ b/lldb/test/API/functionalities/stats_api/arm64-minidump-build-ids.yaml
@@ -0,0 +1,19 @@
+--- !minidump
+Streams:
+ - Type: SystemInfo
+ Processor Arch: ARM
+ Platform ID: Linux
+ CSD Version: '15E216'
+ CPU:
+ CPUID: 0x00000000
+ - Type: ModuleList
+ Modules:
+ - Base of Image: 0x0000000000001000
+ Size of Image: 0x00001000
+ Module Name: '/tmp/a'
+ CodeView Record: 4C4570420102030405060708090A0B0C0D0E0F1011121314
+ - Base of Image: 0x0000000000001000
+ Size of Image: 0x00001000
+ Module Name: '/tmp/b'
+ CodeView Record: 4C4570420A141E28323C46505A646E78828C96A0AAB4BEC8
+...
diff --git a/lldb/test/API/functionalities/thread/step_out_line0/Makefile b/lldb/test/API/functionalities/thread/step_out_line0/Makefile
new file mode 100644
index 000000000000..10495940055b
--- /dev/null
+++ b/lldb/test/API/functionalities/thread/step_out_line0/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+
+include Makefile.rules
diff --git a/lldb/test/API/functionalities/thread/step_out_line0/TestThreadStepOutLine0.py b/lldb/test/API/functionalities/thread/step_out_line0/TestThreadStepOutLine0.py
new file mode 100644
index 000000000000..2707ca852f66
--- /dev/null
+++ b/lldb/test/API/functionalities/thread/step_out_line0/TestThreadStepOutLine0.py
@@ -0,0 +1,35 @@
+"""
+Test stepping out of a function when the return location is an unsuitable
+stopping point.
+"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class ThreadStepOutLine0TestCase(TestBase):
+ def test(self):
+ self.build()
+ target, process, thread, _ = lldbutil.run_to_source_breakpoint(
+ self, "// Set breakpoint here", lldb.SBFileSpec("main.c")
+ )
+ correct_stepped_out_line = line_number("main.c", "// Should stop here")
+ return_statement_line = line_number("main.c", "// Ran too far")
+ safety_bp = target.BreakpointCreateByLocation(
+ lldb.SBFileSpec("main.c"), return_statement_line
+ )
+ self.assertTrue(safety_bp.IsValid())
+
+ error = lldb.SBError()
+ thread.StepOut(error)
+ self.assertTrue(error.Success())
+
+ frame = thread.GetSelectedFrame()
+ self.assertEqual(
+ frame.line_entry.GetLine(),
+ correct_stepped_out_line,
+ "Step-out lost control of execution, ran too far",
+ )
diff --git a/lldb/test/API/functionalities/thread/step_out_line0/main.c b/lldb/test/API/functionalities/thread/step_out_line0/main.c
new file mode 100644
index 000000000000..ad0c1c05d695
--- /dev/null
+++ b/lldb/test/API/functionalities/thread/step_out_line0/main.c
@@ -0,0 +1,11 @@
+int step_out_of_here(int a) {
+ return a + 5; // Set breakpoint here
+}
+
+int main() {
+#line 0
+ int v = step_out_of_here(3) + 7;
+#line 9
+ v += 11; // Should stop here
+ return v; // Ran too far
+}
diff --git a/lldb/test/API/functionalities/unwind/cortex-m-exception/TestCortexMExceptionUnwind.py b/lldb/test/API/functionalities/unwind/cortex-m-exception/TestCortexMExceptionUnwind.py
index 768dd6fe6867..50ea17370524 100644
--- a/lldb/test/API/functionalities/unwind/cortex-m-exception/TestCortexMExceptionUnwind.py
+++ b/lldb/test/API/functionalities/unwind/cortex-m-exception/TestCortexMExceptionUnwind.py
@@ -12,21 +12,7 @@ from lldbsuite.test import lldbutil
class TestCortexMExceptionUnwind(TestBase):
NO_DEBUG_INFO_TESTCASE = True
- # on the lldb-remote-linux-ubuntu CI, the binary.json's triple of
- # armv7m-apple is not being set in the Target triple, and we're
- # picking the wrong ABI plugin, ABISysV_arm.
- # ABISysV_arm::CreateDefaultUnwindPlan() doesn't have a way to detect
- # arm/thumb for a stack frame, or even the Target's triple for a
- # Cortex-M part that is always thumb. It hardcodes r11 as the frame
- # pointer register, which is correct for arm code but not thumb.
- # It is never correct # on a Cortex-M target.
- # The Darwin ABIMacOSX_arm diverges from AAPCS and always uses r7 for
- # the frame pointer -- the thumb convention -- whether executing arm or
- # thumb. So its CreateDefaultUnwindPlan picks the correct register for
- # the frame pointer, and we can walk the stack.
- # ABISysV_arm::CreateDefaultUnwindPlan will only get one frame and
- # not be able to continue.
- @skipIfRemote
+ @skipIfLLVMTargetMissing("ARM")
def test_no_fpu(self):
"""Test that we can backtrace correctly through an ARM Cortex-M Exception return stack"""
@@ -42,6 +28,9 @@ class TestCortexMExceptionUnwind(TestBase):
core = self.getBuildArtifact("core")
self.yaml2macho_core("armv7m-nofpu-exception.yaml", core, exe_uuid)
+ if self.TraceOn():
+ self.runCmd("log enable lldb unwind")
+
process = target.LoadCore(core)
self.assertTrue(process.IsValid())
@@ -55,14 +44,9 @@ class TestCortexMExceptionUnwind(TestBase):
thread = process.GetThreadAtIndex(0)
self.assertTrue(thread.IsValid())
- # We have 4 named stack frames and two unnamed
- # frames above that. The topmost two stack frames
- # were not interesting for this test, so I didn't
- # create symbols for them.
- self.assertEqual(thread.GetNumFrames(), 6)
+ self.assertEqual(thread.GetNumFrames(), 3)
stackframe_names = [
"exception_catcher",
- "exception_catcher",
"exception_thrower",
"main",
]
diff --git a/lldb/test/API/functionalities/unwind/cortex-m-exception/armv7m-nofpu-exception.yaml b/lldb/test/API/functionalities/unwind/cortex-m-exception/armv7m-nofpu-exception.yaml
index 9ce5ff49d9b6..0b4e1f8fac3e 100644
--- a/lldb/test/API/functionalities/unwind/cortex-m-exception/armv7m-nofpu-exception.yaml
+++ b/lldb/test/API/functionalities/unwind/cortex-m-exception/armv7m-nofpu-exception.yaml
@@ -2,8 +2,8 @@ cpu: armv7m
threads:
- regsets:
- flavor: gpr
- registers: [{name: sp, value: 0x2000fe70}, {name: r7, value: 0x2000fe80},
- {name: pc, value: 0x0020392c}, {name: lr, value: 0x0020392d}]
+ registers: [{name: sp, value: 0x2000fe88}, {name: r7, value: 0x2000fe88},
+ {name: pc, value: 0x00203916}, {name: lr, value: 0x0020392d}]
memory-regions:
# stack memory fetched via
# (lldb) p/x $sp
@@ -14,7 +14,7 @@ memory-regions:
0x0000002a, 0x20010e58, 0x00203923, 0x00000001,
0x2000fe88, 0x00203911, 0x2000ffdc, 0xfffffff9,
0x00000102, 0x00000002, 0x000003f0, 0x0000002a,
- 0x20012620, 0x00203215, 0x00203366, 0x81000200,
+ 0x20012620, 0x00203215, 0x00202a92, 0x81000200,
0x00203215, 0x200128b0, 0x0024928d, 0x2000fecc,
0x002491ed, 0x20010e58, 0x20010e4c, 0x2000ffa0,
0x200107a0, 0x0000003c, 0x200116e8, 0x200108b0,
@@ -62,3 +62,26 @@ memory-regions:
0x98, 0xae, 0x28, 0x00
]
+ # exception_thrower
+ # (lldb) disass -b -c 12 -n exception_thrower
+ # 0x202a88 <+0>: 0xb5f0 push {r4, r5, r6, r7, lr}
+ # 0x202a8a <+2>: 0xaf03 add r7, sp, #0xc
+ # 0x202a8c <+4>: 0xe92d0f00 push.w {r8, r9, r10, r11}
+ # 0x202a90 <+8>: 0xb0c3 sub sp, #0x10c
+ # 0x202a92 <+10>: 0xf7ffffd9 bl 0x202a48
+ - addr: 0x202a88
+ UInt8: [
+ 0xf0, 0xb5, 0x03, 0xaf, 0x2d, 0xe9, 0x00, 0x0f,
+ 0xc3, 0xb0, 0xff, 0xf7, 0xd9, 0xff, 0xff, 0xf7
+ ]
+
+ # main:
+ # 0x202a7e <+0>: push {r7, lr}
+ # 0x202a80 <+2>: mov r7, sp
+ # 0x202a82 <+4>: bl 0x202a88 ; exception_thrower
+ # 0x202a86 <+8>: nop
+ - addr: 0x202a7e
+ UInt8: [
+ 0x80, 0xb5, 0x6f, 0x46, 0x00, 0xf0, 0x01, 0xf8,
+ 0x00, 0xbf
+ ]
diff --git a/lldb/test/API/functionalities/unwind/cortex-m-exception/binary.json b/lldb/test/API/functionalities/unwind/cortex-m-exception/binary.json
index 8fcd5307ff82..0de0169f7adb 100644
--- a/lldb/test/API/functionalities/unwind/cortex-m-exception/binary.json
+++ b/lldb/test/API/functionalities/unwind/cortex-m-exception/binary.json
@@ -1,5 +1,5 @@
{
- "triple": "armv7m-apple",
+ "triple": "armv7m--",
"uuid": "2D157DBA-53C9-3AC7-B5A1-9D336EC831CB",
"type": "executable",
"sections": [
@@ -28,13 +28,13 @@
{
"name": "exception_catcher",
"type": "code",
- "size": 44,
+ "size": 32,
"address": 2111760
},
{
"name": "exception_thrower",
"type": "code",
- "size": 2652,
+ "size": 16,
"address": 2108040
}
]