<!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.13"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Crashpad: crashpad::Ptracer 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.13 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </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_1Ptracer.html">Ptracer</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> | <a href="classcrashpad_1_1Ptracer-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">crashpad::Ptracer Class Reference</div> </div> </div><!--header--> <div class="contents"> <p>Provides an architecturally agnostic interface for collecting information with <code>ptrace</code>. <a href="classcrashpad_1_1Ptracer.html#details">More...</a></p> <p><code>#include "util/linux/ptracer.h"</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:abd1431ec88983c9d1a6282e622e32d65"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1Ptracer.html#abd1431ec88983c9d1a6282e622e32d65">Ptracer</a> (bool is_64_bit, bool can_log)</td></tr> <tr class="memdesc:abd1431ec88983c9d1a6282e622e32d65"><td class="mdescLeft"> </td><td class="mdescRight">Constructs this object with a pre-determined bitness. <a href="#abd1431ec88983c9d1a6282e622e32d65">More...</a><br /></td></tr> <tr class="separator:abd1431ec88983c9d1a6282e622e32d65"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a73a6d58c4e265a88079e009ad511adfe"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1Ptracer.html#a73a6d58c4e265a88079e009ad511adfe">Ptracer</a> (bool can_log)</td></tr> <tr class="memdesc:a73a6d58c4e265a88079e009ad511adfe"><td class="mdescLeft"> </td><td class="mdescRight">Constructs this object without a pre-determined bitness. <a href="#a73a6d58c4e265a88079e009ad511adfe">More...</a><br /></td></tr> <tr class="separator:a73a6d58c4e265a88079e009ad511adfe"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a110b2dba5079e93ff13230b2f6a51e9c"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1Ptracer.html#a110b2dba5079e93ff13230b2f6a51e9c">Initialize</a> (pid_t pid)</td></tr> <tr class="memdesc:a110b2dba5079e93ff13230b2f6a51e9c"><td class="mdescLeft"> </td><td class="mdescRight">Initializes this object to the bitness of the process whose process ID is <em>pid</em>. <a href="#a110b2dba5079e93ff13230b2f6a51e9c">More...</a><br /></td></tr> <tr class="separator:a110b2dba5079e93ff13230b2f6a51e9c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a099fd87be8696988f4f54072b0aad564"><td class="memItemLeft" align="right" valign="top"><a id="a099fd87be8696988f4f54072b0aad564"></a> bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1Ptracer.html#a099fd87be8696988f4f54072b0aad564">Is64Bit</a> ()</td></tr> <tr class="memdesc:a099fd87be8696988f4f54072b0aad564"><td class="mdescLeft"> </td><td class="mdescRight">Return <code>true</code> if this object is configured for 64-bit. <br /></td></tr> <tr class="separator:a099fd87be8696988f4f54072b0aad564"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ae6b7f81ee593a72d38789e890f5abd1d"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1Ptracer.html#ae6b7f81ee593a72d38789e890f5abd1d">GetThreadInfo</a> (pid_t tid, <a class="el" href="structcrashpad_1_1ThreadInfo.html">ThreadInfo</a> *info)</td></tr> <tr class="memdesc:ae6b7f81ee593a72d38789e890f5abd1d"><td class="mdescLeft"> </td><td class="mdescRight">Uses <code>ptrace</code> to collect information about the thread with thread ID <em>tid</em>. <a href="#ae6b7f81ee593a72d38789e890f5abd1d">More...</a><br /></td></tr> <tr class="separator:ae6b7f81ee593a72d38789e890f5abd1d"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ab5e3c4efe6d3a06ea6abdf60fec2747f"><td class="memItemLeft" align="right" valign="top">ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1Ptracer.html#ab5e3c4efe6d3a06ea6abdf60fec2747f">ReadUpTo</a> (pid_t pid, <a class="el" href="namespacecrashpad.html#acb197256391fbfca91f9a7e5c911db45">LinuxVMAddress</a> address, size_t size, char *buffer)</td></tr> <tr class="memdesc:ab5e3c4efe6d3a06ea6abdf60fec2747f"><td class="mdescLeft"> </td><td class="mdescRight">Uses <code>ptrace</code> to read memory from the process with process ID <em>pid</em>, up to a maximum number of bytes. <a href="#ab5e3c4efe6d3a06ea6abdf60fec2747f">More...</a><br /></td></tr> <tr class="separator:ab5e3c4efe6d3a06ea6abdf60fec2747f"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>Provides an architecturally agnostic interface for collecting information with <code>ptrace</code>. </p> <p>A ptracer is configured for a particular bitness. It is an error to make any calls via this object against a thread whose bitness does not match the bitness this object was initialized with. </p> </div><h2 class="groupheader">Constructor & Destructor Documentation</h2> <a id="abd1431ec88983c9d1a6282e622e32d65"></a> <h2 class="memtitle"><span class="permalink"><a href="#abd1431ec88983c9d1a6282e622e32d65">◆ </a></span>Ptracer() <span class="overload">[1/2]</span></h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">crashpad::Ptracer::Ptracer </td> <td>(</td> <td class="paramtype">bool </td> <td class="paramname"><em>is_64_bit</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"><em>can_log</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Constructs this object with a pre-determined bitness. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">is_64_bit</td><td><code>true</code> if this object is to be configured for 64-bit. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">can_log</td><td>Whether methods in this class can log error messages. </td></tr> </table> </dd> </dl> </div> </div> <a id="a73a6d58c4e265a88079e009ad511adfe"></a> <h2 class="memtitle"><span class="permalink"><a href="#a73a6d58c4e265a88079e009ad511adfe">◆ </a></span>Ptracer() <span class="overload">[2/2]</span></h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">crashpad::Ptracer::Ptracer </td> <td>(</td> <td class="paramtype">bool </td> <td class="paramname"><em>can_log</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"> <p>Constructs this object without a pre-determined bitness. </p> <p><a class="el" href="classcrashpad_1_1Ptracer.html#a110b2dba5079e93ff13230b2f6a51e9c" title="Initializes this object to the bitness of the process whose process ID is pid. ">Initialize()</a> must be successfully called before making any other calls on this object.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">can_log</td><td>Whether methods in this class can log error messages. </td></tr> </table> </dd> </dl> </div> </div> <h2 class="groupheader">Member Function Documentation</h2> <a id="ae6b7f81ee593a72d38789e890f5abd1d"></a> <h2 class="memtitle"><span class="permalink"><a href="#ae6b7f81ee593a72d38789e890f5abd1d">◆ </a></span>GetThreadInfo()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool crashpad::Ptracer::GetThreadInfo </td> <td>(</td> <td class="paramtype">pid_t </td> <td class="paramname"><em>tid</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structcrashpad_1_1ThreadInfo.html">ThreadInfo</a> * </td> <td class="paramname"><em>info</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Uses <code>ptrace</code> to collect information about the thread with thread ID <em>tid</em>. </p> <p>The target thread should be attached before calling this method. </p><dl class="section see"><dt>See also</dt><dd><a class="el" href="classcrashpad_1_1ScopedPtraceAttach.html" title="Maintains a ptrace() attachment to a process. ">ScopedPtraceAttach</a></dd></dl> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">tid</td><td>The thread ID of the thread to collect information for. </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">info</td><td>A <a class="el" href="structcrashpad_1_1ThreadInfo.html" title="A collection of ptrace-able information about a thread. ">ThreadInfo</a> for the thread. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd><code>true</code> on success. <code>false</code> on failure with a message logged, if enabled. </dd></dl> </div> </div> <a id="a110b2dba5079e93ff13230b2f6a51e9c"></a> <h2 class="memtitle"><span class="permalink"><a href="#a110b2dba5079e93ff13230b2f6a51e9c">◆ </a></span>Initialize()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool crashpad::Ptracer::Initialize </td> <td>(</td> <td class="paramtype">pid_t </td> <td class="paramname"><em>pid</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Initializes this object to the bitness of the process whose process ID is <em>pid</em>. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">pid</td><td>The process ID of the process to initialize with. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd><code>true</code> on success. <code>false</code> on failure with a message logged, if enabled. </dd></dl> </div> </div> <a id="ab5e3c4efe6d3a06ea6abdf60fec2747f"></a> <h2 class="memtitle"><span class="permalink"><a href="#ab5e3c4efe6d3a06ea6abdf60fec2747f">◆ </a></span>ReadUpTo()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ssize_t crashpad::Ptracer::ReadUpTo </td> <td>(</td> <td class="paramtype">pid_t </td> <td class="paramname"><em>pid</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="namespacecrashpad.html#acb197256391fbfca91f9a7e5c911db45">LinuxVMAddress</a> </td> <td class="paramname"><em>address</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>size</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char * </td> <td class="paramname"><em>buffer</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Uses <code>ptrace</code> to read memory from the process with process ID <em>pid</em>, up to a maximum number of bytes. </p> <p>The target process should already be attached before calling this method. </p><dl class="section see"><dt>See also</dt><dd><a class="el" href="classcrashpad_1_1ScopedPtraceAttach.html" title="Maintains a ptrace() attachment to a process. ">ScopedPtraceAttach</a></dd></dl> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">pid</td><td>The process ID whose memory to read. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">address</td><td>The base address of the region to read. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>The size of the memory region to read. <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 to fill with the data read. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>the number of bytes read, 0 if there are no more bytes to read, or -1 on failure with a message logged if logging is enabled. </dd></dl> </div> </div> <hr/>The documentation for this class was generated from the following files:<ul> <li>util/linux/ptracer.h</li> <li>util/linux/ptracer.cc</li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.13 </small></address> </body> </html>