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
2016-10-05 05:02:13 +08:00
|
|
|
//===-- MinidumpParser.h ---------------------------------------*- C++ -*-===//
|
2016-09-01 19:29:53 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
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
2016-10-05 05:02:13 +08:00
|
|
|
//===--------------------------------------------------------------------===//
|
2016-09-01 19:29:53 +08:00
|
|
|
|
|
|
|
#ifndef liblldb_MinidumpParser_h_
|
|
|
|
#define liblldb_MinidumpParser_h_
|
|
|
|
|
|
|
|
// Project includes
|
|
|
|
#include "MinidumpTypes.h"
|
|
|
|
|
|
|
|
// Other libraries and framework includes
|
|
|
|
#include "lldb/Core/ArchSpec.h"
|
|
|
|
#include "lldb/Core/DataBuffer.h"
|
|
|
|
#include "lldb/Core/Error.h"
|
|
|
|
|
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
|
|
|
#include "llvm/ADT/DenseMap.h"
|
|
|
|
#include "llvm/ADT/Optional.h"
|
2016-09-13 23:54:38 +08:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2016-09-01 19:29:53 +08:00
|
|
|
|
|
|
|
// C includes
|
|
|
|
// C++ includes
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
namespace lldb_private {
|
2016-09-01 19:29:53 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
namespace minidump {
|
2016-09-01 19:29:53 +08:00
|
|
|
|
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
2016-10-05 05:02:13 +08:00
|
|
|
// Describes a range of memory captured in the Minidump
|
|
|
|
struct Range {
|
|
|
|
lldb::addr_t start; // virtual address of the beginning of the range
|
|
|
|
// range_ref - absolute pointer to the first byte of the range and size
|
|
|
|
llvm::ArrayRef<uint8_t> range_ref;
|
|
|
|
|
|
|
|
Range(lldb::addr_t start, llvm::ArrayRef<uint8_t> range_ref)
|
|
|
|
: start(start), range_ref(range_ref) {}
|
|
|
|
};
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
class MinidumpParser {
|
2016-09-01 19:29:53 +08:00
|
|
|
public:
|
2016-09-07 04:57:50 +08:00
|
|
|
static llvm::Optional<MinidumpParser>
|
|
|
|
Create(const lldb::DataBufferSP &data_buf_sp);
|
2016-09-01 19:29:53 +08:00
|
|
|
|
2016-09-28 03:05:55 +08:00
|
|
|
llvm::ArrayRef<uint8_t> GetData();
|
2016-09-01 19:29:53 +08:00
|
|
|
|
2016-09-13 23:54:38 +08:00
|
|
|
llvm::ArrayRef<uint8_t> GetStream(MinidumpStreamType stream_type);
|
2016-09-01 19:29:53 +08:00
|
|
|
|
2016-09-13 23:54:38 +08:00
|
|
|
llvm::Optional<std::string> GetMinidumpString(uint32_t rva);
|
|
|
|
|
|
|
|
llvm::ArrayRef<MinidumpThread> GetThreads();
|
2016-09-01 19:29:53 +08:00
|
|
|
|
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
2016-10-05 05:02:13 +08:00
|
|
|
llvm::ArrayRef<uint8_t> GetThreadContext(const MinidumpThread &td);
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const MinidumpSystemInfo *GetSystemInfo();
|
2016-09-01 19:29:53 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
ArchSpec GetArchitecture();
|
2016-09-01 19:29:53 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const MinidumpMiscInfo *GetMiscInfo();
|
2016-09-01 19:29:53 +08:00
|
|
|
|
2016-09-13 23:54:38 +08:00
|
|
|
llvm::Optional<LinuxProcStatus> GetLinuxProcStatus();
|
|
|
|
|
|
|
|
llvm::Optional<lldb::pid_t> GetPid();
|
|
|
|
|
|
|
|
llvm::ArrayRef<MinidumpModule> GetModuleList();
|
|
|
|
|
|
|
|
const MinidumpExceptionStream *GetExceptionStream();
|
|
|
|
|
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
2016-10-05 05:02:13 +08:00
|
|
|
llvm::Optional<Range> FindMemoryRange(lldb::addr_t addr);
|
|
|
|
|
2016-09-01 19:29:53 +08:00
|
|
|
private:
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::DataBufferSP m_data_sp;
|
|
|
|
const MinidumpHeader *m_header;
|
|
|
|
llvm::DenseMap<uint32_t, MinidumpLocationDescriptor> m_directory_map;
|
|
|
|
|
2016-09-13 23:54:38 +08:00
|
|
|
MinidumpParser(
|
|
|
|
const lldb::DataBufferSP &data_buf_sp, const MinidumpHeader *header,
|
|
|
|
llvm::DenseMap<uint32_t, MinidumpLocationDescriptor> &&directory_map);
|
2016-09-01 19:29:53 +08:00
|
|
|
};
|
|
|
|
|
2016-09-28 03:05:55 +08:00
|
|
|
} // end namespace minidump
|
|
|
|
} // end namespace lldb_private
|
2016-09-01 19:29:53 +08:00
|
|
|
#endif // liblldb_MinidumpParser_h_
|