greenplumn CMiniDumper 源码

  • 2022-08-18
  • 浏览 (282)

greenplumn CMiniDumper 代码

文件路径:/src/backend/gporca/libgpos/src/error/CMiniDumper.cpp

//---------------------------------------------------------------------------
//	Greenplum Database
//	Copyright (C) 2011 EMC Corp.
//
//	@filename:
//		CMiniDumper.cpp
//
//	@doc:
//		Partial implementation of interface for minidump handler
//---------------------------------------------------------------------------

#include "gpos/error/CMiniDumper.h"

#include "gpos/base.h"
#include "gpos/common/clibwrapper.h"
#include "gpos/error/CErrorContext.h"
#include "gpos/string/CWStringConst.h"
#include "gpos/task/CTask.h"

using namespace gpos;

//---------------------------------------------------------------------------
//	@function:
//		CMiniDumper::CMiniDumper
//
//	@doc:
//		Ctor
//
//---------------------------------------------------------------------------
CMiniDumper::CMiniDumper() = default;


//---------------------------------------------------------------------------
//	@function:
//		CMiniDumper::~CMiniDumper
//
//	@doc:
//		Dtor
//
//---------------------------------------------------------------------------
CMiniDumper::~CMiniDumper()
{
	if (m_initialized)
	{
		CTask *task = CTask::Self();

		GPOS_ASSERT(nullptr != task);

		task->ConvertErrCtxt()->Unregister(
#ifdef GPOS_DEBUG
			this
#endif	// GPOS_DEBUG
		);
	}
}


//---------------------------------------------------------------------------
//	@function:
//		CMiniDumper::Init
//
//	@doc:
//		Initialize
//
//---------------------------------------------------------------------------
void
CMiniDumper::Init(COstream *oos)
{
	GPOS_ASSERT(!m_initialized);
	GPOS_ASSERT(!m_finalized);

	CTask *task = CTask::Self();

	GPOS_ASSERT(nullptr != task);

	m_oos = oos;

	task->ConvertErrCtxt()->Register(this);

	m_initialized = true;

	SerializeHeader();
}


//---------------------------------------------------------------------------
//	@function:
//		CMiniDumper::Finalize
//
//	@doc:
//		Finalize
//
//---------------------------------------------------------------------------
void
CMiniDumper::Finalize()
{
	GPOS_ASSERT(m_initialized);
	GPOS_ASSERT(!m_finalized);

	SerializeFooter();

	m_finalized = true;
}


//---------------------------------------------------------------------------
//	@function:
//		CMiniDumper::GetOStream
//
//	@doc:
//		Get stream to serialize to
//
//---------------------------------------------------------------------------
COstream &
CMiniDumper::GetOStream()
{
	GPOS_ASSERT(m_initialized);

	return *m_oos;
}


// EOF

相关信息

greenplumn 源码目录

相关文章

greenplumn CAutoExceptionStack 源码

greenplumn CAutoTrace 源码

greenplumn CErrorContext 源码

greenplumn CErrorHandlerStandard 源码

greenplumn CException 源码

greenplumn CLogger 源码

greenplumn CLoggerStream 源码

greenplumn CLoggerSyslog 源码

greenplumn CMessage 源码

greenplumn CMessageRepository 源码

0  赞