LLDB mainline
Macros | Functions
MinidumpParser.cpp File Reference
#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 > &regions)
 
static bool CheckForLinuxExecutable (ConstString path, const MemoryRegionInfos &regions, 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 > &regions)
 
static bool CreateRegionsCacheFromMemoryList (MinidumpParser &parser, std::vector< MemoryRegionInfo > &regions)
 
static bool CreateRegionsCacheFromMemory64List (MinidumpParser &parser, std::vector< MemoryRegionInfo > &regions)
 

Macro Definition Documentation

◆ ENUM_TO_CSTR

#define ENUM_TO_CSTR (   ST)
Value:
case StreamType::ST: \
return #ST

Definition at line 629 of file MinidumpParser.cpp.

Function Documentation

◆ CheckForLinuxExecutable()

static bool CheckForLinuxExecutable ( ConstString  path,
const MemoryRegionInfos regions,
lldb::addr_t  base_of_image 
)
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.

Parameters
[in]pathThe 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]regionsA sorted list of memory regions obtained from a call to CreateRegionsCacheFromLinuxMaps.
[in]base_of_imageThe load address of this module from BaseOfImage in the modules list.
Returns
True if a contiguous region of memory belonging to the module with a matching path exists that has executable permissions. Returns false if regions is empty or if there are no regions with execute permissions that match path.

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().

◆ CreateRegionsCacheFromLinuxMaps()

static bool CreateRegionsCacheFromLinuxMaps ( MinidumpParser parser,
std::vector< MemoryRegionInfo > &  regions 
)
static

◆ CreateRegionsCacheFromMemory64List()

static bool CreateRegionsCacheFromMemory64List ( MinidumpParser parser,
std::vector< MemoryRegionInfo > &  regions 
)
static

◆ CreateRegionsCacheFromMemoryInfoList()

static bool CreateRegionsCacheFromMemoryInfoList ( MinidumpParser parser,
std::vector< MemoryRegionInfo > &  regions 
)
static

◆ CreateRegionsCacheFromMemoryList()

static bool CreateRegionsCacheFromMemoryList ( MinidumpParser parser,
std::vector< MemoryRegionInfo > &  regions 
)
static