Backed out changeset 628ebca30ce3 (bug 1490240) for bustages on [Unified_cpp_crashreporter0.obj]. CLOSED TREE

This commit is contained in:
Brindusan Cristian 2018-09-24 17:10:58 +03:00
parent f8eb1abca2
commit f997140c00
12 changed files with 115 additions and 93 deletions

View File

@ -152,8 +152,8 @@ public:
return false;
}
return mPatchedFns.append(
reinterpret_cast<void*>(readOnlyTargetFn.GetBaseAddress()));
mPatchedFns.append(reinterpret_cast<void*>(readOnlyTargetFn.GetBaseAddress()));
return true;
}
bool WriteHook(const ReadOnlyTargetFunction<MMPolicyT>& aFn,
@ -169,7 +169,7 @@ public:
// Check that the 5 bytes before the function are NOP's or INT 3's,
const uint8_t nopOrBp[] = { 0x90, 0xCC };
if (!writableFn.template VerifyValuesAreOneOf<uint8_t, 5>(nopOrBp)) {
if (!writableFn.VerifyValuesAreOneOf<uint8_t, 5>(nopOrBp)) {
return false;
}
@ -184,8 +184,7 @@ public:
// (These look backwards because little-endian)
const uint16_t possibleEncodings[] = { 0xFF8B, 0xFF89 };
if (!writableFn.template VerifyValuesAreOneOf<uint16_t, 1>(
possibleEncodings, 5)) {
if (!writableFn.VerifyValuesAreOneOf<uint16_t, 1>(possibleEncodings, 5)) {
return false;
}

View File

@ -595,81 +595,82 @@ private:
uint8_t const * const mBase;
};
template <typename TargetMMPolicy> class TargetBytesPtr;
template<>
class TargetBytesPtr<MMPolicyInProcess>
{
public:
typedef TargetBytesPtr<MMPolicyInProcess> Type;
static Type Make(const MMPolicyInProcess& aMMPolicy, const void* aFunc)
{
return TargetBytesPtr(aMMPolicy, aFunc);
}
static Type CopyFromOffset(const TargetBytesPtr& aOther,
const uint32_t aOffsetFromOther)
{
return TargetBytesPtr(aOther, aOffsetFromOther);
}
ReadOnlyTargetBytes<MMPolicyInProcess>* operator->()
{
return &mTargetBytes;
}
TargetBytesPtr(TargetBytesPtr&& aOther)
: mTargetBytes(std::move(aOther.mTargetBytes))
{
}
TargetBytesPtr(const TargetBytesPtr& aOther)
: mTargetBytes(aOther.mTargetBytes)
{
}
TargetBytesPtr& operator=(const TargetBytesPtr&) = delete;
TargetBytesPtr& operator=(TargetBytesPtr&&) = delete;
private:
TargetBytesPtr(const MMPolicyInProcess& aMMPolicy, const void* aFunc)
: mTargetBytes(aMMPolicy, aFunc)
{
}
TargetBytesPtr(const TargetBytesPtr& aOther,
const uint32_t aOffsetFromOther)
: mTargetBytes(aOther.mTargetBytes, aOffsetFromOther)
{
}
ReadOnlyTargetBytes<MMPolicyInProcess> mTargetBytes;
};
template <>
class TargetBytesPtr<MMPolicyOutOfProcess>
{
public:
typedef std::shared_ptr<ReadOnlyTargetBytes<MMPolicyOutOfProcess>> Type;
static Type Make(const MMPolicyOutOfProcess& aMMPolicy, const void* aFunc)
{
return std::make_shared<ReadOnlyTargetBytes<MMPolicyOutOfProcess>>(
aMMPolicy, aFunc);
}
static Type CopyFromOffset(const Type& aOther,
const uint32_t aOffsetFromOther)
{
return std::make_shared<ReadOnlyTargetBytes<MMPolicyOutOfProcess>>(
*aOther, aOffsetFromOther);
}
};
template <typename MMPolicy>
class MOZ_STACK_CLASS ReadOnlyTargetFunction final
{
template <typename TargetMMPolicy>
class TargetBytesPtr;
template<>
class TargetBytesPtr<MMPolicyInProcess>
{
public:
typedef TargetBytesPtr<MMPolicyInProcess> Type;
static Type Make(const MMPolicyInProcess& aMMPolicy, const void* aFunc)
{
return std::move(TargetBytesPtr(aMMPolicy, aFunc));
}
static Type CopyFromOffset(const TargetBytesPtr& aOther,
const uint32_t aOffsetFromOther)
{
return std::move(TargetBytesPtr(aOther, aOffsetFromOther));
}
ReadOnlyTargetBytes<MMPolicyInProcess>* operator->()
{
return &mTargetBytes;
}
TargetBytesPtr(TargetBytesPtr&& aOther)
: mTargetBytes(std::move(aOther.mTargetBytes))
{
}
TargetBytesPtr(const TargetBytesPtr& aOther)
: mTargetBytes(aOther.mTargetBytes)
{
}
TargetBytesPtr& operator=(const TargetBytesPtr&) = delete;
TargetBytesPtr& operator=(TargetBytesPtr&&) = delete;
private:
TargetBytesPtr(const MMPolicyInProcess& aMMPolicy, const void* aFunc)
: mTargetBytes(aMMPolicy, aFunc)
{
}
TargetBytesPtr(const TargetBytesPtr& aOther,
const uint32_t aOffsetFromOther)
: mTargetBytes(aOther.mTargetBytes, aOffsetFromOther)
{
}
ReadOnlyTargetBytes<MMPolicyInProcess> mTargetBytes;
};
template <>
class TargetBytesPtr<MMPolicyOutOfProcess>
{
public:
typedef std::shared_ptr<ReadOnlyTargetBytes<MMPolicyOutOfProcess>> Type;
static Type Make(const MMPolicyOutOfProcess& aMMPolicy, const void* aFunc)
{
return std::move(std::make_shared<ReadOnlyTargetBytes<MMPolicyOutOfProcess>>(
aMMPolicy, aFunc));
}
static Type CopyFromOffset(const Type& aOther,
const uint32_t aOffsetFromOther)
{
return std::move(std::make_shared<ReadOnlyTargetBytes<MMPolicyOutOfProcess>>(
*aOther, aOffsetFromOther));
}
};
public:
ReadOnlyTargetFunction(const MMPolicy& aMMPolicy, const void* aFunc)
: mTargetBytes(TargetBytesPtr<MMPolicy>::Make(aMMPolicy, aFunc))

View File

@ -30,6 +30,9 @@ if CONFIG['OS_TARGET'] == 'Android':
'/toolkit/crashreporter/google-breakpad/src/common/android/include',
]
# We allow warnings for third-party code that can be updated from upstream.
AllowCompilerWarnings()
FINAL_LIBRARY = 'xul'
include('/toolkit/crashreporter/crashreporter.mozbuild')

View File

@ -11,6 +11,9 @@ UNIFIED_SOURCES += [
'minidump_generator.cc',
]
# We allow warnings for third-party code that can be updated from upstream.
AllowCompilerWarnings()
FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [

View File

@ -283,8 +283,7 @@ static string FormatLastError()
}
else {
char buf[64];
sprintf(buf, "Unknown error, error code: 0x%08x",
static_cast<unsigned int>(err));
sprintf(buf, "Unknown error, error code: 0x%08x", err);
message += buf;
}
return message;
@ -349,6 +348,18 @@ static void SetDlgItemVisible(HWND hwndDlg, UINT item, bool visible)
ShowWindow(hwnd, visible ? SW_SHOW : SW_HIDE);
}
static void SetDlgItemDisabled(HWND hwndDlg, UINT item, bool disabled)
{
HWND hwnd = GetDlgItem(hwndDlg, item);
LONG style = GetWindowLong(hwnd, GWL_STYLE);
if (!disabled)
style |= WS_DISABLED;
else
style &= ~WS_DISABLED;
SetWindowLong(hwnd, GWL_STYLE, style);
}
/* === Crash Reporting Dialog === */
static void StretchDialog(HWND hwndDlg, int ydiff)

View File

@ -99,3 +99,6 @@ RCINCLUDE = 'crashreporter.rc'
DisableStlWrapping()
include('/toolkit/crashreporter/crashreporter.mozbuild')
if CONFIG['CC_TYPE'] == 'clang-cl':
AllowCompilerWarnings() # workaround for bug 1090497

View File

@ -42,6 +42,9 @@ SOURCES += [
Library('breakpad_mac_common_s')
# We allow warnings for third-party code that can be updated from upstream.
AllowCompilerWarnings()
FINAL_LIBRARY = 'xul'
CMFLAGS += ['-std=c99']

View File

@ -70,6 +70,9 @@ if CONFIG['OS_TARGET'] == 'Android':
Library('breakpad_common_s')
# We allow warnings for third-party code that can be updated from upstream.
AllowCompilerWarnings()
FINAL_LIBRARY = 'xul'
include('/toolkit/crashreporter/crashreporter.mozbuild')

View File

@ -141,3 +141,6 @@ crash_annotations.inputs = [
with Files('**'):
BUG_COMPONENT = ('Toolkit', 'Crash Reporting')
if CONFIG['CC_TYPE'] == 'clang-cl':
AllowCompilerWarnings() # workaround for bug 1090497

View File

@ -12,7 +12,6 @@
#include "nsDirectoryService.h"
#include "nsDataHashtable.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/EnumeratedRange.h"
#include "mozilla/Services.h"
#include "nsIObserverService.h"
@ -1330,8 +1329,6 @@ FreeBreakpadVM()
}
}
#if defined(XP_WIN)
/**
* Filters out floating point exceptions which are handled by nsSigHandlers.cpp
* and should not be handled as crashes.
@ -1382,8 +1379,6 @@ ChildFPEFilter(void* context, EXCEPTION_POINTERS* exinfo,
return result;
}
#endif // defined(XP_WIN)
static MINIDUMP_TYPE
GetMinidumpType()
{
@ -1433,8 +1428,6 @@ static bool ShouldReport()
return true;
}
#if !defined(XP_WIN)
static bool
Filter(void* context)
{
@ -1455,8 +1448,6 @@ ChildFilter(void* context)
return result;
}
#endif // !defined(XP_WIN)
static void
TerminateHandler()
{
@ -1671,10 +1662,9 @@ nsresult SetExceptionHandler(nsIFile* aXREDirectory,
// protect the crash reporter from being unloaded
gBlockUnhandledExceptionFilter = true;
gKernel32Intercept.Init("kernel32.dll");
DebugOnly<bool> ok =
stub_SetUnhandledExceptionFilter.Set(gKernel32Intercept,
"SetUnhandledExceptionFilter",
&patched_SetUnhandledExceptionFilter);
bool ok = stub_SetUnhandledExceptionFilter.Set(gKernel32Intercept,
"SetUnhandledExceptionFilter",
&patched_SetUnhandledExceptionFilter);
#ifdef DEBUG
if (!ok)

View File

@ -59,3 +59,6 @@ NO_PGO = True
# Temporary workaround for an issue in upstream breakpad
if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
CXXFLAGS += ['-wd4334']
if CONFIG['CC_TYPE'] == 'clang-cl':
AllowCompilerWarnings() # workaround for bug 1090497

View File

@ -176,7 +176,7 @@ void Crash(int16_t how)
auto pfnTest = m[how];
auto pfnLauncher = m[CRASH_X64CFI_LAUNCHER];
ReserveStack();
pfnLauncher(0, reinterpret_cast<void*>(pfnTest));
pfnLauncher(0, pfnTest);
break;
}
#endif // XP_WIN && HAVE_64BIT_BUILD && !defined(__MINGW32__)