-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[lldb] convert jit-loader_rtdyld_elf.test to an API test #170333
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
Changes from all commits
07ecfc8
887a09d
28b3a57
9074baa
faf36ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| CXX_SOURCES := jitbp.cpp | ||
|
|
||
| include Makefile.rules | ||
|
|
||
| jitbp.ll: jitbp.cpp | ||
| $(CXX) -g -S -emit-llvm --target=x86_64-unknown-unknown-elf \ | ||
| -o $@ $< | ||
|
|
||
| all: jitbp.ll | ||
|
|
||
| clean:: | ||
| rm -f jitbp.ll |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| """ | ||
| Test that pending breakpoints resolve for JITted code with mcjit and rtdyld. | ||
| """ | ||
|
|
||
| import lldb | ||
| from lldbsuite.test.decorators import * | ||
| from lldbsuite.test.lldbtest import * | ||
|
|
||
|
|
||
| class TestJitBreakpoint(TestBase): | ||
| @skipUnlessArch("x86_64") | ||
| @skipUnlessCompilerIsClang | ||
| @expectedFailureAll(oslist=["windows"]) | ||
| def test_jit_breakpoints(self): | ||
| self.build() | ||
| self.ll = self.getBuildArtifact("jitbp.ll") | ||
| self.do_test("--jit-kind=mcjit") | ||
| self.do_test("--jit-linker=rtdyld") | ||
|
|
||
| def do_test(self, jit_flag: str): | ||
| self.runCmd("settings set plugin.jit-loader.gdb.enable on") | ||
|
|
||
| clang_path = self.findBuiltClang() | ||
| self.assertTrue(clang_path, "built clang could not be found") | ||
| lli_path = os.path.join(os.path.dirname(clang_path), "lli") | ||
| self.assertTrue(lldbutil.is_exe(lli_path), f"'{lli_path}' is not an executable") | ||
| self.runCmd(f"target create {lli_path}", CURRENT_EXECUTABLE_SET) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lldbutil.run_to_source_breakpoint takes the path to the executable to run as a named argument, and a boolean for whether the pattern is found on launch, so you could replace from line 27 to line 46 with:
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But if your goal is to have this be in separate pieces in case you need to instrument it when it mysteriously fails on some bot, maybe doing the separate stages by hand in the test is okay too.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that, as you said, we should keep the separate stages to instrument the test later on once it times out. |
||
|
|
||
| line = line_number("jitbp.cpp", "int jitbp()") | ||
| lldbutil.run_break_set_by_file_and_line( | ||
| self, "jitbp.cpp", line, num_expected_locations=0 | ||
| ) | ||
|
|
||
| self.runCmd(f"run {jit_flag} {self.ll}", RUN_SUCCEEDED) | ||
|
|
||
| # The stop reason of the thread should be breakpoint. | ||
| # And it should break at jitbp.cpp:1. | ||
| self.expect( | ||
| "thread list", | ||
| STOPPED_DUE_TO_BREAKPOINT, | ||
| substrs=[ | ||
| "stopped", | ||
| "jitbp.cpp:%d" % line, | ||
| "stop reason = breakpoint", | ||
| ], | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| int jitbp() { return 0; } | ||
| int main() { return jitbp(); } |
This file was deleted.
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.
We'll also need a decorator that checks that the compiler is clang (and not, e.g., gcc) since we use the
-emit-llvmflag.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.
I have added
@skipUnlessCompilerIsClang