<div dir="ltr">Hi Alessandro,<br>If you need to access registers, you should use `CPUArchState`, which is architecture-specific (ie: you should put it inside the right ifdef guard)<br>You can use it like this:<br><br>&gt; #ifdef TARGET_I386<br>&gt; CPUArchState *env = (CPUArchState*)cpu-&gt;env_ptr;<br>&gt; ... rest of architecture dependent code...  <br>&gt;<br>&gt; #endif<br><br>Regards,<br>Gabriele</div><div class="gmail_extra"><br><div class="gmail_quote">2017-11-04 20:19 GMT+01:00 alessandro mantovani <span dir="ltr">&lt;<a href="mailto:alk13@hotmail.it" target="_blank">alk13@hotmail.it</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div id="m_4359405624623204007divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Dear Brendan,</p>
<p><br>
</p>
<p>Thank you for the answer but during the building phase (i.e. after that I launch build.sh) I get the following error:</p>
<p><br>
</p>
<p></p>
<div>panda/plugins/myfirstplugin.c:<wbr>42:13: error: ‘CPUState’ has no member named ‘regs’
<br>
</div>
<div>                       pc, env-&gt;regs[R_EAX]);</div>
<div><br>
</div>
<div>All the other files are correctly compiled so I don&#39;t have any idea. <br>
</div>
<div>Obviously env is a CPUState* variable. My included files are:</div>
<div><br>
</div>
<div>
<div>#include &quot;panda/plugin.h&quot;<br>
#include &quot;panda/plugin_plugin.h&quot;<br>
#include &quot;cpu.h&quot;<br>
#include &quot;qemu-common.h&quot;</div>
<div><br>
</div>
<div>Do you know what is the problem?</div>
<div>greetings to all<br>
</div>
<br>
</div>
<br>
<p></p>
<br>
<br>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div id="m_4359405624623204007divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>Da:</b> Brendan Dolan-Gavitt &lt;<a href="mailto:brendandg@nyu.edu" target="_blank">brendandg@nyu.edu</a>&gt;<br>
<b>Inviato:</b> venerdì 3 novembre 2017 17:02<br>
<b>A:</b> alessandro mantovani<br>
<b>Cc:</b> <a href="mailto:panda-users@mit.edu" target="_blank">panda-users@mit.edu</a><br>
<b>Oggetto:</b> Re: [panda-users] Plugin</font>
<div> </div>
</div>
<div>
<div dir="ltr"><span class="">Put it in the panda/plugins directory and then add the name of the plugin to panda/plugins/config.panda. Then just run build.sh as normal and your plugin will be built with the others. It is also possible to have an &quot;external plugins&quot; path, see
 here for details:
<div><br>
</div>
</span><div><a href="https://github.com/panda-re/panda/blob/4d1e32541d1f9e79abc8b7706669a95d3fcb7a2f/panda/docs/manual.md#personal-plugins" id="m_4359405624623204007LPlnk212661" target="_blank">https://github.com/panda-re/<wbr>panda/blob/<wbr>4d1e32541d1f9e79abc8b7706669a9<wbr>5d3fcb7a2f/panda/docs/manual.<wbr>md#personal-plugins</a>
<div id="m_4359405624623204007LPBorder_GT_15098226845600.6599008466126686" style="margin-bottom:20px;overflow:auto;width:100%;text-indent:0px">
<table id="m_4359405624623204007LPContainer_15098226845520.24308928926247897" style="width:90%;background-color:rgb(255,255,255);overflow:auto;padding-top:20px;padding-bottom:20px;margin-top:20px;border-top:1px dotted rgb(200,200,200);border-bottom:1px dotted rgb(200,200,200)" cellspacing="0">
<tbody>
<tr style="border-spacing:0px" valign="top">
<td id="m_4359405624623204007ImageCell_15098226845530.3997214158170095" style="width:250px;display:table-cell;padding-right:20px" colspan="1">
<div id="m_4359405624623204007LPImageContainer_15098226845530.9046132705200602" style="background-color:rgb(255,255,255);height:250px;margin:auto;display:table;width:250px">
<a id="m_4359405624623204007LPImageAnchor_15098226845540.7941027087199549" style="display:table-cell;text-align:center" href="https://github.com/panda-re/panda/blob/4d1e32541d1f9e79abc8b7706669a95d3fcb7a2f/panda/docs/manual.md#personal-plugins" target="_blank"><img style="display:inline-block;max-width:250px;max-height:250px;height:250px;width:250px;border-width:0px;vertical-align:bottom" id="m_4359405624623204007LPThumbnailImageID_15098226845550.25946596231593544" width="250" height="250" src="https://avatars1.githubusercontent.com/u/16124198?s=400&amp;v=4"></a></div>
</td>
<td id="m_4359405624623204007TextCell_15098226845560.12578831194922258" style="vertical-align:top;padding:0px;display:table-cell" colspan="2">
<div id="m_4359405624623204007LPRemovePreviewContainer_15098226845560.6146059540911536"></div>
<div id="m_4359405624623204007LPExpandDescriptionContainer_15098226845560.8881102697757849"></div>
<div id="m_4359405624623204007LPTitle_15098226845560.7058263915490041" style="color:rgb(0,120,215);font-weight:400;font-size:21px;font-family:&quot;wf_segoe-ui_light&quot;,&quot;Segoe UI Light&quot;,&quot;Segoe WP Light&quot;,&quot;Segoe UI&quot;,&quot;Segoe WP&quot;,Tahoma,Arial,sans-serif;line-height:21px">
<a id="m_4359405624623204007LPUrlAnchor_15098226845570.8413501130113494" style="text-decoration:none" href="https://github.com/panda-re/panda/blob/4d1e32541d1f9e79abc8b7706669a95d3fcb7a2f/panda/docs/manual.md#personal-plugins" target="_blank">panda-re/panda</a></div>
<div id="m_4359405624623204007LPMetadata_15098226845570.14327266664911764" style="margin:10px 0px 16px;color:rgb(102,102,102);font-weight:400;font-family:&quot;wf_segoe-ui_normal&quot;,&quot;Segoe UI&quot;,&quot;Segoe WP&quot;,Tahoma,Arial,sans-serif;font-size:14px;line-height:14px">
<a href="http://github.com" target="_blank">github.com</a></div>
<div id="m_4359405624623204007LPDescription_15098226845570.5884090310025817" style="display:block;color:rgb(102,102,102);font-weight:400;font-family:&quot;wf_segoe-ui_normal&quot;,&quot;Segoe UI&quot;,&quot;Segoe WP&quot;,Tahoma,Arial,sans-serif;font-size:14px;line-height:20px;max-height:100px;overflow:hidden">
panda - Platform for Architecture-Neutral Dynamic Analysis</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
</div>
</div><span class="">
<div class="m_4359405624623204007x_gmail_extra"><br>
<div class="m_4359405624623204007x_gmail_quote">On Fri, Nov 3, 2017 at 11:56 AM, alessandro mantovani <span dir="ltr">
&lt;<a href="mailto:alk13@hotmail.it" target="_blank">alk13@hotmail.it</a>&gt;</span> wrote:<br>
<blockquote class="m_4359405624623204007x_gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div id="m_4359405624623204007x_m_3699392511106330615divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif">
<p>Hi all,</p>
<p><br>
</p>
<p>I have written my first plugin but I don&#39;t know what I&#39;ve to do now. How can I compile and build it so that it can be called in command line through the &#39;-panda&#39; option? (i.e. exactly like the other plugins already written)</p>
<p><br>
</p>
<p>Thank you<br>
</p>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
panda-users mailing list<br>
<a href="mailto:panda-users@mit.edu" target="_blank">panda-users@mit.edu</a><br>
<a href="http://mailman.mit.edu/mailman/listinfo/panda-users" rel="noreferrer" target="_blank">http://mailman.mit.edu/mailman<wbr>/listinfo/panda-users</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="m_4359405624623204007x_gmail_signature">Brendan Dolan-Gavitt<br>
Assistant Professor, Department of Computer Science and Engineering<br>
NYU Tandon School of Engineering</div>
</div>
</span></div>
</div>
</div>
</div>

<br>______________________________<wbr>_________________<br>
panda-users mailing list<br>
<a href="mailto:panda-users@mit.edu">panda-users@mit.edu</a><br>
<a href="http://mailman.mit.edu/mailman/listinfo/panda-users" rel="noreferrer" target="_blank">http://mailman.mit.edu/<wbr>mailman/listinfo/panda-users</a><br>
<br></blockquote></div><br></div>