-
Notifications
You must be signed in to change notification settings - Fork 16.1k
[lldb] Fix setting CanJIT if memory cannot be allocated #176099
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
+73
−5
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
69a7a99
[lldb] Fix setting CanJIT if memory cannot be allocated
igorkudrin 40b49a3
fixup! simplify GDBRemoteTestBase.createTarget()
igorkudrin 7b1f907
fixup! remove redundant import
igorkudrin ca23b86
fixup! add handlers for '_M' and '_m' to MockGDBServerResponder
igorkudrin d2a6c96
fixup! simplify the response string in 'readRegisters()'
igorkudrin d072b38
fixup! update the test description
igorkudrin 925c899
fixup! add an expression which fails without JIT
igorkudrin 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
55 changes: 55 additions & 0 deletions
55
lldb/test/API/functionalities/gdb_remote_client/TestExprNoAlloc.py
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 @@ | ||
| import lldb | ||
| from lldbsuite.test.lldbtest import * | ||
| from lldbsuite.test.decorators import * | ||
| from lldbsuite.test.gdbclientutils import * | ||
| from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase | ||
|
|
||
|
|
||
| class MyResponder(MockGDBServerResponder): | ||
| def _M(self, size, permissions) -> str: | ||
| return "E04" | ||
|
|
||
| def readRegister(self, regnum): | ||
| return "E01" | ||
|
|
||
| def readRegisters(self): | ||
| return "".join( | ||
| [ | ||
| # x0 | ||
| "2000000000000000", | ||
| # x1..x30, sp, pc | ||
| 32 * "0000000000000000", | ||
| # cpsr | ||
| "00000000", | ||
| ] | ||
| ) | ||
|
|
||
|
|
||
| class TestExprNoAlloc(GDBRemoteTestBase): | ||
| @skipIfRemote | ||
| @skipIfLLVMTargetMissing("AArch64") | ||
| def test(self): | ||
| """ | ||
| We should be able to evaluate an expression that requires no allocations, | ||
| even if the server responds to '_M' with an error. 'CanJIT' should be set | ||
| to 'eCanJITNo' for this response; otherwise, 'IRMemoryMap' would attempt | ||
| to allocate memory in the inferior process and fail. | ||
| """ | ||
|
|
||
| self.server.responder = MyResponder() | ||
| # Note: DynamicLoaderStatic disables JIT by calling 'm_process->SetCanJIT(false)' | ||
| # in LoadAllImagesAtFileAddresses(). Specifying a triple with "-linux" enables | ||
| # DynamicLoaderPOSIXDYLD to be used instead. | ||
| self.target = self.createTarget("basic_eh_frame-aarch64.yaml", "aarch64-linux") | ||
| process = self.connect(self.target) | ||
| lldbutil.expect_state_changes( | ||
| self, self.dbg.GetListener(), process, [lldb.eStateStopped] | ||
| ) | ||
|
|
||
| self.expect_expr("$x0", result_type="unsigned long", result_value="32") | ||
| res = self.target.EvaluateExpression("(int)foo()") | ||
| self.assertFalse(res.GetError().Success()) | ||
| self.assertIn( | ||
| "Can't evaluate the expression without a running target", | ||
| res.GetError().GetCString(), | ||
| ) |
Oops, something went wrong.
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.