blob: 67523a72ad115e6974357dedd777a13793ab44f3 (
plain) (
blame)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
//===-- MinidumpParser.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_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"
#include "llvm/ADT/StringRef.h"
// C includes
// C++ includes
#include <cstring>
#include <unordered_map>
namespace lldb_private {
namespace minidump {
// 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) {}
};
class MinidumpParser {
public:
static llvm::Optional<MinidumpParser>
Create(const lldb::DataBufferSP &data_buf_sp);
llvm::ArrayRef<uint8_t> GetData();
llvm::ArrayRef<uint8_t> GetStream(MinidumpStreamType stream_type);
llvm::Optional<std::string> GetMinidumpString(uint32_t rva);
llvm::ArrayRef<MinidumpThread> GetThreads();
llvm::ArrayRef<uint8_t> GetThreadContext(const MinidumpThread &td);
llvm::ArrayRef<uint8_t> GetThreadContextWow64(const MinidumpThread &td);
const MinidumpSystemInfo *GetSystemInfo();
ArchSpec GetArchitecture();
const MinidumpMiscInfo *GetMiscInfo();
llvm::Optional<LinuxProcStatus> GetLinuxProcStatus();
llvm::Optional<lldb::pid_t> GetPid();
llvm::ArrayRef<MinidumpModule> GetModuleList();
// There are cases in which there is more than one record in the ModuleList
// for the same module name.(e.g. when the binary has non contiguous segments)
// So this function returns a filtered module list - if it finds records that
// have the same name, it keeps the copy with the lowest load address.
std::vector<const MinidumpModule *> GetFilteredModuleList();
const MinidumpExceptionStream *GetExceptionStream();
llvm::Optional<Range> FindMemoryRange(lldb::addr_t addr);
llvm::ArrayRef<uint8_t> GetMemory(lldb::addr_t addr, size_t size);
llvm::Optional<MemoryRegionInfo> GetMemoryRegionInfo(lldb::addr_t);
private:
lldb::DataBufferSP m_data_sp;
const MinidumpHeader *m_header;
llvm::DenseMap<uint32_t, MinidumpLocationDescriptor> m_directory_map;
MinidumpParser(
const lldb::DataBufferSP &data_buf_sp, const MinidumpHeader *header,
llvm::DenseMap<uint32_t, MinidumpLocationDescriptor> &&directory_map);
};
} // end namespace minidump
} // end namespace lldb_private
#endif // liblldb_MinidumpParser_h_
|