summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Windows/ExceptionRecord.h
blob: 3b29f97d4a04938eed3284197c4b449a67a0ef41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//===-- 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:
    explicit ExceptionRecord(const EXCEPTION_RECORD &record)
    {
        m_code = record.ExceptionCode;
        m_continuable = (record.ExceptionFlags == 0);
        if (record.ExceptionRecord)
            m_next_exception.reset(new ExceptionRecord(*record.ExceptionRecord));
        m_exception_addr = reinterpret_cast<lldb::addr_t>(record.ExceptionAddress);
        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;
    }

  private:
    DWORD m_code;
    bool m_continuable;
    std::shared_ptr<ExceptionRecord> m_next_exception;
    lldb::addr_t m_exception_addr;
    std::vector<ULONG_PTR> m_arguments;
};
}

#endif
OpenPOWER on IntegriCloud