2014-11-11 08:00:14 +08:00
|
|
|
//===-- ExceptionRecord.h ---------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef liblldb_Plugins_Process_Windows_ExceptionRecord_H_
|
|
|
|
#define liblldb_Plugins_Process_Windows_ExceptionRecord_H_
|
|
|
|
|
|
|
|
#include "ForwardDecl.h"
|
|
|
|
|
|
|
|
#include "lldb/lldb-forward.h"
|
|
|
|
#include "lldb/Host/windows/windows.h"
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace lldb_private
|
|
|
|
{
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// ExceptionRecord
|
|
|
|
//
|
|
|
|
// ExceptionRecord defines an interface which allows implementors to receive
|
|
|
|
// notification of events that happen in a debugged process.
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
class ExceptionRecord
|
|
|
|
{
|
|
|
|
public:
|
2015-05-19 07:24:32 +08:00
|
|
|
ExceptionRecord(const EXCEPTION_RECORD &record, lldb::tid_t thread_id)
|
2014-11-11 08:00:14 +08:00
|
|
|
{
|
|
|
|
m_code = record.ExceptionCode;
|
|
|
|
m_continuable = (record.ExceptionFlags == 0);
|
|
|
|
if (record.ExceptionRecord)
|
2015-05-19 07:24:32 +08:00
|
|
|
m_next_exception.reset(new ExceptionRecord(*record.ExceptionRecord, thread_id));
|
2014-11-11 08:00:14 +08:00
|
|
|
m_exception_addr = reinterpret_cast<lldb::addr_t>(record.ExceptionAddress);
|
2015-05-19 07:24:32 +08:00
|
|
|
m_thread_id = thread_id;
|
2014-11-11 08:00:14 +08:00
|
|
|
m_arguments.assign(record.ExceptionInformation, record.ExceptionInformation + record.NumberParameters);
|
|
|
|
}
|
|
|
|
virtual ~ExceptionRecord() {}
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
GetExceptionCode() const
|
|
|
|
{
|
|
|
|
return m_code;
|
|
|
|
}
|
|
|
|
bool
|
|
|
|
IsContinuable() const
|
|
|
|
{
|
|
|
|
return m_continuable;
|
|
|
|
}
|
|
|
|
const ExceptionRecord *
|
|
|
|
GetNextException() const
|
|
|
|
{
|
|
|
|
return m_next_exception.get();
|
|
|
|
}
|
|
|
|
lldb::addr_t
|
|
|
|
GetExceptionAddress() const
|
|
|
|
{
|
|
|
|
return m_exception_addr;
|
|
|
|
}
|
|
|
|
|
2015-05-19 07:24:32 +08:00
|
|
|
lldb::tid_t
|
|
|
|
GetThreadID() const
|
|
|
|
{
|
|
|
|
return m_thread_id;
|
|
|
|
}
|
|
|
|
|
2014-11-11 08:00:14 +08:00
|
|
|
private:
|
|
|
|
DWORD m_code;
|
|
|
|
bool m_continuable;
|
|
|
|
std::shared_ptr<ExceptionRecord> m_next_exception;
|
|
|
|
lldb::addr_t m_exception_addr;
|
2015-05-19 07:24:32 +08:00
|
|
|
lldb::tid_t m_thread_id;
|
2014-11-11 08:00:14 +08:00
|
|
|
std::vector<ULONG_PTR> m_arguments;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|