blob: fac51cc8b2136df4f41e5975496ff3679bd145d3 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Crashpad: crashpad::MachOImageSegmentReader 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.18 -->
<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_1MachOImageSegmentReader.html">MachOImageSegmentReader</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="classcrashpad_1_1MachOImageSegmentReader-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">crashpad::MachOImageSegmentReader Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>A reader for <code>LC_SEGMENT</code> or <code>LC_SEGMENT_64</code> load commands in Mach-O images mapped into another process.
<a href="classcrashpad_1_1MachOImageSegmentReader.html#details">More...</a></p>
<p><code>#include &quot;snapshot/mac/mach_o_image_segment_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:ae31cdad3d716b7b82f96541a82adbff9"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#ae31cdad3d716b7b82f96541a82adbff9">Initialize</a> (<a class="el" href="classcrashpad_1_1ProcessReaderMac.html">ProcessReaderMac</a> *process_reader, mach_vm_address_t load_command_address, const std::string &amp;load_command_info, const std::string &amp;module_name, uint32_t file_type)</td></tr>
<tr class="memdesc:ae31cdad3d716b7b82f96541a82adbff9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads the segment load command from another process. <a href="classcrashpad_1_1MachOImageSegmentReader.html#ae31cdad3d716b7b82f96541a82adbff9">More...</a><br /></td></tr>
<tr class="separator:ae31cdad3d716b7b82f96541a82adbff9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6ebb278d318490b4ac6656f1911cf6ad"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a6ebb278d318490b4ac6656f1911cf6ad">SetSlide</a> (mach_vm_size_t slide)</td></tr>
<tr class="memdesc:a6ebb278d318490b4ac6656f1911cf6ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the image’s slide value. <a href="classcrashpad_1_1MachOImageSegmentReader.html#a6ebb278d318490b4ac6656f1911cf6ad">More...</a><br /></td></tr>
<tr class="separator:a6ebb278d318490b4ac6656f1911cf6ad"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4c31878c0cac883d27bf212c9a616385"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a4c31878c0cac883d27bf212c9a616385">Name</a> () const</td></tr>
<tr class="memdesc:a4c31878c0cac883d27bf212c9a616385"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the segment’s name. <a href="classcrashpad_1_1MachOImageSegmentReader.html#a4c31878c0cac883d27bf212c9a616385">More...</a><br /></td></tr>
<tr class="separator:a4c31878c0cac883d27bf212c9a616385"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a873ee4e1206c53ba15faa3fcae684d2e"><td class="memItemLeft" align="right" valign="top">mach_vm_address_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a873ee4e1206c53ba15faa3fcae684d2e">Address</a> () const</td></tr>
<tr class="separator:a873ee4e1206c53ba15faa3fcae684d2e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0d1d9a429f5f3ef9bc8cff02f90c3374"><td class="memItemLeft" align="right" valign="top">mach_vm_address_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a0d1d9a429f5f3ef9bc8cff02f90c3374">Size</a> () const</td></tr>
<tr class="separator:a0d1d9a429f5f3ef9bc8cff02f90c3374"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6cbf169de4e86aed8fc7d3f00ddcf302"><td class="memItemLeft" align="right" valign="top">mach_vm_address_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a6cbf169de4e86aed8fc7d3f00ddcf302">vmaddr</a> () const</td></tr>
<tr class="memdesc:a6cbf169de4e86aed8fc7d3f00ddcf302"><td class="mdescLeft">&#160;</td><td class="mdescRight">The segment’s preferred load address. <a href="classcrashpad_1_1MachOImageSegmentReader.html#a6cbf169de4e86aed8fc7d3f00ddcf302">More...</a><br /></td></tr>
<tr class="separator:a6cbf169de4e86aed8fc7d3f00ddcf302"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa801e05da01e40484e0fcc08b861282d"><td class="memItemLeft" align="right" valign="top">mach_vm_size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#aa801e05da01e40484e0fcc08b861282d">vmsize</a> () const</td></tr>
<tr class="memdesc:aa801e05da01e40484e0fcc08b861282d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the segment’s size as mapped into memory. <a href="classcrashpad_1_1MachOImageSegmentReader.html#aa801e05da01e40484e0fcc08b861282d">More...</a><br /></td></tr>
<tr class="separator:aa801e05da01e40484e0fcc08b861282d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab3b139fd095a7187294f05d0780af81c"><td class="memItemLeft" align="right" valign="top">mach_vm_size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#ab3b139fd095a7187294f05d0780af81c">fileoff</a> () const</td></tr>
<tr class="memdesc:ab3b139fd095a7187294f05d0780af81c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the file offset of the mapped segment in the file from which it was mapped. <a href="classcrashpad_1_1MachOImageSegmentReader.html#ab3b139fd095a7187294f05d0780af81c">More...</a><br /></td></tr>
<tr class="separator:ab3b139fd095a7187294f05d0780af81c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af5ec4fad5cedad192ba8ca92728dd928"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#af5ec4fad5cedad192ba8ca92728dd928">nsects</a> () const</td></tr>
<tr class="memdesc:af5ec4fad5cedad192ba8ca92728dd928"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of sections in the segment. <a href="classcrashpad_1_1MachOImageSegmentReader.html#af5ec4fad5cedad192ba8ca92728dd928">More...</a><br /></td></tr>
<tr class="separator:af5ec4fad5cedad192ba8ca92728dd928"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2f2f06905518f693178e52ee14c57e9e"><td class="memItemLeft" align="right" valign="top">const process_types::section *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a2f2f06905518f693178e52ee14c57e9e">GetSectionByName</a> (const std::string &amp;section_name, mach_vm_address_t *address) const</td></tr>
<tr class="memdesc:a2f2f06905518f693178e52ee14c57e9e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Obtain section information by section name. <a href="classcrashpad_1_1MachOImageSegmentReader.html#a2f2f06905518f693178e52ee14c57e9e">More...</a><br /></td></tr>
<tr class="separator:a2f2f06905518f693178e52ee14c57e9e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a370e8711294ba506de99e093ac879357"><td class="memItemLeft" align="right" valign="top">const process_types::section *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a370e8711294ba506de99e093ac879357">GetSectionAtIndex</a> (size_t index, mach_vm_address_t *address) const</td></tr>
<tr class="memdesc:a370e8711294ba506de99e093ac879357"><td class="mdescLeft">&#160;</td><td class="mdescRight">Obtain section information by section index. <a href="classcrashpad_1_1MachOImageSegmentReader.html#a370e8711294ba506de99e093ac879357">More...</a><br /></td></tr>
<tr class="separator:a370e8711294ba506de99e093ac879357"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a37363d59c8264d505783d78f0bcce649"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a37363d59c8264d505783d78f0bcce649">SegmentSlides</a> () const</td></tr>
<tr class="separator:a37363d59c8264d505783d78f0bcce649"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:ad00d9acfb6f78cd0c5e640d667e8b746"><td class="memItemLeft" align="right" valign="top">static std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#ad00d9acfb6f78cd0c5e640d667e8b746">SegmentNameString</a> (const char *segment_name_c)</td></tr>
<tr class="memdesc:ad00d9acfb6f78cd0c5e640d667e8b746"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a segment name string. <a href="classcrashpad_1_1MachOImageSegmentReader.html#ad00d9acfb6f78cd0c5e640d667e8b746">More...</a><br /></td></tr>
<tr class="separator:ad00d9acfb6f78cd0c5e640d667e8b746"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad9357dc5d34a7f09219f6e850694014b"><td class="memItemLeft" align="right" valign="top">static std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#ad9357dc5d34a7f09219f6e850694014b">SectionNameString</a> (const char *section_name_c)</td></tr>
<tr class="memdesc:ad9357dc5d34a7f09219f6e850694014b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a section name string. <a href="classcrashpad_1_1MachOImageSegmentReader.html#ad9357dc5d34a7f09219f6e850694014b">More...</a><br /></td></tr>
<tr class="separator:ad9357dc5d34a7f09219f6e850694014b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3f607c8cc16a960a6638bf4b91965397"><td class="memItemLeft" align="right" valign="top">static std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a3f607c8cc16a960a6638bf4b91965397">SegmentAndSectionNameString</a> (const char *segment_name_c, const char *section_name_c)</td></tr>
<tr class="memdesc:a3f607c8cc16a960a6638bf4b91965397"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a segment and section name string. <a href="classcrashpad_1_1MachOImageSegmentReader.html#a3f607c8cc16a960a6638bf4b91965397">More...</a><br /></td></tr>
<tr class="separator:a3f607c8cc16a960a6638bf4b91965397"><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 <code>LC_SEGMENT</code> or <code>LC_SEGMENT_64</code> load commands in Mach-O images mapped into another process. </p>
<p>This class is capable of reading both <code>LC_SEGMENT</code> and <code>LC_SEGMENT_64</code> based on the bitness of the remote process.</p>
<p>A <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html" title="A reader for LC_SEGMENT or LC_SEGMENT_64 load commands in Mach-O images mapped into another process.">MachOImageSegmentReader</a> will normally be instantiated by a <a class="el" href="classcrashpad_1_1MachOImageReader.html" title="A reader for Mach-O images mapped into another process.">MachOImageReader</a>. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a873ee4e1206c53ba15faa3fcae684d2e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a873ee4e1206c53ba15faa3fcae684d2e">&#9670;&nbsp;</a></span>Address()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">mach_vm_address_t crashpad::MachOImageSegmentReader::Address </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>The segment’s actual load address in memory, adjusted for any “slide”.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>For the segment’s preferred load address, not adjusted for slide, use <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a6cbf169de4e86aed8fc7d3f00ddcf302" title="The segment’s preferred load address.">vmaddr()</a>. </dd></dl>
</div>
</div>
<a id="ab3b139fd095a7187294f05d0780af81c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab3b139fd095a7187294f05d0780af81c">&#9670;&nbsp;</a></span>fileoff()</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::MachOImageSegmentReader::fileoff </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 file offset of the mapped segment in the file from which it was mapped. </p>
<p>The file offset is the difference between the beginning of the <code>mach_header</code> or <code>mach_header_64</code> and the beginning of the segment’s mapped region. For segments that are not mapped from a file (such as <code>__PAGEZERO</code> segments), this will be <code>0</code>. </p>
</div>
</div>
<a id="a370e8711294ba506de99e093ac879357"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a370e8711294ba506de99e093ac879357">&#9670;&nbsp;</a></span>GetSectionAtIndex()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const process_types::section * crashpad::MachOImageSegmentReader::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">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 command. Unlike <a class="el" href="classcrashpad_1_1MachOImageReader.html#ac9a2388f42c8d4c5c01ca007e93079fc" title="Obtain section information by section index.">MachOImageReader::GetSectionAtIndex()</a>, this is a 0-based index. This parameter must be in the range of valid indices aas reported by <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#af5ec4fad5cedad192ba8ca92728dd928" title="Returns the number of sections in the segment.">nsects()</a>. </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, execution is aborted. 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_1MachOImageSegmentReader.html" title="A reader for LC_SEGMENT or LC_SEGMENT_64 load commands in Mach-O images mapped into another process.">MachOImageSegmentReader</a> object.</dd></dl>
<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. </dd>
<dd>
Unlike <a class="el" href="classcrashpad_1_1MachOImageReader.html#ac9a2388f42c8d4c5c01ca007e93079fc" title="Obtain section information by section index.">MachOImageReader::GetSectionAtIndex()</a>, this method does not accept out-of-range values for <em>index</em>, and aborts execution instead of returning <code>nullptr</code> upon encountering an out-of-range value. This is because this method is expected to be used in a loop that can be limited to <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#af5ec4fad5cedad192ba8ca92728dd928" title="Returns the number of sections in the segment.">nsects()</a> iterations, so an out-of-range error can be treated more harshly as a logic error, as opposed to a data error.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classcrashpad_1_1MachOImageReader.html#ac9a2388f42c8d4c5c01ca007e93079fc" title="Obtain section information by section index.">MachOImageReader::GetSectionAtIndex()</a> </dd></dl>
</div>
</div>
<a id="a2f2f06905518f693178e52ee14c57e9e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2f2f06905518f693178e52ee14c57e9e">&#9670;&nbsp;</a></span>GetSectionByName()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const process_types::section * crashpad::MachOImageSegmentReader::GetSectionByName </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 section name. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">section_name</td><td>The name of the section to search for, without the leading segment name. For example, use <code>"__text"</code>, not <code>"__TEXT,__text"</code> or <code>"__TEXT.__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_1MachOImageSegmentReader.html" title="A reader for LC_SEGMENT or LC_SEGMENT_64 load commands in Mach-O images mapped into another process.">MachOImageSegmentReader</a> object.</dd></dl>
<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.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classcrashpad_1_1MachOImageReader.html#a1917ca481052f1d2de7163cb6f8701cc" title="Obtain section information by segment and section name.">MachOImageReader::GetSectionByName()</a> </dd></dl>
</div>
</div>
<a id="ae31cdad3d716b7b82f96541a82adbff9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae31cdad3d716b7b82f96541a82adbff9">&#9670;&nbsp;</a></span>Initialize()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool crashpad::MachOImageSegmentReader::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>load_command_address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>load_command_info</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>module_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>file_type</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Reads the segment load command 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">load_command_address</td><td>The address, in the remote process’ address space, where the <code>LC_SEGMENT</code> or <code>LC_SEGMENT_64</code> load command to be read is located. This address is determined by a Mach-O image reader, such as <a class="el" href="classcrashpad_1_1MachOImageReader.html" title="A reader for Mach-O images mapped into another process.">MachOImageReader</a>, as it walks Mach-O load commands. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">load_command_info</td><td>A string to be used in logged messages. This string is for diagnostic purposes only, and may be empty. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">module_name</td><td>The path used to load the module. This string is used to relax otherwise strict parsing rules for common modules with known defects. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">file_type</td><td>The module’s Mach-O file type. This is used 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 load command was read successfully. <code>false</code> otherwise, with an appropriate message logged. </dd></dl>
</div>
</div>
<a id="a4c31878c0cac883d27bf212c9a616385"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4c31878c0cac883d27bf212c9a616385">&#9670;&nbsp;</a></span>Name()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string crashpad::MachOImageSegmentReader::Name </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the segment’s name. </p>
<p>The segment’s name is taken from the load command’s <code>segname</code> field. Common segment names are <code>"__TEXT"</code>, <code>"__DATA"</code>, and <code>"__LINKEDIT"</code>. Symbolic constants for these common names are defined in <code>&lt;mach-o/loader.h&gt;</code>. </p>
</div>
</div>
<a id="af5ec4fad5cedad192ba8ca92728dd928"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af5ec4fad5cedad192ba8ca92728dd928">&#9670;&nbsp;</a></span>nsects()</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::MachOImageSegmentReader::nsects </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 number of sections in the segment. </p>
<p>This will return <code>0</code> for a segment without any sections, typical for <code>__PAGEZERO</code> and <code>__LINKEDIT</code> segments.</p>
<p>Although the Mach-O file format uses a <code>uint32_t</code> for this field, there is an overall limit of 255 sections in an entire Mach-O image file (not just in a single segment) imposed by the symbol table format. Symbols will not be able to reference anything in a section beyond the first 255 in a Mach-O image file. </p>
</div>
</div>
<a id="ad9357dc5d34a7f09219f6e850694014b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad9357dc5d34a7f09219f6e850694014b">&#9670;&nbsp;</a></span>SectionNameString()</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::MachOImageSegmentReader::SectionNameString </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>section_name_c</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a section name string. </p>
<p>Section names may be 16 characters long, and are not necessarily <code>NUL</code>-terminated. This function will return a section name based on up to the first 16 characters found at <em>section_name_c</em>. </p>
</div>
</div>
<a id="a3f607c8cc16a960a6638bf4b91965397"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3f607c8cc16a960a6638bf4b91965397">&#9670;&nbsp;</a></span>SegmentAndSectionNameString()</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::MachOImageSegmentReader::SegmentAndSectionNameString </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>segment_name_c</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>section_name_c</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a segment and section name string. </p>
<p>A segment and section name string is composed of a segment name string (see <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#ad00d9acfb6f78cd0c5e640d667e8b746" title="Returns a segment name string.">SegmentNameString()</a>) and a section name string (see <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#ad9357dc5d34a7f09219f6e850694014b" title="Returns a section name string.">SectionNameString()</a>) separated by a comma. An example is <code>"__TEXT,__text"</code>. </p>
</div>
</div>
<a id="ad00d9acfb6f78cd0c5e640d667e8b746"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad00d9acfb6f78cd0c5e640d667e8b746">&#9670;&nbsp;</a></span>SegmentNameString()</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::MachOImageSegmentReader::SegmentNameString </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>segment_name_c</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a segment name string. </p>
<p>Segment names may be 16 characters long, and are not necessarily <code>NUL</code>-terminated. This function will return a segment name based on up to the first 16 characters found at <em>segment_name_c</em>. </p>
</div>
</div>
<a id="a37363d59c8264d505783d78f0bcce649"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a37363d59c8264d505783d78f0bcce649">&#9670;&nbsp;</a></span>SegmentSlides()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool crashpad::MachOImageSegmentReader::SegmentSlides </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns whether the segment slides.</p>
<p>Most segments slide, but the <code>__PAGEZERO</code> segment does not, it grows instead. This method identifies non-sliding segments in the same way that the kernel does. </p>
</div>
</div>
<a id="a6ebb278d318490b4ac6656f1911cf6ad"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6ebb278d318490b4ac6656f1911cf6ad">&#9670;&nbsp;</a></span>SetSlide()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void crashpad::MachOImageSegmentReader::SetSlide </td>
<td>(</td>
<td class="paramtype">mach_vm_size_t&#160;</td>
<td class="paramname"><em>slide</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the image’s slide value. </p>
<p>This method must only be called once on an object, after <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#ae31cdad3d716b7b82f96541a82adbff9" title="Reads the segment load command from another process.">Initialize()</a> is called successfully. It must be called before <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a873ee4e1206c53ba15faa3fcae684d2e">Address()</a>, <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a0d1d9a429f5f3ef9bc8cff02f90c3374">Size()</a>, <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a2f2f06905518f693178e52ee14c57e9e" title="Obtain section information by section name.">GetSectionByName()</a>, or <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a370e8711294ba506de99e093ac879357" title="Obtain section information by section index.">GetSectionAtIndex()</a> can be called.</p>
<p>This method is provided because slide is a property of the image that cannot be determined until at least some segments have been read. As such, it is not necessarily known at the time that <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#ae31cdad3d716b7b82f96541a82adbff9" title="Reads the segment load command from another process.">Initialize()</a> is called. </p>
</div>
</div>
<a id="a0d1d9a429f5f3ef9bc8cff02f90c3374"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0d1d9a429f5f3ef9bc8cff02f90c3374">&#9670;&nbsp;</a></span>Size()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">mach_vm_size_t crashpad::MachOImageSegmentReader::Size </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>The segment’s actual size address in memory, adjusted for any growth in the case of a nonsliding segment.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>For the segment’s preferred size, not adjusted for growth, use <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#aa801e05da01e40484e0fcc08b861282d" title="Returns the segment’s size as mapped into memory.">vmsize()</a>. </dd></dl>
</div>
</div>
<a id="a6cbf169de4e86aed8fc7d3f00ddcf302"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6cbf169de4e86aed8fc7d3f00ddcf302">&#9670;&nbsp;</a></span>vmaddr()</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::MachOImageSegmentReader::vmaddr </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>The segment’s preferred load address. </p>
<dl class="section return"><dt>Returns</dt><dd>The segment’s preferred load address as stored in the Mach-O file.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This value is not adjusted for any “slide” that may have occurred when the image was loaded. Use <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a873ee4e1206c53ba15faa3fcae684d2e">Address()</a> for a value adjusted for slide.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classcrashpad_1_1MachOImageReader.html#a687d6ad610407967e283d8ba8b6e2db4" title="Obtain segment information by segment name.">MachOImageReader::GetSegmentByName()</a> </dd></dl>
</div>
</div>
<a id="aa801e05da01e40484e0fcc08b861282d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa801e05da01e40484e0fcc08b861282d">&#9670;&nbsp;</a></span>vmsize()</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::MachOImageSegmentReader::vmsize </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 segment’s size as mapped into memory. </p>
<dl class="section note"><dt>Note</dt><dd>For non-sliding segments, this value is not adjusted for any growth that may have occurred when the image was loaded. Use <a class="el" href="classcrashpad_1_1MachOImageSegmentReader.html#a0d1d9a429f5f3ef9bc8cff02f90c3374">Size()</a> for a value adjusted for growth. </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>snapshot/mac/mach_o_image_segment_reader.h</li>
<li>snapshot/mac/mach_o_image_segment_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.18
</small></address>
</body>
</html>