mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-29 08:39:44 +08:00
4893a9b76d
Capture the memory for the loader lock (can be inspected by !cs), as well as all locks that were created with .DebugInfo which can be viewed with !locks. e.g. 0:000> !cs ntdll!LdrpLoaderLock ----------------------------------------- Critical section = 0x778d6410 (ntdll!LdrpLoaderLock+0x0) DebugInfo = 0x778d6b6c NOT LOCKED LockSemaphore = 0x0 SpinCount = 0x04000000 0:000> !locks -v CritSec ntdll!RtlpProcessHeapsListLock+0 at 778d7620 LockCount NOT LOCKED RecursionCount 0 OwningThread 0 EntryCount 0 ContentionCount 0 CritSec +7a0248 at 007a0248 LockCount NOT LOCKED RecursionCount 0 OwningThread 0 EntryCount 0 ContentionCount 0 CritSec crashy_program!g_critical_section_with_debug_info+0 at 01342c48 LockCount NOT LOCKED RecursionCount 0 OwningThread 0 EntryCount 0 ContentionCount 0 CritSec crashy_program!crashpad::`anonymous namespace'::g_test_critical_section+0 at 01342be0 WaiterWoken No LockCount 0 RecursionCount 1 OwningThread 34b8 EntryCount 0 ContentionCount 0 *** Locked Scanned 4 critical sections R=mark@chromium.org BUG=crashpad:52 Review URL: https://codereview.chromium.org/1392093003 .
77 lines
3.0 KiB
C++
77 lines
3.0 KiB
C++
// Copyright 2015 The Crashpad Authors. All rights reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#ifndef CRASHPAD_HANDLER_WIN_CRASH_REPORT_EXCEPTION_HANDLER_H_
|
|
#define CRASHPAD_HANDLER_WIN_CRASH_REPORT_EXCEPTION_HANDLER_H_
|
|
|
|
#include <windows.h>
|
|
|
|
#include <map>
|
|
#include <string>
|
|
|
|
#include "util/win/exception_handler_server.h"
|
|
|
|
namespace crashpad {
|
|
|
|
class CrashReportDatabase;
|
|
class CrashReportUploadThread;
|
|
|
|
//! \brief An exception handler that writes crash reports for exception messages
|
|
//! to a CrashReportDatabase.
|
|
class CrashReportExceptionHandler : public ExceptionHandlerServer::Delegate {
|
|
public:
|
|
//! \brief Creates a new object that will store crash reports in \a database.
|
|
//!
|
|
//! \param[in] database The database to store crash reports in. Weak.
|
|
//! \param[in] upload_thread The upload thread to notify when a new crash
|
|
//! report is written into \a database.
|
|
//! \param[in] process_annotations A map of annotations to insert as
|
|
//! process-level annotations into each crash report that is written. Do
|
|
//! not confuse this with module-level annotations, which are under the
|
|
//! control of the crashing process, and are used to implement Chrome's
|
|
//! "crash keys." Process-level annotations are those that are beyond the
|
|
//! control of the crashing process, which must reliably be set even if
|
|
//! the process crashes before it's able to establish its own annotations.
|
|
//! To interoperate with Breakpad servers, the recommended practice is to
|
|
//! specify values for the `"prod"` and `"ver"` keys as process
|
|
//! annotations.
|
|
CrashReportExceptionHandler(
|
|
CrashReportDatabase* database,
|
|
CrashReportUploadThread* upload_thread,
|
|
const std::map<std::string, std::string>* process_annotations);
|
|
|
|
~CrashReportExceptionHandler() override;
|
|
|
|
// ExceptionHandlerServer::Delegate:
|
|
|
|
//! \brief Processes an exception message by writing a crash report to this
|
|
//! object's CrashReportDatabase.
|
|
void ExceptionHandlerServerStarted() override;
|
|
unsigned int ExceptionHandlerServerException(
|
|
HANDLE process,
|
|
WinVMAddress exception_information_address,
|
|
WinVMAddress debug_critical_section_address) override;
|
|
|
|
private:
|
|
CrashReportDatabase* database_; // weak
|
|
CrashReportUploadThread* upload_thread_; // weak
|
|
const std::map<std::string, std::string>* process_annotations_; // weak
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CrashReportExceptionHandler);
|
|
};
|
|
|
|
} // namespace crashpad
|
|
|
|
#endif // CRASHPAD_HANDLER_WIN_CRASH_REPORT_EXCEPTION_HANDLER_H_
|