Plugins Python API » History » Revision 12
Revision 11 (Alexis Jeandet, 21/09/2015 02:51 PM) → Revision 12/21 (Alexis Jeandet, 21/09/2015 02:54 PM)
h1. Plugins Python API All SocExplorer plugins expose some common functions and their own functions to the embedded Python terminal. h2. Common Functions All this functions are either implemented in the base class *socexplorerplugin* or in the plugin itself. Function list: * %{color:green}QVariantList% *[[Plugins_Python_API#Read|Read]]* (%{color:green}unsigned int% address, %{color:green}unsigned int% count); * %{color:blue}void% *[[Plugins_Python_API#Write|Write]]* (%{color:green}unsigned int% address, %{color:green}QList<QVariant>% dataList); * %{color:blue}void% *[[Plugins_Python_API#closeMe|closeMe]]* (); * %{color:blue}void% *[[Plugins_Python_API#activate|activate]]* (%{color:green}bool% flag); * %{color:blue}void% *[[Plugins_Python_API#setInstanceName|setInstanceName]]* (%{color:green}const QString% & newName); * %{color:green}bool% *[[Plugins_Python_API#dumpMemory|dumpMemory]]* (%{color:green}unsigned int% address, %{color:green}unsigned int% count, %{color:green}QString% file); * %{color:green}bool% *[[Plugins_Python_API#memSet|memSet]]* (%{color:green}unsigned int% address, %{color:green}int% value, %{color:green}unsigned int% count); * %{color:green}bool% *[[Plugins_Python_API#loadbin|loadbin]]* (%{color:green}unsigned int% address, %{color:green}QString% file); * %{color:green}bool% *[[Plugins_Python_API#loadfile|loadfile]]* (%{color:green}abstractBinFile% * file); * %{color:green}bool% *[[Plugins_Python_API#dumpMemory|dumpMemory]]* (%{color:green}unsigned int% address, %{color:green}unsigned int% count, %{color:green}QString% file, %{color:green}const QString% & format); ---- ---- h2(#Read). %{color:green}QVariantList% *Read* (%{color:green}unsigned int% address, %{color:green}unsigned int% count) Reads target memory at given address and return its content. On any root plugin it will read system memory and by default on child plugin it will forward request to parent plugin util it reach root plugin and read system bus. Note that this function could be re-implemented on a child plugin and have a different behavior. The returned list is a *Word* list which means that the smallest data you can read is a word(32 bits) and *count* is the number of words to read. The function respect host endianness so it will convert data depending on target endianness. *See also* %{color:blue}void% *[[Plugins_Python_API#Write|Write]]* (%{color:green}unsigned int% address, %{color:green}QList<QVariant>% dataList); ---- h2(#Write). %{color:blue}void% *Write* (%{color:green}unsigned int% address, %{color:green}QList<QVariant>% dataList) Writes given *datalist* at given *address* in target system bus. On any root plugin it will writes system memory and by default on child plugin it will forward request to parent plugin util it reach root plugin and writes system bus. Note that this function could be re-implemented on a child plugin and have a different behavior. The given list is a Word list which means that the smallest data you can write is a word(32 bits). The function respect host endianness so it will convert data depending on target endianness. Example: Let's consider we have a Leon3 with some RAM at 0x40000000 and we want to write 1 2 3 and 0xffffffff. We are connected to the target through *rootplugin* which can be replaced by the plugin are using. <pre><code class="python"> rootplugin.Write(0x40000000,[1,2,3,0xffffffff]) </code></pre> See also %{color:green}QVariantList% *[[Plugins_Python_API#Read|Read]]* (%{color:green}unsigned int% address, %{color:green}unsigned int% count); ---- h2(#closeMe). %{color:blue}void% *closeMe* () Closes the plugin. ---- h2(#activate). %{color:blue}void% *activate* (%{color:green}bool% flag) Activates the plugin GUI, this function is called by *SocExplorer* you may not call this function unless you know exactly what you do. ---- ---- h2(#setInstanceName). %{color:blue}void% *setInstanceName* (%{color:green}const QString% & newName) ---- h2(#dumpMemory). %{color:green}bool% *dumpMemory* (%{color:green}unsigned int% address, %{color:green}unsigned int% count, %{color:green}QString% file) ---- h2(#memSet). %{color:green}bool% *memSet* (%{color:green}unsigned int% address, %{color:green}int% value, %{color:green}unsigned int% count) ---- h2(#loadbin). %{color:green}bool% *loadbin* (%{color:green}unsigned int% address, %{color:green}QString% file) ---- h2(#loadfile). %{color:green}bool% *loadfile* (%{color:green}abstractBinFile% * file) ---- h2(#dumpMemory). %{color:green}bool% *dumpMemory* (%{color:green}unsigned int% address, %{color:green}unsigned int% count, %{color:green}QString% file, %{color:green}const QString% & format) ----