Adrian McCarthy | c96516f | 2015-08-03 23:01:51 +0000 | [diff] [blame] | 1 | //===-- ProcessWinMiniDump.h ------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef liblldb_ProcessWinMiniDump_h_ |
| 11 | #define liblldb_ProcessWinMiniDump_h_ |
| 12 | |
| 13 | #include <list> |
| 14 | #include <vector> |
| 15 | |
| 16 | #include "lldb/Core/ConstString.h" |
| 17 | #include "lldb/Core/Error.h" |
| 18 | #include "lldb/Target/Process.h" |
| 19 | |
| 20 | struct ThreadData; |
| 21 | |
| 22 | class ProcessWinMiniDump : public lldb_private::Process |
| 23 | { |
| 24 | public: |
| 25 | static lldb::ProcessSP |
| 26 | CreateInstance (lldb_private::Target& target, |
| 27 | lldb_private::Listener &listener, |
| 28 | const lldb_private::FileSpec *crash_file_path); |
| 29 | |
| 30 | static void |
| 31 | Initialize(); |
| 32 | |
| 33 | static void |
| 34 | Terminate(); |
| 35 | |
| 36 | static lldb_private::ConstString |
| 37 | GetPluginNameStatic(); |
| 38 | |
| 39 | static const char * |
| 40 | GetPluginDescriptionStatic(); |
| 41 | |
| 42 | ProcessWinMiniDump(lldb_private::Target& target, |
| 43 | lldb_private::Listener &listener, |
| 44 | const lldb_private::FileSpec &core_file); |
| 45 | |
| 46 | virtual |
| 47 | ~ProcessWinMiniDump(); |
| 48 | |
| 49 | bool |
| 50 | CanDebug(lldb_private::Target &target, bool plugin_specified_by_name) override; |
| 51 | |
| 52 | lldb_private::Error |
| 53 | DoLoadCore() override; |
| 54 | |
| 55 | lldb_private::DynamicLoader * |
| 56 | GetDynamicLoader() override; |
| 57 | |
| 58 | lldb_private::ConstString |
| 59 | GetPluginName() override; |
| 60 | |
| 61 | uint32_t |
| 62 | GetPluginVersion() override; |
| 63 | |
| 64 | lldb_private::Error |
| 65 | DoDestroy() override; |
| 66 | |
| 67 | void |
| 68 | RefreshStateAfterStop() override; |
| 69 | |
| 70 | bool |
| 71 | IsAlive() override; |
| 72 | |
| 73 | size_t |
| 74 | ReadMemory(lldb::addr_t addr, void *buf, size_t size, lldb_private::Error &error) override; |
| 75 | |
| 76 | size_t |
| 77 | DoReadMemory(lldb::addr_t addr, void *buf, size_t size, lldb_private::Error &error) override; |
| 78 | |
| 79 | lldb::addr_t |
| 80 | GetImageInfoAddress() override; |
| 81 | |
| 82 | lldb_private::ArchSpec |
| 83 | GetArchitecture(); |
| 84 | |
| 85 | protected: |
| 86 | void |
| 87 | Clear(); |
| 88 | |
| 89 | bool |
| 90 | UpdateThreadList(lldb_private::ThreadList &old_thread_list, |
| 91 | lldb_private::ThreadList &new_thread_list) override; |
| 92 | |
| 93 | private: |
| 94 | lldb_private::Error |
| 95 | MapMiniDumpIntoMemory(const char *file); |
| 96 | |
| 97 | lldb_private::ArchSpec |
| 98 | DetermineArchitecture(); |
| 99 | |
Adrian McCarthy | 61ede15 | 2015-08-19 20:43:22 +0000 | [diff] [blame] | 100 | void |
| 101 | ReadExceptionRecord(); |
| 102 | |
| 103 | // A thin wrapper around WinAPI's MiniDumpReadDumpStream to avoid redundant |
| 104 | // checks. If there's a failure (e.g., if the requested stream doesn't exist), |
| 105 | // the function returns nullptr and sets *size_out to 0. |
| 106 | void * |
| 107 | FindDumpStream(unsigned stream_number, size_t *size_out); |
| 108 | |
Adrian McCarthy | c96516f | 2015-08-03 23:01:51 +0000 | [diff] [blame] | 109 | // Isolate the data to keep Windows-specific types out of this header. Can't |
| 110 | // use the typical pimpl idiom because the implementation of this class also |
| 111 | // needs access to public and protected members of the base class. |
| 112 | class Data; |
| 113 | std::unique_ptr<Data> m_data_up; |
| 114 | }; |
| 115 | |
| 116 | #endif // liblldb_ProcessWinMiniDump_h_ |