-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[lldb] Do not bump memory modificator ID when "internal" debugger memory is updated #129092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1d2da22
[lldb] Do not bump memory modificator ID when "internal" debugger mem…
5ce65f1
[lldb] Reformat test code and add additional test for modifying membe…
12a6668
[lldb] Fixed test on Linux
c007937
[lldb] Make new behaviour opt-in via "target.process.process-state-tr…
697cfb7
[lldb] Added ability to dump ProcessModID and added test to verify th…
3de5e26
[lldb] Fixed test_all_settings_exist
b3be794
[lldb] Give new setting a better name
3c216ef
[lldb] Fixed test on Linux
d5a8a89
[lldb] Fixed formatting
ad45f5d
[lldb] Give a new dump command a clearer name
7a1c31b
[lldb] Code review follow up
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,55 @@ | ||
// Tests evaluating expressions with side effects. | ||
// Applied side effect should be visible to the debugger. | ||
|
||
// RUN: %build %s -o %t | ||
// RUN: %lldb %t \ | ||
// RUN: -o "settings set target.process.track-memory-cache-changes false" \ | ||
// RUN: -o "run" \ | ||
// RUN: -o "frame variable x" \ | ||
// RUN: -o "expr x.inc()" \ | ||
// RUN: -o "frame variable x" \ | ||
// RUN: -o "continue" \ | ||
// RUN: -o "frame variable x" \ | ||
// RUN: -o "expr x.i = 10" \ | ||
// RUN: -o "frame variable x" \ | ||
// RUN: -o "continue" \ | ||
// RUN: -o "frame variable x" \ | ||
// RUN: -o "exit" | FileCheck %s -dump-input=fail | ||
|
||
class X { | ||
int i = 0; | ||
|
||
public: | ||
void inc() { ++i; } | ||
}; | ||
|
||
int main() { | ||
X x; | ||
x.inc(); | ||
|
||
__builtin_debugtrap(); | ||
__builtin_debugtrap(); | ||
__builtin_debugtrap(); | ||
return 0; | ||
} | ||
|
||
// CHECK-LABEL: frame variable x | ||
// CHECK: (X) x = (i = 1) | ||
|
||
// CHECK-LABEL: expr x.inc() | ||
// CHECK-LABEL: frame variable x | ||
// CHECK: (X) x = (i = 2) | ||
|
||
// CHECK-LABEL: continue | ||
// CHECK-LABEL: frame variable x | ||
// CHECK: (X) x = (i = 2) | ||
|
||
// CHECK-LABEL: expr x.i = 10 | ||
// CHECK: (int) $0 = 10 | ||
|
||
// CHECK-LABEL: frame variable x | ||
// CHECK: (X) x = (i = 10) | ||
|
||
// CHECK-LABEL: continue | ||
// CHECK-LABEL: frame variable x | ||
// CHECK: (X) x = (i = 10) |
52 changes: 52 additions & 0 deletions
52
lldb/test/Shell/Expr/TestExprWithSideEffectOnConvenienceVar.cpp
This file contains hidden or 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,52 @@ | ||
// Tests evaluating expressions with side effects on convenience variable. | ||
// Applied side effect should be visible to the debugger. | ||
|
||
// UNSUPPORTED: system-windows | ||
|
||
// RUN: %build %s -o %t | ||
// RUN: %lldb %t \ | ||
// RUN: -o "settings set target.process.track-memory-cache-changes false" \ | ||
// RUN: -o "run" \ | ||
// RUN: -o "expr int \$y = 11" \ | ||
// RUN: -o "expr \$y" \ | ||
// RUN: -o "expr \$y = 100" \ | ||
// RUN: -o "expr \$y" \ | ||
// RUN: -o "continue" \ | ||
// RUN: -o "expr \$y" \ | ||
// RUN: -o "expr X \$mine = {100, 200}" \ | ||
// RUN: -o "expr \$mine.a = 300" \ | ||
// RUN: -o "expr \$mine" \ | ||
// RUN: -o "exit" | FileCheck %s -dump-input=fail | ||
|
||
struct X { | ||
int a; | ||
int b; | ||
}; | ||
|
||
int main() { | ||
X x; | ||
|
||
__builtin_debugtrap(); | ||
__builtin_debugtrap(); | ||
return 0; | ||
} | ||
|
||
// CHECK-LABEL: expr int $y = 11 | ||
// CHECK-LABEL: expr $y | ||
// CHECK: (int) $y = 11 | ||
|
||
// CHECK-LABEL: expr $y = 100 | ||
// CHECK: (int) $0 = 100 | ||
|
||
// CHECK-LABEL: expr $y | ||
// CHECK: (int) $y = 100 | ||
|
||
// CHECK-LABEL: continue | ||
// CHECK-LABEL: expr $y | ||
// CHECK: (int) $y = 100 | ||
|
||
// CHECK-LABEL: expr X $mine = {100, 200} | ||
// CHECK-LABEL: expr $mine.a = 300 | ||
// CHECK: (int) $1 = 300 | ||
// CHECK-LABEL: expr $mine | ||
// CHECK: (X) $mine = (a = 300, b = 200) |
51 changes: 51 additions & 0 deletions
51
lldb/test/Shell/Expr/TestExprWithSideEffectOnConvenienceVarWindows.cpp
This file contains hidden or 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,51 @@ | ||
// Same as TestExprWithSideEffectOnConvenienceVar.cpp but without $ escaping | ||
|
||
// REQUIRES: target-windows | ||
|
||
// RUN: %build %s -o %t | ||
// RUN: %lldb %t \ | ||
// RUN: -o "settings set target.process.track-memory-cache-changes false" \ | ||
// RUN: -o "run" \ | ||
// RUN: -o "expr int $y = 11" \ | ||
// RUN: -o "expr $y" \ | ||
// RUN: -o "expr $y = 100" \ | ||
// RUN: -o "expr $y" \ | ||
// RUN: -o "continue" \ | ||
// RUN: -o "expr $y" \ | ||
// RUN: -o "expr X $mine = {100, 200}" \ | ||
// RUN: -o "expr $mine.a = 300" \ | ||
// RUN: -o "expr $mine" \ | ||
// RUN: -o "exit" | FileCheck %s -dump-input=fail | ||
|
||
struct X { | ||
int a; | ||
int b; | ||
}; | ||
|
||
int main() { | ||
X x; | ||
|
||
__builtin_debugtrap(); | ||
__builtin_debugtrap(); | ||
return 0; | ||
} | ||
|
||
// CHECK-LABEL: expr int $y = 11 | ||
// CHECK-LABEL: expr $y | ||
// CHECK: (int) $y = 11 | ||
|
||
// CHECK-LABEL: expr $y = 100 | ||
// CHECK: (int) $0 = 100 | ||
|
||
// CHECK-LABEL: expr $y | ||
// CHECK: (int) $y = 100 | ||
|
||
// CHECK-LABEL: continue | ||
// CHECK-LABEL: expr $y | ||
// CHECK: (int) $y = 100 | ||
|
||
// CHECK-LABEL: expr X $mine = {100, 200} | ||
// CHECK-LABEL: expr $mine.a = 300 | ||
// CHECK: (int) $1 = 300 | ||
// CHECK-LABEL: expr $mine | ||
// CHECK: (X) $mine = (a = 300, b = 200) |
This file contains hidden or 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,67 @@ | ||
// Tests that ProcessModID.m_memory_id is not bumped when evaluating expressions without side effects. | ||
|
||
// REQUIRES: target-windows | ||
// Due to different implementations exact numbers (m_stop_id) are different on different OSs. So we lock this test to specific platform. | ||
|
||
// RUN: %build %s -o %t | ||
// RUN: %lldb %t \ | ||
// RUN: -o "settings set target.process.track-memory-cache-changes false" \ | ||
// RUN: -o "run" \ | ||
// RUN: -o "process dump-modification-id" \ | ||
// RUN: -o "expr x.i != 42" \ | ||
// RUN: -o "process dump-modification-id" \ | ||
// RUN: -o "expr x.get()" \ | ||
// RUN: -o "process dump-modification-id" \ | ||
// RUN: -o "expr x.i = 10" \ | ||
// RUN: -o "process dump-modification-id" \ | ||
// RUN: -o "continue" \ | ||
// RUN: -o "process dump-modification-id" \ | ||
// RUN: -o "exit" | FileCheck %s -dump-input=fail | ||
|
||
class X { | ||
int i = 0; | ||
|
||
public: | ||
int get() { return i; } | ||
}; | ||
|
||
int main() { | ||
X x; | ||
x.get(); | ||
|
||
__builtin_debugtrap(); | ||
__builtin_debugtrap(); | ||
return 0; | ||
} | ||
|
||
// CHECK-LABEL: process dump-modification-id | ||
// CHECK: m_stop_id: 2 | ||
// CHECK: m_memory_id: 0 | ||
|
||
// CHECK-LABEL: expr x.i != 42 | ||
// IDs are not changed when executing simple expressions | ||
|
||
// CHECK-LABEL: process dump-modification-id | ||
// CHECK: m_stop_id: 2 | ||
// CHECK: m_memory_id: 0 | ||
|
||
// CHECK-LABEL: expr x.get() | ||
// Expression causes ID to be bumped because LLDB has to execute function | ||
|
||
// CHECK-LABEL: process dump-modification-id | ||
// CHECK: m_stop_id: 3 | ||
// CHECK: m_memory_id: 1 | ||
|
||
// CHECK-LABEL: expr x.i = 10 | ||
// Expression causes MemoryID to be bumped because LLDB writes to non-cache memory | ||
|
||
// CHECK-LABEL: process dump-modification-id | ||
// CHECK: m_stop_id: 3 | ||
// CHECK: m_memory_id: 2 | ||
|
||
// CHECK-LABEL: continue | ||
// Continue causes StopID to be bumped because process is resumed | ||
|
||
// CHECK-LABEL: process dump-modification-id | ||
// CHECK: m_stop_id: 4 | ||
// CHECK: m_memory_id: 2 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.