This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Add Windows support for //flutter/fml/backtrace.h
#36202
Merged
Merged
Changes from 9 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
760e866
Add Windows support for `//flutter/fml/backtrace.h`
moko256 6b26b25
remove empty break
moko256 aa92903
use absl::GetStackTrace
moko256 1d5b4fc
remove __cxxabiv1::__cxa_demangle
moko256 09649c1
replace with absil's signal handler
moko256 dca3616
fix format
moko256 dba4017
cleanup unused vars
moko256 a5b212c
fix test to enable to run without symbol
moko256 4fe24c3
mark BacktraceTest as DeathTest
moko256 f67dcf6
restore BacktraceHere
moko256 393233e
add comment
moko256 edfe8c1
test if stacktrace is supported
moko256 30105e7
Revert "test if stacktrace is supported"
moko256 51eaf5d
Rollback to 6b26b25
moko256 8df181b
Restore some changes.
moko256 6d5f7c2
Remove unused include.
moko256 a5a124a
Unite adding to offset
moko256 763d211
Remove test output
moko256 987eee5
Add test for BacktraceHere(0)
moko256 d6c28d9
Skip test if binary has no symbol
moko256 20b6dc4
Use gmock's matcher
moko256 ce81ec5
Fix private header
moko256 a4f3850
Force inlining
moko256 b6c657e
Skip if backtrace is not supported
moko256 a99f0dc
Inline manually
moko256 24b2aa5
Rollback to 763d211 and fix comment
moko256 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
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 |
---|---|---|
|
@@ -4,34 +4,20 @@ | |
|
||
#include "backtrace.h" | ||
|
||
#include <csignal> | ||
|
||
#include "gtest/gtest.h" | ||
#include "logging.h" | ||
|
||
namespace fml { | ||
namespace testing { | ||
|
||
TEST(BacktraceTest, CanGatherBacktrace) { | ||
TEST(BacktraceDeathTest, CanGatherBacktrace) { | ||
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. This test does nothing useful now. Let's remove this as well as 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. done |
||
if (!IsCrashHandlingSupported()) { | ||
GTEST_SKIP(); | ||
return; | ||
} | ||
{ | ||
auto trace = BacktraceHere(0); | ||
ASSERT_GT(trace.size(), 0u); | ||
ASSERT_NE(trace.find("Frame 0"), std::string::npos); | ||
} | ||
|
||
{ | ||
auto trace = BacktraceHere(1); | ||
ASSERT_GT(trace.size(), 0u); | ||
ASSERT_NE(trace.find("Frame 0"), std::string::npos); | ||
} | ||
|
||
{ | ||
auto trace = BacktraceHere(2); | ||
ASSERT_GT(trace.size(), 0u); | ||
ASSERT_NE(trace.find("Frame 0"), std::string::npos); | ||
} | ||
::testing::FLAGS_gtest_death_test_style = "threadsafe"; | ||
EXPECT_DEATH_IF_SUPPORTED({ std::abort(); }, "SIGABRT"); | ||
} | ||
|
||
} // namespace testing | ||
|
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.
Why remove this function? I presume the intent was for use when debugging.
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.
Since the #16450, which introduced
BacktraceHere
, this is only used in signal handler (and test forBacktraceHere
). I thought it was made public to test.The handler from
absl::InstallFailureSignalHandler
also shows stacktrace when receive signal, same as from fml'sInstallCrashHandler
before. The stacktrace's format is a little different from BacktraceHere, but it seems that the existing tests doesn't depend on the format.I just intended to avoid bitrot to follow the style guide. I know this can be used to debug. If any engine's contributors use it to debug, I'll restore it.
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.
sgtm -- I don't use it to debug, so personally I'm fine if we remove it (we can always restore it in a followup patch with appropriate tweaks if desired)
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 shouldn't have code that isn't used, but I do end up using this call frequently when debugging/testing locally. Does absl have a similar function?
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.
(This is not blocking for landing, but I'd like to know for my own edification)
Uh oh!
There was an error while loading. Please reload this page.
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.
If people are using it for development, and if absl doesn't have an equivalent then let's restore it (the existing test will avoid bitrot, at least to some extent).
If absl does have an equivalent call, maybe we could add a "// See: absl::SomethingOrOther" type comment to the class docs as a little breadcrumb to help developers find it.
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.
done