Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[lldb] Fixed TestProcessModificationIdOnExpr to work on both x86 and x64 architectures #138941

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 1 commit into from
May 8, 2025

Conversation

real-mikhail
Copy link
Contributor

Original PR where test was introduced and improvements discussed: #129092 (comment)

@real-mikhail real-mikhail requested a review from JDevlieghere as a code owner May 7, 2025 19:08
@llvmbot llvmbot added the lldb label May 7, 2025
@llvmbot
Copy link
Member

llvmbot commented May 7, 2025

@llvm/pr-subscribers-lldb

Author: Mikhail Zakharov (real-mikhail)

Changes

Original PR where test was introduced and improvements discussed: #129092 (comment)


Full diff: https://github.com/llvm/llvm-project/pull/138941.diff

1 Files Affected:

  • (modified) lldb/test/Shell/Expr/TestProcessModificationIdOnExpr.cpp (+30-12)
diff --git a/lldb/test/Shell/Expr/TestProcessModificationIdOnExpr.cpp b/lldb/test/Shell/Expr/TestProcessModificationIdOnExpr.cpp
index fe6c2fd93303c..4d67200745018 100644
--- a/lldb/test/Shell/Expr/TestProcessModificationIdOnExpr.cpp
+++ b/lldb/test/Shell/Expr/TestProcessModificationIdOnExpr.cpp
@@ -1,7 +1,7 @@
 // Tests that ProcessModID.m_memory_id is not bumped when evaluating expressions without side effects.
 
-// REQUIRES: target-windows && target-x86
-// Due to different implementations exact numbers (m_stop_id) are different on different OSs. So we lock this test to specific platform (Windows). It is limited to x86 because on x86, running get()
+// REQUIRES: target-windows && (target-x86 || target-x86_64)
+// Due to different implementations exact numbers (m_stop_id) are different on different OSs. So we lock this test to specific platform (Windows). It is limited to x86/x64 because on x86/x64, running get()
 // requires that we write the return address to the stack, this does not happen on AArch64.
 
 // RUN: %build %s -o %t
@@ -11,10 +11,13 @@
 // RUN:   -o "process status -d" \
 // RUN:   -o "expr x.i != 42" \
 // RUN:   -o "process status -d" \
+// RUN:   -o "process status -d" \
 // RUN:   -o "expr x.get()" \
 // RUN:   -o "process status -d" \
+// RUN:   -o "process status -d" \
 // RUN:   -o "expr x.i = 10" \
 // RUN:   -o "process status -d" \
+// RUN:   -o "process status -d" \
 // RUN:   -o "continue" \
 // RUN:   -o "process status -d" \
 // RUN:   -o "exit" | FileCheck %s -dump-input=fail
@@ -36,34 +39,49 @@ int main() {
 }
 
 // CHECK-LABEL: process status -d
-// CHECK: m_stop_id: 2
-// CHECK: m_memory_id: 0
+// CHECK: m_stop_id: [[#STOP_ID:]]
+// CHECK: m_memory_id: [[#MEMORY_ID:]]
 
 // CHECK-LABEL: expr x.i != 42
 // IDs are not changed when executing simple expressions
 
 // CHECK-LABEL: process status -d
-// CHECK: m_stop_id: 2
-// CHECK: m_memory_id: 0
+// CHECK: m_stop_id: [[#STOP_ID]]
+// CHECK: m_memory_id: [[#MEMORY_ID]]
+
+// CHECK-LABEL: process status -d
+// Remember new values
+// CHECK: m_stop_id: [[#STOP_ID:]]
+// CHECK: m_memory_id: [[#MEMORY_ID:]]
 
 // CHECK-LABEL: expr x.get()
 // Expression causes ID to be bumped because LLDB has to execute function and in doing
 // so must write the return address to the stack.
 
 // CHECK-LABEL: process status -d
-// CHECK: m_stop_id: 3
-// CHECK: m_memory_id: 1
+// CHECK-NOT: m_stop_id: [[#STOP_ID]]
+// CHECK-NOT: m_memory_id: [[#MEMORY_ID]]
+
+// CHECK-LABEL: process status -d
+// Remember new values
+// CHECK: m_stop_id: [[#STOP_ID:]]
+// CHECK: m_memory_id: [[#MEMORY_ID:]]
 
 // CHECK-LABEL: expr x.i = 10
 // Expression causes MemoryID to be bumped because LLDB writes to non-cache memory
 
 // CHECK-LABEL: process status -d
-// CHECK: m_stop_id: 3
-// CHECK: m_memory_id: 2
+// CHECK: m_stop_id: [[#STOP_ID]]
+// CHECK-NOT: m_memory_id: [[#MEMORY_ID]]
+
+// CHECK-LABEL: process status -d
+// Remember new values
+// CHECK: m_stop_id: [[#STOP_ID:]]
+// CHECK: m_memory_id: [[#MEMORY_ID:]]
 
 // CHECK-LABEL: continue
 // Continue causes StopID to be bumped because process is resumed
 
 // CHECK-LABEL: process status -d
-// CHECK: m_stop_id: 4
-// CHECK: m_memory_id: 2
+// CHECK-NOT: m_stop_id: [[#STOP_ID]]
+// CHECK: m_memory_id: [[#MEMORY_ID]]

Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine just one question.

Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@real-mikhail
Copy link
Contributor Author

Thanks for checking @DavidSpickett. Could you please merge this PR for me?

@DavidSpickett DavidSpickett merged commit ea7e23c into llvm:main May 8, 2025
12 checks passed
@real-mikhail real-mikhail deleted the mz/memory-id-2 branch May 8, 2025 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants