-
Notifications
You must be signed in to change notification settings - Fork 1.4k
pass -fno-omit-frame-pointer in support of new backtracer #7042
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
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 |
---|---|---|
|
@@ -1189,6 +1189,10 @@ final class BuildPlanTests: XCTestCase { | |
#endif | ||
|
||
args += [hostTriple.isWindows() ? "-gdwarf" : "-g"] | ||
|
||
if hostTriple.isLinux() { | ||
args += ["-fno-omit-frame-pointer"] | ||
} | ||
|
||
XCTAssertEqual(try ext.basicArguments(isCXX: false), args) | ||
XCTAssertEqual(try ext.objects, [buildPath.appending(components: "extlib.build", "extlib.c.o")]) | ||
|
@@ -1219,6 +1223,11 @@ final class BuildPlanTests: XCTestCase { | |
args += ["-fmodules-cache-path=\(buildPath.appending(components: "ModuleCache"))"] | ||
#endif | ||
args += [hostTriple.isWindows() ? "-gdwarf" : "-g"] | ||
|
||
if hostTriple.isLinux() { | ||
args += ["-fno-omit-frame-pointer"] | ||
} | ||
|
||
XCTAssertEqual(try exe.basicArguments(isCXX: false), args) | ||
XCTAssertEqual(try exe.objects, [buildPath.appending(components: "exe.build", "main.c.o")]) | ||
XCTAssertEqual(exe.moduleMap, nil) | ||
|
@@ -1514,6 +1523,11 @@ final class BuildPlanTests: XCTestCase { | |
args += ["-fmodules-cache-path=\(buildPath.appending(components: "ModuleCache"))"] | ||
#endif | ||
args += [hostTriple.isWindows() ? "-gdwarf" : "-g"] | ||
|
||
if hostTriple.isLinux() { | ||
args += ["-fno-omit-frame-pointer"] | ||
} | ||
|
||
XCTAssertEqual(try lib.basicArguments(isCXX: false), args) | ||
XCTAssertEqual(try lib.objects, [buildPath.appending(components: "lib.build", "lib.c.o")]) | ||
XCTAssertEqual(lib.moduleMap, buildPath.appending(components: "lib.build", "module.modulemap")) | ||
|
@@ -2509,6 +2523,11 @@ final class BuildPlanTests: XCTestCase { | |
#endif | ||
|
||
expectedExeBasicArgs += [triple.isWindows() ? "-gdwarf" : "-g"] | ||
|
||
if triple.isLinux() { | ||
expectedExeBasicArgs += ["-fno-omit-frame-pointer"] | ||
} | ||
|
||
XCTAssertEqual(try exe.basicArguments(isCXX: false), expectedExeBasicArgs) | ||
XCTAssertEqual(try exe.objects, [buildPath.appending(components: "exe.build", "main.c.o")]) | ||
XCTAssertEqual(exe.moduleMap, nil) | ||
|
@@ -2530,6 +2549,11 @@ final class BuildPlanTests: XCTestCase { | |
triple.isWindows() ? "-gdwarf" : "-g", | ||
triple.isWindows() ? "-gdwarf" : "-g", | ||
] | ||
|
||
if triple.isLinux() { | ||
expectedLibBasicArgs += ["-fno-omit-frame-pointer"] | ||
} | ||
|
||
XCTAssertEqual(try lib.basicArguments(isCXX: true), expectedLibBasicArgs) | ||
|
||
XCTAssertEqual(try lib.objects, [buildPath.appending(components: "lib.build", "lib.cpp.o")]) | ||
|
@@ -3059,7 +3083,7 @@ final class BuildPlanTests: XCTestCase { | |
"-fblocks", "-fmodules", "-fmodule-name=lib", | ||
"-I", Pkg.appending(components: "Sources", "lib", "include").pathString, | ||
"-fmodules-cache-path=\(buildPath.appending(components: "ModuleCache"))", | ||
"-g", | ||
"-g" | ||
] | ||
XCTAssertEqual(try lib.basicArguments(isCXX: false), args) | ||
XCTAssertEqual(try lib.objects, [buildPath.appending(components: "lib.build", "lib.c.o")]) | ||
|
@@ -3136,7 +3160,10 @@ final class BuildPlanTests: XCTestCase { | |
|
||
func createResult(for triple: Basics.Triple) throws -> BuildPlanResult { | ||
try BuildPlanResult(plan: BuildPlan( | ||
buildParameters: mockBuildParameters(canRenameEntrypointFunctionName: true, targetTriple: triple), | ||
buildParameters: mockBuildParameters( | ||
canRenameEntrypointFunctionName: true, | ||
targetTriple: triple | ||
), | ||
graph: graph, | ||
fileSystem: fs, | ||
observabilityScope: observability.topScope | ||
|
@@ -3511,18 +3538,68 @@ final class BuildPlanTests: XCTestCase { | |
XCTAssertMatch(dep, [.anySequence, "-DDEP", .anySequence]) | ||
|
||
let cbar = try result.target(for: "cbar").clangTarget().basicArguments(isCXX: false) | ||
XCTAssertMatch(cbar, [.anySequence, "-DCCC=2", "-I\(A.appending(components: "Sources", "cbar", "Sources", "headers"))", "-I\(A.appending(components: "Sources", "cbar", "Sources", "cppheaders"))", "-Icfoo", "-L", "cbar", "-Icxxfoo", "-L", "cxxbar", "-g", .end]) | ||
XCTAssertMatch(cbar, [.anySequence, "-DCCC=2", "-I\(A.appending(components: "Sources", "cbar", "Sources", "headers"))", "-I\(A.appending(components: "Sources", "cbar", "Sources", "cppheaders"))", "-Icfoo", "-L", "cbar", "-Icxxfoo", "-L", "cxxbar", "-g", "-fno-omit-frame-pointer", .end]) | ||
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. Is this correct? 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 so, why not? 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. for reference this is for |
||
|
||
let bar = try result.target(for: "bar").swiftTarget().compileArguments() | ||
XCTAssertMatch(bar, [.anySequence, "-DLINUX", "-Isfoo", "-L", "sbar", "-cxx-interoperability-mode=default", "-enable-upcoming-feature", "BestFeature", "-g", "-Xcc", "-g", .end]) | ||
XCTAssertMatch(bar, [.anySequence, "-DLINUX", "-Isfoo", "-L", "sbar", "-cxx-interoperability-mode=default", "-enable-upcoming-feature", "BestFeature", "-g", "-Xcc", "-g", "-Xcc", "-fno-omit-frame-pointer", .end]) | ||
|
||
let exe = try result.target(for: "exe").swiftTarget().compileArguments() | ||
XCTAssertMatch(exe, [.anySequence, "-DFOO", "-g", "-Xcc", "-g", .end]) | ||
XCTAssertMatch(exe, [.anySequence, "-DFOO", "-g", "-Xcc", "-g", "-Xcc", "-fno-omit-frame-pointer", .end]) | ||
|
||
let linkExe = try result.buildProduct(for: "exe").linkArguments() | ||
XCTAssertMatch(linkExe, [.anySequence, "-lsqlite3", "-llibz", "-Ilfoo", "-L", "lbar", "-g", .end]) | ||
} | ||
|
||
// omit frame pointers explicitly set to true | ||
do { | ||
let result = try BuildPlanResult(plan: BuildPlan( | ||
buildParameters: mockBuildParameters( | ||
targetTriple: .x86_64Linux, | ||
omitFramePointers: true | ||
), | ||
graph: graph, | ||
fileSystem: fs, | ||
observabilityScope: observability.topScope | ||
)) | ||
|
||
let dep = try result.target(for: "t1").swiftTarget().compileArguments() | ||
XCTAssertMatch(dep, [.anySequence, "-DDEP", .anySequence]) | ||
|
||
let cbar = try result.target(for: "cbar").clangTarget().basicArguments(isCXX: false) | ||
XCTAssertMatch(cbar, [.anySequence, "-DCCC=2", "-I\(A.appending(components: "Sources", "cbar", "Sources", "headers"))", "-I\(A.appending(components: "Sources", "cbar", "Sources", "cppheaders"))", "-Icfoo", "-L", "cbar", "-Icxxfoo", "-L", "cxxbar", "-g", "-fomit-frame-pointer", .end]) | ||
|
||
let bar = try result.target(for: "bar").swiftTarget().compileArguments() | ||
XCTAssertMatch(bar, [.anySequence, "-DLINUX", "-Isfoo", "-L", "sbar", "-cxx-interoperability-mode=default", "-enable-upcoming-feature", "BestFeature", "-g", "-Xcc", "-g", "-Xcc", "-fomit-frame-pointer", .end]) | ||
|
||
let exe = try result.target(for: "exe").swiftTarget().compileArguments() | ||
XCTAssertMatch(exe, [.anySequence, "-DFOO", "-g", "-Xcc", "-g", "-Xcc", "-fomit-frame-pointer", .end]) | ||
} | ||
|
||
// omit frame pointers explicitly set to false | ||
do { | ||
let result = try BuildPlanResult(plan: BuildPlan( | ||
buildParameters: mockBuildParameters( | ||
targetTriple: .x86_64Linux, | ||
omitFramePointers: false | ||
), | ||
graph: graph, | ||
fileSystem: fs, | ||
observabilityScope: observability.topScope | ||
)) | ||
|
||
let dep = try result.target(for: "t1").swiftTarget().compileArguments() | ||
XCTAssertMatch(dep, [.anySequence, "-DDEP", .anySequence]) | ||
|
||
let cbar = try result.target(for: "cbar").clangTarget().basicArguments(isCXX: false) | ||
XCTAssertMatch(cbar, [.anySequence, "-DCCC=2", "-I\(A.appending(components: "Sources", "cbar", "Sources", "headers"))", "-I\(A.appending(components: "Sources", "cbar", "Sources", "cppheaders"))", "-Icfoo", "-L", "cbar", "-Icxxfoo", "-L", "cxxbar", "-g", "-fno-omit-frame-pointer", .end]) | ||
|
||
let bar = try result.target(for: "bar").swiftTarget().compileArguments() | ||
XCTAssertMatch(bar, [.anySequence, "-DLINUX", "-Isfoo", "-L", "sbar", "-cxx-interoperability-mode=default", "-enable-upcoming-feature", "BestFeature", "-g", "-Xcc", "-g", "-Xcc", "-fno-omit-frame-pointer", .end]) | ||
|
||
let exe = try result.target(for: "exe").swiftTarget().compileArguments() | ||
XCTAssertMatch(exe, [.anySequence, "-DFOO", "-g", "-Xcc", "-g", "-Xcc", "-fno-omit-frame-pointer", .end]) | ||
} | ||
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. Not sure I like that we're making these tests even more unmaintainable by copy-pasting two extra times, but I guess it's fine... |
||
|
||
do { | ||
let result = try createResult(for: .x86_64MacOS) | ||
|
||
|
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.
Why remove the trailing
,
? It is convenient.