blob: ac1676bc741d7f64ef2b90433d7b1313da318fd3 [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::TaskMemory 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_1TaskMemory.html">TaskMemory</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classcrashpad_1_1TaskMemory-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">crashpad::TaskMemory Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Accesses the memory of another Mach task.
<a href="classcrashpad_1_1TaskMemory.html#details">More...</a></p>
<p><code>#include &quot;util/mach/task_memory.h&quot;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1TaskMemory_1_1MappedMemory.html">MappedMemory</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A memory region mapped from another Mach task. <a href="classcrashpad_1_1TaskMemory_1_1MappedMemory.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><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:aa285dd7fa791444753783c5ec03696a1"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1TaskMemory.html#aa285dd7fa791444753783c5ec03696a1">TaskMemory</a> (task_t task)</td></tr>
<tr class="separator:aa285dd7fa791444753783c5ec03696a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a323d157824f62eb286e4c39f8d99e3a9"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1TaskMemory.html#a323d157824f62eb286e4c39f8d99e3a9">Read</a> (mach_vm_address_t address, size_t size, void *buffer)</td></tr>
<tr class="memdesc:a323d157824f62eb286e4c39f8d99e3a9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copies memory from the target task into a caller-provided buffer in the current task. <a href="#a323d157824f62eb286e4c39f8d99e3a9">More...</a><br /></td></tr>
<tr class="separator:a323d157824f62eb286e4c39f8d99e3a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae4a62001732f11829cca98aecb02d693"><td class="memItemLeft" align="right" valign="top">std::unique_ptr&lt; <a class="el" href="classcrashpad_1_1TaskMemory_1_1MappedMemory.html">MappedMemory</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1TaskMemory.html#ae4a62001732f11829cca98aecb02d693">ReadMapped</a> (mach_vm_address_t address, size_t size)</td></tr>
<tr class="memdesc:ae4a62001732f11829cca98aecb02d693"><td class="mdescLeft">&#160;</td><td class="mdescRight">Maps memory from the target task into the current task. <a href="#ae4a62001732f11829cca98aecb02d693">More...</a><br /></td></tr>
<tr class="separator:ae4a62001732f11829cca98aecb02d693"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9365a798d8140094cda73606ec132e87"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1TaskMemory.html#a9365a798d8140094cda73606ec132e87">ReadCString</a> (mach_vm_address_t address, std::string *string)</td></tr>
<tr class="memdesc:a9365a798d8140094cda73606ec132e87"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads a <code>NUL</code>-terminated C string from the target task into a string in the current task. <a href="#a9365a798d8140094cda73606ec132e87">More...</a><br /></td></tr>
<tr class="separator:a9365a798d8140094cda73606ec132e87"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a51092ce134b41d605a9a4ae470826eb6"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1TaskMemory.html#a51092ce134b41d605a9a4ae470826eb6">ReadCStringSizeLimited</a> (mach_vm_address_t address, mach_vm_size_t size, std::string *string)</td></tr>
<tr class="memdesc:a51092ce134b41d605a9a4ae470826eb6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads a <code>NUL</code>-terminated C string from the target task into a string in the current task. <a href="#a51092ce134b41d605a9a4ae470826eb6">More...</a><br /></td></tr>
<tr class="separator:a51092ce134b41d605a9a4ae470826eb6"><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>Accesses the memory of another Mach task. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="aa285dd7fa791444753783c5ec03696a1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa285dd7fa791444753783c5ec03696a1">&#9670;&nbsp;</a></span>TaskMemory()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">crashpad::TaskMemory::TaskMemory </td>
<td>(</td>
<td class="paramtype">task_t&#160;</td>
<td class="paramname"><em>task</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">task</td><td>A send right to the target task’s task port. This object does not take ownership of the send right. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a323d157824f62eb286e4c39f8d99e3a9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a323d157824f62eb286e4c39f8d99e3a9">&#9670;&nbsp;</a></span>Read()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool crashpad::TaskMemory::Read </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">size_t&#160;</td>
<td class="paramname"><em>size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>buffer</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Copies memory from the target task into a caller-provided buffer in the current task. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">address</td><td>The address, in the target task’s address space, of the memory region to copy. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>The size, in bytes, of the memory region to copy. <em>buffer</em> must be at least this size. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">buffer</td><td>The buffer into which the contents of the other task’s memory will be copied.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> on success, with <em>buffer</em> filled appropriately. <code>false</code> on failure, with a warning logged. Failures can occur, for example, when encountering unmapped or unreadable pages.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classcrashpad_1_1TaskMemory.html#ae4a62001732f11829cca98aecb02d693" title="Maps memory from the target task into the current task. ">ReadMapped()</a> </dd></dl>
</div>
</div>
<a id="a9365a798d8140094cda73606ec132e87"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9365a798d8140094cda73606ec132e87">&#9670;&nbsp;</a></span>ReadCString()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool crashpad::TaskMemory::ReadCString </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">std::string *&#160;</td>
<td class="paramname"><em>string</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Reads a <code>NUL</code>-terminated C string from the target task into a string in the current task. </p>
<p>The length of the string need not be known ahead of time. This method will read contiguous memory until a <code>NUL</code> terminator is found.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">address</td><td>The address, in the target task’s address space, of the string to copy. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">string</td><td>The string read from the other task.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> on success, with <em>string</em> set appropriately. <code>false</code> on failure, with a warning logged. Failures can occur, for example, when encountering unmapped or unreadable pages.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classcrashpad_1_1TaskMemory_1_1MappedMemory.html#a9a616b5de4e5a66b99e8078cb923f8e1" title="Reads a NUL-terminated C string from the mapped region. ">MappedMemory::ReadCString()</a> </dd></dl>
</div>
</div>
<a id="a51092ce134b41d605a9a4ae470826eb6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a51092ce134b41d605a9a4ae470826eb6">&#9670;&nbsp;</a></span>ReadCStringSizeLimited()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool crashpad::TaskMemory::ReadCStringSizeLimited </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">mach_vm_size_t&#160;</td>
<td class="paramname"><em>size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::string *&#160;</td>
<td class="paramname"><em>string</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Reads a <code>NUL</code>-terminated C string from the target task into a string in the current task. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">address</td><td>The address, in the target task’s address space, of the string to copy. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>The maximum number of bytes to read. The string is required to be <code>NUL</code>-terminated within this many bytes. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">string</td><td>The string read from the other task.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> on success, with <em>string</em> set appropriately. <code>false</code> on failure, with a warning logged. Failures can occur, for example, when a <code>NUL</code> terminator is not found within <em>size</em> bytes, or when encountering unmapped or unreadable pages.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classcrashpad_1_1TaskMemory_1_1MappedMemory.html#a9a616b5de4e5a66b99e8078cb923f8e1" title="Reads a NUL-terminated C string from the mapped region. ">MappedMemory::ReadCString()</a> </dd></dl>
</div>
</div>
<a id="ae4a62001732f11829cca98aecb02d693"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae4a62001732f11829cca98aecb02d693">&#9670;&nbsp;</a></span>ReadMapped()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::unique_ptr&lt; <a class="el" href="classcrashpad_1_1TaskMemory_1_1MappedMemory.html">TaskMemory::MappedMemory</a> &gt; crashpad::TaskMemory::ReadMapped </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">size_t&#160;</td>
<td class="paramname"><em>size</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Maps memory from the target task into the current task. </p>
<p>This interface is an alternative to <a class="el" href="classcrashpad_1_1TaskMemory.html#a323d157824f62eb286e4c39f8d99e3a9" title="Copies memory from the target task into a caller-provided buffer in the current task. ">Read()</a> that does not require the caller to provide a buffer to fill. This avoids copying memory, which can offer a performance improvement.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">address</td><td>The address, in the target task’s address space, of the memory region to map. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>The size, in bytes, of the memory region to map.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>On success, a <a class="el" href="classcrashpad_1_1TaskMemory_1_1MappedMemory.html" title="A memory region mapped from another Mach task. ">MappedMemory</a> object that provides access to the data requested. On faliure, <code>nullptr</code>, with a warning logged. Failures can occur, for example, when encountering unmapped or unreadable pages. </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>util/mach/task_memory.h</li>
<li>util/mach/task_memory.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>