<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">You are right, it seems the argument is out of range, both vtableAddr and vtableAddr-8 are “8.5” byte long. Maybe there is something wrong with the way I get vtableAddress? I will clean up my full script and send it to you if the following
 does not provide enough information, thanks much.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">def vtable_addr (vtableSymbol):</p>
<p class="MsoNormal">    return vtableSymbol.addr.section.file_addr + vtableSymbol.addr.offset + 0x10
</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">vtableAddr, type=<type 'long'>, value=<span style="background:yellow;mso-highlight:yellow">0x1000000000000000f</span></p>
<p class="MsoNormal">vtableAddr-8, type=<type 'long'>, value=<span style="background:yellow;mso-highlight:yellow">0x10000000000000007</span></p>
<p class="MsoNormal">Traceback (most recent call last):</p>
<p class="MsoNormal">  File "<input>", line 1, in <module></p>
<p class="MsoNormal">  File "/home/leikong/repo/WindowsFabric/build.prod/test/fabdbg.py", line 199, in findall</p>
<p class="MsoNormal">    findtypes(pattern,ignorePureVirtualType)</p>
<p class="MsoNormal">  File "/home/leikong/repo/WindowsFabric/build.prod/test/fabdbg.py", line 156, in findtypes</p>
<p class="MsoNormal">    if ignorePureVirtualType and has_pure_virtual(vtableAddr, pureVirtualFuncs) :</p>
<p class="MsoNormal">  File "/home/leikong/repo/WindowsFabric/build.prod/test/fabdbg.py", line 100, in has_pure_virtual</p>
<p class="MsoNormal">    vtableEndAddr = lldb.process.ReadPointerFromMemory(vtableAddr-8, error)</p>
<p class="MsoNormal">  File "/home/leikong/bin/lldb/lib/python2.7/site-packages/lldb/__init__.py", line 9418, in ReadPointerFromMemory</p>
<p class="MsoNormal">    return _lldb.SBProcess_ReadPointerFromMemory(self, addr, error)</p>
<p class="MsoNormal">OverflowError: in method 'SBProcess_ReadPointerFromMemory', argument 2 of type 'lldb::addr_t'<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><o:p> </o:p></span></p>
<div style="mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="border:none;padding:0in"><b>From: </b><a href="mailto:gclayton@apple.com">Greg Clayton</a><br>
<b>Sent: </b>Monday, September 19, 2016 09:12 AM<br>
<b>To: </b><a href="mailto:leikong@msn.com">Lei Kong</a><br>
<b>Cc: </b><a href="mailto:jingham@apple.com">Jim Ingham</a>; <a href="mailto:lldb-dev@lists.llvm.org">
lldb-dev@lists.llvm.org</a><br>
<b>Subject: </b>Re: [lldb-dev] OverflowError: in method 'SBProcess_ReadPointerFromMemory', argument 2 of type 'lldb::addr_t'</p>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><o:p> </o:p></span></p>
</div>
<div class="BodyFragment">
<div class="PlainText">Try printing the type of the value you are passing in the line:<br>
<br>
    vtableEndAddr = lldb.process.ReadPointerFromMemory(vtableAddr-8, error)<br>
<br>
print type(vtableAddr)<br>
print type(vtableAddr-8)<br>
<br>
It seems like it thinks vtableAddr doesn't fit into a lldb::addr_t which is a uint64_t<br>
<br>
<br>
<br>
> On Sep 16, 2016, at 7:39 PM, Lei Kong via lldb-dev <lldb-dev@lists.llvm.org> wrote:<br>
> <br>
> I tried printing error.descryption, but it didn't work, because when the error happens, it seems ReadPointerFromMemory never returned to my code.<br>
>  <br>
>  <br>
> read from address 0000000001223f68<br>
> Traceback (most recent call last):<br>
>   File "<input>", line 1, in <module><br>
>   File "/home/leikong/repo/WindowsFabric/build.prod/test/fabdbg.py", line 289, in findall<br>
>     findtypes(pattern,ignorePureVirtualType)<br>
>   File "/home/leikong/repo/WindowsFabric/build.prod/test/fabdbg.py", line 246, in findtypes<br>
>     if ignorePureVirtualType and has_pure_virtual(vtableAddr, pureVirtualFuncs) :<br>
>   File "/home/leikong/repo/WindowsFabric/build.prod/test/fabdbg.py", line 190, in has_pure_virtual<br>
>     vtableEndAddr = lldb.process.ReadPointerFromMemory(vtableAddr-8, error)<br>
>   File "/home/leikong/bin/lldb/lib/python2.7/site-packages/lldb/__init__.py", line 9418, in ReadPointerFromMemory<br>
>     return _lldb.SBProcess_ReadPointerFromMemory(self, addr, error)<br>
> OverflowError: in method 'SBProcess_ReadPointerFromMemory', argument 2 of type 'lldb::addr_t'<br>
> <br>
>  <br>
> > Subject: Re: [lldb-dev] OverflowError: in method 'SBProcess_ReadPointerFromMemory', argument 2 of type 'lldb::addr_t'<br>
> > From: jingham@apple.com<br>
> > Date: Fri, 16 Sep 2016 17:12:24 -0700<br>
> > CC: lldb-dev@lists.llvm.org<br>
> > To: leikong@msn.com<br>
> > <br>
> > You passed an error into ReadPointerFromMemory. In the cases where you aren't getting what you expect, what does that error say?<br>
> > <br>
> > Jim<br>
> > <br>
> > > On Sep 16, 2016, at 5:06 PM, Lei Kong via lldb-dev <lldb-dev@lists.llvm.org> wrote:<br>
> > > <br>
> > > I ran into the error in the subject when running a python script with "script myfile.myscript()".<br>
> > >  <br>
> > > The value addr_t parameter used is 0x0000000001223f68, the following works fine:<br>
> > > <br>
> > > (lldb) scr<br>
> > > Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.<br>
> > > >>> e = lldb.SBError()<br>
> > > >>> ptr = lldb.process.ReadPointerFromMemory(0x0000000001223f68, e)<br>
> > > >>> print ptr<br>
> > > 0<br>
> > > >>> <br>
> > >  <br>
> > > Any suggestion how to further investigate? Thanks.<br>
> > >  <br>
> > > myfile.myscript() calls the following function in a loop (iterate through all vtable symbols), which contains the call ReadPointerFromMemory.<br>
> > >  <br>
> > > def dump_vtbl(vtableAddr) :<br>
> > > error = lldb.SBError()<br>
> > > vtableEndAddr = lldb.process.ReadPointerFromMemory(vtableAddr+8, error)<br>
> > > if not error.success :<br>
> > > return False<br>
> > > print "vtable: [%0.16x, %0.16x)" % (vtableAddr, vtableEndAddr)<br>
> > > for addr in range(vtableAddr, vtableEndAddr, 8) :<br>
> > > print "read from address %.016x" % addr<br>
> > > try:<br>
> > > funcAddr = lldb.process.ReadPointerFromMemory(addr, error)<br>
> > > except:<br>
> > > sys.exc_clear()<br>
> > > continue<br>
> > > if not error.success :<br>
> > > continue<br>
> > > <br>
> > > _______________________________________________<br>
> > > lldb-dev mailing list<br>
> > > lldb-dev@lists.llvm.org<br>
> > > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
> > <br>
> _______________________________________________<br>
> lldb-dev mailing list<br>
> lldb-dev@lists.llvm.org<br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
<br>
</div>
</div>
</body>
</html>