Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Internal expressions shouldn't increment the result variable numbering.
There an option: EvaluateExpressionOptions::SetResultIsInternal to indicate whether the result number should be returned to the pool or not. It got broken when the PersistentExpressionState was refactored. This fixes the issue and provides a test of the behavior. Differential Revision: https://reviews.llvm.org/D76532
- Loading branch information
Showing
12 changed files
with
99 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
C_SOURCES := main.c | ||
CFLAGS_EXTRAS := -std=c99 | ||
|
||
include Makefile.rules |
48 changes: 48 additions & 0 deletions
48
lldb/test/API/commands/expression/result_numbering/TestResultNumbering.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
""" | ||
Make sure running internal expressions doesn't | ||
influence the result variable numbering. | ||
""" | ||
|
||
|
||
|
||
import lldb | ||
import lldbsuite.test.lldbutil as lldbutil | ||
from lldbsuite.test.lldbtest import * | ||
|
||
|
||
class TestExpressionResultNumbering(TestBase): | ||
|
||
mydir = TestBase.compute_mydir(__file__) | ||
|
||
NO_DEBUG_INFO_TESTCASE = True | ||
|
||
def test_sample_rename_this(self): | ||
self.build() | ||
self.main_source_file = lldb.SBFileSpec("main.c") | ||
self.do_numbering_test() | ||
|
||
def do_numbering_test(self): | ||
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, | ||
"Set a breakpoint here", self.main_source_file) | ||
|
||
bkpt = target.BreakpointCreateBySourceRegex("Add conditions to this breakpoint", | ||
self.main_source_file) | ||
self.assertEqual(bkpt.GetNumLocations(), 1, "Set the breakpoint") | ||
|
||
bkpt.SetCondition("call_me(value) < 6") | ||
|
||
# Get the number of the last expression: | ||
result = thread.frames[0].EvaluateExpression("call_me(200)") | ||
self.assertTrue(result.GetError().Success(), "Our expression succeeded") | ||
name = result.GetName() | ||
ordinal = int(name[1:]) | ||
|
||
process.Continue() | ||
|
||
# The condition evaluation had to run a 4 expressions, but we haven't | ||
# run any user expressions. | ||
result = thread.frames[0].EvaluateExpression("call_me(200)") | ||
self.assertTrue(result.GetError().Success(), "Our expression succeeded the second time") | ||
after_name = result.GetName() | ||
after_ordinal = int(after_name[1:]) | ||
self.assertEqual(ordinal + 1, after_ordinal) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <stdio.h> | ||
|
||
int | ||
call_me(int input) | ||
{ | ||
return input; | ||
} | ||
|
||
int | ||
main() | ||
{ | ||
int value = call_me(0); // Set a breakpoint here | ||
while (value < 10) | ||
{ | ||
printf("Add conditions to this breakpoint: %d.\n", value++); | ||
} | ||
return 0; | ||
} |