Revert "Shorten TRAP_SEQUENCE() to one instruction on most platforms."
This reverts commit ffe0185ea67114e8f0809e0112412c5bea61320b.
Reason for revert: Causes test failures in official builds
Original change's description:
> Shorten TRAP_SEQUENCE() to one instruction on most platforms.
>
> Previously, TRAP_SEQUENCE() consisted of:
> - an instruction to trigger a debugger breakpoint
> - an instruction to ensure fatal termination (usually encoded as an
> illegal instruction)
>
> But all that's really needed is the latter, so eliminate the
> instruction to trigger the debugger breakpoint.
>
> Note: on Intel, the debugger breakpoint instruction (int3) is only one
> byte, while the fatal termination instruction (ud2) is two bytes.
> Unfortunately, crash reports seem to be indicating that int3 is
> non-fatal. Since it's important that TRAP_SEQUENCE() terminates, it
> cannot rely on int3.
>
> Bug: 958675
> Change-Id: I84b3123b07a9871dbd3b062fd73e79137b1ef6dd
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1672227
> Reviewed-by: Mark Mentovai <[email protected]>
> Reviewed-by: Alex Moshchuk <[email protected]>
> Commit-Queue: Daniel Cheng <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#678065}
[email protected],[email protected],[email protected],[email protected]
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: 958675, 985138
Change-Id: Ib9c3d09f6b2a5dc182cb125f90a7d9130c98e5be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1713904
Reviewed-by: Reid Kleckner <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Commit-Queue: Reid Kleckner <[email protected]>
Cr-Commit-Position: refs/heads/master@{#679787}
diff --git a/base/immediate_crash_unittest.cc b/base/immediate_crash_unittest.cc
index 1b538ae..8fc9d38 100644
--- a/base/immediate_crash_unittest.cc
+++ b/base/immediate_crash_unittest.cc
@@ -38,19 +38,14 @@
NativeLibraryLoadError load_error;
FilePath helper_library_path;
#if !defined(OS_ANDROID) && !defined(OS_FUCHSIA)
- // Appending the library name to DIR_EXE isn't necessary on all platforms (and
- // can even break in some places):
- // - on Android M, DIR_EXE == /system/bin when running base_unittests.
- // - on Fuchsia, NativeLibrary knows where to look already, since it
- // understands the platform convention that libraries are not colocated with
- // the binary.
+ // On Android M, DIR_EXE == /system/bin when running base_unittests.
+ // On Fuchsia, NativeLibrary understands the native convention that libraries
+ // are not colocated with the binary.
ASSERT_TRUE(PathService::Get(DIR_EXE, &helper_library_path));
#endif
helper_library_path = helper_library_path.AppendASCII(
GetNativeLibraryName("immediate_crash_test_helper"));
#if defined(OS_ANDROID) && defined(COMPONENT_BUILD)
- // Android component builds use a unique shared library suffix to avoid naming
- // collisions.
helper_library_path = helper_library_path.ReplaceExtension(".cr.so");
#endif
// TODO(dcheng): Shouldn't GetNativeLibraryName just return a FilePath?
@@ -91,10 +86,8 @@
// Look for two IMMEDIATE_CRASH() opcode sequences.
for (int i = 0; i < 2; ++i) {
-#if defined(OS_LINUX)
- // INT3
+ // INT 3
EXPECT_EQ(0xCC, *++it);
-#endif // defined(OS_LINUX)
// UD2
EXPECT_EQ(0x0F, *++it);
EXPECT_EQ(0x0B, *++it);
@@ -127,6 +120,8 @@
// Look for two IMMEDIATE_CRASH() opcode sequences.
for (int i = 0; i < 2; ++i) {
+ // BKPT #0
+ EXPECT_EQ(0xBE00, *++it);
// UDF #0
EXPECT_EQ(0xDE00, *++it);
}
@@ -148,6 +143,8 @@
// Look for two IMMEDIATE_CRASH() opcode sequences.
for (int i = 0; i < 2; ++i) {
+ // BRK #0
+ EXPECT_EQ(0XD4200000, *++it);
// HLT #0
EXPECT_EQ(0xD4400000, *++it);
}