blob: 9aa02bbc9ecb3783508859b0371d28fb0fd248ab [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Crashpad: crashpad::MachOImageReader Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="crashpad_doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Crashpad
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacecrashpad.html">crashpad</a></li><li class="navelem"><a class="el" href="classcrashpad_1_1MachOImageReader.html">MachOImageReader</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classcrashpad_1_1MachOImageReader-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">crashpad::MachOImageReader Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>A reader for Mach-O images mapped into another process.
<a href="classcrashpad_1_1MachOImageReader.html#details">More...</a></p>
<p><code>#include &quot;snapshot/mac/mach_o_image_reader.h&quot;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:aa5edd770d5ccb59fabc6e80839d66b0b"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageReader.html#aa5edd770d5ccb59fabc6e80839d66b0b">Initialize</a> (<a class="el" href="classcrashpad_1_1ProcessReaderMac.html">ProcessReaderMac</a> *process_reader, mach_vm_address_t address, const std::string &amp;name)</td></tr>
<tr class="memdesc:aa5edd770d5ccb59fabc6e80839d66b0b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads the Mach-O image file’s load commands from another process. <a href="#aa5edd770d5ccb59fabc6e80839d66b0b">More...</a><br /></td></tr>
<tr class="separator:aa5edd770d5ccb59fabc6e80839d66b0b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8cd79040c190b0f165fdb915bc469e8b"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageReader.html#a8cd79040c190b0f165fdb915bc469e8b">FileType</a> () const</td></tr>
<tr class="memdesc:a8cd79040c190b0f165fdb915bc469e8b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the Mach-O file type. <a href="#a8cd79040c190b0f165fdb915bc469e8b">More...</a><br /></td></tr>
<tr class="separator:a8cd79040c190b0f165fdb915bc469e8b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9b153b9b41c333f4cddb2f6d067445ad"><td class="memItemLeft" align="right" valign="top">mach_vm_address_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageReader.html#a9b153b9b41c333f4cddb2f6d067445ad">Address</a> () const</td></tr>
<tr class="memdesc:a9b153b9b41c333f4cddb2f6d067445ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the Mach-O image’s load address. <a href="#a9b153b9b41c333f4cddb2f6d067445ad">More...</a><br /></td></tr>
<tr class="separator:a9b153b9b41c333f4cddb2f6d067445ad"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9b98ab3b8c98c6ef584681baa355ca3a"><td class="memItemLeft" align="right" valign="top">mach_vm_size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageReader.html#a9b98ab3b8c98c6ef584681baa355ca3a">Size</a> () const</td></tr>
<tr class="memdesc:a9b98ab3b8c98c6ef584681baa355ca3a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the mapped size of the Mach-O image’s <code>__TEXT</code> segment. <a href="#a9b98ab3b8c98c6ef584681baa355ca3a">More...</a><br /></td></tr>
<tr class="separator:a9b98ab3b8c98c6ef584681baa355ca3a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0216e421b0f2677f3841b72e80cba832"><td class="memItemLeft" align="right" valign="top">mach_vm_size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageReader.html#a0216e421b0f2677f3841b72e80cba832">Slide</a> () const</td></tr>
<tr class="memdesc:a0216e421b0f2677f3841b72e80cba832"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the Mach-O image’s “slide,” the difference between its actual load address and its preferred load address. <a href="#a0216e421b0f2677f3841b72e80cba832">More...</a><br /></td></tr>
<tr class="separator:a0216e421b0f2677f3841b72e80cba832"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a687d6ad610407967e283d8ba8b6e2db4"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html">MachOImageSegmentReader</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageReader.html#a687d6ad610407967e283d8ba8b6e2db4">GetSegmentByName</a> (const std::string &amp;segment_name) const</td></tr>
<tr class="memdesc:a687d6ad610407967e283d8ba8b6e2db4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Obtain segment information by segment name. <a href="#a687d6ad610407967e283d8ba8b6e2db4">More...</a><br /></td></tr>
<tr class="separator:a687d6ad610407967e283d8ba8b6e2db4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1917ca481052f1d2de7163cb6f8701cc"><td class="memItemLeft" align="right" valign="top">const process_types::section *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageReader.html#a1917ca481052f1d2de7163cb6f8701cc">GetSectionByName</a> (const std::string &amp;segment_name, const std::string &amp;section_name, mach_vm_address_t *address) const</td></tr>
<tr class="memdesc:a1917ca481052f1d2de7163cb6f8701cc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Obtain section information by segment and section name. <a href="#a1917ca481052f1d2de7163cb6f8701cc">More...</a><br /></td></tr>
<tr class="separator:a1917ca481052f1d2de7163cb6f8701cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac9a2388f42c8d4c5c01ca007e93079fc"><td class="memItemLeft" align="right" valign="top">const process_types::section *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageReader.html#ac9a2388f42c8d4c5c01ca007e93079fc">GetSectionAtIndex</a> (size_t index, const <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html">MachOImageSegmentReader</a> **containing_segment, mach_vm_address_t *address) const</td></tr>
<tr class="memdesc:ac9a2388f42c8d4c5c01ca007e93079fc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Obtain section information by section index. <a href="#ac9a2388f42c8d4c5c01ca007e93079fc">More...</a><br /></td></tr>
<tr class="separator:ac9a2388f42c8d4c5c01ca007e93079fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adbaaf5a08d6e67fe7128d171cd11b176"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageReader.html#adbaaf5a08d6e67fe7128d171cd11b176">LookUpExternalDefinedSymbol</a> (const std::string &amp;name, mach_vm_address_t *value) const</td></tr>
<tr class="memdesc:adbaaf5a08d6e67fe7128d171cd11b176"><td class="mdescLeft">&#160;</td><td class="mdescRight">Looks up a symbol in the image’s symbol table. <a href="#adbaaf5a08d6e67fe7128d171cd11b176">More...</a><br /></td></tr>
<tr class="separator:adbaaf5a08d6e67fe7128d171cd11b176"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a42cdb8f4d8dc4ab9b768b1219133ab2c"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageReader.html#a42cdb8f4d8dc4ab9b768b1219133ab2c">DylibVersion</a> () const</td></tr>
<tr class="memdesc:a42cdb8f4d8dc4ab9b768b1219133ab2c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a Mach-O dylib image’s current version. <a href="#a42cdb8f4d8dc4ab9b768b1219133ab2c">More...</a><br /></td></tr>
<tr class="separator:a42cdb8f4d8dc4ab9b768b1219133ab2c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2952fd68a9d4aa248ff27c93bd5210d1"><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageReader.html#a2952fd68a9d4aa248ff27c93bd5210d1">SourceVersion</a> () const</td></tr>
<tr class="memdesc:a2952fd68a9d4aa248ff27c93bd5210d1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a Mach-O image’s source version. <a href="#a2952fd68a9d4aa248ff27c93bd5210d1">More...</a><br /></td></tr>
<tr class="separator:a2952fd68a9d4aa248ff27c93bd5210d1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4c80cea7062a88ab67051931b939909f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageReader.html#a4c80cea7062a88ab67051931b939909f">UUID</a> (<a class="el" href="structcrashpad_1_1UUID.html">crashpad::UUID</a> *uuid) const</td></tr>
<tr class="memdesc:a4c80cea7062a88ab67051931b939909f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a Mach-O image’s <a class="el" href="structcrashpad_1_1UUID.html" title="A universally unique identifier (UUID). ">UUID</a>. <a href="#a4c80cea7062a88ab67051931b939909f">More...</a><br /></td></tr>
<tr class="separator:a4c80cea7062a88ab67051931b939909f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0d74f905f989440e4602371c3b1f148d"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageReader.html#a0d74f905f989440e4602371c3b1f148d">DylinkerName</a> () const</td></tr>
<tr class="memdesc:a0d74f905f989440e4602371c3b1f148d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the dynamic linker’s pathname. <a href="#a0d74f905f989440e4602371c3b1f148d">More...</a><br /></td></tr>
<tr class="separator:a0d74f905f989440e4602371c3b1f148d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a72201407e48e5deb91f60f8bb7029f7a"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageReader.html#a72201407e48e5deb91f60f8bb7029f7a">GetCrashpadInfo</a> (<a class="el" href="structcrashpad_1_1process__types_1_1CrashpadInfo.html">process_types::CrashpadInfo</a> *crashpad_info) const</td></tr>
<tr class="memdesc:a72201407e48e5deb91f60f8bb7029f7a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Obtains the module’s <a class="el" href="structcrashpad_1_1CrashpadInfo.html" title="A structure that can be used by a Crashpad-enabled program to provide information to the Crashpad cra...">CrashpadInfo</a> structure. <a href="#a72201407e48e5deb91f60f8bb7029f7a">More...</a><br /></td></tr>
<tr class="separator:a72201407e48e5deb91f60f8bb7029f7a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A reader for Mach-O images mapped into another process. </p>
<p>This class is capable of reading both 32-bit (<code>mach_header</code>/<code>MH_MAGIC</code>) and 64-bit (<code>mach_header_64</code>/<code>MH_MAGIC_64</code>) images based on the bitness of the remote process.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classcrashpad_1_1MachOImageAnnotationsReader.html" title="A reader for annotations stored in a Mach-O image mapped into another process. ">MachOImageAnnotationsReader</a> </dd></dl>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a9b153b9b41c333f4cddb2f6d067445ad"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9b153b9b41c333f4cddb2f6d067445ad">&#9670;&nbsp;</a></span>Address()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">mach_vm_address_t crashpad::MachOImageReader::Address </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the Mach-O image’s load address. </p>
<p>This is the value passed as <em>address</em> to <a class="el" href="classcrashpad_1_1MachOImageReader.html#aa5edd770d5ccb59fabc6e80839d66b0b" title="Reads the Mach-O image file’s load commands from another process. ">Initialize()</a>. </p>
</div>
</div>
<a id="a42cdb8f4d8dc4ab9b768b1219133ab2c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a42cdb8f4d8dc4ab9b768b1219133ab2c">&#9670;&nbsp;</a></span>DylibVersion()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t crashpad::MachOImageReader::DylibVersion </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a Mach-O dylib image’s current version. </p>
<p>This information comes from the <code>dylib_current_version</code> field of a dylib’s <code>LC_ID_DYLIB</code> load command. For dylibs without this load command, <code>0</code> will be returned.</p>
<p>This method may only be called on Mach-O images for which <a class="el" href="classcrashpad_1_1MachOImageReader.html#a8cd79040c190b0f165fdb915bc469e8b" title="Returns the Mach-O file type. ">FileType()</a> returns <code>MH_DYLIB</code>. </p>
</div>
</div>
<a id="a0d74f905f989440e4602371c3b1f148d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0d74f905f989440e4602371c3b1f148d">&#9670;&nbsp;</a></span>DylinkerName()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::string crashpad::MachOImageReader::DylinkerName </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the dynamic linker’s pathname. </p>
<p>The dynamic linker is normally /usr/lib/dyld.</p>
<p>For executable images (those with file type <code>MH_EXECUTE</code>), this is the name provided in the <code>LC_LOAD_DYLINKER</code> load command, if any. For dynamic linker images (those with file type <code>MH_DYLINKER</code>), this is the name provided in the <code>LC_ID_DYLINKER</code> load command. In other cases, this will be empty. </p>
</div>
</div>
<a id="a8cd79040c190b0f165fdb915bc469e8b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8cd79040c190b0f165fdb915bc469e8b">&#9670;&nbsp;</a></span>FileType()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">uint32_t crashpad::MachOImageReader::FileType </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the Mach-O file type. </p>
<p>This value comes from the <code>filetype</code> field of the <code>mach_header</code> or <code>mach_header_64</code>. Common values include <code>MH_EXECUTE</code>, <code>MH_DYLIB</code>, <code>MH_DYLINKER</code>, and <code>MH_BUNDLE</code>. </p>
</div>
</div>
<a id="a72201407e48e5deb91f60f8bb7029f7a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a72201407e48e5deb91f60f8bb7029f7a">&#9670;&nbsp;</a></span>GetCrashpadInfo()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool crashpad::MachOImageReader::GetCrashpadInfo </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structcrashpad_1_1process__types_1_1CrashpadInfo.html">process_types::CrashpadInfo</a> *&#160;</td>
<td class="paramname"><em>crashpad_info</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Obtains the module’s <a class="el" href="structcrashpad_1_1CrashpadInfo.html" title="A structure that can be used by a Crashpad-enabled program to provide information to the Crashpad cra...">CrashpadInfo</a> structure. </p>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> on success, <code>false</code> on failure. If the module does not have a <code>__DATA,crashpad_info</code> section, this will return <code>false</code> without logging any messages. Other failures will result in messages being logged. </dd></dl>
</div>
</div>
<a id="ac9a2388f42c8d4c5c01ca007e93079fc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac9a2388f42c8d4c5c01ca007e93079fc">&#9670;&nbsp;</a></span>GetSectionAtIndex()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const process_types::section * crashpad::MachOImageReader::GetSectionAtIndex </td>
<td>(</td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>index</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html">MachOImageSegmentReader</a> **&#160;</td>
<td class="paramname"><em>containing_segment</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">mach_vm_address_t *&#160;</td>
<td class="paramname"><em>address</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Obtain section information by section index. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">index</td><td>The index of the section to return, in the order that it appears in the segment load commands. This is a 1-based index, matching the section number values used for <code>nlist::n_sect</code>. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">containing_segment</td><td>The segment that contains the section. This parameter can be <code>nullptr</code>. The caller does not take ownership; the lifetime of the returned object is scoped to the lifetime of this <a class="el" href="classcrashpad_1_1MachOImageReader.html" title="A reader for Mach-O images mapped into another process. ">MachOImageReader</a> object. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">address</td><td>The actual address that the section was loaded at in memory, taking any “slide” into account if the section did not load at its preferred address as stored in the Mach-O image file. This parameter can be <code>nullptr</code>.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the section information. If <em>index</em> is out of range, logs a warning and returns <code>nullptr</code>. The caller does not take ownership; the lifetime of the returned object is scoped to the lifetime of this <a class="el" href="classcrashpad_1_1MachOImageReader.html" title="A reader for Mach-O images mapped into another process. ">MachOImageReader</a> object.</dd></dl>
<p>No parameter is provided for the section’s size, because it can be obtained from the returned process_types::section::size field.</p>
<dl class="section note"><dt>Note</dt><dd>The process_types::section::addr field gives the section’s preferred load address as stored in the Mach-O image file, and is not adjusted for any “slide” that may have occurred when the image was loaded. Use <em>address</em> to obtain the section’s actual load address. </dd>
<dd>
Unlike <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a370e8711294ba506de99e093ac879357" title="Obtain section information by section index. ">MachOImageSegmentReader::GetSectionAtIndex()</a>, this method accepts out-of-range values for <em>index</em>, and returns <code>nullptr</code> instead of aborting execution upon encountering an out-of-range value. This is because a Mach-O image file’s symbol table refers to this per-module section index, and an out-of-range index in that case should be treated as a data error (where the data is beyond this code’s control) and handled non-fatally by reporting the error to the caller. </dd></dl>
</div>
</div>
<a id="a1917ca481052f1d2de7163cb6f8701cc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1917ca481052f1d2de7163cb6f8701cc">&#9670;&nbsp;</a></span>GetSectionByName()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const process_types::section * crashpad::MachOImageReader::GetSectionByName </td>
<td>(</td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>segment_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>section_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">mach_vm_address_t *&#160;</td>
<td class="paramname"><em>address</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Obtain section information by segment and section name. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">segment_name</td><td>The name of the segment to search for, for example, <code>"__TEXT"</code>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">section_name</td><td>The name of the section within the segment to search for, for example, <code>"__text"</code>. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">address</td><td>The actual address that the section was loaded at in memory, taking any “slide” into account if the section did not load at its preferred address as stored in the Mach-O image file. This parameter can be <code>nullptr</code>.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the section information if it was found, or <code>nullptr</code> if it was not found. The caller does not take ownership; the lifetime of the returned object is scoped to the lifetime of this <a class="el" href="classcrashpad_1_1MachOImageReader.html" title="A reader for Mach-O images mapped into another process. ">MachOImageReader</a> object.</dd></dl>
<p>No parameter is provided for the section’s size, because it can be obtained from the returned process_types::section::size field.</p>
<dl class="section note"><dt>Note</dt><dd>The process_types::section::addr field gives the section’s preferred load address as stored in the Mach-O image file, and is not adjusted for any “slide” that may have occurred when the image was loaded. Use <em>address</em> to obtain the section’s actual load address. </dd></dl>
</div>
</div>
<a id="a687d6ad610407967e283d8ba8b6e2db4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a687d6ad610407967e283d8ba8b6e2db4">&#9670;&nbsp;</a></span>GetSegmentByName()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html">MachOImageSegmentReader</a> * crashpad::MachOImageReader::GetSegmentByName </td>
<td>(</td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>segment_name</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Obtain segment information by segment name. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">segment_name</td><td>The name of the segment to search for, for example, <code>"__TEXT"</code>.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the segment information if it was found, or <code>nullptr</code> if it was not found. The caller does not take ownership; the lifetime of the returned object is scoped to the lifetime of this <a class="el" href="classcrashpad_1_1MachOImageReader.html" title="A reader for Mach-O images mapped into another process. ">MachOImageReader</a> object. </dd></dl>
</div>
</div>
<a id="aa5edd770d5ccb59fabc6e80839d66b0b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa5edd770d5ccb59fabc6e80839d66b0b">&#9670;&nbsp;</a></span>Initialize()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool crashpad::MachOImageReader::Initialize </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classcrashpad_1_1ProcessReaderMac.html">ProcessReaderMac</a> *&#160;</td>
<td class="paramname"><em>process_reader</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">mach_vm_address_t&#160;</td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>name</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Reads the Mach-O image file’s load commands from another process. </p>
<p>This method must only be called once on an object. This method must be called successfully before any other method in this class may be called.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">process_reader</td><td>The reader for the remote process. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">address</td><td>The address, in the remote process’ address space, where the <code>mach_header</code> or <code>mach_header_64</code> at the beginning of the image to be read is located. This address can be determined by reading the remote process’ dyld information (see snapshot/mac/process_types/dyld_images.proctype). </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">name</td><td>The module’s name, a string to be used in logged messages. This string is for diagnostic purposes and to relax otherwise strict parsing rules for common modules with known defects.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> if the image was read successfully, including all load commands. <code>false</code> otherwise, with an appropriate message logged. </dd></dl>
</div>
</div>
<a id="adbaaf5a08d6e67fe7128d171cd11b176"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adbaaf5a08d6e67fe7128d171cd11b176">&#9670;&nbsp;</a></span>LookUpExternalDefinedSymbol()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool crashpad::MachOImageReader::LookUpExternalDefinedSymbol </td>
<td>(</td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">mach_vm_address_t *&#160;</td>
<td class="paramname"><em>value</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Looks up a symbol in the image’s symbol table. </p>
<p>This method is capable of locating external defined symbols. Specifically, this method can look up symbols that have these charcteristics:</p><ul>
<li><code>N_STAB</code> (debugging) and <code>N_PEXT</code> (private external) must not be set.</li>
<li><code>N_EXT</code> (external) must be set.</li>
<li>The type must be <code>N_ABS</code> (absolute) or <code>N_SECT</code> (defined in section).</li>
</ul>
<p><code>N_INDR</code> (indirect), <code>N_UNDF</code> (undefined), and <code>N_PBUD</code> (prebound undefined) symbols cannot be located through this mechanism.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">name</td><td>The name of the symbol to look up, “mangled” or “decorated” appropriately. For example, use <code>"_main"</code> to look up the symbol for the C <code>main()</code> function, and use <code>"__Z4Funcv"</code> to look up the symbol for the C++ <code>Func()</code> function. Contrary to <code>dlsym()</code>, the leading underscore must not be stripped when using this interface. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">value</td><td>If the lookup was successful, this will be set to the value of the symbol, adjusted for any “slide” as needed. The value can be used as an address in the remote process’ address space where the pointee of the symbol exists in memory.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> if the symbol lookup was successful and the symbol was found. <code>false</code> otherwise, including error conditions (for which a warning message will be logged), modules without symbol tables, and symbol names not found in the symbol table.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>Symbol values returned via this interface are adjusted for “slide” as appropriate, in contrast to the underlying implementation, <a class="el" href="classcrashpad_1_1MachOImageSymbolTableReader.html#ac85da22c3a7915bb5869a77765c9ffbc" title="Looks up a symbol in the image’s symbol table. ">MachOImageSymbolTableReader::LookUpExternalDefinedSymbol()</a>.</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>Symbols that are resolved by running symbol resolvers (<code>.symbol_resolver</code>) are not properly handled by this interface. The address of the symbol resolver is returned because that’s what shows up in the symbol table, rather than the effective address of the resolved symbol as used by dyld after running the resolver. The only way to detect this situation would be to read the <code>LC_DYLD_INFO</code> or <code>LC_DYLD_INFO_ONLY</code> load command if present and looking for the <code>EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER</code> flag, but that would just be able to detect symbols with a resolver, it would not be able to resolve them from out-of-process, so it’s not currently done. </dd></dl>
</div>
</div>
<a id="a9b98ab3b8c98c6ef584681baa355ca3a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9b98ab3b8c98c6ef584681baa355ca3a">&#9670;&nbsp;</a></span>Size()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">mach_vm_size_t crashpad::MachOImageReader::Size </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the mapped size of the Mach-O image’s <code>__TEXT</code> segment. </p>
<p>Note that this is returns only the size of the <code>__TEXT</code> segment, not of any other segment. This is because the interface only allows one load address and size to be reported, but Mach-O image files may consist of multiple discontiguous segments. By convention, the <code>__TEXT</code> segment is always mapped at the beginning of a Mach-O image file, and it is the most useful for the expected intended purpose of collecting data to obtain stack backtraces. The implementation insists during initialization that the <code>__TEXT</code> segment be mapped at the beginning of the file.</p>
<p>In practice, discontiguous segments are only found for images that have loaded out of the dyld shared cache, but the <code>__TEXT</code> segment’s size is returned for modules that loaded with contiguous segments as well for consistency. </p>
</div>
</div>
<a id="a0216e421b0f2677f3841b72e80cba832"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0216e421b0f2677f3841b72e80cba832">&#9670;&nbsp;</a></span>Slide()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">mach_vm_size_t crashpad::MachOImageReader::Slide </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the Mach-O image’s “slide,” the difference between its actual load address and its preferred load address. </p>
<p>“Slide” is computed by subtracting the <code>__TEXT</code> segment’s preferred load address from its actual load address. It will be reported as a positive offset when the actual load address is greater than the preferred load address. The preferred load address is taken to be the segment’s reported <code>vmaddr</code> value. </p>
</div>
</div>
<a id="a2952fd68a9d4aa248ff27c93bd5210d1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2952fd68a9d4aa248ff27c93bd5210d1">&#9670;&nbsp;</a></span>SourceVersion()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">uint64_t crashpad::MachOImageReader::SourceVersion </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a Mach-O image’s source version. </p>
<p>This information comes from a Mach-O image’s <code>LC_SOURCE_VERSION</code> load command. For Mach-O images without this load command, <code>0</code> will be returned. </p>
</div>
</div>
<a id="a4c80cea7062a88ab67051931b939909f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4c80cea7062a88ab67051931b939909f">&#9670;&nbsp;</a></span>UUID()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void crashpad::MachOImageReader::UUID </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structcrashpad_1_1UUID.html">crashpad::UUID</a> *&#160;</td>
<td class="paramname"><em>uuid</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a Mach-O image’s <a class="el" href="structcrashpad_1_1UUID.html" title="A universally unique identifier (UUID). ">UUID</a>. </p>
<p>This information comes from a Mach-O image’s <code>LC_UUID</code> load command. For Mach-O images without this load command, a zeroed-out <a class="el" href="structcrashpad_1_1UUID.html" title="A universally unique identifier (UUID). ">UUID</a> value will be returned. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>snapshot/mac/mach_o_image_reader.h</li>
<li>snapshot/mac/mach_o_image_reader.cc</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>