-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace ArchSpec::PiecewiseCompare() with Triple::operator==()
Looking ast the definition of both functions this is *almost* an NFC change, except that Triple also looks at the SubArch (important) and ObjectFormat (less so). This fixes a bug that only manifests with how Xcode uses the SBAPI to attach to a process by name: it guesses the architecture based on the system. If the system is arm64 and the Process is arm64e Target fails to update the triple because it deemed the two to be equivalent. rdar://123338218
- Loading branch information
1 parent
b876596
commit f9f3316
Showing
6 changed files
with
33 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
C_SOURCES := main.c | ||
include Makefile.rules |
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,28 @@ | ||
import lldb | ||
from lldbsuite.test.decorators import * | ||
from lldbsuite.test.lldbtest import * | ||
from lldbsuite.test import lldbutil | ||
|
||
|
||
class TestArm64eAttach(TestBase): | ||
NO_DEBUG_INFO_TESTCASE = True | ||
|
||
# On Darwin systems, arch arm64e means ARMv8.3 with ptrauth ABI used. | ||
@skipIf(archs=no_match(["arm64e"])) | ||
def test(self): | ||
# Skip this test if not running on AArch64 target that supports PAC | ||
if not self.isAArch64PAuth(): | ||
self.skipTest("Target must support pointer authentication.") | ||
self.build() | ||
popen = self.spawnSubprocess(self.getBuildArtifact(), []) | ||
error = lldb.SBError() | ||
# This simulates how Xcode attaches to a process by pid/name. | ||
target = self.dbg.CreateTarget("", "arm64", "", True, error) | ||
listener = lldb.SBListener("my.attach.listener") | ||
process = target.AttachToProcessWithID(listener, popen.pid, error) | ||
self.assertSuccess(error) | ||
self.assertTrue(process, PROCESS_IS_VALID) | ||
self.assertEqual(target.GetTriple().split('-')[0], "arm64e", | ||
"target triple is updated correctly") | ||
error = process.Kill() | ||
self.assertSuccess(error) |
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,2 @@ | ||
int getchar(); | ||
int main() { return getchar(); } |