diff options
author | Dimitar Vlahovski <dvlahovski@google.com> | 2016-10-04 21:02:13 +0000 |
---|---|---|
committer | Dimitar Vlahovski <dvlahovski@google.com> | 2016-10-04 21:02:13 +0000 |
commit | 8cabfb764d6b0390038f2d0af6f29781b4b2294b (patch) | |
tree | d5f809b2ae4a5dce6cb4e632e95b8b673547f733 /lldb/source/Plugins/Process/minidump/ProcessMinidump.h | |
parent | 625fba88406e3ff47ceb63b7d36d5db756ec44cf (diff) | |
download | bcm5719-llvm-8cabfb764d6b0390038f2d0af6f29781b4b2294b.tar.gz bcm5719-llvm-8cabfb764d6b0390038f2d0af6f29781b4b2294b.zip |
Adding a new Minidump post-mortem debugging plugin
Summary:
This plugin resembles the already existing Windows-only Minidump plugin.
The WinMinidumpPlugin uses the Windows API for parsing Minidumps
while this plugin is cross-platform because it includes a Minidump
parser (which is already commited)
It is able to produce a backtrace, to read the general puprose regiters,
inspect local variables, show image list, do memory reads, etc.
For now the only arch that this supports is x86 64 bit
This is because I have only written a register context for that arch.
Others will come in next CLs.
I copied the WinMinidump tests and adapted them a little bit for them to
work with the new plugin (and they pass)
I will add more tests, aiming for better code coverage.
There is still functionality to be added, see TODOs in code.
Reviewers: labath, zturner
Subscribers: beanz, mgorny, amccarth, lldb-commits, modocache
Differential Revision: https://reviews.llvm.org/D25196
llvm-svn: 283259
Diffstat (limited to 'lldb/source/Plugins/Process/minidump/ProcessMinidump.h')
-rw-r--r-- | lldb/source/Plugins/Process/minidump/ProcessMinidump.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.h b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h new file mode 100644 index 00000000000..00c45d6491a --- /dev/null +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h @@ -0,0 +1,103 @@ +//===-- ProcessMinidump.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_ProcessMinidump_h_ +#define liblldb_ProcessMinidump_h_ + +// Project includes +#include "MinidumpParser.h" +#include "MinidumpTypes.h" + +// Other libraries and framework includes +#include "lldb/Core/ConstString.h" +#include "lldb/Core/Error.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/StopInfo.h" +#include "lldb/Target/Target.h" + +#include "llvm/Support/Format.h" +#include "llvm/Support/raw_ostream.h" + +// C Includes +// C++ Includes + +namespace lldb_private { + +namespace minidump { + +class ProcessMinidump : public Process { +public: + static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp, + lldb::ListenerSP listener_sp, + const FileSpec *crash_file_path); + + static void Initialize(); + + static void Terminate(); + + static ConstString GetPluginNameStatic(); + + static const char *GetPluginDescriptionStatic(); + + ProcessMinidump(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, + const lldb_private::FileSpec &core_file, + MinidumpParser minidump_parser); + + ~ProcessMinidump() override; + + bool CanDebug(lldb::TargetSP target_sp, + bool plugin_specified_by_name) override; + + Error DoLoadCore() override; + + DynamicLoader *GetDynamicLoader() override; + + ConstString GetPluginName() override; + + uint32_t GetPluginVersion() override; + + Error DoDestroy() override; + + void RefreshStateAfterStop() override; + + bool IsAlive() override; + + bool WarnBeforeDetach() const override; + + size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size, + Error &error) override; + + size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size, + Error &error) override; + + ArchSpec GetArchitecture(); + + Error GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info) override; + + MinidumpParser m_minidump_parser; + +protected: + void Clear(); + + bool UpdateThreadList(ThreadList &old_thread_list, + ThreadList &new_thread_list) override; + + void ReadModuleList(); + +private: + FileSpec m_core_file; + llvm::ArrayRef<MinidumpThread> m_thread_list; + const MinidumpExceptionStream *m_active_exception; +}; + +} // namespace minidump +} // namespace lldb_private + +#endif // liblldb_ProcessMinidump_h_ |