forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 341
Add an <address-expression> fallback that handles register expressions #8470
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
adrian-prantl
merged 2 commits into
swiftlang:swift/release/6.0
from
jimingham:addr-expression-swift
Mar 26, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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 |
27 changes: 27 additions & 0 deletions
27
lldb/test/API/commands/target/modules/lookup/TestImageLookupPCExpression.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,27 @@ | ||
""" | ||
Make sure that "target modules lookup -va $pc" works | ||
""" | ||
|
||
|
||
import lldb | ||
import lldbsuite.test.lldbutil as lldbutil | ||
from lldbsuite.test.lldbtest import * | ||
|
||
|
||
class TestImageLookupPCInC(TestBase): | ||
def test_sample_rename_this(self): | ||
"""There can be many tests in a test case - describe this test here.""" | ||
self.build() | ||
self.main_source_file = lldb.SBFileSpec("main.c") | ||
self.sample_test() | ||
|
||
def sample_test(self): | ||
"""Make sure the address expression resolves to the right function""" | ||
|
||
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( | ||
self, "Set a breakpoint here", self.main_source_file | ||
) | ||
|
||
self.expect("target modules lookup -va $pc", substrs=["doSomething"]) | ||
self.expect("target modules lookup -va $pc+4", substrs=["doSomething"]) | ||
|
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,15 @@ | ||
#include <stdio.h> | ||
|
||
void | ||
doSomething() | ||
{ | ||
printf ("Set a breakpoint here.\n"); | ||
printf ("Need a bit more code.\n"); | ||
} | ||
|
||
int | ||
main() | ||
{ | ||
doSomething(); | ||
return 0; | ||
} |
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,4 @@ | ||
SWIFT_SOURCES := main.swift | ||
SWIFTFLAGS_EXTRAS := -O | ||
|
||
include Makefile.rules |
19 changes: 19 additions & 0 deletions
19
lldb/test/API/commands/target/modules/swift/TestSwiftImageLookupPC.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,19 @@ | ||
import lldb | ||
from lldbsuite.test.lldbtest import * | ||
from lldbsuite.test.decorators import * | ||
import lldbsuite.test.lldbutil as lldbutil | ||
import unittest2 | ||
|
||
|
||
class SwiftAddressExpressionTest(TestBase): | ||
@swiftTest | ||
def test(self): | ||
"""Test that you can use register names in image lookup in a swift frame.""" | ||
self.build() | ||
(target, process, thread, breakpoint) = lldbutil.run_to_source_breakpoint(self, | ||
"break here to check image lookup", lldb.SBFileSpec("main.swift")) | ||
# I don't want to be too specific in what we print for image lookup, | ||
# we're testing that the address expression for the pc worked. | ||
self.expect("image lookup -va $pc", substrs=["doSomething"]) | ||
self.expect("image lookup -va $pc+4", substrs=["doSomething"]) | ||
|
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,7 @@ | ||
func doSomething() { | ||
print("break here to check image lookup"); | ||
print("I need another line of code here"); | ||
} | ||
|
||
doSomething() | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably forgot to rename this test name and the comment below?