LLDB mainline
|
#include "MinidumpParser.h"
#include "NtStructures.h"
#include "RegisterContextMinidump_x86_32.h"
#include "Plugins/Process/Utility/LinuxProcMaps.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include <algorithm>
#include <map>
#include <optional>
#include <vector>
#include <utility>
Go to the source code of this file.
Macros | |
#define | ENUM_TO_CSTR(ST) |
Functions | |
static bool | CreateRegionsCacheFromLinuxMaps (MinidumpParser &parser, std::vector< MemoryRegionInfo > ®ions) |
static bool | CheckForLinuxExecutable (ConstString path, const MemoryRegionInfos ®ions, lldb::addr_t base_of_image) |
Check for the memory regions starting at load_addr for a contiguous section that has execute permissions that matches the module path. | |
static bool | CreateRegionsCacheFromMemoryInfoList (MinidumpParser &parser, std::vector< MemoryRegionInfo > ®ions) |
static bool | CreateRegionsCacheFromMemoryList (MinidumpParser &parser, std::vector< MemoryRegionInfo > ®ions) |
static bool | CreateRegionsCacheFromMemory64List (MinidumpParser &parser, std::vector< MemoryRegionInfo > ®ions) |
#define ENUM_TO_CSTR | ( | ST | ) |
Definition at line 629 of file MinidumpParser.cpp.
|
static |
Check for the memory regions starting at load_addr for a contiguous section that has execute permissions that matches the module path.
When we load a breakpad generated minidump file, we might have the /proc/<pid>/maps text for a process that details the memory map of the process that the minidump is describing. This checks the sorted memory regions for a section that has execute permissions. A sample maps files might look like:
00400000-00401000 r–p 00000000 fd:01 2838574 /tmp/a.out 00401000-00402000 r-xp 00001000 fd:01 2838574 /tmp/a.out 00402000-00403000 r–p 00002000 fd:01 2838574 /tmp/a.out 00403000-00404000 r–p 00002000 fd:01 2838574 /tmp/a.out 00404000-00405000 rw-p 00003000 fd:01 2838574 /tmp/a.out ...
This function should return true when given 0x00400000 and "/tmp/a.out" is passed in as the path since it has a consecutive memory region for "/tmp/a.out" that has execute permissions at 0x00401000. This will help us differentiate if a file has been memory mapped into a process for reading and breakpad ends up saving a minidump file that has two module entries for a given file: one that is read only for the entire file, and then one that is the real executable that is loaded into memory for execution. For memory mapped files they will typically show up and r–p permissions and a range matcning the entire range of the file on disk:
00800000-00805000 r–p 00000000 fd:01 2838574 /tmp/a.out 00805000-00806000 r-xp 00001000 fd:01 1234567 /usr/lib/libc.so
This function should return false when asked about 0x00800000 with "/tmp/a.out" as the path.
[in] | path | The path to the module to check for in the memory regions. Only sequential memory regions whose paths match this path will be considered when looking for execute permissions. |
[in] | regions | A sorted list of memory regions obtained from a call to CreateRegionsCacheFromLinuxMaps. |
[in] | base_of_image | The load address of this module from BaseOfImage in the modules list. |
Definition at line 328 of file MinidumpParser.cpp.
References lldb_private::MemoryRegionInfo::eYes, lldb_private::Range< B, S >::GetByteSize(), lldb_private::MemoryRegionInfo::GetExecutable(), lldb_private::minidump::MinidumpParser::GetMemoryRegionInfo(), lldb_private::MemoryRegionInfo::GetName(), and lldb_private::MemoryRegionInfo::GetRange().
Referenced by lldb_private::minidump::MinidumpParser::GetFilteredModuleList().
|
static |
Definition at line 258 of file MinidumpParser.cpp.
References lldb_private::Expressions, lldb_private::GetLog(), lldb_private::minidump::MinidumpParser::GetStream(), LLDB_LOG_ERROR, and lldb_private::ParseLinuxMapRegions().
Referenced by lldb_private::minidump::MinidumpParser::BuildMemoryRegions(), and lldb_private::minidump::MinidumpParser::GetFilteredModuleList().
|
static |
Definition at line 578 of file MinidumpParser.cpp.
References lldb_private::MemoryRegionInfo::eYes, lldb_private::MemoryRegionInfo::GetRange(), lldb_private::minidump::MinidumpParser::GetStream(), lldb_private::minidump::MinidumpMemoryDescriptor64::ParseMemory64List(), lldb_private::Range< B, S >::SetByteSize(), lldb_private::MemoryRegionInfo::SetMapped(), lldb_private::Range< B, S >::SetRangeBase(), and lldb_private::MemoryRegionInfo::SetReadable().
Referenced by lldb_private::minidump::MinidumpParser::BuildMemoryRegions().
|
static |
Definition at line 516 of file MinidumpParser.cpp.
References lldb_private::MemoryRegionInfo::eNo, lldb_private::MemoryRegionInfo::eYes, lldb_private::GetLog(), lldb_private::minidump::MinidumpParser::GetMinidumpFile(), lldb_private::MemoryRegionInfo::GetRange(), LLDB_LOG_ERROR, lldb_private::Modules, lldb_private::Range< B, S >::SetByteSize(), lldb_private::MemoryRegionInfo::SetExecutable(), lldb_private::MemoryRegionInfo::SetMapped(), lldb_private::Range< B, S >::SetRangeBase(), lldb_private::MemoryRegionInfo::SetReadable(), and lldb_private::MemoryRegionInfo::SetWritable().
Referenced by lldb_private::minidump::MinidumpParser::BuildMemoryRegions().
|
static |
Definition at line 553 of file MinidumpParser.cpp.
References lldb_private::MemoryRegionInfo::eYes, lldb_private::GetLog(), lldb_private::minidump::MinidumpParser::GetMinidumpFile(), lldb_private::MemoryRegionInfo::GetRange(), LLDB_LOG_ERROR, lldb_private::Modules, lldb_private::Range< B, S >::SetByteSize(), lldb_private::MemoryRegionInfo::SetMapped(), lldb_private::Range< B, S >::SetRangeBase(), and lldb_private::MemoryRegionInfo::SetReadable().
Referenced by lldb_private::minidump::MinidumpParser::BuildMemoryRegions().