Ghidra is a software reverse engineering (SRE) framework
Edits to Decompiler help
caheckmanf0b05dda2cfa
diff --git a/Ghidra/Features/Decompiler/certification.manifest b/Ghidra/Features/Decompiler/certification.manifestindex 5e64a5bf6d..ccf3b465a8 100644--- a/Ghidra/Features/Decompiler/certification.manifest+++ b/Ghidra/Features/Decompiler/certification.manifest@@ -1,6 +1,7 @@##VERSION: 2.0##MODULE IP: Crystal Clear Icons - LGPL 2.1##MODULE IP: FAMFAMFAM Icons - CC 2.5+##MODULE IP: Modified Nuvola Icons - LGPL 2.1##MODULE IP: Oxygen Icons - LGPL 3.0##MODULE IP: Tango Icons - Public DomainModule.manifest||GHIDRA||||END|@@ -75,6 +76,8 @@ src/main/help/help/topics/DecompilePlugin/images/ForwardSlice.png||GHIDRA||||ENDsrc/main/help/help/topics/DecompilePlugin/images/Undefined.png||GHIDRA||||END|src/main/help/help/topics/DecompilePlugin/images/camera-photo.png||Tango Icons - Public Domain|||Tango|END|src/main/help/help/topics/DecompilePlugin/images/decompileFunction.gif||GHIDRA||reviewed||END|+src/main/help/help/topics/DecompilePlugin/images/document-properties.png||Tango Icons - Public Domain|||tango|END|+src/main/help/help/topics/DecompilePlugin/images/openFolder.png||Modified Nuvola Icons - LGPL 2.1||||END|src/main/help/help/topics/DecompilePlugin/images/page_edit.png||FAMFAMFAM Icons - CC 2.5||||END|src/main/help/help/topics/DecompilePlugin/images/page_white_copy.png||FAMFAMFAM Icons - CC 2.5||||END|src/main/help/help/topics/DecompilePlugin/images/reload3.png||Crystal Clear Icons - LGPL 2.1||||END|diff --git a/Ghidra/Features/Decompiler/src/main/doc/decompileplugin.xml b/Ghidra/Features/Decompiler/src/main/doc/decompileplugin.xmlindex 8eb4b3efb0..4b8fc27786 100644--- a/Ghidra/Features/Decompiler/src/main/doc/decompileplugin.xml+++ b/Ghidra/Features/Decompiler/src/main/doc/decompileplugin.xml@@ -1,4 +1,8 @@<?xml version="1.0" encoding="utf-8"?>+<!DOCTYPE book [+<!ENTITY emsp " "> <!-- Embedded space -->+<!ENTITY nbsp " "> <!-- Non-breaking space -->+]><book xmlns="http://docbook.org/ns/docbook"xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"><info>@@ -32,13 +36,13 @@<para>The Decompiler is a full Plug-in within Ghidra and can be configured to be enabled ordisabled within any particular tool. Default configurations will have the- plug-in enabled, but if its disabled for some reason, it can be enabled from within- a Code Browser by selecting the menu option+ plug-in enabled, but if it is disabled for some reason, it can be enabled from within+ a Code Browser by selecting the<informalexample>- <emphasis role="bold">File -> Configure</emphasis>+ <emphasis role="bold">File -> Configure...</emphasis></informalexample>- Then click on the <emphasis>Configure</emphasis> link under the- <emphasis role="bold">Ghidra Core</emphasis> section and check the box next to+ menu option, then clicking on the <emphasis>Configure</emphasis> link under the+ <emphasis role="bold">Ghidra Core</emphasis> section and checking the box next to<emphasis role="bold">DecompilePlugin</emphasis>.</para></sect2>@@ -57,7 +61,7 @@<imagedata condition="withscaling" fileref="images/decompileFunction.gif" contentwidth="0.15in" contentdepth="0.15in"/></imageobject></inlinemediaobject>- </guiicon> icon+ </guiicon> iconin the tool bar, <emphasis>or</emphasis></listitem><listitem>@@ -69,8 +73,8 @@</para><para>The window automatically decompiles and displays the function at the- <emphasis>current address</emphasis>. The address is set typically by left-clicking in the Listing window,- or invoking the <emphasis>Goto</emphasis> command (pressing the 'g' key) and manually entering+ <emphasis>current address</emphasis>. The address is set typically by left-clicking in the Listing,+ or invoking the <emphasis>Go To...</emphasis> command (pressing the 'G' key) and manually enteringthe address or some other label, but the Decompiler windowfollows any type of navigation in the Code Browser, triggering decompilation of the new functionbeing displayed.@@ -92,7 +96,7 @@<sect2 id="Capabilities"><title>Capabilities</title><para>- Some of the primary capabilities of the decompiler include:+ Some of the primary capabilities of the Decompiler include:<informalexample><variablelist>@@ -101,7 +105,7 @@<term><emphasis role="bold">Recovering Expressions</emphasis></term><listitem><para>- The decompiler does full data-flow analysis which allows it to+ The Decompiler does full data-flow analysis which allows it toperform slicing on functions: complicated expressions, which have been split intodistinct operations/instructions and then mixed together withother instructions by the compiling/optimizing process, are@@ -113,7 +117,7 @@<term><emphasis role="bold">Recovering High-Level Scoped Variables</emphasis></term><listitem><para>- The decompiler understands how compilers+ The Decompiler understands how compilersuse processor stacks and registers to implement variables withdifferent scopes within a function. Data-flow analysis allows it tofollow what was originally a single variable as it moves from@@ -128,7 +132,7 @@<term><emphasis role="bold">Recovering Function Parameters</emphasis></term><listitem><para>- The decompiler understands the parameter passing conventions of+ The Decompiler understands the parameter-passing conventions ofthe compiler and can reconstruct the original form offunction calls.</para>@@ -138,7 +142,7 @@<term><emphasis role="bold">Using Data-type, Name, and Signature Annotations</emphasis></term><listitem><para>- The decompiler automatically pulls in+ The Decompiler automatically pulls inall the different data types and variable names that the userhas applied to functions, and the C output is altered to reflectthis. High-level variables are appropriately named, structure@@ -152,7 +156,7 @@<term><emphasis role="bold">Propagating Local Data-types</emphasis></term><listitem><para>- The decompiler infers the data-type of unlabeled variables+ The Decompiler infers the data-type of unlabeled variablesby propagating information from other sources throughout a function.</para></listitem>@@ -161,7 +165,7 @@<term><emphasis role="bold">Recovering Structure Definitions</emphasis></term><listitem><para>- The decompiler can be used to create structures that match the usage+ The Decompiler can be used to create structures that match the usagepattern of particular functions and variables, automatically discoveringcomponent offsets and data-types.</para>@@ -181,10 +185,10 @@<title>P-code</title><para>P-code is Ghidra's Intermediate Representation (IR) language. When analyzing a function,- the decompiler translates every machine instruction into p-code first and performs its- analysis directly on the operators and variables of the language. Output of the decompiler+ the Decompiler translates every machine instruction into p-code first and performs its+ analysis directly on the operators and variables of the language. Output of the Decompileris also best understood in terms of p-code. This section presents the key concepts of- p-code. For a more detailed discussion see the document "P-Code Reference Manual".+ p-code. For a more detailed discussion see the document "P-Code Reference Manual."</para><sect2 id="ConceptAddressSpace"><title>Address Space</title>@@ -210,7 +214,7 @@<para>For a p-code model of a specific processor, all elements of the processor state (including RAM, registers,flags, etc.) must be contained in some address space. The model will define multiple address spaces- to accomplish this, and beyond the raw translation of machine instructions to p-code, the decompiler+ to accomplish this, and beyond the raw translation of machine instructions to p-code, the Decompilercan add additional spaces. Address space definitions that are common across many different processors include:<informalexample><variablelist>@@ -240,7 +244,7 @@<listitem><para>A space dedicated to <emphasis>temporary</emphasis> registers.- It is used to hold intermediate values when modeling instruction behavior, and the decompiler+ It is used to hold intermediate values when modeling instruction behavior, and the Decompileruses it to allocate space for variables that don't directly correspond to the low levelprocessor state. The name <emphasis>unique</emphasis> is reserved for this purpose andis present in all processor models.@@ -252,7 +256,7 @@<listitem><para>A space that represents bytes explicitly indexed through a <emphasis>stack pointer</emphasis>.- This is an example of an address space added by the decompiler beyond what the raw processor+ This is an example of an address space added by the Decompiler beyond what the raw processormodel defines. The <emphasis>stack</emphasis> space is a logical construction representing the set of bytes asingle function might access through its stack pointer. Each stack address representsthe offset of a byte in some underlying space (usually <emphasis>ram</emphasis>) relative@@ -296,7 +300,7 @@</para><para>Varnodes by themselves do not necessarily have a data-type associated with them.- The decompiler ultimately assigns a formal data-type, but at the lowest level of p-code,+ The Decompiler ultimately assigns a formal data-type, but at the lowest level of p-code,varnodes inherit one the building block data-types from the p-code operations thatact on them:<informalexample>@@ -411,10 +415,10 @@<title>Operator Tokens</title><para>Most opcodes naturally correspond to a particular C operator token,- and in decompiler output, many of the operator tokens displayed correspond- directly to a p-code operation present in the decompiler's internal+ and in Decompiler output, many of the operator tokens displayed correspond+ directly to a p-code operation present in the Decompiler's internalrepresentation. The biggest exception are the <emphasis>Branching</emphasis>- operations; the decompiler uses standard high-level language control-flow+ operations; the Decompiler uses standard high-level language control-flowstructures, like <emphasis>if/else</emphasis>, <emphasis>switch</emphasis>, and<emphasis>do/while</emphasis> blocks, instead of thelow-level branching operations. But even here, there is some correspondence@@ -796,7 +800,7 @@<sect3 id="ConceptControlFlow"><title>P-code Control Flow</title><para>- P-code has natural <emphasis role="bold">control-flow</emphasis>, with the subtlety that flow+ P-code has natural <emphasis role="bold">control flow</emphasis>, with the subtlety that flowhappens both within and across machine instructions. Most p-code operators have<emphasis role="bold">fall-through</emphasis> semantics, meaning that flow moves to thenext operator in the sequence associated with the instruction, or, if the operator is the@@ -807,7 +811,7 @@</para><para>Ghidra labels a machine instruction with one of the following <emphasis role="bold">Flow Types</emphasis> that describe- its overall control-flow. The Flow Type is derived directly from the control-flow of the p-code for the instruction,+ its overall control flow. The Flow Type is derived directly from the control flow of the p-code for the instruction,with the basic types corresponding directly with a specific branching p-code operator.<informalexample><itemizedlist mark='none'>@@ -846,8 +850,8 @@not specified.</para><para>- The decompiler treats a CALLOTHER operation as a black box. It will keep track of data- flowing into and out of the operation but won't simplify or transform it. In decompiler+ The Decompiler treats a CALLOTHER operation as a black box. It will keep track of data+ flowing into and out of the operation but won't simplify or transform it. In Decompileroutput, a CALLOTHER is usually displayed using its unique name, with functional syntaxshowing its inputs and output.</para>@@ -857,17 +861,17 @@<emphasis role="bold">Callother-Fixup</emphasis>, which is substituted for theCALLOTHER operation during decompilation, or by other Analyzers that use p-code.Callother-Fixups are applied by Ghidra for specific processor or compiler variants,- and a user can choose to apply them to an individual Program. (See <xref linkend="ExtensionOptions"/>)+ and a user can choose to apply them to an individual Program (see <xref linkend="ExtensionOptions"/>).</para></sect3><sect3 id="ConceptInternalFunctions"><title>Internal Decompiler Functions</title><para>- Certain p-code operations can show up in decompiler output that cannot be represented+ Certain p-code operations can show up in Decompiler output that cannot be representedas either an operator token, a cast operation, or other depiction that is natural to- the language. The decompiler generally tries to eliminate these, but this isn't always- possible. The decompiler resorts to a functional syntax for these kinds+ the language. The Decompiler generally tries to eliminate these, but this isn't always+ possible. The Decompiler resorts to a functional syntax for these kindsof p-code operations, displaying them as if they were built-in functions for the language.</para><informalexample>@@ -1002,7 +1006,7 @@<title>The HighFunction</title><para>A <emphasis role="bold">HighFunction</emphasis> is the collection of specific information- produced by the decompiler about a function, referring to the root class in the Ghidra+ produced by the Decompiler about a function, referring to the root class in the Ghidrasource which holds this information.The HighFunction is made up of the following explicit objects:<informalexample>@@ -1022,18 +1026,18 @@</informalexample></para><para>- The decompiler's output provides a standalone view of the function which is distinct+ The Decompiler's output provides a standalone view of the function which is distinctfrom any annotations about the function that are present in the Program database- and displayed in the Listing view (although the output may be informed by these annotations).+ and displayed in the Listing (although the output may be informed by these annotations).The terms <emphasis>HighFunction</emphasis>, <emphasis>HighVariable</emphasis>, and- <emphasis>HighSymbol</emphasis> refer to this decompiler specific view of the function.+ <emphasis>HighSymbol</emphasis> refer to this Decompiler specific view of the function.</para><sect2 id="ConceptHighSymbol"><title>HighSymbol</title><para>A <emphasis role="bold">HighSymbol</emphasis> is one of the explicit symbols recovered by the- decompiler. It is made up of a name and data-type and can describe either:+ Decompiler. It is made up of a name and data-type and can describe either:<informalexample><itemizedlist mark='none'><listitem>@@ -1051,10 +1055,10 @@<para>An important aspect of HighSymbols is that they are distinct fromthe standard Ghidra symbols stored in the Program database and are part of- the decompiler's separate view of the function. When the decompiler displays+ the Decompiler's separate view of the function. When the Decompiler displaysdeclarations for symbols in its output for instance, it is displayingHighSymbols, which may not directly match up with database symbols.- The decompiler is generally+ The Decompiler is generally<emphasis>informed</emphasis> by annotations in the database and maycopy specific symbols from the database into its view, but it isgenerally free to invent new symbols discovered during its analysis.@@ -1069,12 +1073,12 @@<sect2 id="ConceptVarnodeSSA"><title>Varnodes in the Decompiler</title><para>- Varnodes are the central <emphasis>variable</emphasis> concept for the decompiler.- They form the individual nodes in the decompiler's data-flow representation+ Varnodes are the central <emphasis>variable</emphasis> concept for the Decompiler.+ They form the individual nodes in the Decompiler's data-flow representationof functions and are used during all stages of analysis. During the initial stagesof analysis, varnodes simply represent specific storage locations that are accessed- in sequence by individual p-code operations. The decompiler immediately converts- the p-code into a graph based data-flow representation, called Static Single+ in sequence by individual p-code operations. The Decompiler immediately converts+ the p-code into a graph-based data-flow representation, called Static SingleAssignment (SSA) form. In this form, the varnodes take on some additional attributes.</para><para>@@ -1098,15 +1102,15 @@</listitem></itemizedlist></informalexample>- The scope extends via control-flow to each p-code operation that <emphasis>reads</emphasis> the+ The scope extends via control flow to each p-code operation that <emphasis>reads</emphasis> thespecific varnode as an operand. The value of the varnode between the defining p-code operationand the reading operations does not change. The scope of a varnode can be thought of as a set- of addresses within the function's body connected by control-flow. The address of the defining+ of addresses within the function's body connected by control flow. The address of the definingp-code operation is referred to as the varnode's <emphasis role="bold">first use point</emphasis>or <emphasis role="bold">first use offset</emphasis>.</para><para>- In the decompiler output for a specific high-level language like C or Java,+ In the Decompiler output for a specific high-level language like C or Java,a varnode still has a <emphasis>scope</emphasis> and represents a variablein the high-level language only across this connected region of the code.A set of varnodes, with disjoint scopes, provides a complete@@ -1120,7 +1124,7 @@<para>A <emphasis role="bold">HighVariable</emphasis> is a set varnodes that, takentogether, represent the storage of an entire variable in the high-level language- being output by the decompiler. Each varnode describes where the variable's+ being output by the Decompiler. Each varnode describes where the variable'svalue is stored across some section of code.</para><para>@@ -1148,7 +1152,7 @@<title>Merging</title><para><emphasis role="bold">Merging</emphasis> is the part of the analysis process where- the decompiler decides what varnodes get grouped together to create the final+ the Decompiler decides what varnodes get grouped together to create the finalHighVariables in the output. Each varnode's scope (see the discussion in<xref linkend="ConceptVarnodeSSA"/>) provides the fundamental restriction on this process.Two varnodes cannot be merged if their scopes intersect. But this leaves a lot of@@ -1161,14 +1165,14 @@to as <emphasis role="bold">forced merging</emphasis>.</para><para>- The decompiler may also merge varnodes that could just as easily exist as separate+ The Decompiler may also merge varnodes that could just as easily exist as separatevariables. This is called <emphasis role="bold">speculative merging</emphasis>.- In addition to the intersection condition on varnode scopes, the decompiler only- speculatively merges variables that share the same data-type. Beyond this, the decompiler+ In addition to the intersection condition on varnode scopes, the Decompiler only+ speculatively merges variables that share the same data-type. Beyond this, the Decompilerprioritizes variable pairs that are read and written within the same instruction and- then pairs that are "near" each other in the control-flow of the function.+ then pairs that are <emphasis>near</emphasis> each other in the control flow of the function.To a limited extent, users are able to control this kind of merging- (See <xref linkend="ActionIsolate"/>).+ (see <xref linkend="ActionIsolate"/>).</para></sect3></sect2>@@ -1185,12 +1189,12 @@a calling convention and holds its specific rules and resource details.</para><para>- Prototype models are architecture specific, and depending on the compiler, a single Program may make- use of multiple models. Subsequently, each distinct model has a name like <code>__stdcall</code> or- <code>__thiscall</code>. The decompiler makes use of the prototype model, as assigned to the function by the user or+ Prototype models are architecture-specific, and depending on the compiler, a single Program may make+ use of multiple models. Subsequently, each distinct model has a name like <emphasis role="bold">__stdcall</emphasis> or+ <emphasis role="bold">__thiscall</emphasis>. The Decompiler makes use of the prototype model, as assigned to the function by the user ordiscovered in some other way, when performing its analysis of parameters.- It is possible for users to extend the set of prototype models available to a Program,- see <xref linkend="ExtensionOptions"/>.+ It is possible for users to extend the set of prototype models available to a Program+ (see <xref linkend="ExtensionOptions"/>).</para><para>A prototype model is typically used as a whole and is assigned by name to individual functions. But some of@@ -1209,12 +1213,61 @@If the parameteris stored on the stack, the storage location is viewed as a constant offset in the <emphasis role="bold">stack</emphasis>space, where the offset is relative to the incoming value of <emphasis>stack pointer</emphasis>- (See the discussion in <xref linkend="ConceptAddressSpace"/>).+ (see the discussion in <xref linkend="ConceptAddressSpace"/>).</para><para>- The <emphasis>return value</emphasis> for the function, similarly, is stored at a single memory location. It- is guaranteed to be at that location only at points where the function is exited. There may be multiple exit- points, but they all share the same return value storage location.+ The <emphasis>return value</emphasis> for the function, unless it is passed back on the stack, is also stored at a single+ memory location. It is guaranteed to be at that location only at points where the function is exited. There may be multiple exit+ points, but they all share the same return value storage location. For return values passed back on the stack, compilers+ generally implement a special input register to hold the location where the value will be stored. See the+ discussion of <xref linkend="ConceptAutoParameters"/> and the <emphasis role="bold">__return_storage_ptr__</emphasis> below.+ </para>+ </sect3>+ <sect3 id="ConceptAutoParameters">+ <title>Auto-Parameters</title>+ <para>+ Compiled binaries may pass values as parameters between functions that aren't in the formal+ list of parameters as defined by the original source code for the program. These are referred to+ as <emphasis role="bold">auto-parameters</emphasis> or sometimes <emphasis role="bold">hidden</emphasis>+ parameters within the documentation. If the prototype model requires it, Ghidra will automatically+ create an auto-parameter for a function to honor a user's request for a specific formal signature.+ See <link xlink:href="help/topics/FunctionPlugin/Variables.htm#Edit_Function">Function Editor Dialog</link>.+ Because reverse engineers need to see them, the+ Decompiler will generally display auto-parameters explicitly in function prototypes as part of its output, even though+ they would not be present in the original source.+ Ghidra explicitly defines two auto-parameters:+ <informalexample>+ <variablelist>+ <?dbfo list-presentation="blocks"?>+ <varlistentry>+ <term><emphasis role="bold">this</emphasis></term>+ <listitem>+ <para>+ Within Object Oriented languages, a function defined as a class <emphasis>method</emphasis>+ often has a <emphasis role="bold">this</emphasis> parameter pointing to an instantiation of the+ class' structure data-type. Within Ghidra, functions with the <emphasis role="bold">__thiscall</emphasis>+ calling convention are automatically assigned a <emphasis role="bold">this</emphasis> parameter.+ If the function is part of a class namespace and the class has an associated structure, the+ <emphasis role="bold">this</emphasis> parameter will be a pointer to the structure, otherwise+ it will be a pointer to the <emphasis role="bold">void</emphasis> data-type.+ </para>+ </listitem>+ </varlistentry>+ <varlistentry>+ <term><emphasis role="bold">__return_storage_ptr__</emphasis></term>+ <listitem>+ <para>+ Most calling conventions allow the value returned by a function, if it is large enough, to be passed back+ on the stack instead of in a register. This is usually implemented by having the calling function+ pass an additional <emphasis>input</emphasis> parameter that holds a pointer to the location on+ the stack where the return value should be stored. Ghidra labels this special parameter as+ <emphasis role="bold">__return_storage_ptr__</emphasis>, which will be a pointer to the+ data-type of the return value.+ </para>+ </listitem>+ </varlistentry>+ </variablelist>+ </informalexample></para></sect3><sect3 id="ConceptPrototypeUnaffected">@@ -1226,7 +1279,7 @@These encompass a calling convention's <emphasis>saved registers</emphasis>, where a calling functioncan store values it doesn't want to change unexpectedly, but also may include other registers that areknown not to change, like the stack pointer.- The decompiler uses the information to determine which locations can be safely propagated across+ The Decompiler uses the information to determine which locations can be safely propagated acrossa called function.</para></sect3>@@ -1252,15 +1305,15 @@Disassemble machine instructions from the underlying bytes and</listitem><listitem>- Produce the raw p-code consumed by the decompiler and other analyzers.+ Produce the raw p-code consumed by the Decompiler and other analyzers.</listitem></itemizedlist></informalexample></para><para>Specification files are selected based on the <emphasis>Language Id</emphasis>- assigned to the Program at the time it is imported into Ghidra.- (See <link xlink:href="help/topics/ImporterPlugin/importer.htm">Import Program</link>)+ assigned to the Program at the time it is imported into Ghidra+ (see <link xlink:href="help/topics/ImporterPlugin/importer.htm">Import Program</link>).<informalexample><itemizedlist mark='none' spacing='compact'><listitem><code>x86:LE:32:default:windows</code></listitem>@@ -1275,15 +1328,16 @@<listitem>Processor family</listitem><listitem>Endianess</listitem><listitem>Size of the address bus</listitem>- <listitem>Process variant</listitem>+ <listitem>Processor variant</listitem><listitem>Compiler producing the Program</listitem></itemizedlist></informalexample>- A field with the value 'default' indicates either the preferred processor variant or the preferred compiler.+ A field with the value <emphasis role="bold">default</emphasis> indicates either the preferred processor variant or the preferred compiler.</para><para>Within the Ghidra installation, specification files are stored based on the overarching- processor family, such as 'MIPS' or 'x86'. For a specific family, files are located under+ processor family, such as <emphasis role="bold">MIPS</emphasis> or+ <emphasis role="bold">x86</emphasis>. For a specific family, files are located under<informalexample><code><Root>/Ghidra/Processors/<Family>/data/languages</code></informalexample>@@ -1303,7 +1357,7 @@These are the human readable SLEIGH language files. A single specification isrooted in one of the <code>*.slaspec</code> files, which may recursively includeone or more <code>*.sinc</code> files. The format of these files is described- in the document "SLEIGH: A Language for Rapid Processor Specification".+ in the document "SLEIGH: A Language for Rapid Processor Specification."</para></listitem></varlistentry>@@ -1383,54 +1437,55 @@<para>Individual <emphasis role="bold">machine instructions</emphasis>make up the biggest source of information when the- decompiler analyzes a function. Instructions are translated from their- processor specific form into Ghidra's IR language (see <xref linkend="ConceptPcode"/>),+ Decompiler analyzes a function. Instructions are translated from their+ processor-specific form into Ghidra's IR language (see <xref linkend="ConceptPcode"/>),which provides both the control-flow behavior of the instruction and the detailed- semantics describing how the processor and memory state is affected. The translation is controlled by+ semantics describing how the processor and memory state are affected. The translation is controlled bythe underlying processor model and, except in limited circumstances, cannot be directly altered- from the tool. Flow Overrides (see below) can change how certain control-flow is translated,- and, depending on the processor, context registers may affect p-code (see <xref linkend="AnnoteContextRegister"/>).+ from the tool. Flow Overrides (see below) can change how certain control flow is translated+ and, depending on the processor, how context registers affect p-code (see <xref linkend="AnnoteContextRegister"/>).</para><para>Outside of the tool, users <emphasis>can</emphasis> modify the model specification itself.- See the document "SLEIGH: A Language for Rapid Processor Specification".+ See the document "SLEIGH: A Language for Rapid Processor Specification."</para><para>- Decompiling a function starts by analyzing control-flow starting from the function's- first instruction. Control-flow is traced to additional instructions using flow information- from the underlying processor model. All paths are traced through instructions with- <emphasis>fall through</emphasis>, <emphasis>conditional jump</emphasis>, and other+ Decompiling a function starts by analyzing the control flow of machine instructions.+ Control flow is traced from the first instruction, through additional instructions depending+ on their flow semantics (see <xref linkend="ConceptControlFlow"/>). All paths are traced through instructions with+ any form of <emphasis>fall-through</emphasis> or <emphasis>jump</emphasis>semantics until an instruction with <emphasis>terminator</emphasis> semantics is- reached, which is usually a "return from subroutine"- instruction. Flow is not traced into called functions, in this situation. Instructions+ reached, which is usually a formal <emphasis>return</emphasis> (return from subroutine) instruction.+ Flow is not traced into called functions, in this situation. Instructionswith <emphasis>call</emphasis> semantics are treated only as if they fall through.</para><para>- An <emphasis role="bold">entry point</emphasis> is the address of the function's first instruction.+ An <emphasis role="bold">entry point</emphasis> is the address of the instruction first+ executed when the function is called.</para><para>A <emphasis role="bold">function body</emphasis> is the set of addresses reached by control-flow- analysis (and the machine instructions at those addresses).+ analysis and the machine instructions at those addresses.</para><sect2 id="AnnoteEntryPoint"><title>Entry Point</title><para>The <emphasis>entry point</emphasis> address for a function plays a pivotal role for- analysis using the Ghidra decompiler. Ghidra generally associates+ analysis using the Decompiler. Ghidra generally associatesa formal <emphasis>Function Symbol</emphasis> and an underlying<emphasis>Function</emphasis> object at this address, which are the key elements that- need to be present to trigger decompilation.- (See <link xlink:href="help/topics/FunctionPlugin/Functions.htm">Functions</link>)+ need to be present to trigger decompilation+ (see <link xlink:href="help/topics/FunctionPlugin/Functions.htm">Functions</link>).The Function object stores the function body, parameters, local variables, andother information critical to the decompilation process.</para><para>Function Symbols and Function objects are generally created automatically by a Ghidra- analyzer when initially importing a binary executable and running auto-analysis.- If necessary however, a user can manually create a Function object from the Listing window- by using <emphasis>Create Function</emphasis> command (pressing the 'f' key), when the cursor- is placed on the function's entry point.- (See <link xlink:href="help/topics/FunctionPlugin/Functions.htm#Create_Function">Create Function</link>)+ analyzer when initially importing a binary executable and running Auto Analysis.+ If necessary, however, a user can manually create a Function object from a Listing window+ by using the <emphasis>Create Function</emphasis> command (pressing the 'F' key), when the cursor+ is placed on the function's entry point+ (see <link xlink:href="help/topics/FunctionPlugin/Functions.htm#Create_Function">Create Function</link>).</para></sect2><sect2 id="AnnoteFormalFunctionBody">@@ -1444,11 +1499,11 @@to a navigation event to an arbitrary address.</para><warning>- The decompiler does <emphasis>not</emphasis> use the formal function body when it computes- control-flow; it recomputes its own idea of the function body starting from the entry point+ The Decompiler does <emphasis>not</emphasis> use the formal function body when it computes+ control flow; it recomputes its own idea of the function body starting from the entry pointit is handed. If the formal function body was created manually, using a selection for instance,- or in other extreme circumstances, the decompiler's view of the function body may not match- the formal view. This can lead to confusing behavior, where clicking in a decompiler window+ or in other extreme circumstances, the Decompiler's view of the function body may not match+ the formal view. This can lead to confusing behavior, where clicking in a Decompiler windowmay unexpectedly navigate the window away from the function.</warning></sect2>@@ -1464,7 +1519,7 @@Flow Overrides are applied by Analyzers or manually by the user.</para><para>- The decompiler automatically incorporates any relevant Flow Overrides into its+ The Decompiler automatically incorporates any relevant Flow Overrides into itsanalysis of a function. This can have a significant impact on results. Thetypes of possible Flow Overrides include:<informalexample>@@ -1480,7 +1535,7 @@the call target becomes the branch destination,and the instruction is no longer assumedto fall through. <emphasis>RETURN</emphasis> instructions become an- indirect branch, and the decompiler will attempt to recover branch+ indirect branch, and the Decompiler will attempt to recover branchdestinations using <emphasis>switch</emphasis> analysis.</para></listitem>@@ -1535,20 +1590,20 @@<section id="AnnoteComments"><title>Comments</title><para>- The decompiler automatically incorporates comments from the Program database into its+ The Decompiler automatically incorporates comments from the Program database into itsoutput. Comments in Ghidra are centralized and can be created and displayed by multiple- Program views, including the decompiler. Comments created from a decompiler window will- show up in the Listing window for instance, and vice versa.+ Program views, including the Decompiler. Comments created from a Decompiler window will+ show up in a Listing window for instance, and vice versa.</para><para>- For the purposes of understanding comments within the decompiler, keep in mind that:+ For the purposes of understanding comments within the Decompiler, keep in mind that:<informalexample><itemizedlist mark='bullet'><listitem>An individual comment is associated with a specific <emphasis>address</emphasis> in the Program.</listitem><listitem>- There are 5 different kinds of comments.+ There are 5 different types of comments:<itemizedlist mark='circle'><listitem><emphasis>Plate</emphasis>@@ -1578,7 +1633,7 @@<sect2 id="CommentDisplay"><title>Display</title><para>- The decompiler collects and displays comments associated with any address in the+ The Decompiler collects and displays comments associated with any address in theformal <emphasis>function body</emphasis> currently decompiling.The comments are integrated line by line into the decompiled code, and anindividual comment is displayed on the line <emphasis>before</emphasis> the@@ -1588,27 +1643,27 @@<para>Because a single line of code typically encompasses multiple machine instructions,there is a possibility that multiple comments at different addresses apply to- the same line. In this case, the decompiler displays each comment on its+ the same line. In this case, the Decompiler displays each comment on itsown line, in address order, directly before the line of code.</para><para>- Because the output of the decompiler can be a heavily transformed version compared- to the original machine instructions, its possible that individual instructions+ Because the output of the Decompiler can be a heavily transformed version compared+ to the original machine instructions, it is possible that individual instructionsno longer have explicit tokens representing them in the output. Comments attached- to these instruction will still be displayed in the decompiler output with the+ to these instruction will still be displayed in the Decompiler output with theclosest associated line of code, usually within the same basic block.</para><para>- By default, the decompiler displays only the <emphasis>Pre</emphasis> comments+ By default, the Decompiler displays only the <emphasis>Pre</emphasis> commentswithin the body of the function. It also displays <emphasis>Plate</emphasis>comments, but only if they are attached to the <emphasis>entry point</emphasis>- of the function. In this case, they are displayed first in the decompiler output,+ of the function. In this case, they are displayed first in the Decompiler output,along with WARNING comments, before the function declaration. Other comment- types can be configured to display in decompiler output, by changing the- decompiler Display options (See <xref linkend="CommentOptions"/>).+ types can be configured to be part of Decompiler output by changing the+ Decompiler display options (see <xref linkend="CommentOptions"/>).</para><warning>- Unlike the Listing window, the decompiler does not alter how a comment is+ Unlike a Listing window, the Decompiler does not alter how a comment isdisplayed based on its type.All enabled types of comment are displayed in the same way, ona separate line before the line of code associated with the address.@@ -1618,7 +1673,7 @@<sect2 id="CommentUnreachable"><title>Unreachable Blocks</title><para>- The decompiler may decide as part of its analysis that individual+ The Decompiler may decide as part of its analysis that individual<emphasis>basic blocks</emphasis> are unreachable and not display them in the output.In this case, any comments associated with addresses in the unreachable blockwill also not be displayed.@@ -1628,9 +1683,9 @@<sect2 id="CommentWarnings"><title>Warning Comments</title><para>- The decompiler can generate internal warnings during its analysis and will incorporate- them into the output as comments in the same way as the user defined- comments described above. They are not part of Ghidra's comment system however and+ The Decompiler can generate internal warnings during its analysis and will incorporate+ them into the output as comments in the same way as the user-defined+ comments described above. They are not part of Ghidra's comment system, however, andcannot be edited. They can be distinguished from normal comments by the word'WARNING' at the beginning of the comment.<informalexample>@@ -1644,10 +1699,10 @@<title>Variable Annotations</title><para>Variable annotations are the most important way to get names and data-types- that are meaningful to the user incorporated into the decompiler's output.+ that are meaningful to the user incorporated into the Decompiler's output.A <emphasis role="bold">variable</emphasis> in this context is loosely definedas any piece of memory that code in the Program treats as a logical entity.- The decompiler works to incorporate all forms of annotation into its output+ The Decompiler works to incorporate all forms of annotation into its outputfor any variable pertinent to the function being analyzed.</para><para>@@ -1676,9 +1731,9 @@<emphasis>local</emphasis> to a function.</para><para>- Global variables annotations are created from the tool by applying a data-type to a memory- location in the Listing window, either by invoking a command from the <emphasis>Data</emphasis>- pop-up menu, or dragging a data-type from the <emphasis>Data Type Manager</emphasis>+ Global variable annotations are created from the tool by applying a data-type to a memory+ location in a Listing window, either by invoking a command from the <emphasis>Data</emphasis>+ pop-up menu or by dragging a data-type from the <emphasis>Data Type Manager</emphasis>window directly onto the memory location. Refer to the documentation:<informalexample><itemizedlist mark='none'>@@ -1689,7 +1744,7 @@</informalexample></para><para>- Local variables annotations are created from the Listing from various editor dialogs. See in particular:+ Local variables annotations are created from the Listing using various editor dialogs. See, in particular:<informalexample><itemizedlist mark='none'><listitem>@@ -1734,7 +1789,7 @@In order to widely accommodate different use cases, Ghidra's symboltable has extremely lax naming rules. Ghidramay allow names that conflict with the stricter rules of the language- the decompiler is attempting to produce. The decompiler does not currently+ the Decompiler is attempting to produce. The Decompiler does not currentlyhave an option that checks for this. Users should be aware of:<informalexample><variablelist>@@ -1755,7 +1810,7 @@Ghidra allows different functions to have the same name, even within the samenamespace, in order to model languages that support <emphasis>function overloading</emphasis>.In most languages, such functions would be expected to have distinct prototypes to allow- the symbols to be distinguished in context. Ghidra and the decompiler however do not check+ the symbols to be distinguished in context. Ghidra and the Decompiler, however, do not checkfor this, as prototypes may not be known.</para></listitem>@@ -1767,10 +1822,10 @@<sect3 id="SymbolScope"><title>Variable Scope</title><para>- All variables belong either to a <emphasis>global</emphasis> or <emphasis>local</emphasis>- scope, which directly affects how the variable is treated in the decompiler's data-flow+ All variables belong to either a <emphasis>global</emphasis> or <emphasis>local</emphasis>+ scope, which directly affects how the variable is treated in the Decompiler's data-flowanalysis.- Annotations created by applying a data-type directly to a memory location in the listing+ Annotations created by applying a data-type directly to a memory location in the Listingare automatically added to the formal <emphasis>global</emphasis> namespace.Ghidra can create other custom namespaces that are considered global in this sense, andrenaming actions provide options that let individual global annotations be moved into@@ -1779,7 +1834,7 @@create variable annotations that are local to that function.</para><para>- A global variable annotation forces the decompiler to treat the memory location as if its value+ A global variable annotation forces the Decompiler to treat the memory location as if its valuepersists beyond the end of the function. The variable must <emphasis>exist</emphasis>at all points of the function body, generally at the same memory location.</para>@@ -1789,7 +1844,7 @@at the instruction that first writes to them, and then exist only up to the lastinstruction that reads them. The memory location storing a local variableat one point of the function may be reused for different variables at other points.- This can cause ambiguity in how the decompiler should treat a given memory location used+ This can cause ambiguity in how the Decompiler should treat a given memory location usedfor storing local variables, which the user may want to steer. See the discussionin <xref linkend="AnnoteStorage"/>.</para>@@ -1806,17 +1861,17 @@<emphasis role="bold">data-types</emphasis> that are tailored for the Programbeing analyzed. Data-types that are explicitly part of a variable annotationare, to the extent possible, automatically incorporated- into the decompiler's analysis.+ into the Decompiler's analysis.</para><sect3 id="DecompilerDataTypes"><title>Data-types Supported by the Decompiler</title><para>- The decompiler understands traditional primitive data-types, in all their various sizes,+ The Decompiler understands traditional primitive data-types in all their various sizes,like integers, floating-point numbers, booleans, and characters. It also understandspointers, structures, and arrays, letting it supportarbitrarily complicated composite data-types. Ghidra providessome data-types with specialized display capabilities that don't have a natural representation- in the high-level language output by the decompiler. The decompiler treats these as+ in the high-level language output by the Decompiler. The Decompiler treats these asblack-box data-types, preserving the name, but treating the underlying data either as an integeror simply as an array of bytes.</para>@@ -1824,26 +1879,26 @@<sect4 id="TypeUndefined"><title>Undefined</title><para>- The <emphasis>undefined</emphasis> data-types are supported, in their various sizes:+ The <emphasis>undefined</emphasis> data-types are supported in their various sizes:<emphasis role="bold">undefined1</emphasis>, <emphasis role="bold">undefined2</emphasis>,<emphasis role="bold">undefined4</emphasis>, etc. In Ghidra, the undefined- data-types, let the user specify the size of a variable, while formally declaring that+ data-types let the user specify the size of a variable, while formally declaring thatother details about the data-type are unknown.</para><para>- For the decompiler, undefined data-types as an annotation have the important special meaning- that the decompiler should let its analysis determine the final data-type presented in the- output for the variable (See <xref linkend="AnnoteForcing"/> below).+ For the Decompiler, undefined data-types, as an annotation, have the important special meaning+ that the Decompiler should let its analysis determine the final data-type presented in the+ output for the variable (see <xref linkend="AnnoteForcing"/> below).</para></sect4><sect4 id="TypeVoid"><title>Void</title><para>The <emphasis role="bold">void</emphasis> data-type is supported but treated specially by- the decompiler, as does Ghidra in general. A <emphasis role="bold">void</emphasis> can be+ the Decompiler, as does Ghidra in general. A <emphasis role="bold">void</emphasis> can beused to indicate the absence of a return value in function prototypes, but cannot be usedas a general annotation on variables. A void pointer, <emphasis role="bold">void *</emphasis>,- is possible; the decompiler treats it as a pointer to an unknown data-type.+ is possible; the Decompiler treats it as a pointer to an unknown data-type.</para></sect4><sect4 id="TypeInteger">@@ -1851,7 +1906,7 @@<para>Integer data-types, both signed and unsigned, are supported up to a size of 8 bytes. Largersizes are supported internally but are generally represented as an array of bytes in- decompiler output. Odd integer sizes are also supported.+ Decompiler output. Nonstandard integer sizes of 3, 5, 6, and 7 bytes are also supported.</para><para>The standard C data-type names: <emphasis role="bold">int</emphasis>, <emphasis role="bold">short</emphasis>,@@ -1871,15 +1926,15 @@Floating-point sizes of 4, 8, 10, and 16 are supported, mapping in all cases currently to the<emphasis role="bold">float</emphasis>, <emphasis role="bold">double</emphasis>,<emphasis role="bold">float10</emphasis>, and <emphasis role="bold">float16</emphasis>- data-types respectively. The decompiler currently cannot display floating-point constants+ data-types, respectively. The Decompiler currently cannot display floating-point constantsthat are bigger than 8 bytes.</para></sect4><sect4 id="TypeChar"><title>Character</title><para>- ASCII or Unicode encoded character data-types are supported for sizes of 1, 2, and 4. The size effectively- chooses between the UTF8, UTF16, and UTF32 character encodings respectively. The standard+ ASCII- and Unicode-encoded character data-types are supported for sizes of 1, 2, and 4. The size effectively+ chooses between the UTF8, UTF16, and UTF32 character encodings, respectively. The standardC data-type names <emphasis role="bold">char</emphasis> and <emphasis role="bold">wchar_t</emphasis> aremapped to one of these sizes based on theprocessor and compiler selected when importing the Program.@@ -1888,11 +1943,11 @@<sect4 id="TypeString"><title>String</title><para>- Terminated strings, encoded either in ASCII or Unicode, are supported. The decompiler converts+ Terminated strings, encoded either in ASCII or Unicode, are supported. The Decompiler convertsGhidra's dedicated string data-types like <emphasis role="bold">string</emphasis> to- an "array of characters" data-type, such as <emphasis role="bold">char[]</emphasis>,+ an array-of-characters data-type, such as <emphasis role="bold">char[]</emphasis>,where the character size matches the encoding.- A "pointer to character" data-type like+ A pointer-to-character data-type like<informalexample><itemizedlist mark='none'><listitem>@@ -1903,11 +1958,11 @@</listitem></itemizedlist></informalexample>- is also treated as a potential string reference. The decompiler can infer terminated strings if this+ is also treated as a potential string reference. The Decompiler can infer terminated strings if thiskind of data-type propagates to constant values during its analysis.</para><para>- Strings should be fully rendered in decompiler output,+ Strings should be fully rendered in Decompiler output,with non-printable characters escaped using either traditional sequences like '\r', '\n' or using Unicodeescape sequences like '\xFF'.</para>@@ -1916,22 +1971,22 @@<title>Pointer</title><para>Pointer data-types are fully supported. A pointer to any other supported data-type is- possible. The data-type being pointed to, whether its a primitive, structure, or another pointer,- informs how the decompiler renders a dereferenced pointer.- The decompiler assumes that a pointer variable may refer to an array of+ possible. The data-type being pointed to, whether it is a primitive, structure, or another pointer,+ informs how the Decompiler renders a dereferenced pointer.+ The Decompiler assumes that a pointer variable may refer to an array ofthe underlying data-type and will use array notation if there is evidence of more thanone element.</para><para>The default pointer size is set based on the processor and compiler selected when the Program is- imported and generally matches the size of the <emphasis role="bold">ram</emphasis> (or equivalent)- address space. Different pointer sizes within the same Program are possible. The decompiler generally+ imported and generally matches the size of the <emphasis role="bold">ram</emphasis> or equivalent+ address space. Different pointer sizes within the same Program are possible. The Decompiler generallyexpects the pointer size to match the size of the address space being pointed to, but individualarchitectures can model different size pointers into the space (such as <emphasis>near</emphasis> pointers).</para><para>For processors with more than one memory address space, pointer data-types currently cannot be directly- annotated to indicate a preferred address space. Where there is ambiguity, the decompiler attempts to+ annotated to indicate a preferred address space. Where there is ambiguity, the Decompiler attempts todetermine the correct address space from the context of its use within the function.</para></sect4>@@ -1945,21 +2000,21 @@<sect4 id="TypeStructure"><title>Structure</title><para>- Structured data-types are fully supported. The decompiler does not automatically infer structures- when analyzing a function; it propagates structured data-types into the function from explicitly- annotated sources, like input parameters or global variables. Decompiler directed creation of- structures can be triggered by the user, see <xref linkend="ActionAutoStructure"/>.+ Structure data-types are fully supported. The Decompiler does not automatically infer structures+ when analyzing a function; it propagates them into the function from explicitly+ annotated sources, like input parameters or global variables. Decompiler-directed creation of+ structures can be triggered by the user (see <xref linkend="ActionAutoStructure"/>).</para></sect4><sect4 id="TypeEnum"><title>Enumeration</title><para>- Enumerations are fully supported. The decompiler can propagate enumerations from explicitly+ Enumerations are fully supported. The Decompiler can propagate enumerations from explicitlyannotated sources throughout a function onto constants, which are then displayed with theappropriate label from the definition of the enumeration. If the constant does not match a- single value in the enumeration definition, the decompiler attempts to build a matching+ single value in the enumeration definition, the Decompiler attempts to build a matchingvalue by <emphasis>or</emphasis>-ing together multiple labels.- The decompiler can be made to break out constants representing packed <emphasis>flags</emphasis>,+ The Decompiler can be made to break out constants representing packed <emphasis>flags</emphasis>,for instance, by labeling individual bit values within an enumeration.</para></sect4>@@ -1968,7 +2023,7 @@<para>A <emphasis role="bold">Function Definition</emphasis> in Ghidra is a data-type that encodesinformation about the parameters and return value for a generic/unspecified function.- A formal <emphasis role="bold">function pointer</emphasis> is supported by the decompiler as a pointer+ A formal <emphasis role="bold">function pointer</emphasis> is supported by the Decompiler as a pointerdata-type that points to a Function Definition. A Function Definition specifically encodes:<informalexample><itemizedlist mark='bullet'>@@ -1982,7 +2037,7 @@The data-type associated with the return value.</listitem><listitem>- An indicator of the <emphasis>prototype model</emphasis> that should be+ The name of a generic <emphasis>calling convention</emphasis>associated with the function.</listitem></itemizedlist>@@ -1990,25 +2045,27 @@</para><para>The Function Definition itself does not encode any storage information. Once the Function- Definition is associated with a Program, the indicator maps to one of the prototype models for the- specific processor and compiler. A Function Definition is currently limited to a prototype model+ Definition is associated with a Program, its generic calling convention maps to one of the+ specific prototype models for the processor and compiler. The prototype model is then used+ to assign storage for parameters and return values, wherever the Function Definition is applied.+ A Function Definition is currently limited to a prototype modelwith one of the following names:<informalexample><itemizedlist mark='bullet'><listitem>- __stdcall+ <emphasis role="bold">__stdcall</emphasis></listitem><listitem>- __thiscall+ <emphasis role="bold">__thiscall</emphasis></listitem><listitem>- __fastcall+ <emphasis role="bold">__fastcall</emphasis></listitem><listitem>- __cdecl+ <emphasis role="bold">__cdecl</emphasis></listitem><listitem>- __vectorcall+ <emphasis role="bold">__vectorcall</emphasis></listitem></itemizedlist></informalexample>@@ -2019,69 +2076,68 @@<sect3 id="AnnoteForcing"><title>Forcing Data-types</title><para>- The decompiler performs <emphasis role="bold">type propagation</emphasis> as part of its analysis- on functions. Data-type information is collected from variable annotations (and other sources),- which is then propagated via data-flow throughout the function to other variables and+ The Decompiler performs <emphasis role="bold">type propagation</emphasis> as part of its analysis+ on functions. Data-type information is collected from variable annotations and other sources,+ which is then propagated via data flow throughout the function to other variables andconstants where the data-type may not be immediately apparent.</para><para>- With few exceptions, a variable annotation is <emphasis>forcing</emphasis> on the decompiler in the sense+ With few exceptions, a variable annotation is <emphasis>forcing</emphasis> on the Decompiler in the sensethat the storage location being annotated is considered an unalterable data-type source. Duringtype propagation, the data-type may propagate to other variables,but the variable representing the storage location being annotated is guaranteed to havethe given name and that data-type; it will not be overridden.</para><warning>- Users should be aware that variable annotations are forcing on the decompiler and may directly+ Users should be aware that variable annotations are forcing on the Decompiler and may directlyoverride aspects of its analysis. Because of this, variable annotations are the most powerful way- for the user to affect decompiler output, but setting an incomplete (or incorrect) data-type as- part of an annotation may produce poorer decompiler output.+ for the user to affect Decompiler output, but setting an incomplete or incorrect data-type as+ part of an annotation may produce poorer Decompiler output.</warning><para>The major exception to forcing annotations is if the data-type in the annotation is <emphasis>undefined</emphasis>.- Ghidra reserves the following names to represent formally undefined data-types:+ Ghidra reserves specific names to represent formally undefined data-types, such as:<informalexample><itemizedlist mark='bullet'><listitem><emphasis role="bold">undefined1</emphasis></listitem><listitem><emphasis role="bold">undefined2</emphasis></listitem><listitem><emphasis role="bold">undefined4</emphasis></listitem><listitem><emphasis role="bold">undefined8</emphasis></listitem>- <listitem>...</listitem></itemizedlist></informalexample>These allow annotations to be made even when the user doesn't have information about a variable's data-type.The number in the name only specifies the number of bytes in the variable.</para><para>- The decompiler views a variable annotation with an undefined data-type only as an indication of what name+ The Decompiler views a variable annotation with an undefined data-type only as an indication of what nameshould be used if a variable at that storage address exists. The data-type for the variable is filled in,using type propagation from other sources.</para><para>For annotations that specifically label a function's formal parameters or return value,- the <link linkend="PrototypeSignatureSource">Signature Source</link> also affects how they're treated by the decompiler.+ the <link linkend="PrototypeSignatureSource">Signature Source</link> also affects how they're treated by the Decompiler.If the Signature Source is set to anything other than <emphasis>DEFAULT</emphasis>, there is a forced- one-to-one correspondence between variable annotations and actual parameters in the decompiler's- view of the function. This is stronger than just forcing the data-type; the existence (or not) of+ one-to-one correspondence between variable annotations and actual parameters in the Decompiler's+ view of the function. This is stronger than just forcing the data-type; the existence or nonexistence ofthe variable itself is forced by the annotation in this case. If the Signature Source is forcing andthere are no parameter annotations, a <emphasis>void</emphasis> prototype is forced on the function.</para><para>A forcing Signature Source is set typically if debug symbols for the function are read in during- Program import (<emphasis>IMPORTED</emphasis>), or if the user manually edits the function prototype+ Program import (<emphasis>IMPORTED</emphasis>) or if the user manually edits the function prototypedirectly (<emphasis>USER_DEFINED</emphasis>).</para><para>If an annotation and the Signature Source force a parameter to exist, specifying an- <emphasis>undefined</emphasis> data-type in the annotation still directs the decompiler to fill in+ <emphasis>undefined</emphasis> data-type in the annotation still directs the Decompiler to fill inthe variable's data-type using type propagation. The same holds true for the return value; an- <emphasis>undefined</emphasis> annotation fixes the size of the return value, but the decompiler+ <emphasis>undefined</emphasis> annotation fixes the size of the return value, but the Decompilerfills in its own data-type.</para><note>- The decompiler may still use an <emphasis>undefined</emphasis> data-type to label a variable,+ The Decompiler may still use an <emphasis>undefined</emphasis> data-type to label a variable,even after type propagation. If a variable is simply copied around within a function and there- are no other substantive operations or annotations on the variable, the decompiler may decide the undefined+ are no other substantive operations or annotations on the variable, the Decompiler may decide the undefineddata-type is appropriate.</note></sect3>@@ -2094,10 +2150,10 @@Every variable annotation is associated with a single <emphasis>storage location</emphasis>, where thevalue of the variable is stored during execution: generally a register, stack location, or an addressin the load image of the Program. The storage location does not necessarily hold the value for that- variable at all points of execution, and its possible for the variable value to be held in+ variable at all points of execution, and it is possible for the variable value to be held in<emphasis>different</emphasis> storage locations at different points of execution. The set of executionpoints where the storage location <emphasis>does</emphasis> hold the variable value is called the annotation- <emphasis role="bold">scope</emphasis>; this is distinct from (but influenced by) the scope of the+ <emphasis role="bold">scope</emphasis>; this is distinct from, but influenced by, the scope of thevariable itself. The different types of storage location are listed below.</para><sect3 id="VariableStorageImage">@@ -2106,21 +2162,21 @@A <emphasis role="bold">load-image address</emphasis> is a concrete address in the load image of the Program,typically in the <emphasis role="bold">ram</emphasis> address space. This kind ofstorage must be backed by a formal memory block for the Program, which typically corresponds to a specific- program section (such as the <code>.text</code> or <code>.bss</code> section). Because it is in the- load image directly, an annotation with this storage shows up directly in the <emphasis>Listing</emphasis>+ program section, such as the <code>.text</code> or <code>.bss</code> section. Because it is in the+ load image directly, an annotation with this storage shows up directly in any Listingwindow and can be directly manipulated there. In much of the Ghidra documentation, these annotations- are referred to as <emphasis role="bold">Data</emphasis>. See the section- <link xlink:href="help/topics/DataPlugin/Data.htm">Data</link> in particular.+ are referred to as <emphasis role="bold">Data</emphasis>. See the+ <link xlink:href="help/topics/DataPlugin/Data.htm">Data</link> section, in particular.</para><para>- Although specific architectures may vary, generally a storage location at a load image address+ Although specific architectures may vary, a storage location at a load image address generallyrepresents a formal <emphasis>global</emphasis> variable, and the annotation is in scope- across all Program execution. For the decompiler, the storage location is treated as a+ across all Program execution. For the Decompiler, the storage location is treated as aa single <emphasis>persistent</emphasis> variable in all functions that reference it. Within a- function, all distinct references to the storage location (varnodes) are merged. The decompiler+ function, all distinct references (varnodes) to the storage location are merged. The Decompilerexpects a value at the storage location to exist from <emphasis>before</emphasis> the start ofthe function, and any change to the value must be explicitly represented as an assignment to- the variable in decompiler output.+ the variable in Decompiler output.</para></sect3><sect3 id="VariableStorageStack">@@ -2135,26 +2191,26 @@single function and the variable must be <emphasis>local</emphasis> to that function.</para><para>- Within the <emphasis>Listing</emphasis> window, a stack annotation is displayed as part of the function header- (at the entry point address of the function), with a syntax similar to:+ Within a <emphasis>Listing</emphasis> window, a stack annotation is displayed as part of the function header+ at the entry point address of the function, with a syntax similar to:<informalexample><code>undefined4 Stack[-0x14]:4 local_14</code></informalexample>The middle field (the <emphasis>Variable Location</emphasis> field) indicates that the storage location is on the- stack, and the value in brackets indicates the offset of the storage location, relative to the incoming+ stack, and the value in brackets indicates the offset of the storage location relative to the incomingstack pointer. The value after the colon indicates the number of bytes in the storage location.</para><para>Currently, the entire body of the function is included- in the scope of any stack annotation, and the decompiler will allow only a single variable to exist+ in the scope of any stack annotation, and the Decompiler will allow only a single variable to existat the stack address. A stack annotation can be a formal parameter to the function, but otherwise the- decompiler does not expect to see a value that exists before the start of the function.+ Decompiler does not expect to see a value that exists before the start of the function.</para><para>- The decompiler will continue to perform <emphasis>copy propagation</emphasis> and other transforms on- stack locations associated with a variable annotation. In particular, within decompiler output,- a specific write operation to a stack address may not show up as an explicit assignment to its variable,- if the value is simply copied to another location.+ The Decompiler will continue to perform <emphasis>copy propagation</emphasis> and other transforms on+ stack locations associated with a variable annotation. In particular, within Decompiler output,+ if the value is simply copied to another location,+ a specific write operation to a stack address may not show up as an explicit assignment to its variable.</para></sect3><sect3 id="VariableStorageRegister">@@ -2162,7 +2218,7 @@<para>A variable annotation can refer to a specific <emphasis>register</emphasis> for the processor associatedwith the Program. In general, such an annotation will be for a variable local to a particular function.- Within the <emphasis>Listing</emphasis> window, this annotation is displayed as part of the function header, with+ Within a <emphasis>Listing</emphasis> window, this annotation is displayed as part of the function header, withsyntax like:<informalexample><code>int EAX:4 iVar1</code>@@ -2171,32 +2227,32 @@the annotation, and the value after the colon indicates the number of bytes in the register.</para><para>- For a local variable annotations with a register storage location, there is an expectation that the+ For local variable annotations with a register storage location, there is an expectation that theregister may be reused for different variables at different points of execution within the function.There may be more than one annotation, for different variables, that share the same registerstorage location.An annotation is associated with a <emphasis>first use point</emphasis> that describes where- the register first holds a value for the particular variable. (See the discussion - <xref linkend="ConceptVarnodeSSA"/>)+ the register first holds a value for the particular variable (see the discussion - <xref linkend="ConceptVarnodeSSA"/>).The entire scope of the annotation is limited to the address regions between the first use point- and any points where the value is read. The decompiler may extend the scope as part of its+ and any points where the value is read. The Decompiler may extend the scope as part of its<emphasis>merging</emphasis> process, but the full extent is not stored in the annotation.</para></sect3><sect3 id="VariableStorageTemp">- <title>Temporary Registers</title>+ <title>Temporary Register</title><para>Variable annotations can have a <emphasis>temporary register</emphasis> as a storage location.A temporary register is not specific to a processor but is produced at various stages ofthe decompilation process. See the discussion of the <emphasis role="bold">unique</emphasis>space in <xref linkend="ConceptAddressSpace"/>. These registers do not have a meaningful name, and- the specific storage address may change on successive decompilations. So within the- <emphasis>Listing</emphasis> window, this annotation is displayed as part of the function header,+ the specific storage address may change on successive decompilations. So, within a+ <emphasis>Listing</emphasis> window, this annotation is displayed as part of the function headerwith syntax like:<informalexample><code>int HASH:5f96367122:4 iVar2</code></informalexample>The <emphasis>Variable Location</emphasis> field displays the internal hash used to uniquely- identify the temporary register within the data-flow of the function.+ identify the temporary register within the data flow of the function.</para><para>A temporary register annotation must be for a local variable, and as with an ordinary register,@@ -2212,7 +2268,7 @@<para>Every formal Function in Ghidra is associated with a set of variable annotations and other properties thatmake up the <emphasis role="bold">function prototype</emphasis>. Due to the nature of reverse engineering,- the function prototype may only include partial information and may be built up over time. Individual+ the function prototype may include only partial information and may be built up over time. Individualelements include:<informalexample><variablelist>@@ -2222,9 +2278,10 @@<listitem><para>Each formal input to the function can have a Variable Annotation that describes its name, data-type,- and storage location, at the moment control-flow enters the function. If annotations exist, they are shown- in the Listing Window as part of the Function header, and they usually correspond directly with symbols in the- <emphasis>function declaration</emphasis> produced by the decompiler.+ and storage location. The storage location applies at the moment control flow enters the function.+ If annotations exist, they are shown+ in a Listing window as part of the Function header, and they usually correspond directly with symbols in the+ <emphasis>function declaration</emphasis> produced by the Decompiler.</para></listitem></varlistentry>@@ -2233,10 +2290,26 @@<listitem><para>The value returned by a function can have a special Variable Annotation that describes its data-type- and storage location, at the moment control-flow exits the function. If it exists, the annotation is shown- in the Listing Window as part of the Function header with the name <code><RETURN></code>, and it usually+ and storage location. The storage location applies at the moment control flow exits the function. If it exists, the annotation is shown+ in a Listing window as part of the Function header with the name <code><RETURN></code>, and it usuallycorresponds directly with the return value in the <emphasis>function declaration</emphasis> produced by- the decompiler.+ the Decompiler.+ </para>+ </listitem>+ </varlistentry>+ <varlistentry>+ <term><emphasis role="bold">Auto-Parameters</emphasis></term>+ <listitem>+ <para>+ Specific prototypes may require auto-parameters like <emphasis role="bold">this</emphasis>+ or <emphasis role="bold">__return_storage_ptr__</emphasis>. These are special input parameters+ that compilers may use to implement specific high-level language concepts. See the discussion+ in <xref linkend="ConceptAutoParameters"/>. Within Ghidra, auto-parameters are automatically created by the+ <link xlink:href="help/topics/FunctionPlugin/Variables.htm#Edit_Function">Function Editor Dialog</link>+ if the desired prototype requires them.+ Within a Listing window, auto-parameters look like other parameter annotations, but the storage field shows the+ string <code>(auto)</code>. Decompiler output will generally display auto-parameters as explicit variables+ rather than hiding them.</para></listitem></varlistentry>@@ -2244,20 +2317,20 @@<term><emphasis role="bold">Calling Convention</emphasis></term><listitem><para>- The calling convention used by the function can be specified as part of the function prototype. The convention+ The calling convention used by the function is specified as part of the function prototype. The conventionis specified by name, referring to the formal <xref linkend="ConceptPrototypeModel"/> that describes how storagelocations are selected for individual parameters along with other information about how the compiler treats- the function. Available models are determined by the processor and compiler, but can be extended by the user.- See <xref linkend="ExtensionOptions"/>.+ the function. Available models are determined by the processor and compiler, but may be extended by the user+ (see <xref linkend="ExtensionOptions"/>).</para><para>- In the absence of parameter and return value annotations, the decompiler will use the prototype model as+ In the absence of input parameter and return value annotations, the Decompiler will use the prototype model aspart of its analysis to <emphasis>discover</emphasis> the input parameters and the return value of the function.</para><para>- The name "unknown" is reserved to indicate that nothing is known about the calling convention. If- set to "unknown", depending on context, the decompiler may assign the calling convention based on- the <emphasis>Prototype Evaluation</emphasis> option (See <xref linkend="OptionProtoEval"/>), or it+ The name <emphasis role="bold">unknown</emphasis> is reserved to indicate that nothing is known about the calling convention. If+ set to <emphasis role="bold">unknown</emphasis>, depending on context, the Decompiler may assign the calling convention based on+ the <emphasis>Prototype Evaluation</emphasis> option (see <xref linkend="OptionProtoEval"/>), or itmay use the default calling convention for the architecture.</para></listitem>@@ -2267,10 +2340,10 @@<listitem><para>Functions have a boolean property called <emphasis role="bold">variable arguments</emphasis>, which can be turned on- if the function is capable of being passed a variable number of inputs. This property informs the decompiler that+ if the function is capable of being passed a variable number of inputs. This property informs the Decompiler thatthe function may take additional parameters beyond any with an explicit variable annotation.This affects decompilation of any function which calls the <emphasis>variable arguments</emphasis> function, allowing- the decompiler to discover unlisted parameters at a given call site.+ the Decompiler to discover unlisted parameters at a given call site.</para></listitem></varlistentry>@@ -2278,9 +2351,9 @@<term><emphasis role="bold">No Return</emphasis></term><listitem><para>- A function can be marked explicitly as <emphasis role="bold">not returning</emphasis>, meaning that once- a call is made to the function, execution will never return to the caller. The decompiler uses this to- compute the correct control-flow in any calling functions.+ A function can be marked with the <emphasis role="bold">no return</emphasis> property, meaning that once+ a call is made to the function, execution will never return to the caller. The Decompiler uses this to+ compute the correct control flow in any calling functions.</para></listitem></varlistentry>@@ -2288,13 +2361,13 @@<term><emphasis role="bold">In-Line</emphasis></term><listitem><para>- If the boolean property <emphasis role="bold">in-line</emphasis> is turned on for a particular function,- it directs the decompiler to inline the effects of the function into the decompilation of any of its calling functions.- The function will no longer appear as a direct function call in the decompilation, but all of its data-flow+ If the <emphasis role="bold">in-line</emphasis> property is turned on for a particular function,+ it directs the Decompiler to inline the effects of the function into the decompilation of any of its calling functions.+ The function will no longer appear as a direct function call in the decompilation, but all of its data flowwill be incorporated into the calling function.</para><para>- This is useful for <emphasis>bookkeeping</emphasis> functions, where its important for the decompiler to+ This is useful for <emphasis>bookkeeping</emphasis> functions, where it is important for the Decompiler to<emphasis>see</emphasis> its effects on the calling function. Functions that set up the stack frame for a caller orfunctions that look up or dispatch a switch destination are typical examples that should be marked <emphasis>in-line</emphasis>.</para>@@ -2305,7 +2378,7 @@<listitem><para>This property is similar in spirit to marking a function as <emphasis>in-line</emphasis>.- A <emphasis role="bold">call-fixup</emphasis> directs the decompiler to replace any call to the function with a specific+ A <emphasis role="bold">call-fixup</emphasis> directs the Decompiler to replace any call to the function with a specificchunk of raw p-code. The decompilation of any calling function no longer shows the function call, but the chunkof p-code incorporates the called function's effects.</para>@@ -2316,7 +2389,7 @@<para>Call-fixups are specified by name. The name and associated p-code chunk are typically defined in the<emphasis>compiler specification</emphasis> for the Program. Users can extend the available set- of call-fixups. See <xref linkend="ExtensionOptions"/>.+ of call-fixups (see <xref linkend="ExtensionOptions"/>).</para></listitem></varlistentry>@@ -2329,7 +2402,7 @@Ghidra records a <emphasis role="bold">Signature Source</emphasis> for every function,indicating the origin of its prototype information. This issimilar to the <emphasis>Symbol Source</emphasis> attached to Ghidra's symbol annotations- (See the documentation for+ (see the documentation for<link xlink:href="help/topics/SymbolTablePlugin/symbol_table.htm#Set_Filter">Filtering</link>in the Symbol Table). The possible types are:<informalexample>@@ -2354,25 +2427,25 @@</para><para>If the Signature Source is set to anything other than <emphasis>DEFAULT</emphasis>, the- function's prototype information is forcing on the decompiler. See the discussion- in <xref linkend="AnnoteForcing"/>+ function's prototype information is forcing on the Decompiler (see the discussion+ in <xref linkend="AnnoteForcing"/>).</para></sect2><sect2 id="PrototypeDiscover"><title>Discovering Parameters</title><para>The input parameter and return value annotations of the function prototype, like- any variable annotations, can be forcing on the decompiler.- See the complete discussion in <xref linkend="AnnoteForcing"/>.+ any variable annotations, can be forcing on the Decompiler+ (see the complete discussion in <xref linkend="AnnoteForcing"/>).But keep in mind:</para><warning>- The input parameters and return value are all forced on the decompiler as a unit based on the+ The input parameters and return value are all forced on the Decompiler as a unit based on the<emphasis>Signature Source</emphasis>. They are all forced if the type is set to anythingother than <emphasis>DEFAULT</emphasis>; otherwise none of them are forced.</warning><para>- If the function prototype's annotations are not forced, the decompiler will attempt to discover the parameters+ If the function prototype's annotations are not forcing, the Decompiler will attempt to discover the parametersand return value using the calling convention. The prototype model underlying the calling conventiondictates which storage locations can be considered as parameters and their formal ordering.</para>@@ -2387,7 +2460,7 @@can be built for the function.</para><para>- The decompiler will disregard the calling convention's rules in this situation and use the custom storage+ The Decompiler will disregard the calling convention's rules in this situation and use the custom storagelocations for parameters and the return value. Other aspects of the calling convention, like the<emphasis>unaffected</emphasis> list, will still be used.</para>@@ -2397,8 +2470,8 @@<section id="AnnoteMutability"><title>Data Mutability</title><para>- <emphasis role="bold">Mutability</emphasis> is a description of how values in a specific memory region- (either a single variable or a larger block) can change during Program execution, based either on+ <emphasis role="bold">Mutability</emphasis> is a description of how values in a specific memory region,+ either a single variable or a larger block, can change during Program execution based either onproperties or established rules. Ghidra recognizes the mutability settings:<informalexample><itemizedlist mark='bullet'>@@ -2407,17 +2480,17 @@<listitem>Volatile</listitem></itemizedlist></informalexample>- Mutability affects decompiler analysis and can have a large impact the output.+ Mutability affects Decompiler analysis and can have a large impact on the output.</para><para>- Most memory has <emphasis role="bold">normal</emphasis> mutability, meaning:+ Most memory has <emphasis role="bold">normal</emphasis> mutability;the value at the memory location may change over the course of executing the Program, but for a givensection of code, the value will not change unless an instruction explicitly writes to it.</para><para>Mutability can be set on an entire block of memory in the Program, typically from the<link xlink:href="help/topics/MemoryMapPlugin/Memory_Map.htm#View_Memory_Map">Memory Map</link>.- It can also be set as part of a single Variable Annotation. From the Listing Window for instance,+ It can also be set as part of a single Variable Annotation. From a Listing window, for instance,use the <link xlink:href="help/topics/DataPlugin/Data.htm#Data_Settings">Settings</link> dialog.</para><sect2 id="MutabilityReadOnly">@@ -2425,9 +2498,9 @@<para>The <emphasis role="bold">constant</emphasis> mutability setting indicates that values withinthe memory region are read-only and don't change during Program execution. If a read-only variable is- accessed in a function being analyzed by the decompiler, its constant value, if present in the- Program's <emphasis>load image</emphasis>, replaces the variable within data-flow for the- function. The decompiler may propagate the constant and fold it in to other operations, which+ accessed in a function being analyzed by the Decompiler, its constant value, if present in the+ Program's <emphasis>load image</emphasis>, replaces the variable within data flow for the+ function. The Decompiler may propagate the constant and fold it in to other operations, whichcan have a substantial impact on the final output.</para></sect2>@@ -2436,17 +2509,17 @@<para>The <emphasis role="bold">volatile</emphasis> mutability setting indicates that values withinthe memory region may change unexpectedly, even if the code currently executing does not directly- write to it. If a volatile variable is accessed in a function being analyzed by the decompiler,+ write to it. If a volatile variable is accessed in a function being analyzed by the Decompiler,each specific access is replaced with a built-in function call, which prevents constant propagationand other transforms across the access. The built-in functions are named based on- whether the access is a <emphasis>read</emphasis> or <emphasis>write</emphasis> and then the size- of the access. Within decompiler output, the first parameter to a built-in function is a symbol+ whether the access is a <emphasis>read</emphasis> or <emphasis>write</emphasis> and on the <emphasis>size</emphasis>+ of the access. Within the Decompiler output, the first parameter to a built-in function is a symbolindicating the volatile variable. The function returns a value in the case of a volatile read ortakes a second parameter in the case of a volatile write.<informalexample><programlisting>- write_volatile_1(DAT_mem_002b,0x20);X = read_volatile_2(SREG);+ write_volatile_1(DAT_mem_002b,0x20);</programlisting></informalexample></para>@@ -2456,14 +2529,14 @@<section id="AnnoteConstants"><title>Constant Annotations</title><para>- Ghidra provides numerous actions to control how specific constants are formatted or displayed.- An annotation can be applied directly to a constant in the Decompiler Window, which always affects- decompiler output. Or, an annotation can be applied to the constant operand of a specific machine- instruction displayed in the Listing Window. In this case, to the extent possible, the decompiler- attempts to track the operand and apply the annotation to the matching constant in the decompiler output.- However, the constant may be transformed from its value in the original machine instruction during the decompiler's- analysis. The decompiler will follow the constant through simple transformations, but if the constant strays- too far from its original value, the annotation will not be applied. The transforms followed are:+ Ghidra provides numerous actions to control how a specific constant is formatted or displayed.+ An annotation can be applied directly to a constant in a Decompiler window, which always affects+ Decompiler output. Or, an annotation can be applied to the constant operand of a specific machine+ instruction displayed in a Listing window. In this case, to the extent possible, the Decompiler+ attempts to track the operand and apply the annotation to the matching constant in the Decompiler output.+ However, the constant may be transformed from its value in the original machine instruction during the Decompiler's+ analysis. The Decompiler will follow the constant through one of the following simple transformations, but+ otherwise the annotation will not be applied.<informalexample><itemizedlist mark='bullet'><listitem>Signed or zero extension</listitem>@@ -2479,56 +2552,54 @@Ghidra can create an association between a name and a constant, called an <emphasis role="bold">equate</emphasis>.An equate is a descriptive string that is intended to replace the numeric form of the constant, and equatesacross the entire Program can be viewed from the- <link xlink:href="help/topics/EquatePlugin/Equates.htm#Equate_Table">Equate Table</link>.+ <link xlink:href="help/topics/EquatePlugin/Equates.htm#Equate_Table">Equates Table</link>.</para><para>An equate can be applied to a machine instruction with a constantoperand by using the <link xlink:href="help/topics/EquatePlugin/Equates.htm#Set_Equate">Set Equate</link>- menu from the Listing Window. If the decompiler successfully follows the operand to a matching constant,- the equate's name is displayed as part of the decompiler's output as well as in the Listing Window.- A transformed operand is displayed as an expression, where the transforming operations are applied to- the equate symbol (representing the original constant).+ menu from a Listing window. If the Decompiler successfully follows the operand to a matching constant,+ the equate's name is displayed as part of the Decompiler's output as well as in any Listing window.+ A transformed operand is displayed as an expression, where the transforming operation is applied to+ the equate symbol representing the original constant.</para><para>- Alternately an equate can be applied directly to a constant from the Decompiler Window using its+ Alternatively, an equate can be applied directly to a constant from a Decompiler window using its<xref linkend="ActionSetEquate"/> menu. The constant may or may not have a corresponding instruction- operand but will be displayed in decompiler output using the descriptive string.- </para>- <para>-+ operand but will be displayed in Decompiler output using the descriptive string.</para></sect2><sect2 id="ConstantConversions"><title>Format Conversions</title><para>- Ghidra can apply a <emphasis role="bold">format conversion</emphasis> to integer constants that are displayed- in decompiler output.+ Ghidra can apply a <emphasis role="bold">format conversion</emphasis> to any integer constant that is displayed+ in Decompiler output.</para><para>A conversion can be applied to the machine instruction containing the constantas an operand using the <link xlink:href="help/topics/EquatePlugin/Equates.htm#Convert">Convert</link> menu option- from the Listing Window. If the decompiler successfully traces the operand to a matching constant,- the format conversion is applied in the decompiler output as well as in the Listing Window.+ from a Listing window. If the Decompiler successfully traces the operand to a matching constant,+ the format conversion is applied in the Decompiler output as well as in the Listing window.</para><para>- Alternately, a conversion can be applied directly to an integer constant in the- Decompiler Window using its <xref linkend="ActionConvert"/> menu option. The constant may or may not- have a corresponding instruction operand but is displayed in decompiler output using the conversion.+ Alternately, a conversion can be applied directly to an integer constant in a+ Decompiler window using its <xref linkend="ActionConvert"/> menu option. The constant may or may not+ have a corresponding instruction operand but is displayed in Decompiler output using the conversion.</para><para>- Conversions applied by the decompiler are currently limited to:+ Conversions applied by the Decompiler are currently limited to:<informalexample><itemizedlist mark='bullet'><listitem>Binary - 0b01100001</listitem>- <listitem>Decimal- 97</listitem>+ <listitem>Decimal - 97</listitem><listitem>Hexadecimal - 0x61</listitem><listitem>Octal - 0141</listitem><listitem>Char - 'a'</listitem></itemizedlist></informalexample>- An appropriate header matching the format is prepended to the representation string, either "0b", "0x" or just- "0". The decompiler will not switch the signedness of the constant but preserves the signed or unsigned data-type- as determined by analysis.+ If necessary, a header matching the format is prepended to the representation string, either "0b", "0x" or just+ "0". A conversion will not switch the signedness of the constant; the signed or unsigned data-type associated+ with the constant, as determined by analysis, is preserved. If the constant is negative, with a signed data-type,+ the representation string will always start with a '-' character.</para></sect2></section>@@ -2539,15 +2610,15 @@A <emphasis role="bold">register value</emphasis> in this context is a region of code in the Programwhere a specific register holds a known constant value. Ghidra maintains an explicit list of these values forthe Program (see the documentation for <link xlink:href="help/topics/RegisterPlugin/Registers.htm">Register Values</link>),- which the decompiler can use when analyzing a function.- A register value benefits decompiler analysis, especially if the original compiler was aware- of the constant value, as the decompiler can recover address references calculated as offsets relative to the register+ which the Decompiler can use when analyzing a function.+ A register value benefits Decompiler analysis, especially if the original compiler was aware+ of the constant value, as the Decompiler can recover address references calculated as offsets relative to the registerand otherwise propagate the constant.</para><para>- A <emphasis>register value</emphasis> is set by highlighting the region of code in the Listing Window and then invoking the- <link xlink:href="help/topics/RegisterPlugin/Registers.htm#SetRegisterValues">Set Register Values ...</link> command- from the pop-up menu. The beginning and end of a region is indicated in the Listing Window with+ A <emphasis>register value</emphasis> is set by highlighting the region of code in a Listing window and then invoking the+ <link xlink:href="help/topics/RegisterPlugin/Registers.htm#SetRegisterValues">Set Register Values...</link> command+ from the pop-up menu. The beginning and end of a region is indicated in a Listing window with<code>assume</code> directives, and regions can be generally viewed from the<link xlink:href="help/topics/RegisterPlugin/Registers.htm#Register_Manager">Register Manager</link> window.</para>@@ -2555,15 +2626,15 @@In order for a particular register value to affect decompilation, the region of code associated with thevalue must contain the entry point of the function, and of course the function must read from the register.Only the initial reads of the register are replaced with the constant value.- The decompiler will continue to respect later instructions that write to the register (even if the- instruction is inside the register value's region)+ The Decompiler will continue to respect later instructions that write to the register, even if the+ instruction is inside the register value's region.If a register value's region starts in the middle of a function, decompilation is <emphasis>not</emphasis>affected at all.</para><sect2 id="AnnoteContextRegister"><title>Context Registers</title><para>- There is a special class of registers, called <emphasis role="bold">context registers</emphasis> whose+ There is a special class of registers called <emphasis role="bold">context registers</emphasis> whosevalues have a different affect on analysis and decompilation than described above.</para><tip>@@ -2573,7 +2644,7 @@<para>The value in a context register is examined when Ghidra decodes machine instructions from the underlyingbytes in the Program. A specific value generally corresponds to a specific <emphasis>execution mode</emphasis>- of the processor. The ARM processor <emphasis>T bit</emphasis> for instance, which selects whether the+ of the processor. The ARM processor <emphasis>T bit</emphasis>, for instance, which selects whether theprocessor is executing ARM or THUMB instructions, is modeled as a context register in Ghidra.The same set of bytes in the Program can be decoded to machine instructions in more than one way,depending on context register values.@@ -2588,17 +2659,17 @@<para>If a context register value is changed for a region that has already been disassembled, in order to seethe affect of the change, the machine instructions in the region need to be cleared, and disassembly needs- to be triggered again. See the documentation on the- <link xlink:href="help/topics/ClearPlugin/Clear.htm#Clear_Code_Bytes">Clear Plugin</link>.+ to be triggered again (see the documentation on the+ <link xlink:href="help/topics/ClearPlugin/Clear.htm#Clear_Code_Bytes">Clear Plugin</link>).</para><para>- Values for a context register are set in the same way as any other register, using the- <link xlink:href="help/topics/RegisterPlugin/Registers.htm#SetRegisterValues">Set Register Values ...</link> command+ Values for a context register are set in the same way as for any other register, using the+ <link xlink:href="help/topics/RegisterPlugin/Registers.htm#SetRegisterValues">Set Register Values...</link> commanddescribed above. Within the<link xlink:href="help/topics/RegisterPlugin/Registers.htm#Register_Manager">Register Manager</link> window,- context registers are generally grouped together under the (pseudo-register) heading, <emphasis>contextreg</emphasis>.+ context registers are generally grouped together under the <emphasis>contextreg</emphasis> pseudo-register heading.For details about how context registers are used in processor modeling, see- the document "SLEIGH: A Language for Rapid Processor Specification".+ the document "SLEIGH: A Language for Rapid Processor Specification."</para><para>Because context registers affect machine instructions, they also affect the underlying p-code and@@ -2615,20 +2686,48 @@<title>Decompiler Options</title><simplesect><para>- This lists configuration options that explicitly affect the behavior of the decompiler or- its output, independent of the code that is being decompiled. The bulk of these are+ This page lists configuration options that explicitly affect the behavior of the Decompiler or+ its output, independent of the code that is being decompiled. The bulk of these options areaccessible by selecting the Code Browser menu<informalexample>- <emphasis role="bold">Edit -> Tool Options</emphasis>+ <emphasis role="bold">Edit -> Tool Options...</emphasis></informalexample>- and then picking the <emphasis>Decompiler</emphasis> sub-folder. These options are associated- with the particular tool (Code Browser) being used and will apply to decompilation of any Program- being analyzed by that tool. The three categories of options are:+ and then picking the <emphasis>Decompiler</emphasis> folder. The options are associated+ with the particular Code Browser or other tool being used and will apply to decompilation of any Program+ being analyzed by that tool. There are three categories of options, which are listed by clicking either on the+ <emphasis>Decompiler</emphasis> folder or one of its two subsections.<informalexample>- <itemizedlist mark='bullet'>- <listitem><xref linkend="GeneralOptions"/> affecting the engine behavior</listitem>- <listitem><xref linkend="AnalysisOptions"/> affecting the decompiler's transformation process</listitem>- <listitem><xref linkend="DisplayOptions"/> affecting the final presentation of decompiler output</listitem>+ <itemizedlist mark='none'>+ <listitem>+ <guiicon>+ <inlinemediaobject>+ <imageobject>+ <imagedata condition="noscaling" fileref="images/openFolder.png" contentwidth="25px" contentdepth="17px"/>+ <imagedata condition="withscaling" fileref="images/openFolder.png" contentwidth="0.22in" contentdepth="0.15in"/>+ </imageobject>+ </inlinemediaobject>+ </guiicon><emphasis>Decompiler</emphasis> - lists <xref linkend="GeneralOptions"/> that affect the engine behavior.+ </listitem>+ <listitem>+  <guiicon>+ <inlinemediaobject>+ <imageobject>+ <imagedata condition="noscaling" fileref="images/document-properties.png" contentwidth="16px" contentdepth="16px"/>+ <imagedata condition="withscaling" fileref="images/document-properties.png" contentwidth="0.15in" contentdepth="0.15in"/>+ </imageobject>+ </inlinemediaobject>+ </guiicon> <emphasis>Analysis</emphasis> - lists <xref linkend="AnalysisOptions"/> that affect the Decompiler's transformation process.+ </listitem>+ <listitem>+  <guiicon>+ <inlinemediaobject>+ <imageobject>+ <imagedata condition="noscaling" fileref="images/document-properties.png" contentwidth="16px" contentdepth="16px"/>+ <imagedata condition="withscaling" fileref="images/document-properties.png" contentwidth="0.15in" contentdepth="0.15in"/>+ </imageobject>+ </inlinemediaobject>+ </guiicon> <emphasis>Display</emphasis> - lists <xref linkend="DisplayOptions"/> that affect the final presentation of Decompiler output.+ </listitem></itemizedlist></informalexample></para>@@ -2636,18 +2735,18 @@Options that are specific to the particular Program being analyzed are accessed byselecting the Code Browser menu<informalexample>- <emphasis role="bold">Edit -> Options for <Program></emphasis>+ <emphasis role="bold">Edit -> Options for <program>...</emphasis>.</informalexample>- Picking the <emphasis>Decompiler</emphasis> tab shows <xref linkend="ProgramOptions"/>- that only affect the decompiler. Picking the <xref linkend="ExtensionOptions"/> tab+ Picking the <emphasis>Decompiler</emphasis> section shows <xref linkend="ProgramOptions"/>+ that only affect the Decompiler. Picking the <xref linkend="ExtensionOptions"/> sectionshows a table of the available prototype models, call-fixups, and callother-fixups. These- affect more than just the decompiler but are also documented here.+ affect more than just the Decompiler but are also documented here.</para></simplesect><section id="GeneralOptions"><title>General Options</title><para>- These options govern what resources are available to the Plug-in and the decompiler engine but do+ These options govern what resources are available to the Plug-in and the Decompiler engine but donot affect how analysis is performed or results are displayed.</para><para>@@ -2658,7 +2757,7 @@<term><emphasis role="bold">Cache Size (Functions)</emphasis></term><listitem><para>- Decompilation results for a single function can be compute intensive to produce.+ Producing decompilation results for a single function can be computationally intensive.This option specifies the number of functions whose decompilation resultscan be cached simultaneously. When navigating to a function thathas been recently cached, as when navigating back and forth between a few functions,@@ -2670,7 +2769,7 @@<term><emphasis role="bold">Decompiler Max-Payload (MBytes)</emphasis></term><listitem><para>- This is a limit on the number of bytes that can be produced by the decompiler process as output+ This option limits the number of bytes that can be produced by the Decompiler process as outputwhen decompiling a single function. A payload includes the actual characters to be displayed inthe window, additional token markup, symbol information, and other details of the underlyingsyntax tree. The limit is specified in megabytes of data. If the limit is exceeded for a single@@ -2683,11 +2782,11 @@<term><emphasis role="bold">Decompiler Timeout (seconds)</emphasis></term><listitem><para>- This option sets an upper limit on the number of seconds the decompiler spends attempting+ This option sets an upper limit on the number of seconds the Decompiler spends attemptingto analyze one function before aborting.- It is currently <emphasis role="bold">not</emphasis> enforced for the Decompilation- Window. Instead it applies to the DecompilerSwitchAnalyzer, the <code>analyzeHeadless</code> command, scripts, or other- plug-ins that make use of the decompiler service.+ It is currently <emphasis role="bold">not</emphasis> enforced for a Decompiler+ window. Instead it applies to the DecompilerSwitchAnalyzer, the <code>analyzeHeadless</code> command, scripts, and other+ plug-ins that make use of the Decompiler service.</para></listitem></varlistentry>@@ -2695,10 +2794,10 @@<term><emphasis role="bold">Max Instructions per Function</emphasis></term><listitem><para>- This option sets a maximum number of machine instructions that the decompiler will attempt+ This option sets a maximum number of machine instructions that the Decompiler will attemptto analyze for a single function, as a safeguard against analyzing a long sequence- of zeroes or other constant data. The decompiler will quickly throw an exception if it- traces control-flow into more than the indicated number of instructions.+ of zeroes or other constant data. The Decompiler will quickly throw an exception if it+ traces control flow into more than the indicated number of instructions.</para></listitem></varlistentry>@@ -2710,7 +2809,7 @@<section id="AnalysisOptions"><title>Analysis Options</title><para>- These options directly affect how the decompiler performs its analysis, either by+ These options directly affect how the Decompiler performs its analysis, either bytoggling specific analysis passes or changing how it treats various annotations.</para><para>@@ -2721,16 +2820,16 @@<term><emphasis role="bold">Alias Blocking</emphasis></term><listitem><para>- When deciding if an individual stack location has become dead, the decompiler+ When deciding if an individual stack location has become dead, the Decompilermust consider <emphasis>aliases</emphasis>, pointers onto the stack that could- be used to modify the location within a called function. One strong heuristic the decompiler- uses is; if the user has explicitly created a variable on the stack between the+ be used to modify the location within a called function. One strong heuristic the Decompiler+ uses is: if the user has explicitly created a variable on the stack between thebase location referenced by the pointer and the individual stack location, then- the decompiler can assume that the pointer is not an alias of the stack location.+ the Decompiler can assume that the pointer is not an alias of the stack location.The alias is <emphasis>blocked</emphasis> by the explicit variable.However, if the user's explicit variable is labeling something that isn't- really an explicit variable, like a field within a larger structure for instance,- the decompiler may incorrectly consider the stack location as dead and start removing+ really an explicit variable, like a field within a larger structure, for instance,+ the Decompiler may incorrectly consider the stack location as dead and start removinglive code.</para><para>@@ -2738,10 +2837,10 @@setting to specify what data-types should be considered blocking. The four options are:<informalexample><itemizedlist mark='bullet'>- <listitem><emphasis role="bold">None</emphasis> - No data-type is considered blocking.</listitem>- <listitem><emphasis role="bold">Structures</emphasis> - Only structured data-types are blocking.</listitem>- <listitem><emphasis role="bold">Structures and Arrays</emphasis></listitem>- <listitem><emphasis role="bold">All Data-types</emphasis> - All data-types are blocking.</listitem>+ <listitem><emphasis role="bold">None</emphasis> - No data-type is considered blocking</listitem>+ <listitem><emphasis role="bold">Structures</emphasis> - Only structures are blocking</listitem>+ <listitem><emphasis role="bold">Structures and Arrays</emphasis> - Only structures and arrays are blocking</listitem>+ <listitem><emphasis role="bold">All Data-types</emphasis> - All data-types are blocking</listitem></itemizedlist></informalexample>Selecting <emphasis>None</emphasis> is the equivalent of turning off the heuristic. Selecting anything@@ -2750,36 +2849,19 @@</para></listitem></varlistentry>- <varlistentry id="AnalysisForLoops">- <term><emphasis role="bold">Recover -for- loops</emphasis></term>- <listitem>- <para>- When this is toggle <emphasis>on</emphasis>, the decompiler attempts to pinpoint- variables that control the iteration over specific loops in the function body.- When these <emphasis>loop</emphasis> variables are discovered, the loop is- rendered using a standard <emphasis role="bold">for</emphasis> loop header- that contains an initializer statement, condition, and iterating statement.- <informalexample>- <code>for (iVar2 = 10; iVar2 < len; iVar2 = iVar2 + 1) { ...</code>- </informalexample>- </para>- <para>- If the toggle is <emphasis>off</emphasis>, the loop is displayed using- <emphasis role="bold">while</emphasis> syntax, with any initializer and- iterating statements mixed in with the loop body or preceding basic blocks.- </para>- </listitem>- </varlistentry><varlistentry id="AnalysisUnreachable"><term><emphasis role="bold">Eliminate unreachable code</emphasis></term><listitem><para>- When this is toggled <emphasis>on</emphasis>, the decompiler eliminates code that it+ When toggled <emphasis>on</emphasis>, the Decompiler eliminates code that itconsiders unreachable. This usually happens when, due to constant propagation and other- analysis, the decompiler decides that a boolean value controlling a conditional branch can+ analysis, the Decompiler decides that a boolean value controlling a conditional branch canonly take one possible value and removes the branch corresponding to the other value. Togglingthis to <emphasis>off</emphasis> lets the user see the dead code, which is typically demarcated- by the control-flow structure -- <code>if (false) { ... }</code>.+ by the control-flow structure:+ <informalexample>+ <code>if (false) { ... }</code>+ </informalexample></para></listitem></varlistentry>@@ -2787,15 +2869,15 @@<term><emphasis role="bold">Ignore unimplemented instructions</emphasis></term><listitem><para>- When toggled <emphasis>on</emphasis>, the decompiler treats instructions whose semantics+ When toggled <emphasis>on</emphasis>, the Decompiler treats instructions whose semanticshave been formally marked <emphasis role="bold">unimplemented</emphasis> as if they do- nothing (no operation). Crucially, control-flow falls through to the next instruction.- In this case, the decompiler inserts the warning "Control flow ignored unimplemented+ nothing (no operation). Crucially, control flow falls through to the next instruction.+ In this case, the Decompiler inserts the warning "Control flow ignored unimplementedinstructions" as a comment in the function header, but the exact point at whichinstruction was ignored may not be clear.- If this option is toggled <emphasis>off</emphasis>, the decompiler inserts the built-in+ If this option is toggled <emphasis>off</emphasis>, the Decompiler inserts the built-infunction <code>halt_unimplemented()</code> at the point of the unimplemented instruction, and- control-flow does not fall through.+ control flow does not fall through.</para></listitem></varlistentry>@@ -2803,12 +2885,32 @@<term><emphasis role="bold">Infer constant pointers</emphasis></term><listitem><para>- When toggled <emphasis>on</emphasis>, the decompiler infers a data-type for constants+ When toggled <emphasis>on</emphasis>, the Decompiler infers a data-type for constantsit determines are likely pointers. In the basic heuristic,each constant is considered as an address, and if that address starts a known data or function elementin the program, the constant is assumed to be a pointer. The constants are treated likeany other source of data-type information, and the inferred data-types are freely propagated by- the decompiler to other parts of the function.+ the Decompiler to other parts of the function.+ </para>+ </listitem>+ </varlistentry>+ <varlistentry id="AnalysisForLoops">+ <term><emphasis role="bold">Recover -for- loops</emphasis></term>+ <listitem>+ <para>+ When toggled <emphasis>on</emphasis>, the Decompiler attempts to pinpoint+ variables that control the iteration over specific loops in the function body.+ When these <emphasis>loop</emphasis> variables are discovered, the loop is+ rendered using a standard <emphasis role="bold">for</emphasis> loop header+ that contains an initializer statement, condition, and iterating statement.+ <informalexample>+ <code>for (iVar2 = 10; iVar2 < len; iVar2 = iVar2 + 1) { ...</code>+ </informalexample>+ </para>+ <para>+ When toggled <emphasis>off</emphasis>, the loop is displayed using+ <emphasis role="bold">while</emphasis> syntax, with any initializer and+ iterating statements mixed in with the loop body or preceding basic blocks.</para></listitem></varlistentry>@@ -2816,20 +2918,20 @@<term><emphasis role="bold">Respect read-only flags</emphasis></term><listitem><para>- When toggled <emphasis>on</emphasis>, the decompiler treats any values in memory+ When toggled <emphasis>on</emphasis>, the Decompiler treats any values in memorymarked <emphasis>read-only</emphasis> as constant. If a read-only memory location is explicitlyreferenced by the function being decompiled, it is considered to be unchanging, and the initial- value present in the Program is pulled in to the data-flow of the function as a constant.+ value present in the Program is pulled into the data flow of the function as a constant.Due to <emphasis>Constant Propagation</emphasis> and other transformations, read-only memory- can have a large effect on decompiler output.+ can have a large effect on Decompiler output.</para><para>- Typically as part of the import process, Ghidra marks memory blocks as read-only if they+ Typically, as part of the import process, Ghidra marks memory blocks as read-only if theyare tagged as such by a section header or other meta-data in the original binary.Users can actively set whether specific memory regions are considered read-only through the<emphasis>Memory Manager</emphasis>, and individual data elements can be markedas <emphasis>constant</emphasis> via the <emphasis role="bold">Mutability</emphasis> setting- (See <xref linkend="AnnoteMutability"/>).+ (see <xref linkend="AnnoteMutability"/>).</para></listitem></varlistentry>@@ -2837,7 +2939,7 @@<term><emphasis role="bold">Simplify extended integer operations</emphasis></term><listitem><para>- This toggles whether the decompiler attempts to simplify double precision arithmetic operations,+ This toggles whether the Decompiler attempts to simplify double precision arithmetic operations,where a single logical operation is split into two parts, calculating the high and low piecesof the result in separate instructions. Decompiler support for this kind of transform is currentlylimited, and only certain constructions are simplified.@@ -2848,10 +2950,10 @@<term><emphasis role="bold">Simplify predication</emphasis></term><listitem><para>- When this option is active, the decompiler simplifies code sequences containing+ When this option is active, the Decompiler simplifies code sequences containing<emphasis>predicated</emphasis> instructions. A predicated instruction is executedconditionally based on a boolean value, the <emphasis role="bold">predicate</emphasis>,- and a sequence of instructions can share the same predicate. The decompiler merges the+ and a sequence of instructions can share the same predicate. The Decompiler merges theresulting <code>if/else</code> blocks that share the same predicate so that the condition is onlyprinted once.</para>@@ -2861,7 +2963,7 @@<term><emphasis role="bold">Use in-place assignment operators</emphasis></term><listitem><para>- When toggled <emphasis>on</emphasis>, the decompiler employs in-place assignment operators,+ When toggled <emphasis>on</emphasis>, the Decompiler employs in-place assignment operators,such as <code>+=</code> and <code><<=</code>, in its output syntax.</para></listitem>@@ -2874,7 +2976,7 @@<section id="DisplayOptions"><title>Display Options</title><para>- These options do not change the decompiler's analysis but only affect how the results are presented.+ These options do not change the Decompiler's analysis but only affect how the results are presented.</para><para><informalexample>@@ -2888,11 +2990,21 @@</para></listitem></varlistentry>+ <varlistentry id="DisplayColorDefault">+ <term><emphasis role="bold">Color Default</emphasis></term>+ <listitem>+ <para>+ Assign the color to any characters emitted by the Decompiler that do not fall into one of token types+ listed below. This includes delimiter characters like commas and parentheses as well as various <emphasis>operator</emphasis>+ characters.+ </para>+ </listitem>+ </varlistentry><varlistentry id="DisplayTokenColor"><term><emphasis role="bold">Color for <token></emphasis></term><listitem><para>- Assign colors to the different types of language tokens emitted by the decompiler.+ Assign colors to the different types of language tokens emitted by the Decompiler.These include:<informalexample><itemizedlist mark='bullet'>@@ -2909,21 +3021,11 @@</para></listitem></varlistentry>- <varlistentry id="DisplayColorDefault">- <term><emphasis role="bold">Color Default</emphasis></term>- <listitem>- <para>- Assign the color to any characters emitted by the decompiler that do not fall into one of token types- listed above. This includes delimiter characters like commas and parentheses as well as various <emphasis>operator</emphasis>- characters.- </para>- </listitem>- </varlistentry><varlistentry id="DisplayCurrentHighlight"><term><emphasis role="bold">Color for Current Variable Highlight</emphasis></term><listitem><para>- Assign the background color used to highlight the token currently under the cursor in a Decompiler Window.+ Assign the background color used to highlight the token currently under the cursor in a Decompiler window.</para></listitem></varlistentry>@@ -2931,8 +3033,8 @@<term><emphasis role="bold">Color for Highlighting Find Matches</emphasis></term><listitem><para>- Assign the background color used to highlight characters matching the current <emphasis>Find</emphasis> pattern.- See <xref linkend="ActionFind"/>.+ Assign the background color used to highlight characters matching the current <emphasis>Find</emphasis> pattern+ (see <xref linkend="ActionFind"/>).</para></listitem></varlistentry>@@ -2940,7 +3042,7 @@<term><emphasis role="bold">Comment line indent level</emphasis></term><listitem><para>- Set the number of characters that comment lines are indented within decompiler output. This applies only+ Set the number of characters that comment lines are indented within Decompiler output. This applies onlyto comments within the body of the function being displayed. Comments at the head of the functionare not indented.</para>@@ -2950,7 +3052,7 @@<term><emphasis role="bold">Comment style</emphasis></term><listitem><para>- Set the language syntax used to delimit comments emitted as part of decompiler output. For C and Java,+ Set the language syntax used to delimit comments emitted as part of Decompiler output. For C and Java,the choices are <code>/* C style comments */</code> and <code>// C++ style comments</code>.</para></listitem>@@ -2959,7 +3061,7 @@<term><emphasis role="bold">Disable printing of type casts</emphasis></term><listitem><para>- Set whether the syntax for <emphasis>type casts</emphasis> is emitted in decompiler output.+ Set whether the syntax for <emphasis>type casts</emphasis> is emitted in Decompiler output.If this is toggled on, type cast syntax is never displayed, even when rules of the languagerequire it. So individual statements may no longer be formally accurate.</para>@@ -2969,26 +3071,27 @@<term><emphasis role="bold">Display <kind-of> Comments</emphasis></term><listitem><para>- Set whether a specific kind of comment can be incorporated into decompiler output. Comments in- Ghidra are categorized based on their placement within the Listing Window, and the decompiler- in general tries to display comments where appropriate. See the discussion in <xref linkend="AnnoteComments"/>.- Each kind of comment has its own toggle and can be individually included or excluded from decompiler output.+ Set whether a specific type of comment should be incorporated into Decompiler output.+ Each type has its own toggle and can be individually included or excluded from Decompiler output.<informalexample><itemizedlist mark='bullet'><listitem>- <emphasis role="bold">PLATE</emphasis> - Whether plate comments <emphasis>within the body of the function</emphasis> are displayed+ <emphasis role="bold">EOL</emphasis></listitem><listitem>- <emphasis role="bold">PRE</emphasis>+ <emphasis role="bold">PLATE</emphasis> - Whether plate comments <emphasis>within the body of the function</emphasis> are displayed</listitem><listitem><emphasis role="bold">POST</emphasis></listitem><listitem>- <emphasis role="bold">EOL</emphasis>+ <emphasis role="bold">PRE</emphasis></listitem></itemizedlist></informalexample>+ A comment's type indicates how it is placed within a Listing window, not how it is placed in+ a Decompiler window. All comments within the body of the function are displayed in the same way+ by the decompiler, regardless of their type (see the discussion in <xref linkend="AnnoteComments"/>).</para></listitem></varlistentry>@@ -2996,9 +3099,9 @@<term><emphasis role="bold">Display Header comment</emphasis></term><listitem><para>- Toggle whether the decompiler emits comments at the head (before the beginning) of a function.+ Toggle whether the Decompiler emits comments at the head (before the beginning) of a function.The header is built from Plate comments placed at the <emphasis>entry point</emphasis> of the- function. See the discussion in <xref linkend="AnnoteComments"/>.+ function (see the discussion in <xref linkend="AnnoteComments"/>).The inclusion of other Plate comments is controlled by the <emphasis role="bold">Display PLATE comments</emphasis> toggle, described above.</para></listitem>@@ -3007,11 +3110,11 @@<term><emphasis role="bold">Display Line Numbers</emphasis></term><listitem><para>- Toggle whether line numbers are displayed in any Decompiler Window. If toggled- on, each Decompiler Window reserves space to display a numbers down the left- side of the window, labeling each line of output produced by the decompiler.+ Toggle whether line numbers are displayed in any Decompiler window. If toggled+ on, each Decompiler window reserves space to display a numbers down the left+ side of the window, labeling each line of output produced by the Decompiler.Line numbers are associated with the window itself and are not formally part of- the decompiler's output.+ the Decompiler's output.</para></listitem></varlistentry>@@ -3019,18 +3122,18 @@<term><emphasis role="bold">Display Namespaces</emphasis></term><listitem><para>- Control how the decompiler displays namespace information associated+ Control how the Decompiler displays namespace information associatedwith function and variable symbols. The possible settings are:<informalexample><itemizedlist mark='bullet'><listitem>- <emphasis role="bold">Always</emphasis> - Always display the entire namespace path+ <emphasis role="bold">Minimally</emphasis> - Display the minimal path that distinguishes the symbol</listitem><listitem>- <emphasis role="bold">Never</emphasis> - Never display the namespace path+ <emphasis role="bold">Always</emphasis> - Always display the entire namespace path</listitem><listitem>- <emphasis role="bold">Minimally</emphasis> - Display the minimal path that distinguishes the symbol+ <emphasis role="bold">Never</emphasis> - Never display the namespace path</listitem></itemizedlist></informalexample>@@ -3050,9 +3153,9 @@<term><emphasis role="bold">Display Warning comments</emphasis></term><listitem><para>- Toggle whether decompiler generated <emphasis>WARNING</emphasis> comments are displayed as part- of the output. The decompiler generates these comments, independent of those laid down by users, to- indicate unusual conditions or possible errors (See <xref linkend="CommentWarnings"/>).+ Toggle whether Decompiler generated <emphasis>WARNING</emphasis> comments are displayed as part+ of the output. The Decompiler generates these comments, independent of those laid down by users, to+ indicate unusual conditions or possible errors (see <xref linkend="CommentWarnings"/>).</para></listitem></varlistentry>@@ -3060,8 +3163,8 @@<term><emphasis role="bold">Font</emphasis></term><listitem><para>- Set the typeface used to render characters in any Decompiler Window. Indentation is generally clearer- using a monospaced (fixed width) font, but any font available to the system can be used. The size of+ Set the typeface used to render characters in any Decompiler window. Indentation is generally clearer+ using a monospaced (fixed-width) font, but any font available to Ghidra can be used. The size ofthe font can also be controlled from this option.</para></listitem>@@ -3070,18 +3173,18 @@<term><emphasis role="bold">Integer format</emphasis></term><listitem><para>- Set how integer constants are formatted in the decompiler output.+ Set how integer constants are formatted in the Decompiler output.The possible settings are:<informalexample><itemizedlist mark='bullet'><listitem>- <emphasis role="bold">Best Fit</emphasis> - Select the most <emphasis>natural</emphasis> representation+ <emphasis role="bold">Force Hexadecimal</emphasis> - Always use a hexadecimal representation</listitem><listitem><emphasis role="bold">Force Decimal</emphasis> - Always use a decimal representation</listitem><listitem>- <emphasis role="bold">Force Hexadecimal</emphasis> - Always use a hexadecimal representation+ <emphasis role="bold">Best Fit</emphasis> - Select the most <emphasis>natural</emphasis> representation</listitem></itemizedlist></informalexample>@@ -3095,8 +3198,8 @@<term><emphasis role="bold">Maximum characters in a code line</emphasis></term><listitem><para>- Set the maximum number of characters in a line of code emitted by the decompiler before a line break- is forced. The decompiler will not split an individual token across lines. So line breaks frequently+ Set the maximum number of characters in a line of code emitted by the Decompiler before a line break+ is forced. The Decompiler will not split an individual token across lines. So line breaks frequentlywill come before the maximum number of characters is reached, and technically a single token canextend the line beyond the maximum.</para>@@ -3107,9 +3210,9 @@<listitem><para>Set the amount of indenting used to print statements within a nested scope in the- decompiler output. Each level of nesting (for function bodies,+ Decompiler output. Each level of nesting (function bodies,loop bodies, <emphasis role="bold">if/else</emphasis> bodies, etc.)- bodies adds this number characters.+ adds this number characters.</para></listitem></varlistentry>@@ -3117,10 +3220,10 @@<term><emphasis role="bold">Print 'NULL' for null pointers</emphasis></term><listitem><para>- Set how null pointers are displayed in decompiler output. If this is toggled- on, the decompiler will print a constant pointer value of zero (a <emphasis role="bold">null</emphasis> pointer)+ Set how null pointers are displayed in Decompiler output. If this is toggled+ on, the Decompiler will print a constant pointer value of zero (a <emphasis role="bold">null</emphasis> pointer)using the special token <code>NULL</code>. Otherwise the pointer value is represented with the '0' character,- which is then type cast into a pointer.+ which is then cast to a pointer.</para></listitem></varlistentry>@@ -3129,10 +3232,10 @@<listitem><para>Set whether the <emphasis>calling convention</emphasis> is printed as part of the function- declaration in decompiler output. If this option is turned on, the name of the calling convention+ declaration in Decompiler output. If this option is turned on, the name of the calling conventionis printed just prior to the return value data-type within the function declaration. All functionsin Ghidra have an associated calling convention (or prototype model) that is used during- decompiler analysis. See the discussion in <xref linkend="ConceptPrototypeModel"/>.+ Decompiler analysis (see the discussion in <xref linkend="ConceptPrototypeModel"/>).</para></listitem></varlistentry>@@ -3144,7 +3247,7 @@<section id="ProgramOptions"><title>Program Options</title><para>- Changes to these options affect only the decompiler and only for+ Changes to these options affect only the Decompiler and only forthe current Program being analyzed.</para><para>@@ -3156,9 +3259,9 @@<listitem><para>Sets the calling convention (prototype model) used when decompiling a function where- the convention is not known (i.e. marked as "unknown"). Many architectures have multiple- calling conventions, <code>__stdcall</code>, <code>__thiscall</code> etc. See the- discussion in <xref linkend="ConceptPrototypeModel"/>.+ the convention is not known; i.e., marked as <emphasis role="bold">unknown</emphasis>. Many architectures have multiple+ calling conventions, <emphasis role="bold">__stdcall</emphasis>, <emphasis role="bold">__thiscall</emphasis>, etc.+ (see the discussion in <xref linkend="ConceptPrototypeModel"/>).</para></listitem></varlistentry>@@ -3169,7 +3272,7 @@<section id="ExtensionOptions"><title>Specification Extensions</title><para>- This tab displays elements from the Program's <emphasis>compiler specification</emphasis> and+ This entry displays elements from the Program's <emphasis>compiler specification</emphasis> and<emphasis>processor specification</emphasis> and allows the user to add or remove<emphasis role="bold">extensions</emphasis>, including prototype models, call-fixups, andcallother-fixups.@@ -3182,12 +3285,12 @@with it.</para><para>- Users can change or reimport an extension, if new information points to a better definition.+ Users can change or reimport an extension if new information points to a better definition.Users have full control over an extension, and unlike a core element, can tailor it specificallyto the Program.</para><para>- This options tab presents a table of all specification elements.+ This options entry presents a table of all specification elements.Each element, whether core or an extension, is displayed on a separate row with three columns:<informalexample><itemizedlist mark='none' spacing='compact'>@@ -3197,7 +3300,7 @@</itemizedlist></informalexample>The core elements of the specification have a blank Status column, and any extension- is labeled either as "extension" or "override".+ is labeled either as <emphasis role="bold">extension</emphasis> or <emphasis role="bold">override</emphasis>.</para><sect2 id="ExtendTypes"><title>Extension Types</title>@@ -3213,14 +3316,14 @@<term><emphasis role="bold">prototype</emphasis></term><listitem><para>- This element is a <xref linkend="ConceptPrototypeModel"/> that holds a specific named set- of parameter passing details. It- can be applied to individual functions by name, typically via the "Calling Convention" menu+ This element is a named <xref linkend="ConceptPrototypeModel"/> that holds a specific set+ of parameter-passing details. It+ can be applied to individual functions by name, typically via the <emphasis role="bold">Calling Convention</emphasis> menuin the <link xlink:href="help/topics/FunctionPlugin/Variables.htm#Edit_Function">Function Editor Dialog</link>.See the documentation on <xref linkend="AnnotePrototype"/> for how they affect decompilation.</para><para>- The XML tag, <code><prototype></code> always has a <emphasis role="bold">name</emphasis> attribute+ The XML <code><prototype></code> tag always has a <emphasis role="bold">name</emphasis> attributethat defines the formal name of the prototype model, which must be unique across all models.<programlisting><![CDATA[<prototype name="__stdcall" extrapop="unknown" stackshift="4">@@ -3267,7 +3370,7 @@<para>This element is a Callother-fixup, which can be used to substitute a specific p-codesequence for CALLOTHER p-code operations. A CALLOTHER- is a black-box, or unspecified p-code operation, see <xref linkend="ConceptCallother"/>.+ is a black-box, or unspecified p-code operation (see <xref linkend="ConceptCallother"/>).</para><para>The <code><callotherfixup></code> tag has a@@ -3316,7 +3419,7 @@<term><emphasis role="bold">extension</emphasis></term><listitem><para>- Indicates that the element is a program specific extension that has been+ Indicates that the element is a program-specific extension that has beenadded to the specification.</para></listitem>@@ -3327,7 +3430,7 @@<para>Indicates that the element, which must be a <emphasis role="bold">callotherfixup</emphasis>,is an extension that overrides a core element with the same target. The extension- effectively replaces the p-code injection of the core element with a user supplied one.+ effectively replaces the p-code injection of the core element with a user-supplied one.If this type of extension is later removed, the core element becomes active again.</para></listitem>@@ -3338,7 +3441,7 @@<para>If the user has either imported additional extensions or selected an extension for removal buthas not yet clicked the <emphasis>Apply</emphasis> button in the Options dialog, the Status column- may show one of the following values, indicating a pending change.+ may show one of the following values, indicating a pending change:<informalexample><variablelist><?dbfo list-presentation="blocks"?>@@ -3384,7 +3487,7 @@<title>Importing a New Extension</title><para>The <emphasis>Import</emphasis> button at the bottom of the- "Specification Extensions" pane allows the user to import one of the+ <emphasis role="bold">Specification Extensions</emphasis> pane allows the user to import one of thethree element types, <emphasis role="bold">prototype</emphasis>,<emphasis role="bold">callfixup</emphasis>, or <emphasis role="bold">callotherfixup</emphasis>,into the program as a new extension.@@ -3404,8 +3507,8 @@The XML file describing the extension <emphasis>must</emphasis> have one of the tags,<code><prototype></code>, <code><callfixup></code>, or <code><callotherfixup></code>,as its single root element. Users can find numerous examples within the compiler- and processor specification files that come as part of Ghidra's installation.- See <xref linkend="ConceptSpecification"/>.+ and processor specification files that come as part of Ghidra's installation+ (see <xref linkend="ConceptSpecification"/>).</para><para>In the case of <emphasis role="bold">prototype</emphasis> and <emphasis role="bold">callfixup</emphasis>@@ -3420,7 +3523,7 @@<sect2 id="ExtendRemove"><title>Removing an Extension</title><para>- The <emphasis>Remove</emphasis> button at the bottom of the "Specification Extensions" pane allows+ The <emphasis>Remove</emphasis> button at the bottom of the <emphasis role="bold">Specification Extensions</emphasis> pane allowsthe user to remove a previously installed extension. A row from the table is selected first, whichmust have a Status of <emphasis role="bold">extension</emphasis> or <emphasis role="bold">override</emphasis>.Core elements of the specification cannot be removed.@@ -3446,7 +3549,7 @@<chapter id="DecompilerWindow"><title>Decompiler Window</title><para>- To display the decompiler window, position the cursor on a+ To display the Decompiler window, position the cursor on afunction in the Code Browser, then select the<guiicon><inlinemediaobject>@@ -3455,17 +3558,17 @@<imagedata condition="withscaling" fileref="images/decompileFunction.gif" contentwidth="0.15in" contentdepth="0.15in"/></imageobject></inlinemediaobject>- </guiicon> icon from the tool bar, or the+ </guiicon> icon from the tool bar, or the<emphasis role="bold">Decompile</emphasis> option from the<emphasis role="bold">Window</emphasis> menu in the tool.</para><para>- A decompiler window always displays one <emphasis>function</emphasis> at a time.+ A Decompiler window always displays one <emphasis>function</emphasis> at a time.The initial window that comes up in the Code Browser is called the <emphasis role="bold">Main</emphasis>- window (See <xref linkend="MainWindow"/>), and it automatically decompiles and displays the function at the+ window (see <xref linkend="MainWindow"/>), and it automatically decompiles and displays the function at the<emphasis>current address</emphasis>, following the user's navigation. Other<emphasis role="bold">Snapshot</emphasis> windows can also- be opened that show different functions at the same time (See <xref linkend="Snapshot"/>). But any window+ be opened that show different functions at the same time (see <xref linkend="Snapshot"/>). But any windowonly shows one function at a time.</para><para>@@ -3512,14 +3615,14 @@one or more warnings during the process. These warnings are integrated into the output assource code comments starting with label <code>WARNING:</code>. They occur either at thebeginning of the function as part of the function header or at the point in the code directly- associated with the warning. (See <xref linkend="CommentWarnings"/>)+ associated with the warning (see <xref linkend="CommentWarnings"/>).</para></section><section id="MainWindow"><title>Main Window</title><para>- Initially pushing+ Initially pressing<guiicon><inlinemediaobject><imageobject>@@ -3527,24 +3630,24 @@<imagedata condition="withscaling" fileref="images/decompileFunction.gif" contentwidth="0.15in" contentdepth="0.15in"/></imageobject></inlinemediaobject>- </guiicon> or selecting+ </guiicon> or selecting<emphasis role="bold">Decompile</emphasis> from the <emphasis role="bold">Window</emphasis> menu in the toolbrings up the <emphasis>main</emphasis> window. The main window always displays the functionat the <emphasis>current address</emphasis> within the Code Browser and follows as the user navigateswithin the Program. Any mouse click, menu option, or other action causing the cursor to move to a newaddress in the Listing also causes the main window to display the function containing that address.Navigation to new functions is also possible from within the window by double-clicking on function- tokens (See <xref linkend="MouseActions"/>).+ tokens (see <xref linkend="MouseActions"/>).</para><sect2 id="CrossHighlighting">- <title>Cross Highlighting</title>+ <title>Cross-Highlighting</title><para>The main window maintains a map between the individual variable and operator tokens displayed in- the window and the machine instructions which correspond to them. This can give the user instant- feedback about the correspondence between the decompiler and disassembly views of the function,- and it is frequently useful to have both the Listing window and the Decompiler window side- by side. Clicking on tokens in the Decompiler window causes the Listing window to navigate+ the window and the machine instructions which correspond to them. Disassembled machine instructions+ are displayed by any Listing window, and having both a Listing and Decompiler window side by side+ lets the user see this correspondence between the decompiled and disassembled views of the function.+ Clicking on tokens in the Decompiler window causes the Listing window to navigateto the corresponding instruction, and clicking instructions in the Listing windowcauses the Decompiler window to navigate to the corresponding line. Highlighting a region ofcode in either window causes the corresponding region in the other window to be highlighted.@@ -3564,7 +3667,7 @@<emphasis>Comment</emphasis> tokens map to the machine address associated with the comment.</para><warning>- In general, the map between machine instructions and tokens is not one to one because the decompiler+ In general, the map between machine instructions and tokens is not one-to-one because the Decompilertransforms its underlying representation of the function.An instruction may no longer have any operator that corresponds to it in the decompiled result.Tokens may be transformed from the natural operation of the machine instruction they are associated@@ -3584,32 +3687,35 @@<imagedata condition="withscaling" fileref="images/camera-photo.png" contentwidth="0.15in" contentdepth="0.15in"/></imageobject></inlinemediaobject>- </guiicon> icon- in another Decompiler window's toolbar causes a <emphasis>Snapshot</emphasis> window- to be created, which initially shows decompilation of the same function. Multiple- Snapshot windows can be brought up to show decompilation of different functions+ </guiicon> icon+ in any Decompiler window's toolbar causes a <emphasis>Snapshot</emphasis> window+ to be created, which shows decompilation of the same function.+ Unlike the <emphasis>main</emphasis> window however, the <emphasis>Snapshot</emphasis> window+ does not change the function it displays in response to external navigation events.+ A Snapshot window can be used to hold a function fixed while the user navigates to+ different functions in Listing or other windows.+ </para>+ <para>+ Multiple Snapshot windows can be brought up to show decompilation of different functionssimultaneously. Snapshotwindows are visually distinguished from the <emphasis>main</emphasis> Decompiler windowby their colored outline.</para>- <para>- The Snapshot- window, unlike the <emphasis>main</emphasis> window, is not linked to the Listing window- and does not change the function it displays in response to external navigation events.- A Snapshot window can be used to hold a function fixed while the user navigates to- different functions in the Listing or other windows.- </para><para>Navigating to new functions within a Snapshot window is possible when the window is<emphasis>active</emphasis>. The window responds to the actions<informalexample><itemizedlist mark='bullet'>- <listitem>Go To ... <emphasis>(pressing the 'g' key)</emphasis></listitem>+ <listitem>Go To... <emphasis>(pressing the 'G' key)</emphasis></listitem><listitem>Go to previous location <emphasis>(Back)</emphasis></listitem><listitem>Go to next location <emphasis>(Forward)</emphasis></listitem></itemizedlist></informalexample></para>+ <para>+ Double-clicking on specific tokens within the Snapshot window may also cause it to navigate+ to a new location (see <xref linkend="MouseDouble"/>).+ </para></section><section id="UndefinedFunction">@@ -3617,7 +3723,7 @@<para>If the current location within the Code Browser is in disassembled code, but that codeis not contained in a <link linkend="AnnoteFormalFunctionBody">Formal Function Body</link>,- then the decompiler window invents a function body on the fly called an+ then the Decompiler invents a function body, on the fly, called an<emphasis role="bold">Undefined Function</emphasis>. The background color of the windowis changed to gray to indicate this special state.<mediaobject>@@ -3629,30 +3735,30 @@</para><para>The <emphasis>entry point</emphasis> address of the Undefined Function is chosen by- backtracking through the code's control-flow from the current location to the start of+ backtracking through the code's control flow from the current location to the start ofa basic block that has no flow coming in except possibly from <emphasis>call</emphasis> instructions.During decompilation, a function body is computed from the selected entry point (as with any function)- based on control-flow up to instructions with <emphasis>terminator</emphasis> semantics.+ based on control flow up to instructions with <emphasis>terminator</emphasis> semantics.</para><para>- The current address, as indicated by the cursor in the Listing Window for instance, is- generally <emphasis>not</emphasis> the entry of the invented function, but the current address will be+ The current address, as indicated by the cursor in the Listing for instance, is+ generally <emphasis>not</emphasis> the entry point of the invented function, but the current address will becontained somewhere in the body.</para><para>For display purposes in the window, the invented function is given a name based on thecomputed entry point address with the prefix <code>UndefinedFunction</code>. The functionis assigned the default calling convention, and parameters are discovered as part of- the decompiler's analysis.+ the Decompiler's analysis.</para></section><section id="ToolBar"><title>Tool Bar</title><para>- This is a group of actions that can be triggered by pressing a button in the tool/title- bar at the top of individual decompiler windows, both <emphasis>main</emphasis> and- <emphasis>Snapshot</emphasis>. The action applies to the function and decompiler results+ The following actions are available by pressing the corresponding icon in the title/tool+ bar at the top of each individual Decompiler window.+ The action applies to the function and Decompiler resultsdisplayed in that particular window.</para><sect2 id="ToolBarExport">@@ -3665,7 +3771,7 @@<imagedata condition="withscaling" fileref="images/page_edit.png" contentwidth="0.15in" contentdepth="0.15in"/></imageobject></inlinemediaobject>- </guiicon> - button+ </guiicon> - button</para><para>Exports the decompiled result of the current function to a file. A file chooser@@ -3676,7 +3782,7 @@<para>This action exports a single function at a time. The user can export all functionssimultaneously from the Code Browser, by selecting the menu- <emphasis role="bold">File -> Export Program ...</emphasis> and then choosing+ <emphasis role="bold">File -> Export Program...</emphasis> and then choosing<link xlink:href="help/topics/ExporterPlugin/exporter.htm#c_cpp">C/C++</link>from the drop-down menu. See the full documentation forthe <link xlink:href="help/topics/ExporterPlugin/exporter.htm">Export</link> dialog.@@ -3693,13 +3799,13 @@<imagedata condition="withscaling" fileref="images/camera-photo.png" contentwidth="0.15in" contentdepth="0.15in"/></imageobject></inlinemediaobject>- </guiicon> - button+ </guiicon> - button</para><para>Creates a new <emphasis>Snapshot</emphasis> window. The <emphasis>Snapshot</emphasis> window- initially displays the same function as the decompiler window on which the action was triggered,- but if that window navigates to other functions, the <emphasis>Snapshot</emphasis> does not- follow and continues to display the original function. (See <xref linkend="Snapshot"/>)+ displays the same function as the Decompiler window on which the action was triggered,+ and if that window navigates to other functions, the <emphasis>Snapshot</emphasis> does not+ follow but continues to display the original function (see <xref linkend="Snapshot"/>).</para></sect2>@@ -3713,7 +3819,7 @@<imagedata condition="withscaling" fileref="images/reload3.png" contentwidth="0.15in" contentdepth="0.15in"/></imageobject></inlinemediaobject>- </guiicon> - button+ </guiicon> - button</para><para>Triggers a re-decompilation of the current function displayed in the window.@@ -3722,8 +3828,8 @@<tip>This action is <emphasis role="bold">not</emphasis> necessary for normal reverseengineering tasks. Re-decompilation is <emphasis>automatically</emphasis> triggered for all- decompiler windows by any change to the Program, so the most up-to-date decompilation is- always available to the user without this action. This action is a primarily a debugging+ Decompiler windows by any change to the Program, so the most up-to-date decompilation is+ always available to the user without this action. This action is primarily a debuggingaid for plug-in developers.</tip></sect2>@@ -3738,17 +3844,17 @@<imagedata condition="withscaling" fileref="images/page_white_copy.png" contentwidth="0.15in" contentdepth="0.15in"/></imageobject></inlinemediaobject>- </guiicon> - button+ </guiicon> - button</para><para>- Copies the currently selected text in the decompiler window to the clipboard.+ Copies the currently selected text in the Decompiler window to the clipboard.</para></sect2><sect2 id="ToolBarDebug"><title>Debug Function Decompilation</title><para>- This action is located in the drop-down menu on the right side of the decompiler+ This action is located in the drop-down menu on the right side of the Decompilerwindow tool/title bar.</para><para>@@ -3756,7 +3862,7 @@the current function is collected and saved to an output file inXML format. A file chooser dialog is presented to the user tochoose the output file. The file is useful when submitting bug reports- about the decompiler as it is generally much smaller than+ about the Decompiler as it is generally much smaller thanthe entire Program and only contains information specific to thefunction. Information is generated by performing the fulldecompilation of the function and collecting all the data and@@ -3769,12 +3875,13 @@<sect2 id="ToolBarGraph"><title>Graph AST Control Flow</title><para>- Generate a control-flow graph based upon the results in the active Decompiler Window,+ This action is located in the drop-down menu on the right side of the Decompiler+ window tool/title bar.+ </para>+ <para>+ Generate a control-flow graph based upon the results in the active Decompiler window,and render it using the current Graph Service.</para>- <warning>- If no Graph Service is available then this action will not be present.- </warning></sect2></section>@@ -3782,14 +3889,14 @@<section id="MouseActions"><title>Mouse Actions</title><sect2 id="MouseLeft">- <title>Left Click</title>+ <title>Left-Click</title><para>- Moves the decompiler window cursor and highlights the token. Within the+ Moves the Decompiler window cursor and highlights the token. Within the<emphasis>main</emphasis> window, if a token has a machine address- associated with it, a left click generates a+ associated with it, a left-click generates a<emphasis>navigation</emphasis> event to that address, which may cause other- windows to display code near that address.- (See <xref linkend="CrossHighlighting"/>)+ windows to display code near that address+ (see <xref linkend="CrossHighlighting"/>).</para><para>Selecting a '(' or ')' token causes it and its matching parenthesis to be@@ -3801,28 +3908,33 @@</sect2><sect2 id="MouseRight">- <title>Right Click</title>+ <title>Right-Click</title><para>- Moves the decompiler window cursor, highlights the token, and brings up the menu of- context sensitive actions. Any highlighting and navigation is identical to a- left click. The menu actions presented depend primarily on the token type and+ Moves the Decompiler window cursor, highlights the token, and brings up the menu of+ context-sensitive actions. Any highlighting and navigation is identical to a+ left-click. The menu actions presented depend primarily on the token type andare tailored to the context at that point in the code.</para></sect2><sect2 id="MouseDouble">- <title>Double Click</title>+ <title>Double-Click</title><para>- Navigates based on the selected symbol or other token (See below). If the selected token represents a formal symbol,- such as a function name or a global variable, double clicking causes a+ Navigates based on the selected symbol or other token (see below).+ If the selected token represents a formal symbol,+ such as a function name or a global variable, double-clicking causes a<emphasis>navigation</emphasis> event to the address associated with the symbol.+ </para>+ <para>+ This action is performed by clicking twice on the desired token with the <emphasis>left</emphasis>+ mouse button.<informalexample><variablelist><?dbfo list-presentation="blocks"?><varlistentry><term><emphasis role="bold">Function Symbols</emphasis></term><listitem><para>- Double clicking a called function name causes the+ Double-clicking a called function name causes thewindow itself to navigate away from its current function to the called function, triggeringa new decompilation if necessary and changing its display.</para></listitem>@@ -3830,24 +3942,24 @@<varlistentry><term><emphasis role="bold">Global Variables</emphasis></term><listitem><para>- Double clicking a global- variable name does <emphasis>not</emphasis> have any effect on the decompiler window itself,- but <emphasis>other</emphasis> windows, like the Listing window, may navigate to the+ Double-clicking a global+ variable name does <emphasis>not</emphasis> have any effect on the Decompiler window itself,+ but Listing or <emphasis>other</emphasis> windows may navigate to thestorage address of the global variable.</para></listitem></varlistentry><varlistentry><term><emphasis role="bold">Constants</emphasis></term><listitem><para>- Double clicking a token representing a constant causes the constant to be treated- as an address, and a navigation event to that address is generated. The decompiler+ Double-clicking a token representing a constant causes the constant to be treated+ as an address, and a navigation event to that address is generated. The Decompilerwindow itself navigates depending again on whether the address represents a new function or not.</para></listitem></varlistentry><varlistentry><term><emphasis role="bold">Labels</emphasis></term><listitem><para>- Double clicking the label within a <emphasis>goto</emphasis> statement causes the window to navigate+ Double-clicking the label within a <emphasis>goto</emphasis> statement causes the window to navigateto the target of the goto, within the function. The cursor is set and the window view is adjusted ifnecessary to ensure that the target is visible.</para></listitem>@@ -3855,7 +3967,7 @@<varlistentry><term><emphasis role="bold">Braces</emphasis></term><listitem><para>- Double clicking a '{' or '}' token, causes the window to navigate to the <emphasis>matching</emphasis> brace+ Double-clicking a '{' or '}' token, causes the window to navigate to the <emphasis>matching</emphasis> bracewithin the window. The cursor is set and the window view is adjusted ifnecessary to ensure that the matching brace is visible.</para></listitem>@@ -3866,32 +3978,40 @@</sect2><sect2 id="MouseControlDouble">- <title>Control Double Click</title>+ <title>Ctrl-Double-Click</title><para>Opens a new <emphasis>Snapshot</emphasis> window, navigating it to the selected symbol.This is a convenience for immediately decompiling and displaying a called function in anew window, without disturbing the active window. The behavior is similar to the- Double Click action, the selected token must represent a function name symbol or possibly+ Double-Click action, the selected token must represent a function name symbol or possiblya constant address, but the navigation occurs in the new Snapshot window.</para>+ <para>+ This action is performed by clicking twice on the desired token with the <emphasis>left</emphasis>+ mouse button, while holding down the <emphasis>Ctrl</emphasis> key.+ </para></sect2><sect2 id="MouseControlShift">- <title>Control Shift Click</title>+ <title>Ctrl-Shift-Click</title><para>Generates a navigation event to the address, within the current function, associated withthe clicked token. This allows <emphasis>Snapshot</emphasis> windows to do basic- cross-highlighting in the same way as the <emphasis>main</emphasis> decompiler window.- A Control double-click causes the Listing and other windows to navigate to and display the same- portion of code currently being displayed in the Snapshot window. (See <xref linkend="CrossHighlighting"/>)+ cross-highlighting in the same way as the <emphasis>main</emphasis> Decompiler window.+ A ctrl-shift-click causes Listing and other windows to navigate to and display the same+ portion of code currently being displayed in the Snapshot window (see <xref linkend="CrossHighlighting"/>).+ </para>+ <para>+ This action is performed by clicking on the desired token with the <emphasis>left</emphasis> mouse+ button, while holding down both the <emphasis>Ctrl</emphasis> and <emphasis>Shift</emphasis> keys.</para></sect2><sect2 id="MouseMiddle">- <title>Middle Click</title>+ <title>Middle-Click</title><para>- Highlights every occurrence of a variable, constant, or operator under the current- cursor location, within the decompiler window.+ Highlights every occurrence of a variable, constant, or operator represented by the selected+ token, within the Decompiler window.</para></sect2>@@ -3901,8 +4021,8 @@<title>Pop-up Menu Actions</title><para>All the actions described in this section can be activated from the menu that pops up- when right-clicking on a token within the decompiler window. The pop-up menu is context sensitive and- the type of token in particular (See <xref linkend="DecompilerDisplay"/>) determines what actions are available.+ when right-clicking on a token within the Decompiler window. The pop-up menu is context sensitive and+ the type of token in particular (see <xref linkend="DecompilerDisplay"/>) determines what actions are available.The token clicked provides a local context for the action and may be used to pinpoint the exactvariable or operation affected.</para>@@ -3916,7 +4036,7 @@<para>The <emphasis>structure</emphasis> definition is filled in by examining how the variableis used, assuming it is a pointer to the <emphasis>structure</emphasis>, tracing- data-flow to all the expressions the variable is used in. LOAD and STORE operations+ data flow to all the expressions the variable is used in. LOAD and STORE operationstrigger new <emphasis>fields</emphasis> and additive offsets are traced to calculatethe offset of the fields within the <emphasis>structure</emphasis> definition.</para>@@ -3925,8 +4045,8 @@retyped to be a pointer to the <emphasis>structure</emphasis>. Within the window,the function is decompiled again and references to new fields in the structureshould be immediately apparent. These can be renamed or retyped from the window- to further refine the new <emphasis>structure</emphasis> definition.- (See <xref linkend="ActionRenameVariable"/>)+ to further refine the new <emphasis>structure</emphasis> definition+ (see <xref linkend="ActionRenameVariable"/>).</para><informalexample><variablelist>@@ -3958,31 +4078,39 @@<para>Set or change a comment at the address of the selected token.</para><para>- These actions bring up the general Comment dialog (See <link xlink:href="help/topics/CommentsPlugin/Comments.htm">Comments</link>),- which associates the comment with a specific <emphasis>address</emphasis> in the Program. For the- decompiler actions, this address is of the machine instruction most closely linked to the selected token.- Comments will be visible in the Listing and other Ghidra windows viewing the same+ These actions bring up the general Comment dialog (see <link xlink:href="help/topics/CommentsPlugin/Comments.htm">Comments</link>),+ which associates the comment with a specific <emphasis>address</emphasis> in the Program. For comment+ actions in the Decompiler, this address is of the machine instruction most closely linked to the selected token.+ Any comments generated from a Decompiler window will be visible in Listing and other windows viewing the samesection of code.</para><para>- The decompiler windows can display all comment types, but this may be affected by the Display options- (See <xref linkend="AnnoteComments"/>).+ A Decompiler window can display all comment types, but this may be affected by the Display options+ (see <xref linkend="AnnoteComments"/>).</para><informalexample><variablelist><?dbfo list-presentation="blocks"?><varlistentry>- <term><emphasis role="bold">Set Plate Comment ...</emphasis></term>+ <term><emphasis role="bold">Set Plate Comment...</emphasis></term><listitem><para>Brings up the dialog for setting or editing a <emphasis>Plate</emphasis> comment.</para></listitem></varlistentry><varlistentry>- <term><emphasis role="bold">Set Pre Comment ...</emphasis></term>+ <term><emphasis role="bold">Set Pre Comment...</emphasis></term><listitem><para>Brings up the dialog for setting or editing a <emphasis>Pre</emphasis> comment.</para></listitem></varlistentry>+ <varlistentry>+ <term><emphasis role="bold">Set...</emphasis></term>+ <listitem><para>+ Brings up the dialog for setting or editing a comment based on the selected token.+ A <emphasis>Plate</emphasis> comment is edited if the token is part+ of the function's header. A <emphasis>Pre</emphasis> comment is edited otherwise.+ </para></listitem>+ </varlistentry></variablelist></informalexample></sect2>@@ -3990,49 +4118,49 @@<sect2 id="ActionCommitLocals"><title>Commit Local Names</title><para>- Commit the names of any local variables discovered during the decompiler's analysis+ Commit the names of any local variables discovered during the Decompiler's analysisto the Program database as new Variable Annotations. The recovered data-type isnot committed as part of the annotation, only the name and storage location.</para><para>- Parameters are not affected by this command, see <xref linkend="ActionCommitParams"/>.+ Parameters are not affected by this command (see <xref linkend="ActionCommitParams"/>).The purpose of the command is to synchronize the local variables in the- decompiler's view of a function with the formal Variable Annotations in the disassembly view,+ Decompiler's view of a function with the formal Variable Annotations in the disassembly view,without otherwise affecting the decompilation. After executing this command, additional changes- to local variable can be performed directly on the corresponding annotations in the Listing Window,- using various methods (See <xref linkend="AnnoteVariables"/>).+ to local variables can be performed directly on the corresponding annotations displayed in Listing windows,+ using various methods (see <xref linkend="AnnoteVariables"/>).Data-types are not forced for new annotations, they are created with- an <emphasis>undefined</emphasis> data-type, which allows the decompiler to refine+ an <emphasis>undefined</emphasis> data-type, which allows the Decompiler to refineits view of the variable's data-type as new information becomes available- (See <xref linkend="AnnoteForcing"/>).+ (see <xref linkend="AnnoteForcing"/>).</para></sect2><sect2 id="ActionCommitParams"><title>Commit Params/Return</title><para>- Commit the decompiler's analysis of the input parameters and return value of the current+ Commit the Decompiler's analysis of the input parameters and return value of the currentfunction as annotations to the Program database.</para><para>- In the absence of either <emphasis>imported</emphasis> or <emphasis>user defined</emphasis>- information about a function's prototype, the decompiler performs its own analysis of what+ In the absence of either <emphasis>imported</emphasis> or <emphasis>user-defined</emphasis>+ information about a function's prototype, the Decompiler performs its own analysis of whatthe prototype is, determining the storage location and data-type of all parameters and thereturn value. This action commits this analysis permanently for the current functiondisplayed in the window, creating a matching <emphasis>Variable Annotation</emphasis> for each input- parameter and the return value. The new annotations will be displayed in the- Listing Window as part of the function header, and the action effectively- <emphasis>synchronizes</emphasis> the disassembly view and decompiler's view of the function prototype.+ parameter and the return value. The new annotations will be displayed in a+ Listing window as part of the function header, and the action effectively+ <emphasis>synchronizes</emphasis> the disassembly view and Decompiler's view of the function prototype.</para><para>Committed prototype information is used both when decompiling the function itself and when- decompiling other functions that call it.- The committed annotations are <emphasis>forcing</emphasis> on the decompiler, and it will- no longer perform prototype recovery analysis for that function. The decompiler assumes the committed parameters,+ decompiling other functions that call it. The committed annotations are <emphasis>forcing</emphasis>+ on the Decompiler (see <xref linkend="AnnoteForcing"/>), and it will+ no longer perform prototype recovery analysis for that function. The Decompiler assumes the committed parameters,and only the committed parameters, exist and will not modify their data-types, with theexception of parameters that are explicitly marked as having an <emphasis>undefined</emphasis>data-type. The user must manually modify individual variables or clear the entire prototype- if they want a change (See <xref linkend="AnnoteVariables"/>).+ if they want a change (see <xref linkend="AnnoteVariables"/>).</para></sect2>@@ -4075,10 +4203,10 @@<para>This command primarily targets a constant token in the Decompiler window, butif there is a <emphasis>scalar</emphasis> operand in an instruction that corresponds- with the selected constant, the same conversion is also applied to the scalar in the Listing+ with the selected constant, the same conversion is also applied to the scalar in any Listingwindow. This is equivalent to selecting the- <link xlink:href="help/topics/EquatePlugin/Equates.htm#Convert">Convert</link> command from the- Listing. There may not be a scalar operand directly corresponding to the selected constant, in+ <link xlink:href="help/topics/EquatePlugin/Equates.htm#Convert">Convert</link> command from a+ Listing window. There may not be a scalar operand directly corresponding to the selected constant, inwhich case the conversion will be applied only in the Decompiler window.</para><para>@@ -4094,13 +4222,13 @@</sect2><sect2 id="ActionCopy">- <title>Copy/Copy Special ...</title>+ <title>Copy</title><para>- Copy selected code from the decompiler window into the clipboard.+ Copy selected code from the Decompiler window into the clipboard.</para><para>This is part of the standard copy- capabilities for all Ghidra windows and is suitable for copying (sections of) decompiler output+ capabilities for all Ghidra windows and is suitable for copying (sections of) Decompiler outputinto other documents.</para></sect2>@@ -4119,7 +4247,7 @@<link xlink:href="help/topics/DataTypeEditors/EnumEditor.htm">Enum Editor</link>.</para><para>- Any change to the definition of the data-type is automatically incorporated by the decompiler into its output+ Any change to the definition of the data-type is automatically incorporated by the Decompiler into its output(see <xref linkend="AnnoteDatatype"/>).</para></sect2>@@ -4131,7 +4259,7 @@details about how it passes parameters.</para><para>- The action is available from any token in the decompiler window. Most tokens trigger editing+ The action is available from any token in the Decompiler window. Most tokens trigger editingof the current function itself, but a called function can be edited by putting the cursor onits name specifically.</para>@@ -4163,14 +4291,14 @@<para>See documentation for the<link xlink:href="help/topics/FunctionPlugin/Variables.htm#Edit_Function">Function Editor Dialog</link>.- The decompiler automatically incorporates any changes into its output.+ The Decompiler automatically incorporates any changes into its output.</para></sect2><sect2 id="ActionFind">- <title>Find ...</title>+ <title>Find...</title><para>- Search for strings within the active window, in the current decompiler output.+ Search for strings within the active window, in the current Decompiler output.</para><para>The command brings up a dialog where a search pattern can entered as a raw string or regular expression.@@ -4184,8 +4312,8 @@<sect2 id="ActionHighlight"><title>Highlight</title><para>- All these actions highlight a specific set of variable tokens tracing the data-flow- of the selected variable within the current function. Data-flow is the directed flow+ All these actions highlight a specific set of variable tokens tracing the <emphasis role="bold">data flow</emphasis>+ of the selected variable within the current function, defined as the directed flowof data from input variables through operations that manipulate their value to theiroutput variables. The operations and variables chain together to form data-flow<emphasis>paths</emphasis>.@@ -4275,7 +4403,7 @@<sect2 id="ActionSecondaryHighlight"><title>Secondary Highlight</title><para>- A <emphasis>secondary highlight</emphasis> is a semi-permanent token highlight in the decompiler+ A <emphasis>secondary highlight</emphasis> is a semi-permanent token highlight in the Decompilerwindow that, unlike normal highlights, will not go away as the user clicks other tokens.The color and text being highlighted is controlled by the user and will persist for<emphasis role="bold">for the duration of the Ghidra session</emphasis> or until the user@@ -4326,30 +4454,32 @@Override the function prototype corresponding to the function under the cursor.</para><para>- This action can be triggered at <emphasis>call sites</emphasis>, where the function+ This action can be triggered at a <emphasis>call site</emphasis>, where the functionbeing decompiled is calling into another function. Users must select either the token representing- the called function's name or the tokens representing the function pointer at the call site.- A dialog is brought up where the a complete <emphasis>function declaration</emphasis>, specifying- the return data-type along with the name and data-type for each input parameter. Additionally,- the "Calling Convention", "In Line", and "No Return" properties of the function prototype- can be set (See <xref linkend="AnnotePrototype"/>).+ the called function's name or one of the tokens representing the function pointer at the call site.+ The action brings up a dialog where the <emphasis>function prototype</emphasis>+ corresponding to the call site can be edited. The dialog provides fine-grained control of+ the return data-type along with the name and data-type of each input parameter.+ The function prototype properties <emphasis role="bold">Calling Convention</emphasis>,+ <emphasis role="bold">In Line</emphasis>, and <emphasis role="bold">No Return</emphasis>+ can also be set (see <xref linkend="AnnotePrototype"/>).</para><para>- Confirming the dialog forces the new function prototype on the decompiler's view of the called function,+ Confirming the dialog forces the new function prototype on the Decompiler's view of the called function,but only for the single selected call site.</para><para>This action is suitable for either indirect calls or direct calls to functions taking a variable numberof arguments; situations where a complete description of all parameters is not available.For direct calls with a fixed number of arguments, it is almost always better to provide- parameter information by setting the function's prototype directly. See the- <xref linkend="ActionCommitParams"/> command for instance. In this situation, the "Override Signature"+ parameter information by setting the function's prototype directly (see the+ <xref linkend="ActionCommitParams"/> command). In this situation, the "Override Signature"command is still possible, but it will bring up a confirmation dialog.</para></sect2><sect2 id="ActionReference">- <title>Reference ...</title>+ <title>References</title><sect3 id="ActionFindUses"><title>Find Uses of <data-type></title><para>@@ -4363,7 +4493,7 @@References to parameters and global variables are always listed.If the <emphasis>Dynamic Data Type Discovery</emphasis> option is on(see <link xlink:href="help/topics/LocationReferencesPlugin/Location_References.html#Data_Types">To Find Location References to Data Types</link>),- the decompiler's propagation analysis is invoked on all functions to discover local+ the Decompiler's propagation analysis is invoked on all functions to discover localvariables as well.</para></sect3>@@ -4420,7 +4550,7 @@prototype was previously placed by the <xref linkend="ActionOverrideSignature"/> command. As withthis command, users must select either the token representing the called function's name or thetokens representing the function pointer at the call site. The action causes the- override to be removed immediately. Parameter information will be drawn from the decompiler's+ override to be removed immediately. Parameter information will be drawn from the Decompiler'snormal analysis.</para></sect2>@@ -4432,7 +4562,7 @@</para><para>The current function can be renamed by selecting the name token within the function's- declaration at the top of the decompiler window, or individual called functions+ declaration at the top of the Decompiler window, or individual called functionscan be renamed by selecting their name token within a call expression.This action brings up a dialog containing a text field prepopulated with thename to be changed. The current namespace (and any parent namespaces) is@@ -4442,8 +4572,8 @@</para><para>A new or child namespace can- be specified by prepending the base name with the namespace using the C++ '::'- separator characters. Any namespace path entered this way is considered relative+ be specified by prepending the base name with the namespace using the C++ "::"+ delimiter characters. Any namespace path entered this way is considered relativeto the namespace set in the drop-down menu, so the <emphasis role="bold">Global</emphasis>namespace may need to be selected if the user wants to specify an absolute path. Ifany path element of the namespace does not exist, it is created.@@ -4454,22 +4584,6 @@</para></sect2>-<sect2 id="ActionRenameLabel">- <title>Rename Label</title>- <para>- Rename the label corresponding to the token under the cursor.- </para>- <para>- A label can be renamed by triggering this action while the corresponding label token is- under the cursor. This action brings up the- <a href="help/topics/LabelMgrPlugin/Labels.htm#AddEditDialog">Edit Label Dialog</a>.- </para>- <para>- The change will be immediately visible across all references to the label- (including in any Decompiler, Listing, and Functions windows).- </para>-</sect2>-<sect2 id="ActionRenameField"><title>Rename Field</title><para>@@ -4483,8 +4597,9 @@</para><para>If the initial name looks like <code>field_0x..</code>, it may be that the field offset was- discovered by the decompiler, and the field does not exist in the structure definition.- In this case, a new field is created at that offset, with the new name and a data-type of "undefined".+ discovered by the Decompiler, and the field does not exist in the structure definition.+ In this case, a new field is created at that offset, with the new name and a data-type of+ <emphasis role="bold">undefined</emphasis>.</para><para>The change to the definition is visible globally@@ -4492,7 +4607,7 @@is triggered again to incorporate the new name, but the output is otherwise unaffected.</para><para>- Within a decompiler window, field name tokens are presented <emphasis>in context</emphasis>,+ Within a Decompiler window, field name tokens are presented <emphasis>in context</emphasis>,showing how they are used within the code flow of the current function.Combined with <xref linkend="ActionAutoStructure"/> and<xref linkend="ActionRetypeField"/>, this action allows a@@ -4514,19 +4629,35 @@</para><para>A new or child namespace can- be specified by prepending the base name with the namespace using the C++ '::'- separator characters. Any namespace path entered this way is considered relative+ be specified by prepending the base name with the namespace using the C++ "::"+ delimiter characters. Any namespace path entered this way is considered relativeto the namespace set in the drop-down menu, so the <emphasis role="bold">Global</emphasis>namespace may need to be selected if the user wants to specify an absolute path. Ifany path element of the namespace does not exist, it is created.</para><para>The change will be immediately visible across all references to the variable,- including the Decompiler and Listing windows. A new decompilation is triggered+ including in Decompiler and Listing windows. A new decompilation is triggeredto incorporate the new name, but the output is otherwise unaffected.</para></sect2>+<sect2 id="ActionRenameLabel">+ <title>Rename Label</title>+ <para>+ Rename the label corresponding to the token under the cursor.+ </para>+ <para>+ A label can be renamed by triggering this action while the corresponding label token is+ under the cursor. This action brings up the+ <link xlink:href="help/topics/LabelMgrPlugin/Labels.htm#AddEditDialog">Edit Label Dialog</link>.+ </para>+ <para>+ The change will be immediately visible across all references to the label+ (including in any Decompiler, Listing, and Functions windows).+ </para>+</sect2>+<sect2 id="ActionRenameVariable"><title>Rename Variable</title><para>@@ -4543,11 +4674,11 @@change, but otherwise the the output is unaffected.</para><para>- Local variables and parameters presented by the decompiler may be invented on-the-fly+ Local variables and parameters presented by the Decompiler may be invented on-the-flyand don't necessarily have a formal annotation in Ghidra(see <xref linkend="AnnoteVariables"/>). Performing this action ona variable will create an annotation if one didn't exist previously, which will- generally be visible as part of the function header in the Listing window.+ generally be visible as part of the function header in any Listing window.A new annotation will <emphasis>not</emphasis> commit the data-type of the variable,and data-types applied later, and elsewhere in the function, can still propagate intothe variable.@@ -4576,7 +4707,7 @@<para>The change to the definition is visible globally throughout the Program,anywhere the data-type is referenced, and is <emphasis>forcing</emphasis>- on the decompiler (see <xref linkend="AnnoteForcing"/>). Decompilation is triggered+ on the Decompiler (see <xref linkend="AnnoteForcing"/>). Decompilation is triggeredagain, and the new data-type is propagated from the point of the field reference(s).Changes to the output may be large and indirect.</para>@@ -4595,7 +4726,7 @@</para><para>The change is visible globally throughout the Program, anywhere the variable is- referenced, and is <emphasis>forcing</emphasis> on the decompiler+ referenced, and is <emphasis>forcing</emphasis> on the Decompiler(see <xref linkend="AnnoteForcing"/>). Decompilation is triggeredagain, and the new data-type is propagated from the variable reference(s).Changes to the output may be large and indirect.@@ -4609,7 +4740,7 @@</para><para>This action is only available from the data-type token in the function declaration, at the- top of the decompiler's output. It brings up a dialog prepopulated with the current+ top of the Decompiler's output. It brings up a dialog prepopulated with the currentdata-type returned by the function. The user can select any fixed length data-type in the Program.Editing and confirming this dialog immediately changes the data-type. If an annotation forthe return value (named <code><RETURN></code>) did not exist previously, one is created.@@ -4624,7 +4755,7 @@<para>Setting a data-type on the return value using this action affects decompilation for thefunction itself and, additionally, any function that calls this function. Within a calling- function, the decompiler propagates the data-type into the variable or expression incorporating+ function, the Decompiler propagates the data-type into the variable or expression incorporatingthe return value at each call site.</para></sect2>@@ -4641,17 +4772,17 @@the data-type.</para><para>- The change to the data-type is <emphasis>forcing</emphasis> on the decompiler+ The change to the data-type is <emphasis>forcing</emphasis> on the Decompiler(see <xref linkend="AnnoteForcing"/>). Decompilation is triggered again, and the newdata-type is propagated from the variable reference(s). Changes to the output may belarge and indirect.</para><para>- Local variables and parameters presented by the decompiler may be invented on-the-fly+ Local variables and parameters presented by the Decompiler may be invented on-the-flyand don't necessarily have a formal annotation in Ghidra(see <xref linkend="AnnoteVariables"/>). Performing this action on a variablewill create an annotation if one didn't exist previously, which will generally be- visible as part of the function header in the Listing window.+ visible as part of the function header in any Listing window.</para><para>Performing this action on a function parameter causes a formal annotation to@@ -4668,7 +4799,7 @@</sect2><sect2 id="ActionSetEquate">- <title>Set Equate ...</title>+ <title>Set Equate...</title><para>Change the display of the integer or character constant under the cursor to an <emphasis>equate</emphasis>string.@@ -4685,12 +4816,12 @@OK, completes the action, and the selected equate is substituted for its constant.</para><para>- This command primarily targets a constant token in the Decompiler window, but+ This command primarily targets a constant token in a Decompiler window, butif there is a <emphasis>scalar</emphasis> operand in an instruction that corresponds- with the selected constant, the same equate is also applied to the scalar in the Listing+ with the selected constant, the same equate is also applied to the scalar in any Listingwindow. This is equivalent to selecting the- <link xlink:href="help/topics/EquatePlugin/Equates.htm#Set_Equate">Set Equate</link> command from the- Listing. There may not be a scalar operand directly corresponding to the selected constant, in+ <link xlink:href="help/topics/EquatePlugin/Equates.htm#Set_Equate">Set Equate</link> command from a+ Listing window. There may not be a scalar operand directly corresponding to the selected constant, inwhich case the equate will be applied only in the Decompiler window.</para><para>@@ -4706,11 +4837,11 @@possible range.</para><para>- The decompiler defines high-level variables in terms of <link linkend="ConceptVarnode">varnodes</link> that+ The Decompiler defines high-level variables in terms of <link linkend="ConceptVarnode">varnodes</link> thatare merged together to produce the final variable. Some merging is speculative, which reduces thenumber of variables overall, but is not strictly necessary for valid decompilation. The merged- variable can be represented with two or more variables that have a smaller range. See the- documentation on <xref linkend="ConceptHighVariable"/>.+ variable can be represented with two or more variables that have a smaller range (see the+ documentation on <xref linkend="ConceptHighVariable"/>).</para><para>This command is only available if the selected token is part of a high-level variable that hasdiff --git a/Ghidra/Features/Decompiler/src/main/doc/decompileplugin_common.xsl b/Ghidra/Features/Decompiler/src/main/doc/decompileplugin_common.xslindex 3bc53ab61b..558da89ea8 100644--- a/Ghidra/Features/Decompiler/src/main/doc/decompileplugin_common.xsl+++ b/Ghidra/Features/Decompiler/src/main/doc/decompileplugin_common.xsl@@ -32,13 +32,13 @@<l:template name="table" text="the table titled “%t”"/></l:context><l:context name="xref">- <l:template name="sect1" text="“%t”"/>- <l:template name="sect2" text="“%t”"/>- <l:template name="sect3" text="“%t”"/>- <l:template name="sect4" text="“%t”"/>- <l:template name="sect5" text="“%t”"/>- <l:template name="section" text="“%t”"/>- <l:template name="simplesect" text="“%t”"/>+ <l:template name="sect1" text="%t"/>+ <l:template name="sect2" text="%t"/>+ <l:template name="sect3" text="%t"/>+ <l:template name="sect4" text="%t"/>+ <l:template name="sect5" text="%t"/>+ <l:template name="section" text="%t"/>+ <l:template name="simplesect" text="%t"/></l:context></l:l10n></l:i18n>diff --git a/Ghidra/Features/Decompiler/src/main/doc/decompileplugin_pdf.xsl b/Ghidra/Features/Decompiler/src/main/doc/decompileplugin_pdf.xslindex c9a5c088ac..e315726e5c 100644--- a/Ghidra/Features/Decompiler/src/main/doc/decompileplugin_pdf.xsl+++ b/Ghidra/Features/Decompiler/src/main/doc/decompileplugin_pdf.xsl@@ -6,6 +6,25 @@<xsl:include href="decompileplugin_common.xsl" />+<!-- Turn on italics for cross-references -->+<xsl:template match="sect1|sect2|sect3|sect4|sect5|section|simplesect"+ mode="insert.title.markup">+ <xsl:param name="purpose"/>+ <xsl:param name="xrefstyle"/>+ <xsl:param name="title"/>++ <xsl:choose>+ <xsl:when test="$purpose = 'xref'">+ <fo:inline font-style="italic">+ <xsl:copy-of select="$title"/>+ </fo:inline>+ </xsl:when>+ <xsl:otherwise>+ <xsl:copy-of select="$title"/>+ </xsl:otherwise>+ </xsl:choose>+</xsl:template>+<xsl:param name="fop1.extensions" select="1"/> <!-- Use fop extensions when converting to pdf --><xsl:param name="alignment" select="'left'"/> <!-- Justify normal text (only) on the left -->diff --git a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerAnnotations.html b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerAnnotations.htmlindex 101ef19df7..da482eee40 100644--- a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerAnnotations.html+++ b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerAnnotations.html@@ -22,34 +22,35 @@<p>Individual <span class="bold"><strong>machine instructions</strong></span>make up the biggest source of information when the- decompiler analyzes a function. Instructions are translated from their- processor specific form into Ghidra's IR language (see <a class="xref" href="DecompilerConcepts.html#ConceptPcode" title="P-code">“P-code”</a>),+ Decompiler analyzes a function. Instructions are translated from their+ processor-specific form into Ghidra's IR language (see <a class="xref" href="DecompilerConcepts.html#ConceptPcode" title="P-code">P-code</a>),which provides both the control-flow behavior of the instruction and the detailed- semantics describing how the processor and memory state is affected. The translation is controlled by+ semantics describing how the processor and memory state are affected. The translation is controlled bythe underlying processor model and, except in limited circumstances, cannot be directly altered- from the tool. Flow Overrides (see below) can change how certain control-flow is translated,- and, depending on the processor, context registers may affect p-code (see <a class="xref" href="DecompilerAnnotations.html#AnnoteContextRegister" title="Context Registers">“Context Registers”</a>).+ from the tool. Flow Overrides (see below) can change how certain control flow is translated+ and, depending on the processor, how context registers affect p-code (see <a class="xref" href="DecompilerAnnotations.html#AnnoteContextRegister" title="Context Registers">Context Registers</a>).</p><p>Outside of the tool, users <span class="emphasis"><em>can</em></span> modify the model specification itself.- See the document "SLEIGH: A Language for Rapid Processor Specification".+ See the document "SLEIGH: A Language for Rapid Processor Specification."</p><p>- Decompiling a function starts by analyzing control-flow starting from the function's- first instruction. Control-flow is traced to additional instructions using flow information- from the underlying processor model. All paths are traced through instructions with- <span class="emphasis"><em>fall through</em></span>, <span class="emphasis"><em>conditional jump</em></span>, and other+ Decompiling a function starts by analyzing the control flow of machine instructions.+ Control flow is traced from the first instruction, through additional instructions depending+ on their flow semantics (see <a class="xref" href="DecompilerConcepts.html#ConceptControlFlow" title="P-code Control Flow">P-code Control Flow</a>). All paths are traced through instructions with+ any form of <span class="emphasis"><em>fall-through</em></span> or <span class="emphasis"><em>jump</em></span>semantics until an instruction with <span class="emphasis"><em>terminator</em></span> semantics is- reached, which is usually a "return from subroutine"- instruction. Flow is not traced into called functions, in this situation. Instructions+ reached, which is usually a formal <span class="emphasis"><em>return</em></span> (return from subroutine) instruction.+ Flow is not traced into called functions, in this situation. Instructionswith <span class="emphasis"><em>call</em></span> semantics are treated only as if they fall through.</p><p>- An <span class="bold"><strong>entry point</strong></span> is the address of the function's first instruction.+ An <span class="bold"><strong>entry point</strong></span> is the address of the instruction first+ executed when the function is called.</p><p>A <span class="bold"><strong>function body</strong></span> is the set of addresses reached by control-flow- analysis (and the machine instructions at those addresses).+ analysis and the machine instructions at those addresses.</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title">@@ -57,21 +58,21 @@<p>The <span class="emphasis"><em>entry point</em></span> address for a function plays a pivotal role for- analysis using the Ghidra decompiler. Ghidra generally associates+ analysis using the Decompiler. Ghidra generally associatesa formal <span class="emphasis"><em>Function Symbol</em></span> and an underlying<span class="emphasis"><em>Function</em></span> object at this address, which are the key elements that- need to be present to trigger decompilation.- (See <a class="ulink" href="help/topics/FunctionPlugin/Functions.htm" target="_top">Functions</a>)+ need to be present to trigger decompilation+ (see <a class="ulink" href="help/topics/FunctionPlugin/Functions.htm" target="_top">Functions</a>).The Function object stores the function body, parameters, local variables, andother information critical to the decompilation process.</p><p>Function Symbols and Function objects are generally created automatically by a Ghidra- analyzer when initially importing a binary executable and running auto-analysis.- If necessary however, a user can manually create a Function object from the Listing window- by using <span class="emphasis"><em>Create Function</em></span> command (pressing the 'f' key), when the cursor- is placed on the function's entry point.- (See <a class="ulink" href="help/topics/FunctionPlugin/Functions.htm#Create_Function" target="_top">Create Function</a>)+ analyzer when initially importing a binary executable and running Auto Analysis.+ If necessary, however, a user can manually create a Function object from a Listing window+ by using the <span class="emphasis"><em>Create Function</em></span> command (pressing the 'F' key), when the cursor+ is placed on the function's entry point+ (see <a class="ulink" href="help/topics/FunctionPlugin/Functions.htm#Create_Function" target="_top">Create Function</a>).</p></div><div class="sect2">@@ -92,11 +93,11 @@<th align="left"></th></tr><tr><td align="left" valign="top">- The decompiler does <span class="emphasis"><em>not</em></span> use the formal function body when it computes- control-flow; it recomputes its own idea of the function body starting from the entry point+ The Decompiler does <span class="emphasis"><em>not</em></span> use the formal function body when it computes+ control flow; it recomputes its own idea of the function body starting from the entry pointit is handed. If the formal function body was created manually, using a selection for instance,- or in other extreme circumstances, the decompiler's view of the function body may not match- the formal view. This can lead to confusing behavior, where clicking in a decompiler window+ or in other extreme circumstances, the Decompiler's view of the function body may not match+ the formal view. This can lead to confusing behavior, where clicking in a Decompiler windowmay unexpectedly navigate the window away from the function.</td></tr></table></div>@@ -108,14 +109,14 @@<p>Control-flow behavior for a machine instruction is generally determined by its underlying- p-code (see <a class="xref" href="DecompilerConcepts.html#ConceptControlFlow" title="P-code Control Flow">“P-code Control Flow”</a>), but this can be changed by applying a Flow Override.+ p-code (see <a class="xref" href="DecompilerConcepts.html#ConceptControlFlow" title="P-code Control Flow">P-code Control Flow</a>), but this can be changed by applying a Flow Override.A <span class="bold"><strong>Flow Override</strong></span> maintains the overall semantics of a branching instructionbut changes how the branch is interpreted. For instance, a <code class="code">JMP</code> instruction, which traditionallyrepresents a branch within a single function, can be overridden to represent a call to a new function.Flow Overrides are applied by Analyzers or manually by the user.</p><p>- The decompiler automatically incorporates any relevant Flow Overrides into its+ The Decompiler automatically incorporates any relevant Flow Overrides into itsanalysis of a function. This can have a significant impact on results. Thetypes of possible Flow Overrides include:</p>@@ -130,7 +131,7 @@the call target becomes the branch destination,and the instruction is no longer assumedto fall through. <span class="emphasis"><em>RETURN</em></span> instructions become an- indirect branch, and the decompiler will attempt to recover branch+ indirect branch, and the Decompiler will attempt to recover branchdestinations using <span class="emphasis"><em>switch</em></span> analysis.</p></dd>@@ -181,13 +182,13 @@<a name="AnnoteComments"></a>Comments</h2></div></div></div><p>- The decompiler automatically incorporates comments from the Program database into its+ The Decompiler automatically incorporates comments from the Program database into itsoutput. Comments in Ghidra are centralized and can be created and displayed by multiple- Program views, including the decompiler. Comments created from a decompiler window will- show up in the Listing window for instance, and vice versa.+ Program views, including the Decompiler. Comments created from a Decompiler window will+ show up in a Listing window for instance, and vice versa.</p><p>- For the purposes of understanding comments within the decompiler, keep in mind that:+ For the purposes of understanding comments within the Decompiler, keep in mind that:</p><div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">@@ -195,7 +196,7 @@An individual comment is associated with a specific <span class="emphasis"><em>address</em></span> in the Program.</li><li class="listitem" style="list-style-type: disc">- There are 5 different kinds of comments.+ There are 5 different types of comments:<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem" style="list-style-type: circle"><span class="emphasis"><em>Plate</em></span>@@ -228,7 +229,7 @@<a name="CommentDisplay"></a>Display</h3></div></div></div><p>- The decompiler collects and displays comments associated with any address in the+ The Decompiler collects and displays comments associated with any address in theformal <span class="emphasis"><em>function body</em></span> currently decompiling.The comments are integrated line by line into the decompiled code, and anindividual comment is displayed on the line <span class="emphasis"><em>before</em></span> the@@ -238,24 +239,24 @@<p>Because a single line of code typically encompasses multiple machine instructions,there is a possibility that multiple comments at different addresses apply to- the same line. In this case, the decompiler displays each comment on its+ the same line. In this case, the Decompiler displays each comment on itsown line, in address order, directly before the line of code.</p><p>- Because the output of the decompiler can be a heavily transformed version compared- to the original machine instructions, its possible that individual instructions+ Because the output of the Decompiler can be a heavily transformed version compared+ to the original machine instructions, it is possible that individual instructionsno longer have explicit tokens representing them in the output. Comments attached- to these instruction will still be displayed in the decompiler output with the+ to these instruction will still be displayed in the Decompiler output with theclosest associated line of code, usually within the same basic block.</p><p>- By default, the decompiler displays only the <span class="emphasis"><em>Pre</em></span> comments+ By default, the Decompiler displays only the <span class="emphasis"><em>Pre</em></span> commentswithin the body of the function. It also displays <span class="emphasis"><em>Plate</em></span>comments, but only if they are attached to the <span class="emphasis"><em>entry point</em></span>- of the function. In this case, they are displayed first in the decompiler output,+ of the function. In this case, they are displayed first in the Decompiler output,along with WARNING comments, before the function declaration. Other comment- types can be configured to display in decompiler output, by changing the- decompiler Display options (See <a class="xref" href="DecompilerOptions.html#CommentOptions"><span class="bold"><strong>Display <kind-of> Comments</strong></span></a>).+ types can be configured to be part of Decompiler output by changing the+ Decompiler display options (see <a class="xref" href="DecompilerOptions.html#CommentOptions"><span class="bold"><strong>Display <kind-of> Comments</strong></span></a>).</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning"><tr>@@ -263,7 +264,7 @@<th align="left"></th></tr><tr><td align="left" valign="top">- Unlike the Listing window, the decompiler does not alter how a comment is+ Unlike a Listing window, the Decompiler does not alter how a comment isdisplayed based on its type.All enabled types of comment are displayed in the same way, ona separate line before the line of code associated with the address.@@ -276,7 +277,7 @@<a name="CommentUnreachable"></a>Unreachable Blocks</h3></div></div></div><p>- The decompiler may decide as part of its analysis that individual+ The Decompiler may decide as part of its analysis that individual<span class="emphasis"><em>basic blocks</em></span> are unreachable and not display them in the output.In this case, any comments associated with addresses in the unreachable blockwill also not be displayed.@@ -288,9 +289,9 @@<a name="CommentWarnings"></a>Warning Comments</h3></div></div></div><p>- The decompiler can generate internal warnings during its analysis and will incorporate- them into the output as comments in the same way as the user defined- comments described above. They are not part of Ghidra's comment system however and+ The Decompiler can generate internal warnings during its analysis and will incorporate+ them into the output as comments in the same way as the user-defined+ comments described above. They are not part of Ghidra's comment system, however, andcannot be edited. They can be distinguished from normal comments by the word'WARNING' at the beginning of the comment.</p>@@ -308,10 +309,10 @@<p>Variable annotations are the most important way to get names and data-types- that are meaningful to the user incorporated into the decompiler's output.+ that are meaningful to the user incorporated into the Decompiler's output.A <span class="bold"><strong>variable</strong></span> in this context is loosely definedas any piece of memory that code in the Program treats as a logical entity.- The decompiler works to incorporate all forms of annotation into its output+ The Decompiler works to incorporate all forms of annotation into its outputfor any variable pertinent to the function being analyzed.</p><p>@@ -344,9 +345,9 @@<span class="emphasis"><em>local</em></span> to a function.</p><p>- Global variables annotations are created from the tool by applying a data-type to a memory- location in the Listing window, either by invoking a command from the <span class="emphasis"><em>Data</em></span>- pop-up menu, or dragging a data-type from the <span class="emphasis"><em>Data Type Manager</em></span>+ Global variable annotations are created from the tool by applying a data-type to a memory+ location in a Listing window, either by invoking a command from the <span class="emphasis"><em>Data</em></span>+ pop-up menu or by dragging a data-type from the <span class="emphasis"><em>Data Type Manager</em></span>window directly onto the memory location. Refer to the documentation:</p><div class="informalexample">@@ -357,7 +358,7 @@<p></p><p>- Local variables annotations are created from the Listing from various editor dialogs. See in particular:+ Local variables annotations are created from the Listing using various editor dialogs. See, in particular:</p><div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: none; ">@@ -381,16 +382,16 @@<div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: none; "><li class="listitem" style="list-style-type: none">- <a class="xref" href="DecompilerWindow.html#ActionRenameVariable" title="Rename Variable">“Rename Variable”</a>+ <a class="xref" href="DecompilerWindow.html#ActionRenameVariable" title="Rename Variable">Rename Variable</a></li><li class="listitem" style="list-style-type: none">- <a class="xref" href="DecompilerWindow.html#ActionRetypeVariable" title="Retype Variable">“Retype Variable”</a>+ <a class="xref" href="DecompilerWindow.html#ActionRetypeVariable" title="Retype Variable">Retype Variable</a></li><li class="listitem" style="list-style-type: none">- <a class="xref" href="DecompilerWindow.html#ActionCommitParams" title="Commit Params/Return">“Commit Params/Return”</a>+ <a class="xref" href="DecompilerWindow.html#ActionCommitParams" title="Commit Params/Return">Commit Params/Return</a></li><li class="listitem" style="list-style-type: none">- <a class="xref" href="DecompilerWindow.html#ActionCommitLocals" title="Commit Local Names">“Commit Local Names”</a>+ <a class="xref" href="DecompilerWindow.html#ActionCommitLocals" title="Commit Local Names">Commit Local Names</a></li></ul></div></div>@@ -408,7 +409,7 @@In order to widely accommodate different use cases, Ghidra's symboltable has extremely lax naming rules. Ghidramay allow names that conflict with the stricter rules of the language- the decompiler is attempting to produce. The decompiler does not currently+ the Decompiler is attempting to produce. The Decompiler does not currentlyhave an option that checks for this. Users should be aware of:</p><div class="informalexample">@@ -426,7 +427,7 @@Ghidra allows different functions to have the same name, even within the samenamespace, in order to model languages that support <span class="emphasis"><em>function overloading</em></span>.In most languages, such functions would be expected to have distinct prototypes to allow- the symbols to be distinguished in context. Ghidra and the decompiler however do not check+ the symbols to be distinguished in context. Ghidra and the Decompiler, however, do not checkfor this, as prototypes may not be known.</p></dd>@@ -440,10 +441,10 @@<a name="SymbolScope"></a>Variable Scope</h4></div></div></div><p>- All variables belong either to a <span class="emphasis"><em>global</em></span> or <span class="emphasis"><em>local</em></span>- scope, which directly affects how the variable is treated in the decompiler's data-flow+ All variables belong to either a <span class="emphasis"><em>global</em></span> or <span class="emphasis"><em>local</em></span>+ scope, which directly affects how the variable is treated in the Decompiler's data-flowanalysis.- Annotations created by applying a data-type directly to a memory location in the listing+ Annotations created by applying a data-type directly to a memory location in the Listingare automatically added to the formal <span class="emphasis"><em>global</em></span> namespace.Ghidra can create other custom namespaces that are considered global in this sense, andrenaming actions provide options that let individual global annotations be moved into@@ -452,7 +453,7 @@create variable annotations that are local to that function.</p><p>- A global variable annotation forces the decompiler to treat the memory location as if its value+ A global variable annotation forces the Decompiler to treat the memory location as if its valuepersists beyond the end of the function. The variable must <span class="emphasis"><em>exist</em></span>at all points of the function body, generally at the same memory location.</p>@@ -462,9 +463,9 @@at the instruction that first writes to them, and then exist only up to the lastinstruction that reads them. The memory location storing a local variableat one point of the function may be reused for different variables at other points.- This can cause ambiguity in how the decompiler should treat a given memory location used+ This can cause ambiguity in how the Decompiler should treat a given memory location usedfor storing local variables, which the user may want to steer. See the discussion- in <a class="xref" href="DecompilerAnnotations.html#AnnoteStorage" title="Variable Storage">“Variable Storage”</a>.+ in <a class="xref" href="DecompilerAnnotations.html#AnnoteStorage" title="Variable Storage">Variable Storage</a>.</p><p></p>@@ -481,19 +482,19 @@<span class="bold"><strong>data-types</strong></span> that are tailored for the Programbeing analyzed. Data-types that are explicitly part of a variable annotationare, to the extent possible, automatically incorporated- into the decompiler's analysis.+ into the Decompiler's analysis.</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a name="DecompilerDataTypes"></a>Data-types Supported by the Decompiler</h4></div></div></div><p>- The decompiler understands traditional primitive data-types, in all their various sizes,+ The Decompiler understands traditional primitive data-types in all their various sizes,like integers, floating-point numbers, booleans, and characters. It also understandspointers, structures, and arrays, letting it supportarbitrarily complicated composite data-types. Ghidra providessome data-types with specialized display capabilities that don't have a natural representation- in the high-level language output by the decompiler. The decompiler treats these as+ in the high-level language output by the Decompiler. The Decompiler treats these asblack-box data-types, preserving the name, but treating the underlying data either as an integeror simply as an array of bytes.</p>@@ -503,16 +504,16 @@<a name="TypeUndefined"></a>Undefined</h5></div></div></div><p>- The <span class="emphasis"><em>undefined</em></span> data-types are supported, in their various sizes:+ The <span class="emphasis"><em>undefined</em></span> data-types are supported in their various sizes:<span class="bold"><strong>undefined1</strong></span>, <span class="bold"><strong>undefined2</strong></span>,<span class="bold"><strong>undefined4</strong></span>, etc. In Ghidra, the undefined- data-types, let the user specify the size of a variable, while formally declaring that+ data-types let the user specify the size of a variable, while formally declaring thatother details about the data-type are unknown.</p><p>- For the decompiler, undefined data-types as an annotation have the important special meaning- that the decompiler should let its analysis determine the final data-type presented in the- output for the variable (See <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">“Forcing Data-types”</a> below).+ For the Decompiler, undefined data-types, as an annotation, have the important special meaning+ that the Decompiler should let its analysis determine the final data-type presented in the+ output for the variable (see <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">Forcing Data-types</a> below).</p></div><div class="sect4">@@ -521,10 +522,10 @@<p>The <span class="bold"><strong>void</strong></span> data-type is supported but treated specially by- the decompiler, as does Ghidra in general. A <span class="bold"><strong>void</strong></span> can be+ the Decompiler, as does Ghidra in general. A <span class="bold"><strong>void</strong></span> can beused to indicate the absence of a return value in function prototypes, but cannot be usedas a general annotation on variables. A void pointer, <span class="bold"><strong>void *</strong></span>,- is possible; the decompiler treats it as a pointer to an unknown data-type.+ is possible; the Decompiler treats it as a pointer to an unknown data-type.</p></div><div class="sect4">@@ -534,7 +535,7 @@<p>Integer data-types, both signed and unsigned, are supported up to a size of 8 bytes. Largersizes are supported internally but are generally represented as an array of bytes in- decompiler output. Odd integer sizes are also supported.+ Decompiler output. Nonstandard integer sizes of 3, 5, 6, and 7 bytes are also supported.</p><p>The standard C data-type names: <span class="bold"><strong>int</strong></span>, <span class="bold"><strong>short</strong></span>,@@ -558,7 +559,7 @@Floating-point sizes of 4, 8, 10, and 16 are supported, mapping in all cases currently to the<span class="bold"><strong>float</strong></span>, <span class="bold"><strong>double</strong></span>,<span class="bold"><strong>float10</strong></span>, and <span class="bold"><strong>float16</strong></span>- data-types respectively. The decompiler currently cannot display floating-point constants+ data-types, respectively. The Decompiler currently cannot display floating-point constantsthat are bigger than 8 bytes.</p></div>@@ -567,8 +568,8 @@<a name="TypeChar"></a>Character</h5></div></div></div><p>- ASCII or Unicode encoded character data-types are supported for sizes of 1, 2, and 4. The size effectively- chooses between the UTF8, UTF16, and UTF32 character encodings respectively. The standard+ ASCII- and Unicode-encoded character data-types are supported for sizes of 1, 2, and 4. The size effectively+ chooses between the UTF8, UTF16, and UTF32 character encodings, respectively. The standardC data-type names <span class="bold"><strong>char</strong></span> and <span class="bold"><strong>wchar_t</strong></span> aremapped to one of these sizes based on theprocessor and compiler selected when importing the Program.@@ -579,11 +580,11 @@<a name="TypeString"></a>String</h5></div></div></div><p>- Terminated strings, encoded either in ASCII or Unicode, are supported. The decompiler converts+ Terminated strings, encoded either in ASCII or Unicode, are supported. The Decompiler convertsGhidra's dedicated string data-types like <span class="bold"><strong>string</strong></span> to- an "array of characters" data-type, such as <span class="bold"><strong>char[]</strong></span>,+ an array-of-characters data-type, such as <span class="bold"><strong>char[]</strong></span>,where the character size matches the encoding.- A "pointer to character" data-type like+ A pointer-to-character data-type like</p><div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: none; ">@@ -596,11 +597,11 @@</ul></div></div><p>- is also treated as a potential string reference. The decompiler can infer terminated strings if this+ is also treated as a potential string reference. The Decompiler can infer terminated strings if thiskind of data-type propagates to constant values during its analysis.</p><p>- Strings should be fully rendered in decompiler output,+ Strings should be fully rendered in Decompiler output,with non-printable characters escaped using either traditional sequences like '\r', '\n' or using Unicodeescape sequences like '\xFF'.</p>@@ -611,22 +612,22 @@<p>Pointer data-types are fully supported. A pointer to any other supported data-type is- possible. The data-type being pointed to, whether its a primitive, structure, or another pointer,- informs how the decompiler renders a dereferenced pointer.- The decompiler assumes that a pointer variable may refer to an array of+ possible. The data-type being pointed to, whether it is a primitive, structure, or another pointer,+ informs how the Decompiler renders a dereferenced pointer.+ The Decompiler assumes that a pointer variable may refer to an array ofthe underlying data-type and will use array notation if there is evidence of more thanone element.</p><p>The default pointer size is set based on the processor and compiler selected when the Program is- imported and generally matches the size of the <span class="bold"><strong>ram</strong></span> (or equivalent)- address space. Different pointer sizes within the same Program are possible. The decompiler generally+ imported and generally matches the size of the <span class="bold"><strong>ram</strong></span> or equivalent+ address space. Different pointer sizes within the same Program are possible. The Decompiler generallyexpects the pointer size to match the size of the address space being pointed to, but individualarchitectures can model different size pointers into the space (such as <span class="emphasis"><em>near</em></span> pointers).</p><p>For processors with more than one memory address space, pointer data-types currently cannot be directly- annotated to indicate a preferred address space. Where there is ambiguity, the decompiler attempts to+ annotated to indicate a preferred address space. Where there is ambiguity, the Decompiler attempts todetermine the correct address space from the context of its use within the function.</p></div>@@ -644,10 +645,10 @@<a name="TypeStructure"></a>Structure</h5></div></div></div><p>- Structured data-types are fully supported. The decompiler does not automatically infer structures- when analyzing a function; it propagates structured data-types into the function from explicitly- annotated sources, like input parameters or global variables. Decompiler directed creation of- structures can be triggered by the user, see <a class="xref" href="DecompilerWindow.html#ActionAutoStructure" title="Auto Create Structure">“Auto Create Structure”</a>.+ Structure data-types are fully supported. The Decompiler does not automatically infer structures+ when analyzing a function; it propagates them into the function from explicitly+ annotated sources, like input parameters or global variables. Decompiler-directed creation of+ structures can be triggered by the user (see <a class="xref" href="DecompilerWindow.html#ActionAutoStructure" title="Auto Create Structure">Auto Create Structure</a>).</p></div><div class="sect4">@@ -655,12 +656,12 @@<a name="TypeEnum"></a>Enumeration</h5></div></div></div><p>- Enumerations are fully supported. The decompiler can propagate enumerations from explicitly+ Enumerations are fully supported. The Decompiler can propagate enumerations from explicitlyannotated sources throughout a function onto constants, which are then displayed with theappropriate label from the definition of the enumeration. If the constant does not match a- single value in the enumeration definition, the decompiler attempts to build a matching+ single value in the enumeration definition, the Decompiler attempts to build a matchingvalue by <span class="emphasis"><em>or</em></span>-ing together multiple labels.- The decompiler can be made to break out constants representing packed <span class="emphasis"><em>flags</em></span>,+ The Decompiler can be made to break out constants representing packed <span class="emphasis"><em>flags</em></span>,for instance, by labeling individual bit values within an enumeration.</p></div>@@ -671,7 +672,7 @@<p>A <span class="bold"><strong>Function Definition</strong></span> in Ghidra is a data-type that encodesinformation about the parameters and return value for a generic/unspecified function.- A formal <span class="bold"><strong>function pointer</strong></span> is supported by the decompiler as a pointer+ A formal <span class="bold"><strong>function pointer</strong></span> is supported by the Decompiler as a pointerdata-type that points to a Function Definition. A Function Definition specifically encodes:</p><div class="informalexample">@@ -686,7 +687,7 @@The data-type associated with the return value.</li><li class="listitem" style="list-style-type: disc">- An indicator of the <span class="emphasis"><em>prototype model</em></span> that should be+ The name of a generic <span class="emphasis"><em>calling convention</em></span>associated with the function.</li></ul></div>@@ -695,26 +696,28 @@</p><p>The Function Definition itself does not encode any storage information. Once the Function- Definition is associated with a Program, the indicator maps to one of the prototype models for the- specific processor and compiler. A Function Definition is currently limited to a prototype model+ Definition is associated with a Program, its generic calling convention maps to one of the+ specific prototype models for the processor and compiler. The prototype model is then used+ to assign storage for parameters and return values, wherever the Function Definition is applied.+ A Function Definition is currently limited to a prototype modelwith one of the following names:</p><div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "><li class="listitem" style="list-style-type: disc">- __stdcall+ <span class="bold"><strong>__stdcall</strong></span></li><li class="listitem" style="list-style-type: disc">- __thiscall+ <span class="bold"><strong>__thiscall</strong></span></li><li class="listitem" style="list-style-type: disc">- __fastcall+ <span class="bold"><strong>__fastcall</strong></span></li><li class="listitem" style="list-style-type: disc">- __cdecl+ <span class="bold"><strong>__cdecl</strong></span></li><li class="listitem" style="list-style-type: disc">- __vectorcall+ <span class="bold"><strong>__vectorcall</strong></span></li></ul></div></div>@@ -728,13 +731,13 @@<a name="AnnoteForcing"></a>Forcing Data-types</h4></div></div></div><p>- The decompiler performs <span class="bold"><strong>type propagation</strong></span> as part of its analysis- on functions. Data-type information is collected from variable annotations (and other sources),- which is then propagated via data-flow throughout the function to other variables and+ The Decompiler performs <span class="bold"><strong>type propagation</strong></span> as part of its analysis+ on functions. Data-type information is collected from variable annotations and other sources,+ which is then propagated via data flow throughout the function to other variables andconstants where the data-type may not be immediately apparent.</p><p>- With few exceptions, a variable annotation is <span class="emphasis"><em>forcing</em></span> on the decompiler in the sense+ With few exceptions, a variable annotation is <span class="emphasis"><em>forcing</em></span> on the Decompiler in the sensethat the storage location being annotated is considered an unalterable data-type source. Duringtype propagation, the data-type may propagate to other variables,but the variable representing the storage location being annotated is guaranteed to have@@ -746,15 +749,15 @@<th align="left"></th></tr><tr><td align="left" valign="top">- Users should be aware that variable annotations are forcing on the decompiler and may directly+ Users should be aware that variable annotations are forcing on the Decompiler and may directlyoverride aspects of its analysis. Because of this, variable annotations are the most powerful way- for the user to affect decompiler output, but setting an incomplete (or incorrect) data-type as- part of an annotation may produce poorer decompiler output.+ for the user to affect Decompiler output, but setting an incomplete or incorrect data-type as+ part of an annotation may produce poorer Decompiler output.</td></tr></table></div><p>The major exception to forcing annotations is if the data-type in the annotation is <span class="emphasis"><em>undefined</em></span>.- Ghidra reserves the following names to represent formally undefined data-types:+ Ghidra reserves specific names to represent formally undefined data-types, such as:</p><div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">@@ -762,7 +765,6 @@<li class="listitem" style="list-style-type: disc"><span class="bold"><strong>undefined2</strong></span></li><li class="listitem" style="list-style-type: disc"><span class="bold"><strong>undefined4</strong></span></li><li class="listitem" style="list-style-type: disc"><span class="bold"><strong>undefined8</strong></span></li>-<li class="listitem" style="list-style-type: disc">...</li></ul></div></div><p>@@ -770,29 +772,29 @@The number in the name only specifies the number of bytes in the variable.</p><p>- The decompiler views a variable annotation with an undefined data-type only as an indication of what name+ The Decompiler views a variable annotation with an undefined data-type only as an indication of what nameshould be used if a variable at that storage address exists. The data-type for the variable is filled in,using type propagation from other sources.</p><p>For annotations that specifically label a function's formal parameters or return value,- the <a class="link" href="DecompilerAnnotations.html#PrototypeSignatureSource" title="Signature Source">Signature Source</a> also affects how they're treated by the decompiler.+ the <a class="link" href="DecompilerAnnotations.html#PrototypeSignatureSource" title="Signature Source">Signature Source</a> also affects how they're treated by the Decompiler.If the Signature Source is set to anything other than <span class="emphasis"><em>DEFAULT</em></span>, there is a forced- one-to-one correspondence between variable annotations and actual parameters in the decompiler's- view of the function. This is stronger than just forcing the data-type; the existence (or not) of+ one-to-one correspondence between variable annotations and actual parameters in the Decompiler's+ view of the function. This is stronger than just forcing the data-type; the existence or nonexistence ofthe variable itself is forced by the annotation in this case. If the Signature Source is forcing andthere are no parameter annotations, a <span class="emphasis"><em>void</em></span> prototype is forced on the function.</p><p>A forcing Signature Source is set typically if debug symbols for the function are read in during- Program import (<span class="emphasis"><em>IMPORTED</em></span>), or if the user manually edits the function prototype+ Program import (<span class="emphasis"><em>IMPORTED</em></span>) or if the user manually edits the function prototypedirectly (<span class="emphasis"><em>USER_DEFINED</em></span>).</p><p>If an annotation and the Signature Source force a parameter to exist, specifying an- <span class="emphasis"><em>undefined</em></span> data-type in the annotation still directs the decompiler to fill in+ <span class="emphasis"><em>undefined</em></span> data-type in the annotation still directs the Decompiler to fill inthe variable's data-type using type propagation. The same holds true for the return value; an- <span class="emphasis"><em>undefined</em></span> annotation fixes the size of the return value, but the decompiler+ <span class="emphasis"><em>undefined</em></span> annotation fixes the size of the return value, but the Decompilerfills in its own data-type.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">@@ -801,9 +803,9 @@<th align="left"></th></tr><tr><td align="left" valign="top">- The decompiler may still use an <span class="emphasis"><em>undefined</em></span> data-type to label a variable,+ The Decompiler may still use an <span class="emphasis"><em>undefined</em></span> data-type to label a variable,even after type propagation. If a variable is simply copied around within a function and there- are no other substantive operations or annotations on the variable, the decompiler may decide the undefined+ are no other substantive operations or annotations on the variable, the Decompiler may decide the undefineddata-type is appropriate.</td></tr></table></div>@@ -819,10 +821,10 @@Every variable annotation is associated with a single <span class="emphasis"><em>storage location</em></span>, where thevalue of the variable is stored during execution: generally a register, stack location, or an addressin the load image of the Program. The storage location does not necessarily hold the value for that- variable at all points of execution, and its possible for the variable value to be held in+ variable at all points of execution, and it is possible for the variable value to be held in<span class="emphasis"><em>different</em></span> storage locations at different points of execution. The set of executionpoints where the storage location <span class="emphasis"><em>does</em></span> hold the variable value is called the annotation- <span class="bold"><strong>scope</strong></span>; this is distinct from (but influenced by) the scope of the+ <span class="bold"><strong>scope</strong></span>; this is distinct from, but influenced by, the scope of thevariable itself. The different types of storage location are listed below.</p><div class="sect3">@@ -833,21 +835,21 @@A <span class="bold"><strong>load-image address</strong></span> is a concrete address in the load image of the Program,typically in the <span class="bold"><strong>ram</strong></span> address space. This kind ofstorage must be backed by a formal memory block for the Program, which typically corresponds to a specific- program section (such as the <code class="code">.text</code> or <code class="code">.bss</code> section). Because it is in the- load image directly, an annotation with this storage shows up directly in the <span class="emphasis"><em>Listing</em></span>+ program section, such as the <code class="code">.text</code> or <code class="code">.bss</code> section. Because it is in the+ load image directly, an annotation with this storage shows up directly in any Listingwindow and can be directly manipulated there. In much of the Ghidra documentation, these annotations- are referred to as <span class="bold"><strong>Data</strong></span>. See the section- <a class="ulink" href="help/topics/DataPlugin/Data.htm" target="_top">Data</a> in particular.+ are referred to as <span class="bold"><strong>Data</strong></span>. See the+ <a class="ulink" href="help/topics/DataPlugin/Data.htm" target="_top">Data</a> section, in particular.</p><p>- Although specific architectures may vary, generally a storage location at a load image address+ Although specific architectures may vary, a storage location at a load image address generallyrepresents a formal <span class="emphasis"><em>global</em></span> variable, and the annotation is in scope- across all Program execution. For the decompiler, the storage location is treated as a+ across all Program execution. For the Decompiler, the storage location is treated as aa single <span class="emphasis"><em>persistent</em></span> variable in all functions that reference it. Within a- function, all distinct references to the storage location (varnodes) are merged. The decompiler+ function, all distinct references (varnodes) to the storage location are merged. The Decompilerexpects a value at the storage location to exist from <span class="emphasis"><em>before</em></span> the start ofthe function, and any change to the value must be explicitly represented as an assignment to- the variable in decompiler output.+ the variable in Decompiler output.</p></div><div class="sect3">@@ -859,33 +861,33 @@of a particular function in the Program. Formally, a stack address is defined as an offset relative to theincoming value of the <span class="emphasis"><em>stack pointer</em></span> and exists in the<span class="bold"><strong>stack</strong></span> address space associated with the function. See the discussion- in <a class="xref" href="DecompilerConcepts.html#ConceptAddressSpace" title="Address Space">“Address Space”</a>. A <span class="bold"><strong>stack annotation</strong></span> then is a variable annotation+ in <a class="xref" href="DecompilerConcepts.html#ConceptAddressSpace" title="Address Space">Address Space</a>. A <span class="bold"><strong>stack annotation</strong></span> then is a variable annotationwith a stack address as its storage location. It exists only in the scope of asingle function and the variable must be <span class="emphasis"><em>local</em></span> to that function.</p><p>- Within the <span class="emphasis"><em>Listing</em></span> window, a stack annotation is displayed as part of the function header- (at the entry point address of the function), with a syntax similar to:+ Within a <span class="emphasis"><em>Listing</em></span> window, a stack annotation is displayed as part of the function header+ at the entry point address of the function, with a syntax similar to:</p><div class="informalexample"><code class="code">undefined4 Stack[-0x14]:4 local_14</code></div><p>The middle field (the <span class="emphasis"><em>Variable Location</em></span> field) indicates that the storage location is on the- stack, and the value in brackets indicates the offset of the storage location, relative to the incoming+ stack, and the value in brackets indicates the offset of the storage location relative to the incomingstack pointer. The value after the colon indicates the number of bytes in the storage location.</p><p>Currently, the entire body of the function is included- in the scope of any stack annotation, and the decompiler will allow only a single variable to exist+ in the scope of any stack annotation, and the Decompiler will allow only a single variable to existat the stack address. A stack annotation can be a formal parameter to the function, but otherwise the- decompiler does not expect to see a value that exists before the start of the function.+ Decompiler does not expect to see a value that exists before the start of the function.</p><p>- The decompiler will continue to perform <span class="emphasis"><em>copy propagation</em></span> and other transforms on- stack locations associated with a variable annotation. In particular, within decompiler output,- a specific write operation to a stack address may not show up as an explicit assignment to its variable,- if the value is simply copied to another location.+ The Decompiler will continue to perform <span class="emphasis"><em>copy propagation</em></span> and other transforms on+ stack locations associated with a variable annotation. In particular, within Decompiler output,+ if the value is simply copied to another location,+ a specific write operation to a stack address may not show up as an explicit assignment to its variable.</p></div><div class="sect3">@@ -895,7 +897,7 @@<p>A variable annotation can refer to a specific <span class="emphasis"><em>register</em></span> for the processor associatedwith the Program. In general, such an annotation will be for a variable local to a particular function.- Within the <span class="emphasis"><em>Listing</em></span> window, this annotation is displayed as part of the function header, with+ Within a <span class="emphasis"><em>Listing</em></span> window, this annotation is displayed as part of the function header, withsyntax like:</p><div class="informalexample">@@ -906,28 +908,28 @@the annotation, and the value after the colon indicates the number of bytes in the register.</p><p>- For a local variable annotations with a register storage location, there is an expectation that the+ For local variable annotations with a register storage location, there is an expectation that theregister may be reused for different variables at different points of execution within the function.There may be more than one annotation, for different variables, that share the same registerstorage location.An annotation is associated with a <span class="emphasis"><em>first use point</em></span> that describes where- the register first holds a value for the particular variable. (See the discussion - <a class="xref" href="DecompilerConcepts.html#ConceptVarnodeSSA" title="Varnodes in the Decompiler">“Varnodes in the Decompiler”</a>)+ the register first holds a value for the particular variable (see the discussion - <a class="xref" href="DecompilerConcepts.html#ConceptVarnodeSSA" title="Varnodes in the Decompiler">Varnodes in the Decompiler</a>).The entire scope of the annotation is limited to the address regions between the first use point- and any points where the value is read. The decompiler may extend the scope as part of its+ and any points where the value is read. The Decompiler may extend the scope as part of its<span class="emphasis"><em>merging</em></span> process, but the full extent is not stored in the annotation.</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="VariableStorageTemp"></a>Temporary Registers</h4></div></div></div>+<a name="VariableStorageTemp"></a>Temporary Register</h4></div></div></div><p>Variable annotations can have a <span class="emphasis"><em>temporary register</em></span> as a storage location.A temporary register is not specific to a processor but is produced at various stages ofthe decompilation process. See the discussion of the <span class="bold"><strong>unique</strong></span>- space in <a class="xref" href="DecompilerConcepts.html#ConceptAddressSpace" title="Address Space">“Address Space”</a>. These registers do not have a meaningful name, and- the specific storage address may change on successive decompilations. So within the- <span class="emphasis"><em>Listing</em></span> window, this annotation is displayed as part of the function header,+ space in <a class="xref" href="DecompilerConcepts.html#ConceptAddressSpace" title="Address Space">Address Space</a>. These registers do not have a meaningful name, and+ the specific storage address may change on successive decompilations. So, within a+ <span class="emphasis"><em>Listing</em></span> window, this annotation is displayed as part of the function headerwith syntax like:</p><div class="informalexample">@@ -935,7 +937,7 @@</div><p>The <span class="emphasis"><em>Variable Location</em></span> field displays the internal hash used to uniquely- identify the temporary register within the data-flow of the function.+ identify the temporary register within the data flow of the function.</p><p>A temporary register annotation must be for a local variable, and as with an ordinary register,@@ -953,7 +955,7 @@<p>Every formal Function in Ghidra is associated with a set of variable annotations and other properties thatmake up the <span class="bold"><strong>function prototype</strong></span>. Due to the nature of reverse engineering,- the function prototype may only include partial information and may be built up over time. Individual+ the function prototype may include only partial information and may be built up over time. Individualelements include:</p><div class="informalexample">@@ -962,38 +964,53 @@<dd><p>Each formal input to the function can have a Variable Annotation that describes its name, data-type,- and storage location, at the moment control-flow enters the function. If annotations exist, they are shown- in the Listing Window as part of the Function header, and they usually correspond directly with symbols in the- <span class="emphasis"><em>function declaration</em></span> produced by the decompiler.+ and storage location. The storage location applies at the moment control flow enters the function.+ If annotations exist, they are shown+ in a Listing window as part of the Function header, and they usually correspond directly with symbols in the+ <span class="emphasis"><em>function declaration</em></span> produced by the Decompiler.</p></dd><dt><span class="term"><span class="bold"><strong>Return Value</strong></span></span></dt><dd><p>The value returned by a function can have a special Variable Annotation that describes its data-type- and storage location, at the moment control-flow exits the function. If it exists, the annotation is shown- in the Listing Window as part of the Function header with the name <code class="code"><RETURN></code>, and it usually+ and storage location. The storage location applies at the moment control flow exits the function. If it exists, the annotation is shown+ in a Listing window as part of the Function header with the name <code class="code"><RETURN></code>, and it usuallycorresponds directly with the return value in the <span class="emphasis"><em>function declaration</em></span> produced by- the decompiler.+ the Decompiler.+ </p>+ </dd>+<dt><span class="term"><span class="bold"><strong>Auto-Parameters</strong></span></span></dt>+<dd>+ <p>+ Specific prototypes may require auto-parameters like <span class="bold"><strong>this</strong></span>+ or <span class="bold"><strong>__return_storage_ptr__</strong></span>. These are special input parameters+ that compilers may use to implement specific high-level language concepts. See the discussion+ in <a class="xref" href="DecompilerConcepts.html#ConceptAutoParameters" title="Auto-Parameters">Auto-Parameters</a>. Within Ghidra, auto-parameters are automatically created by the+ <a class="ulink" href="help/topics/FunctionPlugin/Variables.htm#Edit_Function" target="_top">Function Editor Dialog</a>+ if the desired prototype requires them.+ Within a Listing window, auto-parameters look like other parameter annotations, but the storage field shows the+ string <code class="code">(auto)</code>. Decompiler output will generally display auto-parameters as explicit variables+ rather than hiding them.</p></dd><dt><span class="term"><span class="bold"><strong>Calling Convention</strong></span></span></dt><dd><p>- The calling convention used by the function can be specified as part of the function prototype. The convention- is specified by name, referring to the formal <a class="xref" href="DecompilerConcepts.html#ConceptPrototypeModel" title="Prototype Model">“Prototype Model”</a> that describes how storage+ The calling convention used by the function is specified as part of the function prototype. The convention+ is specified by name, referring to the formal <a class="xref" href="DecompilerConcepts.html#ConceptPrototypeModel" title="Prototype Model">Prototype Model</a> that describes how storagelocations are selected for individual parameters along with other information about how the compiler treats- the function. Available models are determined by the processor and compiler, but can be extended by the user.- See <a class="xref" href="DecompilerOptions.html#ExtensionOptions" title="Specification Extensions">“Specification Extensions”</a>.+ the function. Available models are determined by the processor and compiler, but may be extended by the user+ (see <a class="xref" href="DecompilerOptions.html#ExtensionOptions" title="Specification Extensions">Specification Extensions</a>).</p><p>- In the absence of parameter and return value annotations, the decompiler will use the prototype model as+ In the absence of input parameter and return value annotations, the Decompiler will use the prototype model aspart of its analysis to <span class="emphasis"><em>discover</em></span> the input parameters and the return value of the function.</p><p>- The name "unknown" is reserved to indicate that nothing is known about the calling convention. If- set to "unknown", depending on context, the decompiler may assign the calling convention based on- the <span class="emphasis"><em>Prototype Evaluation</em></span> option (See <a class="xref" href="DecompilerOptions.html#OptionProtoEval"><span class="bold"><strong>Prototype Evaluation</strong></span></a>), or it+ The name <span class="bold"><strong>unknown</strong></span> is reserved to indicate that nothing is known about the calling convention. If+ set to <span class="bold"><strong>unknown</strong></span>, depending on context, the Decompiler may assign the calling convention based on+ the <span class="emphasis"><em>Prototype Evaluation</em></span> option (see <a class="xref" href="DecompilerOptions.html#OptionProtoEval"><span class="bold"><strong>Prototype Evaluation</strong></span></a>), or itmay use the default calling convention for the architecture.</p></dd>@@ -1001,30 +1018,30 @@<dd><p>Functions have a boolean property called <span class="bold"><strong>variable arguments</strong></span>, which can be turned on- if the function is capable of being passed a variable number of inputs. This property informs the decompiler that+ if the function is capable of being passed a variable number of inputs. This property informs the Decompiler thatthe function may take additional parameters beyond any with an explicit variable annotation.This affects decompilation of any function which calls the <span class="emphasis"><em>variable arguments</em></span> function, allowing- the decompiler to discover unlisted parameters at a given call site.+ the Decompiler to discover unlisted parameters at a given call site.</p></dd><dt><span class="term"><span class="bold"><strong>No Return</strong></span></span></dt><dd><p>- A function can be marked explicitly as <span class="bold"><strong>not returning</strong></span>, meaning that once- a call is made to the function, execution will never return to the caller. The decompiler uses this to- compute the correct control-flow in any calling functions.+ A function can be marked with the <span class="bold"><strong>no return</strong></span> property, meaning that once+ a call is made to the function, execution will never return to the caller. The Decompiler uses this to+ compute the correct control flow in any calling functions.</p></dd><dt><span class="term"><span class="bold"><strong>In-Line</strong></span></span></dt><dd><p>- If the boolean property <span class="bold"><strong>in-line</strong></span> is turned on for a particular function,- it directs the decompiler to inline the effects of the function into the decompilation of any of its calling functions.- The function will no longer appear as a direct function call in the decompilation, but all of its data-flow+ If the <span class="bold"><strong>in-line</strong></span> property is turned on for a particular function,+ it directs the Decompiler to inline the effects of the function into the decompilation of any of its calling functions.+ The function will no longer appear as a direct function call in the decompilation, but all of its data flowwill be incorporated into the calling function.</p><p>- This is useful for <span class="emphasis"><em>bookkeeping</em></span> functions, where its important for the decompiler to+ This is useful for <span class="emphasis"><em>bookkeeping</em></span> functions, where it is important for the Decompiler to<span class="emphasis"><em>see</em></span> its effects on the calling function. Functions that set up the stack frame for a caller orfunctions that look up or dispatch a switch destination are typical examples that should be marked <span class="emphasis"><em>in-line</em></span>.</p>@@ -1033,7 +1050,7 @@<dd><p>This property is similar in spirit to marking a function as <span class="emphasis"><em>in-line</em></span>.- A <span class="bold"><strong>call-fixup</strong></span> directs the decompiler to replace any call to the function with a specific+ A <span class="bold"><strong>call-fixup</strong></span> directs the Decompiler to replace any call to the function with a specificchunk of raw p-code. The decompilation of any calling function no longer shows the function call, but the chunkof p-code incorporates the called function's effects.</p>@@ -1044,7 +1061,7 @@<p>Call-fixups are specified by name. The name and associated p-code chunk are typically defined in the<span class="emphasis"><em>compiler specification</em></span> for the Program. Users can extend the available set- of call-fixups. See <a class="xref" href="DecompilerOptions.html#ExtensionOptions" title="Specification Extensions">“Specification Extensions”</a>.+ of call-fixups (see <a class="xref" href="DecompilerOptions.html#ExtensionOptions" title="Specification Extensions">Specification Extensions</a>).</p></dd></dl></div>@@ -1059,7 +1076,7 @@Ghidra records a <span class="bold"><strong>Signature Source</strong></span> for every function,indicating the origin of its prototype information. This issimilar to the <span class="emphasis"><em>Symbol Source</em></span> attached to Ghidra's symbol annotations- (See the documentation for+ (see the documentation for<a class="ulink" href="help/topics/SymbolTablePlugin/symbol_table.htm#Set_Filter" target="_top">Filtering</a>in the Symbol Table). The possible types are:</p>@@ -1090,8 +1107,8 @@</p><p>If the Signature Source is set to anything other than <span class="emphasis"><em>DEFAULT</em></span>, the- function's prototype information is forcing on the decompiler. See the discussion- in <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">“Forcing Data-types”</a>+ function's prototype information is forcing on the Decompiler (see the discussion+ in <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">Forcing Data-types</a>).</p></div><div class="sect2">@@ -1100,8 +1117,8 @@<p>The input parameter and return value annotations of the function prototype, like- any variable annotations, can be forcing on the decompiler.- See the complete discussion in <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">“Forcing Data-types”</a>.+ any variable annotations, can be forcing on the Decompiler+ (see the complete discussion in <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">Forcing Data-types</a>).But keep in mind:</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning">@@ -1110,13 +1127,13 @@<th align="left"></th></tr><tr><td align="left" valign="top">- The input parameters and return value are all forced on the decompiler as a unit based on the+ The input parameters and return value are all forced on the Decompiler as a unit based on the<span class="emphasis"><em>Signature Source</em></span>. They are all forced if the type is set to anythingother than <span class="emphasis"><em>DEFAULT</em></span>; otherwise none of them are forced.</td></tr></table></div><p>- If the function prototype's annotations are not forced, the decompiler will attempt to discover the parameters+ If the function prototype's annotations are not forcing, the Decompiler will attempt to discover the parametersand return value using the calling convention. The prototype model underlying the calling conventiondictates which storage locations can be considered as parameters and their formal ordering.</p>@@ -1133,7 +1150,7 @@can be built for the function.</p><p>- The decompiler will disregard the calling convention's rules in this situation and use the custom storage+ The Decompiler will disregard the calling convention's rules in this situation and use the custom storagelocations for parameters and the return value. Other aspects of the calling convention, like the<span class="emphasis"><em>unaffected</em></span> list, will still be used.</p>@@ -1145,8 +1162,8 @@<a name="AnnoteMutability"></a>Data Mutability</h2></div></div></div><p>- <span class="bold"><strong>Mutability</strong></span> is a description of how values in a specific memory region- (either a single variable or a larger block) can change during Program execution, based either on+ <span class="bold"><strong>Mutability</strong></span> is a description of how values in a specific memory region,+ either a single variable or a larger block, can change during Program execution based either onproperties or established rules. Ghidra recognizes the mutability settings:</p><div class="informalexample">@@ -1157,17 +1174,17 @@</ul></div></div><p>- Mutability affects decompiler analysis and can have a large impact the output.+ Mutability affects Decompiler analysis and can have a large impact on the output.</p><p>- Most memory has <span class="bold"><strong>normal</strong></span> mutability, meaning:+ Most memory has <span class="bold"><strong>normal</strong></span> mutability;the value at the memory location may change over the course of executing the Program, but for a givensection of code, the value will not change unless an instruction explicitly writes to it.</p><p>Mutability can be set on an entire block of memory in the Program, typically from the<a class="ulink" href="help/topics/MemoryMapPlugin/Memory_Map.htm#View_Memory_Map" target="_top">Memory Map</a>.- It can also be set as part of a single Variable Annotation. From the Listing Window for instance,+ It can also be set as part of a single Variable Annotation. From a Listing window, for instance,use the <a class="ulink" href="help/topics/DataPlugin/Data.htm#Data_Settings" target="_top">Settings</a> dialog.</p><div class="sect2">@@ -1177,9 +1194,9 @@<p>The <span class="bold"><strong>constant</strong></span> mutability setting indicates that values withinthe memory region are read-only and don't change during Program execution. If a read-only variable is- accessed in a function being analyzed by the decompiler, its constant value, if present in the- Program's <span class="emphasis"><em>load image</em></span>, replaces the variable within data-flow for the- function. The decompiler may propagate the constant and fold it in to other operations, which+ accessed in a function being analyzed by the Decompiler, its constant value, if present in the+ Program's <span class="emphasis"><em>load image</em></span>, replaces the variable within data flow for the+ function. The Decompiler may propagate the constant and fold it in to other operations, whichcan have a substantial impact on the final output.</p></div>@@ -1190,18 +1207,18 @@<p>The <span class="bold"><strong>volatile</strong></span> mutability setting indicates that values withinthe memory region may change unexpectedly, even if the code currently executing does not directly- write to it. If a volatile variable is accessed in a function being analyzed by the decompiler,+ write to it. If a volatile variable is accessed in a function being analyzed by the Decompiler,each specific access is replaced with a built-in function call, which prevents constant propagationand other transforms across the access. The built-in functions are named based on- whether the access is a <span class="emphasis"><em>read</em></span> or <span class="emphasis"><em>write</em></span> and then the size- of the access. Within decompiler output, the first parameter to a built-in function is a symbol+ whether the access is a <span class="emphasis"><em>read</em></span> or <span class="emphasis"><em>write</em></span> and on the <span class="emphasis"><em>size</em></span>+ of the access. Within the Decompiler output, the first parameter to a built-in function is a symbolindicating the volatile variable. The function returns a value in the case of a volatile read ortakes a second parameter in the case of a volatile write.</p><div class="informalexample"><pre class="programlisting">- write_volatile_1(DAT_mem_002b,0x20);X = read_volatile_2(SREG);+ write_volatile_1(DAT_mem_002b,0x20);</pre></div><p>@@ -1214,14 +1231,14 @@<a name="AnnoteConstants"></a>Constant Annotations</h2></div></div></div><p>- Ghidra provides numerous actions to control how specific constants are formatted or displayed.- An annotation can be applied directly to a constant in the Decompiler Window, which always affects- decompiler output. Or, an annotation can be applied to the constant operand of a specific machine- instruction displayed in the Listing Window. In this case, to the extent possible, the decompiler- attempts to track the operand and apply the annotation to the matching constant in the decompiler output.- However, the constant may be transformed from its value in the original machine instruction during the decompiler's- analysis. The decompiler will follow the constant through simple transformations, but if the constant strays- too far from its original value, the annotation will not be applied. The transforms followed are:+ Ghidra provides numerous actions to control how a specific constant is formatted or displayed.+ An annotation can be applied directly to a constant in a Decompiler window, which always affects+ Decompiler output. Or, an annotation can be applied to the constant operand of a specific machine+ instruction displayed in a Listing window. In this case, to the extent possible, the Decompiler+ attempts to track the operand and apply the annotation to the matching constant in the Decompiler output.+ However, the constant may be transformed from its value in the original machine instruction during the Decompiler's+ analysis. The Decompiler will follow the constant through one of the following simple transformations, but+ otherwise the annotation will not be applied.</p><div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">@@ -1241,23 +1258,20 @@Ghidra can create an association between a name and a constant, called an <span class="bold"><strong>equate</strong></span>.An equate is a descriptive string that is intended to replace the numeric form of the constant, and equatesacross the entire Program can be viewed from the- <a class="ulink" href="help/topics/EquatePlugin/Equates.htm#Equate_Table" target="_top">Equate Table</a>.+ <a class="ulink" href="help/topics/EquatePlugin/Equates.htm#Equate_Table" target="_top">Equates Table</a>.</p><p>An equate can be applied to a machine instruction with a constantoperand by using the <a class="ulink" href="help/topics/EquatePlugin/Equates.htm#Set_Equate" target="_top">Set Equate</a>- menu from the Listing Window. If the decompiler successfully follows the operand to a matching constant,- the equate's name is displayed as part of the decompiler's output as well as in the Listing Window.- A transformed operand is displayed as an expression, where the transforming operations are applied to- the equate symbol (representing the original constant).- </p>- <p>- Alternately an equate can be applied directly to a constant from the Decompiler Window using its- <a class="xref" href="DecompilerWindow.html#ActionSetEquate" title="Set Equate ...">“Set Equate ...”</a> menu. The constant may or may not have a corresponding instruction- operand but will be displayed in decompiler output using the descriptive string.+ menu from a Listing window. If the Decompiler successfully follows the operand to a matching constant,+ the equate's name is displayed as part of the Decompiler's output as well as in any Listing window.+ A transformed operand is displayed as an expression, where the transforming operation is applied to+ the equate symbol representing the original constant.</p><p>-+ Alternatively, an equate can be applied directly to a constant from a Decompiler window using its+ <a class="xref" href="DecompilerWindow.html#ActionSetEquate" title="Set Equate...">Set Equate...</a> menu. The constant may or may not have a corresponding instruction+ operand but will be displayed in Decompiler output using the descriptive string.</p></div><div class="sect2">@@ -1265,36 +1279,37 @@<a name="ConstantConversions"></a>Format Conversions</h3></div></div></div><p>- Ghidra can apply a <span class="bold"><strong>format conversion</strong></span> to integer constants that are displayed- in decompiler output.+ Ghidra can apply a <span class="bold"><strong>format conversion</strong></span> to any integer constant that is displayed+ in Decompiler output.</p><p>A conversion can be applied to the machine instruction containing the constantas an operand using the <a class="ulink" href="help/topics/EquatePlugin/Equates.htm#Convert" target="_top">Convert</a> menu option- from the Listing Window. If the decompiler successfully traces the operand to a matching constant,- the format conversion is applied in the decompiler output as well as in the Listing Window.+ from a Listing window. If the Decompiler successfully traces the operand to a matching constant,+ the format conversion is applied in the Decompiler output as well as in the Listing window.</p><p>- Alternately, a conversion can be applied directly to an integer constant in the- Decompiler Window using its <a class="xref" href="DecompilerWindow.html#ActionConvert" title="Convert">“Convert”</a> menu option. The constant may or may not- have a corresponding instruction operand but is displayed in decompiler output using the conversion.+ Alternately, a conversion can be applied directly to an integer constant in a+ Decompiler window using its <a class="xref" href="DecompilerWindow.html#ActionConvert" title="Convert">Convert</a> menu option. The constant may or may not+ have a corresponding instruction operand but is displayed in Decompiler output using the conversion.</p><p>- Conversions applied by the decompiler are currently limited to:+ Conversions applied by the Decompiler are currently limited to:</p><div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "><li class="listitem" style="list-style-type: disc">Binary - 0b01100001</li>-<li class="listitem" style="list-style-type: disc">Decimal- 97</li>+<li class="listitem" style="list-style-type: disc">Decimal - 97</li><li class="listitem" style="list-style-type: disc">Hexadecimal - 0x61</li><li class="listitem" style="list-style-type: disc">Octal - 0141</li><li class="listitem" style="list-style-type: disc">Char - 'a'</li></ul></div></div><p>- An appropriate header matching the format is prepended to the representation string, either "0b", "0x" or just- "0". The decompiler will not switch the signedness of the constant but preserves the signed or unsigned data-type- as determined by analysis.+ If necessary, a header matching the format is prepended to the representation string, either "0b", "0x" or just+ "0". A conversion will not switch the signedness of the constant; the signed or unsigned data-type associated+ with the constant, as determined by analysis, is preserved. If the constant is negative, with a signed data-type,+ the representation string will always start with a '-' character.</p></div></div>@@ -1307,15 +1322,15 @@A <span class="bold"><strong>register value</strong></span> in this context is a region of code in the Programwhere a specific register holds a known constant value. Ghidra maintains an explicit list of these values forthe Program (see the documentation for <a class="ulink" href="help/topics/RegisterPlugin/Registers.htm" target="_top">Register Values</a>),- which the decompiler can use when analyzing a function.- A register value benefits decompiler analysis, especially if the original compiler was aware- of the constant value, as the decompiler can recover address references calculated as offsets relative to the register+ which the Decompiler can use when analyzing a function.+ A register value benefits Decompiler analysis, especially if the original compiler was aware+ of the constant value, as the Decompiler can recover address references calculated as offsets relative to the registerand otherwise propagate the constant.</p><p>- A <span class="emphasis"><em>register value</em></span> is set by highlighting the region of code in the Listing Window and then invoking the- <a class="ulink" href="help/topics/RegisterPlugin/Registers.htm#SetRegisterValues" target="_top">Set Register Values ...</a> command- from the pop-up menu. The beginning and end of a region is indicated in the Listing Window with+ A <span class="emphasis"><em>register value</em></span> is set by highlighting the region of code in a Listing window and then invoking the+ <a class="ulink" href="help/topics/RegisterPlugin/Registers.htm#SetRegisterValues" target="_top">Set Register Values...</a> command+ from the pop-up menu. The beginning and end of a region is indicated in a Listing window with<code class="code">assume</code> directives, and regions can be generally viewed from the<a class="ulink" href="help/topics/RegisterPlugin/Registers.htm#Register_Manager" target="_top">Register Manager</a> window.</p>@@ -1323,8 +1338,8 @@In order for a particular register value to affect decompilation, the region of code associated with thevalue must contain the entry point of the function, and of course the function must read from the register.Only the initial reads of the register are replaced with the constant value.- The decompiler will continue to respect later instructions that write to the register (even if the- instruction is inside the register value's region)+ The Decompiler will continue to respect later instructions that write to the register, even if the+ instruction is inside the register value's region.If a register value's region starts in the middle of a function, decompilation is <span class="emphasis"><em>not</em></span>affected at all.</p>@@ -1333,7 +1348,7 @@<a name="AnnoteContextRegister"></a>Context Registers</h3></div></div></div><p>- There is a special class of registers, called <span class="bold"><strong>context registers</strong></span> whose+ There is a special class of registers called <span class="bold"><strong>context registers</strong></span> whosevalues have a different affect on analysis and decompilation than described above.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">@@ -1349,7 +1364,7 @@<p>The value in a context register is examined when Ghidra decodes machine instructions from the underlyingbytes in the Program. A specific value generally corresponds to a specific <span class="emphasis"><em>execution mode</em></span>- of the processor. The ARM processor <span class="emphasis"><em>T bit</em></span> for instance, which selects whether the+ of the processor. The ARM processor <span class="emphasis"><em>T bit</em></span>, for instance, which selects whether theprocessor is executing ARM or THUMB instructions, is modeled as a context register in Ghidra.The same set of bytes in the Program can be decoded to machine instructions in more than one way,depending on context register values.@@ -1364,17 +1379,17 @@<p>If a context register value is changed for a region that has already been disassembled, in order to seethe affect of the change, the machine instructions in the region need to be cleared, and disassembly needs- to be triggered again. See the documentation on the- <a class="ulink" href="help/topics/ClearPlugin/Clear.htm#Clear_Code_Bytes" target="_top">Clear Plugin</a>.+ to be triggered again (see the documentation on the+ <a class="ulink" href="help/topics/ClearPlugin/Clear.htm#Clear_Code_Bytes" target="_top">Clear Plugin</a>).</p><p>- Values for a context register are set in the same way as any other register, using the- <a class="ulink" href="help/topics/RegisterPlugin/Registers.htm#SetRegisterValues" target="_top">Set Register Values ...</a> command+ Values for a context register are set in the same way as for any other register, using the+ <a class="ulink" href="help/topics/RegisterPlugin/Registers.htm#SetRegisterValues" target="_top">Set Register Values...</a> commanddescribed above. Within the<a class="ulink" href="help/topics/RegisterPlugin/Registers.htm#Register_Manager" target="_top">Register Manager</a> window,- context registers are generally grouped together under the (pseudo-register) heading, <span class="emphasis"><em>contextreg</em></span>.+ context registers are generally grouped together under the <span class="emphasis"><em>contextreg</em></span> pseudo-register heading.For details about how context registers are used in processor modeling, see- the document "SLEIGH: A Language for Rapid Processor Specification".+ the document "SLEIGH: A Language for Rapid Processor Specification."</p><p>Because context registers affect machine instructions, they also affect the underlying p-code anddiff --git a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerConcepts.html b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerConcepts.htmlindex b7440a1df2..d1dae701b8 100644--- a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerConcepts.html+++ b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerConcepts.html@@ -21,10 +21,10 @@<p>P-code is Ghidra's Intermediate Representation (IR) language. When analyzing a function,- the decompiler translates every machine instruction into p-code first and performs its- analysis directly on the operators and variables of the language. Output of the decompiler+ the Decompiler translates every machine instruction into p-code first and performs its+ analysis directly on the operators and variables of the language. Output of the Decompileris also best understood in terms of p-code. This section presents the key concepts of- p-code. For a more detailed discussion see the document "P-Code Reference Manual".+ p-code. For a more detailed discussion see the document "P-Code Reference Manual."</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title">@@ -54,7 +54,7 @@<p>For a p-code model of a specific processor, all elements of the processor state (including RAM, registers,flags, etc.) must be contained in some address space. The model will define multiple address spaces- to accomplish this, and beyond the raw translation of machine instructions to p-code, the decompiler+ to accomplish this, and beyond the raw translation of machine instructions to p-code, the Decompilercan add additional spaces. Address space definitions that are common across many different processors include:</p><div class="informalexample">@@ -79,7 +79,7 @@<dd><p>A space dedicated to <span class="emphasis"><em>temporary</em></span> registers.- It is used to hold intermediate values when modeling instruction behavior, and the decompiler+ It is used to hold intermediate values when modeling instruction behavior, and the Decompileruses it to allocate space for variables that don't directly correspond to the low levelprocessor state. The name <span class="emphasis"><em>unique</em></span> is reserved for this purpose andis present in all processor models.@@ -89,7 +89,7 @@<dd><p>A space that represents bytes explicitly indexed through a <span class="emphasis"><em>stack pointer</em></span>.- This is an example of an address space added by the decompiler beyond what the raw processor+ This is an example of an address space added by the Decompiler beyond what the raw processormodel defines. The <span class="emphasis"><em>stack</em></span> space is a logical construction representing the set of bytes asingle function might access through its stack pointer. Each stack address representsthe offset of a byte in some underlying space (usually <span class="emphasis"><em>ram</em></span>) relative@@ -135,7 +135,7 @@</p><p>Varnodes by themselves do not necessarily have a data-type associated with them.- The decompiler ultimately assigns a formal data-type, but at the lowest level of p-code,+ The Decompiler ultimately assigns a formal data-type, but at the lowest level of p-code,varnodes inherit one the building block data-types from the p-code operations thatact on them:</p>@@ -262,10 +262,10 @@<p>Most opcodes naturally correspond to a particular C operator token,- and in decompiler output, many of the operator tokens displayed correspond- directly to a p-code operation present in the decompiler's internal+ and in Decompiler output, many of the operator tokens displayed correspond+ directly to a p-code operation present in the Decompiler's internalrepresentation. The biggest exception are the <span class="emphasis"><em>Branching</em></span>- operations; the decompiler uses standard high-level language control-flow+ operations; the Decompiler uses standard high-level language control-flowstructures, like <span class="emphasis"><em>if/else</em></span>, <span class="emphasis"><em>switch</em></span>, and<span class="emphasis"><em>do/while</em></span> blocks, instead of thelow-level branching operations. But even here, there is some correspondence@@ -669,7 +669,7 @@<a name="ConceptControlFlow"></a>P-code Control Flow</h4></div></div></div><p>- P-code has natural <span class="bold"><strong>control-flow</strong></span>, with the subtlety that flow+ P-code has natural <span class="bold"><strong>control flow</strong></span>, with the subtlety that flowhappens both within and across machine instructions. Most p-code operators have<span class="bold"><strong>fall-through</strong></span> semantics, meaning that flow moves to thenext operator in the sequence associated with the instruction, or, if the operator is the@@ -680,7 +680,7 @@</p><p>Ghidra labels a machine instruction with one of the following <span class="bold"><strong>Flow Types</strong></span> that describe- its overall control-flow. The Flow Type is derived directly from the control-flow of the p-code for the instruction,+ its overall control flow. The Flow Type is derived directly from the control flow of the p-code for the instruction,with the basic types corresponding directly with a specific branching p-code operator.</p><div class="informalexample">@@ -737,8 +737,8 @@not specified.</p><p>- The decompiler treats a CALLOTHER operation as a black box. It will keep track of data- flowing into and out of the operation but won't simplify or transform it. In decompiler+ The Decompiler treats a CALLOTHER operation as a black box. It will keep track of data+ flowing into and out of the operation but won't simplify or transform it. In Decompileroutput, a CALLOTHER is usually displayed using its unique name, with functional syntaxshowing its inputs and output.</p>@@ -748,7 +748,7 @@<span class="bold"><strong>Callother-Fixup</strong></span>, which is substituted for theCALLOTHER operation during decompilation, or by other Analyzers that use p-code.Callother-Fixups are applied by Ghidra for specific processor or compiler variants,- and a user can choose to apply them to an individual Program. (See <a class="xref" href="DecompilerOptions.html#ExtensionOptions" title="Specification Extensions">“Specification Extensions”</a>)+ and a user can choose to apply them to an individual Program (see <a class="xref" href="DecompilerOptions.html#ExtensionOptions" title="Specification Extensions">Specification Extensions</a>).</p></div>@@ -757,10 +757,10 @@<a name="ConceptInternalFunctions"></a>Internal Decompiler Functions</h4></div></div></div><p>- Certain p-code operations can show up in decompiler output that cannot be represented+ Certain p-code operations can show up in Decompiler output that cannot be representedas either an operator token, a cast operation, or other depiction that is natural to- the language. The decompiler generally tries to eliminate these, but this isn't always- possible. The decompiler resorts to a functional syntax for these kinds+ the language. The Decompiler generally tries to eliminate these, but this isn't always+ possible. The Decompiler resorts to a functional syntax for these kindsof p-code operations, displaying them as if they were built-in functions for the language.</p><div class="informalexample">@@ -878,7 +878,7 @@<p>A <span class="bold"><strong>HighFunction</strong></span> is the collection of specific information- produced by the decompiler about a function, referring to the root class in the Ghidra+ produced by the Decompiler about a function, referring to the root class in the Ghidrasource which holds this information.The HighFunction is made up of the following explicit objects:</p>@@ -900,11 +900,11 @@<p></p><p>- The decompiler's output provides a standalone view of the function which is distinct+ The Decompiler's output provides a standalone view of the function which is distinctfrom any annotations about the function that are present in the Program database- and displayed in the Listing view (although the output may be informed by these annotations).+ and displayed in the Listing (although the output may be informed by these annotations).The terms <span class="emphasis"><em>HighFunction</em></span>, <span class="emphasis"><em>HighVariable</em></span>, and- <span class="emphasis"><em>HighSymbol</em></span> refer to this decompiler specific view of the function.+ <span class="emphasis"><em>HighSymbol</em></span> refer to this Decompiler specific view of the function.</p><div class="sect2">@@ -913,7 +913,7 @@<p>A <span class="bold"><strong>HighSymbol</strong></span> is one of the explicit symbols recovered by the- decompiler. It is made up of a name and data-type and can describe either:+ Decompiler. It is made up of a name and data-type and can describe either:</p><div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: none; ">@@ -933,10 +933,10 @@<p>An important aspect of HighSymbols is that they are distinct fromthe standard Ghidra symbols stored in the Program database and are part of- the decompiler's separate view of the function. When the decompiler displays+ the Decompiler's separate view of the function. When the Decompiler displaysdeclarations for symbols in its output for instance, it is displayingHighSymbols, which may not directly match up with database symbols.- The decompiler is generally+ The Decompiler is generally<span class="emphasis"><em>informed</em></span> by annotations in the database and maycopy specific symbols from the database into its view, but it isgenerally free to invent new symbols discovered during its analysis.@@ -953,12 +953,12 @@<a name="ConceptVarnodeSSA"></a>Varnodes in the Decompiler</h3></div></div></div><p>- Varnodes are the central <span class="emphasis"><em>variable</em></span> concept for the decompiler.- They form the individual nodes in the decompiler's data-flow representation+ Varnodes are the central <span class="emphasis"><em>variable</em></span> concept for the Decompiler.+ They form the individual nodes in the Decompiler's data-flow representationof functions and are used during all stages of analysis. During the initial stagesof analysis, varnodes simply represent specific storage locations that are accessed- in sequence by individual p-code operations. The decompiler immediately converts- the p-code into a graph based data-flow representation, called Static Single+ in sequence by individual p-code operations. The Decompiler immediately converts+ the p-code into a graph-based data-flow representation, called Static SingleAssignment (SSA) form. In this form, the varnodes take on some additional attributes.</p><p>@@ -984,15 +984,15 @@</ul></div></div><p>- The scope extends via control-flow to each p-code operation that <span class="emphasis"><em>reads</em></span> the+ The scope extends via control flow to each p-code operation that <span class="emphasis"><em>reads</em></span> thespecific varnode as an operand. The value of the varnode between the defining p-code operationand the reading operations does not change. The scope of a varnode can be thought of as a set- of addresses within the function's body connected by control-flow. The address of the defining+ of addresses within the function's body connected by control flow. The address of the definingp-code operation is referred to as the varnode's <span class="bold"><strong>first use point</strong></span>or <span class="bold"><strong>first use offset</strong></span>.</p><p>- In the decompiler output for a specific high-level language like C or Java,+ In the Decompiler output for a specific high-level language like C or Java,a varnode still has a <span class="emphasis"><em>scope</em></span> and represents a variablein the high-level language only across this connected region of the code.A set of varnodes, with disjoint scopes, provides a complete@@ -1008,7 +1008,7 @@<p>A <span class="bold"><strong>HighVariable</strong></span> is a set varnodes that, takentogether, represent the storage of an entire variable in the high-level language- being output by the decompiler. Each varnode describes where the variable's+ being output by the Decompiler. Each varnode describes where the variable'svalue is stored across some section of code.</p><p>@@ -1038,9 +1038,9 @@<p><span class="bold"><strong>Merging</strong></span> is the part of the analysis process where- the decompiler decides what varnodes get grouped together to create the final+ the Decompiler decides what varnodes get grouped together to create the finalHighVariables in the output. Each varnode's scope (see the discussion in- <a class="xref" href="DecompilerConcepts.html#ConceptVarnodeSSA" title="Varnodes in the Decompiler">“Varnodes in the Decompiler”</a>) provides the fundamental restriction on this process.+ <a class="xref" href="DecompilerConcepts.html#ConceptVarnodeSSA" title="Varnodes in the Decompiler">Varnodes in the Decompiler</a>) provides the fundamental restriction on this process.Two varnodes cannot be merged if their scopes intersect. But this leaves a lot ofleeway in what varnodes <span class="emphasis"><em>can</em></span> be merged.</p>@@ -1051,14 +1051,14 @@to as <span class="bold"><strong>forced merging</strong></span>.</p><p>- The decompiler may also merge varnodes that could just as easily exist as separate+ The Decompiler may also merge varnodes that could just as easily exist as separatevariables. This is called <span class="bold"><strong>speculative merging</strong></span>.- In addition to the intersection condition on varnode scopes, the decompiler only- speculatively merges variables that share the same data-type. Beyond this, the decompiler+ In addition to the intersection condition on varnode scopes, the Decompiler only+ speculatively merges variables that share the same data-type. Beyond this, the Decompilerprioritizes variable pairs that are read and written within the same instruction and- then pairs that are "near" each other in the control-flow of the function.+ then pairs that are <span class="emphasis"><em>near</em></span> each other in the control flow of the function.To a limited extent, users are able to control this kind of merging- (See <a class="xref" href="DecompilerWindow.html#ActionIsolate" title="Split Out As New Variable">“Split Out As New Variable”</a>).+ (see <a class="xref" href="DecompilerWindow.html#ActionIsolate" title="Split Out As New Variable">Split Out As New Variable</a>).</p></div></div>@@ -1077,12 +1077,12 @@a calling convention and holds its specific rules and resource details.</p><p>- Prototype models are architecture specific, and depending on the compiler, a single Program may make- use of multiple models. Subsequently, each distinct model has a name like <code class="code">__stdcall</code> or- <code class="code">__thiscall</code>. The decompiler makes use of the prototype model, as assigned to the function by the user or+ Prototype models are architecture-specific, and depending on the compiler, a single Program may make+ use of multiple models. Subsequently, each distinct model has a name like <span class="bold"><strong>__stdcall</strong></span> or+ <span class="bold"><strong>__thiscall</strong></span>. The Decompiler makes use of the prototype model, as assigned to the function by the user ordiscovered in some other way, when performing its analysis of parameters.- It is possible for users to extend the set of prototype models available to a Program,- see <a class="xref" href="DecompilerOptions.html#ExtensionOptions" title="Specification Extensions">“Specification Extensions”</a>.+ It is possible for users to extend the set of prototype models available to a Program+ (see <a class="xref" href="DecompilerOptions.html#ExtensionOptions" title="Specification Extensions">Specification Extensions</a>).</p><p>A prototype model is typically used as a whole and is assigned by name to individual functions. But some of@@ -1103,12 +1103,60 @@If the parameteris stored on the stack, the storage location is viewed as a constant offset in the <span class="bold"><strong>stack</strong></span>space, where the offset is relative to the incoming value of <span class="emphasis"><em>stack pointer</em></span>- (See the discussion in <a class="xref" href="DecompilerConcepts.html#ConceptAddressSpace" title="Address Space">“Address Space”</a>).+ (see the discussion in <a class="xref" href="DecompilerConcepts.html#ConceptAddressSpace" title="Address Space">Address Space</a>).</p><p>- The <span class="emphasis"><em>return value</em></span> for the function, similarly, is stored at a single memory location. It- is guaranteed to be at that location only at points where the function is exited. There may be multiple exit- points, but they all share the same return value storage location.+ The <span class="emphasis"><em>return value</em></span> for the function, unless it is passed back on the stack, is also stored at a single+ memory location. It is guaranteed to be at that location only at points where the function is exited. There may be multiple exit+ points, but they all share the same return value storage location. For return values passed back on the stack, compilers+ generally implement a special input register to hold the location where the value will be stored. See the+ discussion of <a class="xref" href="DecompilerConcepts.html#ConceptAutoParameters" title="Auto-Parameters">Auto-Parameters</a> and the <span class="bold"><strong>__return_storage_ptr__</strong></span> below.+ </p>+ </div>+ <div class="sect3">+<div class="titlepage"><div><div><h4 class="title">+<a name="ConceptAutoParameters"></a>Auto-Parameters</h4></div></div></div>++ <p>+ Compiled binaries may pass values as parameters between functions that aren't in the formal+ list of parameters as defined by the original source code for the program. These are referred to+ as <span class="bold"><strong>auto-parameters</strong></span> or sometimes <span class="bold"><strong>hidden</strong></span>+ parameters within the documentation. If the prototype model requires it, Ghidra will automatically+ create an auto-parameter for a function to honor a user's request for a specific formal signature.+ See <a class="ulink" href="help/topics/FunctionPlugin/Variables.htm#Edit_Function" target="_top">Function Editor Dialog</a>.+ Because reverse engineers need to see them, the+ Decompiler will generally display auto-parameters explicitly in function prototypes as part of its output, even though+ they would not be present in the original source.+ Ghidra explicitly defines two auto-parameters:+ </p>+<div class="informalexample">+ <div class="variablelist"><dl class="variablelist">+<dt><span class="term"><span class="bold"><strong>this</strong></span></span></dt>+<dd>+ <p>+ Within Object Oriented languages, a function defined as a class <span class="emphasis"><em>method</em></span>+ often has a <span class="bold"><strong>this</strong></span> parameter pointing to an instantiation of the+ class' structure data-type. Within Ghidra, functions with the <span class="bold"><strong>__thiscall</strong></span>+ calling convention are automatically assigned a <span class="bold"><strong>this</strong></span> parameter.+ If the function is part of a class namespace and the class has an associated structure, the+ <span class="bold"><strong>this</strong></span> parameter will be a pointer to the structure, otherwise+ it will be a pointer to the <span class="bold"><strong>void</strong></span> data-type.+ </p>+ </dd>+<dt><span class="term"><span class="bold"><strong>__return_storage_ptr__</strong></span></span></dt>+<dd>+ <p>+ Most calling conventions allow the value returned by a function, if it is large enough, to be passed back+ on the stack instead of in a register. This is usually implemented by having the calling function+ pass an additional <span class="emphasis"><em>input</em></span> parameter that holds a pointer to the location on+ the stack where the return value should be stored. Ghidra labels this special parameter as+ <span class="bold"><strong>__return_storage_ptr__</strong></span>, which will be a pointer to the+ data-type of the return value.+ </p>+ </dd>+</dl></div>+ </div>+<p></p></div><div class="sect3">@@ -1122,7 +1170,7 @@These encompass a calling convention's <span class="emphasis"><em>saved registers</em></span>, where a calling functioncan store values it doesn't want to change unexpectedly, but also may include other registers that areknown not to change, like the stack pointer.- The decompiler uses the information to determine which locations can be safely propagated across+ The Decompiler uses the information to determine which locations can be safely propagated acrossa called function.</p></div>@@ -1153,7 +1201,7 @@Disassemble machine instructions from the underlying bytes and</li><li class="listitem" style="list-style-type: disc">- Produce the raw p-code consumed by the decompiler and other analyzers.+ Produce the raw p-code consumed by the Decompiler and other analyzers.</li></ul></div></div>@@ -1161,8 +1209,8 @@</p><p>Specification files are selected based on the <span class="emphasis"><em>Language Id</em></span>- assigned to the Program at the time it is imported into Ghidra.- (See <a class="ulink" href="help/topics/ImporterPlugin/importer.htm" target="_top">Import Program</a>)+ assigned to the Program at the time it is imported into Ghidra+ (see <a class="ulink" href="help/topics/ImporterPlugin/importer.htm" target="_top">Import Program</a>).</p><div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: none; ">@@ -1180,16 +1228,17 @@<li class="listitem">Processor family</li><li class="listitem">Endianess</li><li class="listitem">Size of the address bus</li>-<li class="listitem">Process variant</li>+<li class="listitem">Processor variant</li><li class="listitem">Compiler producing the Program</li></ul></div></div><p>- A field with the value 'default' indicates either the preferred processor variant or the preferred compiler.+ A field with the value <span class="bold"><strong>default</strong></span> indicates either the preferred processor variant or the preferred compiler.</p><p>Within the Ghidra installation, specification files are stored based on the overarching- processor family, such as 'MIPS' or 'x86'. For a specific family, files are located under+ processor family, such as <span class="bold"><strong>MIPS</strong></span> or+ <span class="bold"><strong>x86</strong></span>. For a specific family, files are located under</p><div class="informalexample"><code class="code"><Root>/Ghidra/Processors/<Family>/data/languages</code>@@ -1210,7 +1259,7 @@These are the human readable SLEIGH language files. A single specification isrooted in one of the <code class="code">*.slaspec</code> files, which may recursively includeone or more <code class="code">*.sinc</code> files. The format of these files is described- in the document "SLEIGH: A Language for Rapid Processor Specification".+ in the document "SLEIGH: A Language for Rapid Processor Specification."</p></dd><dt><span class="term"><span class="bold"><strong>Compiled SLEIGH files</strong></span> - *.sla</span></dt>@@ -1258,7 +1307,7 @@Changing any of the specification files described here is not recommended.To make additions to either the <span class="emphasis"><em>compiler specification</em></span>or the <span class="emphasis"><em>processor specification</em></span> files, see- <a class="xref" href="DecompilerOptions.html#ExtensionOptions" title="Specification Extensions">“Specification Extensions”</a>, which describes a safe and portable way+ <a class="xref" href="DecompilerOptions.html#ExtensionOptions" title="Specification Extensions">Specification Extensions</a>, which describes a safe and portable wayto add specific elements.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning">diff --git a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerIntro.html b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerIntro.htmlindex d7d9961f39..d3ce6937f5 100644--- a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerIntro.html+++ b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerIntro.html@@ -39,15 +39,15 @@<p>The Decompiler is a full Plug-in within Ghidra and can be configured to be enabled ordisabled within any particular tool. Default configurations will have the- plug-in enabled, but if its disabled for some reason, it can be enabled from within- a Code Browser by selecting the menu option+ plug-in enabled, but if it is disabled for some reason, it can be enabled from within+ a Code Browser by selecting the</p><div class="informalexample">- <span class="bold"><strong>File -> Configure</strong></span>+ <span class="bold"><strong>File -> Configure...</strong></span></div><p>- Then click on the <span class="emphasis"><em>Configure</em></span> link under the- <span class="bold"><strong>Ghidra Core</strong></span> section and check the box next to+ menu option, then clicking on the <span class="emphasis"><em>Configure</em></span> link under the+ <span class="bold"><strong>Ghidra Core</strong></span> section and checking the box next to<span class="bold"><strong>DecompilePlugin</strong></span>.</p></div>@@ -77,8 +77,8 @@</p><p>The window automatically decompiles and displays the function at the- <span class="emphasis"><em>current address</em></span>. The address is set typically by left-clicking in the Listing window,- or invoking the <span class="emphasis"><em>Goto</em></span> command (pressing the 'g' key) and manually entering+ <span class="emphasis"><em>current address</em></span>. The address is set typically by left-clicking in the Listing,+ or invoking the <span class="emphasis"><em>Go To...</em></span> command (pressing the 'G' key) and manually enteringthe address or some other label, but the Decompiler windowfollows any type of navigation in the Code Browser, triggering decompilation of the new functionbeing displayed.@@ -108,7 +108,7 @@<a name="Capabilities"></a>Capabilities</h3></div></div></div><p>- Some of the primary capabilities of the decompiler include:+ Some of the primary capabilities of the Decompiler include:</p><div class="informalexample">@@ -116,7 +116,7 @@<dt><span class="term"><span class="bold"><strong>Recovering Expressions</strong></span></span></dt><dd><p>- The decompiler does full data-flow analysis which allows it to+ The Decompiler does full data-flow analysis which allows it toperform slicing on functions: complicated expressions, which have been split intodistinct operations/instructions and then mixed together withother instructions by the compiling/optimizing process, are@@ -126,7 +126,7 @@<dt><span class="term"><span class="bold"><strong>Recovering High-Level Scoped Variables</strong></span></span></dt><dd><p>- The decompiler understands how compilers+ The Decompiler understands how compilersuse processor stacks and registers to implement variables withdifferent scopes within a function. Data-flow analysis allows it tofollow what was originally a single variable as it moves from@@ -139,7 +139,7 @@<dt><span class="term"><span class="bold"><strong>Recovering Function Parameters</strong></span></span></dt><dd><p>- The decompiler understands the parameter passing conventions of+ The Decompiler understands the parameter-passing conventions ofthe compiler and can reconstruct the original form offunction calls.</p>@@ -147,7 +147,7 @@<dt><span class="term"><span class="bold"><strong>Using Data-type, Name, and Signature Annotations</strong></span></span></dt><dd><p>- The decompiler automatically pulls in+ The Decompiler automatically pulls inall the different data types and variable names that the userhas applied to functions, and the C output is altered to reflectthis. High-level variables are appropriately named, structure@@ -159,14 +159,14 @@<dt><span class="term"><span class="bold"><strong>Propagating Local Data-types</strong></span></span></dt><dd><p>- The decompiler infers the data-type of unlabeled variables+ The Decompiler infers the data-type of unlabeled variablesby propagating information from other sources throughout a function.</p></dd><dt><span class="term"><span class="bold"><strong>Recovering Structure Definitions</strong></span></span></dt><dd><p>- The decompiler can be used to create structures that match the usage+ The Decompiler can be used to create structures that match the usagepattern of particular functions and variables, automatically discoveringcomponent offsets and data-types.</p>diff --git a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerOptions.html b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerOptions.htmlindex f7e045916f..8f0a6ba0ff 100644--- a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerOptions.html+++ b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerOptions.html@@ -17,26 +17,36 @@<div class="simplesect"><div class="titlepage"></div><p>- This lists configuration options that explicitly affect the behavior of the decompiler or- its output, independent of the code that is being decompiled. The bulk of these are+ This page lists configuration options that explicitly affect the behavior of the Decompiler or+ its output, independent of the code that is being decompiled. The bulk of these options areaccessible by selecting the Code Browser menu</p><div class="informalexample">- <span class="bold"><strong>Edit -> Tool Options</strong></span>+ <span class="bold"><strong>Edit -> Tool Options...</strong></span></div><p>- and then picking the <span class="emphasis"><em>Decompiler</em></span> sub-folder. These options are associated- with the particular tool (Code Browser) being used and will apply to decompilation of any Program- being analyzed by that tool. The three categories of options are:+ and then picking the <span class="emphasis"><em>Decompiler</em></span> folder. The options are associated+ with the particular Code Browser or other tool being used and will apply to decompilation of any Program+ being analyzed by that tool. There are three categories of options, which are listed by clicking either on the+ <span class="emphasis"><em>Decompiler</em></span> folder or one of its two subsections.</p><div class="informalexample">- <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">-<li class="listitem" style="list-style-type: disc">-<a class="xref" href="DecompilerOptions.html#GeneralOptions" title="General Options">“General Options”</a> affecting the engine behavior</li>-<li class="listitem" style="list-style-type: disc">-<a class="xref" href="DecompilerOptions.html#AnalysisOptions" title="Analysis Options">“Analysis Options”</a> affecting the decompiler's transformation process</li>-<li class="listitem" style="list-style-type: disc">-<a class="xref" href="DecompilerOptions.html#DisplayOptions" title="Display Options">“Display Options”</a> affecting the final presentation of decompiler output</li>+ <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: none; ">+<li class="listitem" style="list-style-type: none">+ <span class="guiicon">+ <span class="inlinemediaobject"><img src="images/openFolder.png" width="25" height="17"></span>+ </span><span class="emphasis"><em>Decompiler</em></span> - lists <a class="xref" href="DecompilerOptions.html#GeneralOptions" title="General Options">General Options</a> that affect the engine behavior.+ </li>+<li class="listitem" style="list-style-type: none">+  <span class="guiicon">+ <span class="inlinemediaobject"><img src="images/document-properties.png" width="16" height="16"></span>+ </span>�<span class="emphasis"><em>Analysis</em></span> - lists <a class="xref" href="DecompilerOptions.html#AnalysisOptions" title="Analysis Options">Analysis Options</a> that affect the Decompiler's transformation process.+ </li>+<li class="listitem" style="list-style-type: none">+  <span class="guiicon">+ <span class="inlinemediaobject"><img src="images/document-properties.png" width="16" height="16"></span>+ </span>�<span class="emphasis"><em>Display</em></span> - lists <a class="xref" href="DecompilerOptions.html#DisplayOptions" title="Display Options">Display Options</a> that affect the final presentation of Decompiler output.+ </li></ul></div></div><p>@@ -46,13 +56,13 @@selecting the Code Browser menu</p><div class="informalexample">- <span class="bold"><strong>Edit -> Options for <Program></strong></span>+ <span class="bold"><strong>Edit -> Options for <program>...</strong></span>.</div><p>- Picking the <span class="emphasis"><em>Decompiler</em></span> tab shows <a class="xref" href="DecompilerOptions.html#ProgramOptions" title="Program Options">“Program Options”</a>- that only affect the decompiler. Picking the <a class="xref" href="DecompilerOptions.html#ExtensionOptions" title="Specification Extensions">“Specification Extensions”</a> tab+ Picking the <span class="emphasis"><em>Decompiler</em></span> section shows <a class="xref" href="DecompilerOptions.html#ProgramOptions" title="Program Options">Program Options</a>+ that only affect the Decompiler. Picking the <a class="xref" href="DecompilerOptions.html#ExtensionOptions" title="Specification Extensions">Specification Extensions</a> sectionshows a table of the available prototype models, call-fixups, and callother-fixups. These- affect more than just the decompiler but are also documented here.+ affect more than just the Decompiler but are also documented here.</p></div><div class="section">@@ -60,7 +70,7 @@<a name="GeneralOptions"></a>General Options</h2></div></div></div><p>- These options govern what resources are available to the Plug-in and the decompiler engine but do+ These options govern what resources are available to the Plug-in and the Decompiler engine but donot affect how analysis is performed or results are displayed.</p><p>@@ -72,7 +82,7 @@</dt><dd><p>- Decompilation results for a single function can be compute intensive to produce.+ Producing decompilation results for a single function can be computationally intensive.This option specifies the number of functions whose decompilation resultscan be cached simultaneously. When navigating to a function thathas been recently cached, as when navigating back and forth between a few functions,@@ -84,7 +94,7 @@</dt><dd><p>- This is a limit on the number of bytes that can be produced by the decompiler process as output+ This option limits the number of bytes that can be produced by the Decompiler process as outputwhen decompiling a single function. A payload includes the actual characters to be displayed inthe window, additional token markup, symbol information, and other details of the underlyingsyntax tree. The limit is specified in megabytes of data. If the limit is exceeded for a single@@ -97,11 +107,11 @@</dt><dd><p>- This option sets an upper limit on the number of seconds the decompiler spends attempting+ This option sets an upper limit on the number of seconds the Decompiler spends attemptingto analyze one function before aborting.- It is currently <span class="bold"><strong>not</strong></span> enforced for the Decompilation- Window. Instead it applies to the DecompilerSwitchAnalyzer, the <code class="code">analyzeHeadless</code> command, scripts, or other- plug-ins that make use of the decompiler service.+ It is currently <span class="bold"><strong>not</strong></span> enforced for a Decompiler+ window. Instead it applies to the DecompilerSwitchAnalyzer, the <code class="code">analyzeHeadless</code> command, scripts, and other+ plug-ins that make use of the Decompiler service.</p></dd><dt>@@ -109,10 +119,10 @@</dt><dd><p>- This option sets a maximum number of machine instructions that the decompiler will attempt+ This option sets a maximum number of machine instructions that the Decompiler will attemptto analyze for a single function, as a safeguard against analyzing a long sequence- of zeroes or other constant data. The decompiler will quickly throw an exception if it- traces control-flow into more than the indicated number of instructions.+ of zeroes or other constant data. The Decompiler will quickly throw an exception if it+ traces control flow into more than the indicated number of instructions.</p></dd></dl></div>@@ -126,7 +136,7 @@<a name="AnalysisOptions"></a>Analysis Options</h2></div></div></div><p>- These options directly affect how the decompiler performs its analysis, either by+ These options directly affect how the Decompiler performs its analysis, either bytoggling specific analysis passes or changing how it treats various annotations.</p><p>@@ -138,16 +148,16 @@</dt><dd><p>- When deciding if an individual stack location has become dead, the decompiler+ When deciding if an individual stack location has become dead, the Decompilermust consider <span class="emphasis"><em>aliases</em></span>, pointers onto the stack that could- be used to modify the location within a called function. One strong heuristic the decompiler- uses is; if the user has explicitly created a variable on the stack between the+ be used to modify the location within a called function. One strong heuristic the Decompiler+ uses is: if the user has explicitly created a variable on the stack between thebase location referenced by the pointer and the individual stack location, then- the decompiler can assume that the pointer is not an alias of the stack location.+ the Decompiler can assume that the pointer is not an alias of the stack location.The alias is <span class="emphasis"><em>blocked</em></span> by the explicit variable.However, if the user's explicit variable is labeling something that isn't- really an explicit variable, like a field within a larger structure for instance,- the decompiler may incorrectly consider the stack location as dead and start removing+ really an explicit variable, like a field within a larger structure, for instance,+ the Decompiler may incorrectly consider the stack location as dead and start removinglive code.</p><p>@@ -157,12 +167,13 @@<div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "><li class="listitem" style="list-style-type: disc">-<span class="bold"><strong>None</strong></span> - No data-type is considered blocking.</li>+<span class="bold"><strong>None</strong></span> - No data-type is considered blocking</li><li class="listitem" style="list-style-type: disc">-<span class="bold"><strong>Structures</strong></span> - Only structured data-types are blocking.</li>-<li class="listitem" style="list-style-type: disc"><span class="bold"><strong>Structures and Arrays</strong></span></li>+<span class="bold"><strong>Structures</strong></span> - Only structures are blocking</li><li class="listitem" style="list-style-type: disc">-<span class="bold"><strong>All Data-types</strong></span> - All data-types are blocking.</li>+<span class="bold"><strong>Structures and Arrays</strong></span> - Only structures and arrays are blocking</li>+<li class="listitem" style="list-style-type: disc">+<span class="bold"><strong>All Data-types</strong></span> - All data-types are blocking</li></ul></div></div><p>@@ -172,38 +183,21 @@</p></dd><dt>-<a name="AnalysisForLoops"></a><span class="term"><span class="bold"><strong>Recover -for- loops</strong></span></span>-</dt>-<dd>- <p>- When this is toggle <span class="emphasis"><em>on</em></span>, the decompiler attempts to pinpoint- variables that control the iteration over specific loops in the function body.- When these <span class="emphasis"><em>loop</em></span> variables are discovered, the loop is- rendered using a standard <span class="bold"><strong>for</strong></span> loop header- that contains an initializer statement, condition, and iterating statement.- </p>-<div class="informalexample">- <code class="code">for (iVar2 = 10; iVar2 < len; iVar2 = iVar2 + 1) { ...</code>- </div>-<p>- </p>- <p>- If the toggle is <span class="emphasis"><em>off</em></span>, the loop is displayed using- <span class="bold"><strong>while</strong></span> syntax, with any initializer and- iterating statements mixed in with the loop body or preceding basic blocks.- </p>- </dd>-<dt><a name="AnalysisUnreachable"></a><span class="term"><span class="bold"><strong>Eliminate unreachable code</strong></span></span></dt><dd><p>- When this is toggled <span class="emphasis"><em>on</em></span>, the decompiler eliminates code that it+ When toggled <span class="emphasis"><em>on</em></span>, the Decompiler eliminates code that itconsiders unreachable. This usually happens when, due to constant propagation and other- analysis, the decompiler decides that a boolean value controlling a conditional branch can+ analysis, the Decompiler decides that a boolean value controlling a conditional branch canonly take one possible value and removes the branch corresponding to the other value. Togglingthis to <span class="emphasis"><em>off</em></span> lets the user see the dead code, which is typically demarcated- by the control-flow structure -- <code class="code">if (false) { ... }</code>.+ by the control-flow structure:+ </p>+<div class="informalexample">+ <code class="code">if (false) { ... }</code>+ </div>+<p></p></dd><dt>@@ -211,15 +205,15 @@</dt><dd><p>- When toggled <span class="emphasis"><em>on</em></span>, the decompiler treats instructions whose semantics+ When toggled <span class="emphasis"><em>on</em></span>, the Decompiler treats instructions whose semanticshave been formally marked <span class="bold"><strong>unimplemented</strong></span> as if they do- nothing (no operation). Crucially, control-flow falls through to the next instruction.- In this case, the decompiler inserts the warning "Control flow ignored unimplemented+ nothing (no operation). Crucially, control flow falls through to the next instruction.+ In this case, the Decompiler inserts the warning "Control flow ignored unimplementedinstructions" as a comment in the function header, but the exact point at whichinstruction was ignored may not be clear.- If this option is toggled <span class="emphasis"><em>off</em></span>, the decompiler inserts the built-in+ If this option is toggled <span class="emphasis"><em>off</em></span>, the Decompiler inserts the built-infunction <code class="code">halt_unimplemented()</code> at the point of the unimplemented instruction, and- control-flow does not fall through.+ control flow does not fall through.</p></dd><dt>@@ -227,12 +221,34 @@</dt><dd><p>- When toggled <span class="emphasis"><em>on</em></span>, the decompiler infers a data-type for constants+ When toggled <span class="emphasis"><em>on</em></span>, the Decompiler infers a data-type for constantsit determines are likely pointers. In the basic heuristic,each constant is considered as an address, and if that address starts a known data or function elementin the program, the constant is assumed to be a pointer. The constants are treated likeany other source of data-type information, and the inferred data-types are freely propagated by- the decompiler to other parts of the function.+ the Decompiler to other parts of the function.+ </p>+ </dd>+<dt>+<a name="AnalysisForLoops"></a><span class="term"><span class="bold"><strong>Recover -for- loops</strong></span></span>+</dt>+<dd>+ <p>+ When toggled <span class="emphasis"><em>on</em></span>, the Decompiler attempts to pinpoint+ variables that control the iteration over specific loops in the function body.+ When these <span class="emphasis"><em>loop</em></span> variables are discovered, the loop is+ rendered using a standard <span class="bold"><strong>for</strong></span> loop header+ that contains an initializer statement, condition, and iterating statement.+ </p>+<div class="informalexample">+ <code class="code">for (iVar2 = 10; iVar2 < len; iVar2 = iVar2 + 1) { ...</code>+ </div>+<p>+ </p>+ <p>+ When toggled <span class="emphasis"><em>off</em></span>, the loop is displayed using+ <span class="bold"><strong>while</strong></span> syntax, with any initializer and+ iterating statements mixed in with the loop body or preceding basic blocks.</p></dd><dt>@@ -240,20 +256,20 @@</dt><dd><p>- When toggled <span class="emphasis"><em>on</em></span>, the decompiler treats any values in memory+ When toggled <span class="emphasis"><em>on</em></span>, the Decompiler treats any values in memorymarked <span class="emphasis"><em>read-only</em></span> as constant. If a read-only memory location is explicitlyreferenced by the function being decompiled, it is considered to be unchanging, and the initial- value present in the Program is pulled in to the data-flow of the function as a constant.+ value present in the Program is pulled into the data flow of the function as a constant.Due to <span class="emphasis"><em>Constant Propagation</em></span> and other transformations, read-only memory- can have a large effect on decompiler output.+ can have a large effect on Decompiler output.</p><p>- Typically as part of the import process, Ghidra marks memory blocks as read-only if they+ Typically, as part of the import process, Ghidra marks memory blocks as read-only if theyare tagged as such by a section header or other meta-data in the original binary.Users can actively set whether specific memory regions are considered read-only through the<span class="emphasis"><em>Memory Manager</em></span>, and individual data elements can be markedas <span class="emphasis"><em>constant</em></span> via the <span class="bold"><strong>Mutability</strong></span> setting- (See <a class="xref" href="DecompilerAnnotations.html#AnnoteMutability" title="Data Mutability">“Data Mutability”</a>).+ (see <a class="xref" href="DecompilerAnnotations.html#AnnoteMutability" title="Data Mutability">Data Mutability</a>).</p></dd><dt>@@ -261,7 +277,7 @@</dt><dd><p>- This toggles whether the decompiler attempts to simplify double precision arithmetic operations,+ This toggles whether the Decompiler attempts to simplify double precision arithmetic operations,where a single logical operation is split into two parts, calculating the high and low piecesof the result in separate instructions. Decompiler support for this kind of transform is currentlylimited, and only certain constructions are simplified.@@ -272,10 +288,10 @@</dt><dd><p>- When this option is active, the decompiler simplifies code sequences containing+ When this option is active, the Decompiler simplifies code sequences containing<span class="emphasis"><em>predicated</em></span> instructions. A predicated instruction is executedconditionally based on a boolean value, the <span class="bold"><strong>predicate</strong></span>,- and a sequence of instructions can share the same predicate. The decompiler merges the+ and a sequence of instructions can share the same predicate. The Decompiler merges theresulting <code class="code">if/else</code> blocks that share the same predicate so that the condition is onlyprinted once.</p>@@ -285,7 +301,7 @@</dt><dd><p>- When toggled <span class="emphasis"><em>on</em></span>, the decompiler employs in-place assignment operators,+ When toggled <span class="emphasis"><em>on</em></span>, the Decompiler employs in-place assignment operators,such as <code class="code">+=</code> and <code class="code"><<=</code>, in its output syntax.</p></dd>@@ -300,7 +316,7 @@<a name="DisplayOptions"></a>Display Options</h2></div></div></div><p>- These options do not change the decompiler's analysis but only affect how the results are presented.+ These options do not change the Decompiler's analysis but only affect how the results are presented.</p><p></p>@@ -315,11 +331,21 @@</p></dd><dt>+<a name="DisplayColorDefault"></a><span class="term"><span class="bold"><strong>Color Default</strong></span></span>+</dt>+<dd>+ <p>+ Assign the color to any characters emitted by the Decompiler that do not fall into one of token types+ listed below. This includes delimiter characters like commas and parentheses as well as various <span class="emphasis"><em>operator</em></span>+ characters.+ </p>+ </dd>+<dt><a name="DisplayTokenColor"></a><span class="term"><span class="bold"><strong>Color for <token></strong></span></span></dt><dd><p>- Assign colors to the different types of language tokens emitted by the decompiler.+ Assign colors to the different types of language tokens emitted by the Decompiler.These include:</p><div class="informalexample">@@ -344,21 +370,11 @@</p></dd><dt>-<a name="DisplayColorDefault"></a><span class="term"><span class="bold"><strong>Color Default</strong></span></span>-</dt>-<dd>- <p>- Assign the color to any characters emitted by the decompiler that do not fall into one of token types- listed above. This includes delimiter characters like commas and parentheses as well as various <span class="emphasis"><em>operator</em></span>- characters.- </p>- </dd>-<dt><a name="DisplayCurrentHighlight"></a><span class="term"><span class="bold"><strong>Color for Current Variable Highlight</strong></span></span></dt><dd><p>- Assign the background color used to highlight the token currently under the cursor in a Decompiler Window.+ Assign the background color used to highlight the token currently under the cursor in a Decompiler window.</p></dd><dt>@@ -366,8 +382,8 @@</dt><dd><p>- Assign the background color used to highlight characters matching the current <span class="emphasis"><em>Find</em></span> pattern.- See <a class="xref" href="DecompilerWindow.html#ActionFind" title="Find ...">“Find ...”</a>.+ Assign the background color used to highlight characters matching the current <span class="emphasis"><em>Find</em></span> pattern+ (see <a class="xref" href="DecompilerWindow.html#ActionFind" title="Find...">Find...</a>).</p></dd><dt>@@ -375,7 +391,7 @@</dt><dd><p>- Set the number of characters that comment lines are indented within decompiler output. This applies only+ Set the number of characters that comment lines are indented within Decompiler output. This applies onlyto comments within the body of the function being displayed. Comments at the head of the functionare not indented.</p>@@ -385,7 +401,7 @@</dt><dd><p>- Set the language syntax used to delimit comments emitted as part of decompiler output. For C and Java,+ Set the language syntax used to delimit comments emitted as part of Decompiler output. For C and Java,the choices are <code class="code">/* C style comments */</code> and <code class="code">// C++ style comments</code>.</p></dd>@@ -394,7 +410,7 @@</dt><dd><p>- Set whether the syntax for <span class="emphasis"><em>type casts</em></span> is emitted in decompiler output.+ Set whether the syntax for <span class="emphasis"><em>type casts</em></span> is emitted in Decompiler output.If this is toggled on, type cast syntax is never displayed, even when rules of the languagerequire it. So individual statements may no longer be formally accurate.</p>@@ -404,28 +420,29 @@</dt><dd><p>- Set whether a specific kind of comment can be incorporated into decompiler output. Comments in- Ghidra are categorized based on their placement within the Listing Window, and the decompiler- in general tries to display comments where appropriate. See the discussion in <a class="xref" href="DecompilerAnnotations.html#AnnoteComments" title="Comments">“Comments”</a>.- Each kind of comment has its own toggle and can be individually included or excluded from decompiler output.+ Set whether a specific type of comment should be incorporated into Decompiler output.+ Each type has its own toggle and can be individually included or excluded from Decompiler output.</p><div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "><li class="listitem" style="list-style-type: disc">- <span class="bold"><strong>PLATE</strong></span> - Whether plate comments <span class="emphasis"><em>within the body of the function</em></span> are displayed+ <span class="bold"><strong>EOL</strong></span></li><li class="listitem" style="list-style-type: disc">- <span class="bold"><strong>PRE</strong></span>+ <span class="bold"><strong>PLATE</strong></span> - Whether plate comments <span class="emphasis"><em>within the body of the function</em></span> are displayed</li><li class="listitem" style="list-style-type: disc"><span class="bold"><strong>POST</strong></span></li><li class="listitem" style="list-style-type: disc">- <span class="bold"><strong>EOL</strong></span>+ <span class="bold"><strong>PRE</strong></span></li></ul></div></div><p>+ A comment's type indicates how it is placed within a Listing window, not how it is placed in+ a Decompiler window. All comments within the body of the function are displayed in the same way+ by the decompiler, regardless of their type (see the discussion in <a class="xref" href="DecompilerAnnotations.html#AnnoteComments" title="Comments">Comments</a>).</p></dd><dt>@@ -433,9 +450,9 @@</dt><dd><p>- Toggle whether the decompiler emits comments at the head (before the beginning) of a function.+ Toggle whether the Decompiler emits comments at the head (before the beginning) of a function.The header is built from Plate comments placed at the <span class="emphasis"><em>entry point</em></span> of the- function. See the discussion in <a class="xref" href="DecompilerAnnotations.html#AnnoteComments" title="Comments">“Comments”</a>.+ function (see the discussion in <a class="xref" href="DecompilerAnnotations.html#AnnoteComments" title="Comments">Comments</a>).The inclusion of other Plate comments is controlled by the <span class="bold"><strong>Display PLATE comments</strong></span> toggle, described above.</p></dd>@@ -444,11 +461,11 @@</dt><dd><p>- Toggle whether line numbers are displayed in any Decompiler Window. If toggled- on, each Decompiler Window reserves space to display a numbers down the left- side of the window, labeling each line of output produced by the decompiler.+ Toggle whether line numbers are displayed in any Decompiler window. If toggled+ on, each Decompiler window reserves space to display a numbers down the left+ side of the window, labeling each line of output produced by the Decompiler.Line numbers are associated with the window itself and are not formally part of- the decompiler's output.+ the Decompiler's output.</p></dd><dt>@@ -456,19 +473,19 @@</dt><dd><p>- Control how the decompiler displays namespace information associated+ Control how the Decompiler displays namespace information associatedwith function and variable symbols. The possible settings are:</p><div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "><li class="listitem" style="list-style-type: disc">- <span class="bold"><strong>Always</strong></span> - Always display the entire namespace path+ <span class="bold"><strong>Minimally</strong></span> - Display the minimal path that distinguishes the symbol</li><li class="listitem" style="list-style-type: disc">- <span class="bold"><strong>Never</strong></span> - Never display the namespace path+ <span class="bold"><strong>Always</strong></span> - Always display the entire namespace path</li><li class="listitem" style="list-style-type: disc">- <span class="bold"><strong>Minimally</strong></span> - Display the minimal path that distinguishes the symbol+ <span class="bold"><strong>Never</strong></span> - Never display the namespace path</li></ul></div></div>@@ -489,9 +506,9 @@</dt><dd><p>- Toggle whether decompiler generated <span class="emphasis"><em>WARNING</em></span> comments are displayed as part- of the output. The decompiler generates these comments, independent of those laid down by users, to- indicate unusual conditions or possible errors (See <a class="xref" href="DecompilerAnnotations.html#CommentWarnings" title="Warning Comments">“Warning Comments”</a>).+ Toggle whether Decompiler generated <span class="emphasis"><em>WARNING</em></span> comments are displayed as part+ of the output. The Decompiler generates these comments, independent of those laid down by users, to+ indicate unusual conditions or possible errors (see <a class="xref" href="DecompilerAnnotations.html#CommentWarnings" title="Warning Comments">Warning Comments</a>).</p></dd><dt>@@ -499,8 +516,8 @@</dt><dd><p>- Set the typeface used to render characters in any Decompiler Window. Indentation is generally clearer- using a monospaced (fixed width) font, but any font available to the system can be used. The size of+ Set the typeface used to render characters in any Decompiler window. Indentation is generally clearer+ using a monospaced (fixed-width) font, but any font available to Ghidra can be used. The size ofthe font can also be controlled from this option.</p></dd>@@ -509,19 +526,19 @@</dt><dd><p>- Set how integer constants are formatted in the decompiler output.+ Set how integer constants are formatted in the Decompiler output.The possible settings are:</p><div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "><li class="listitem" style="list-style-type: disc">- <span class="bold"><strong>Best Fit</strong></span> - Select the most <span class="emphasis"><em>natural</em></span> representation+ <span class="bold"><strong>Force Hexadecimal</strong></span> - Always use a hexadecimal representation</li><li class="listitem" style="list-style-type: disc"><span class="bold"><strong>Force Decimal</strong></span> - Always use a decimal representation</li><li class="listitem" style="list-style-type: disc">- <span class="bold"><strong>Force Hexadecimal</strong></span> - Always use a hexadecimal representation+ <span class="bold"><strong>Best Fit</strong></span> - Select the most <span class="emphasis"><em>natural</em></span> representation</li></ul></div></div>@@ -536,8 +553,8 @@</dt><dd><p>- Set the maximum number of characters in a line of code emitted by the decompiler before a line break- is forced. The decompiler will not split an individual token across lines. So line breaks frequently+ Set the maximum number of characters in a line of code emitted by the Decompiler before a line break+ is forced. The Decompiler will not split an individual token across lines. So line breaks frequentlywill come before the maximum number of characters is reached, and technically a single token canextend the line beyond the maximum.</p>@@ -548,9 +565,9 @@<dd><p>Set the amount of indenting used to print statements within a nested scope in the- decompiler output. Each level of nesting (for function bodies,+ Decompiler output. Each level of nesting (function bodies,loop bodies, <span class="bold"><strong>if/else</strong></span> bodies, etc.)- bodies adds this number characters.+ adds this number characters.</p></dd><dt>@@ -558,10 +575,10 @@</dt><dd><p>- Set how null pointers are displayed in decompiler output. If this is toggled- on, the decompiler will print a constant pointer value of zero (a <span class="bold"><strong>null</strong></span> pointer)+ Set how null pointers are displayed in Decompiler output. If this is toggled+ on, the Decompiler will print a constant pointer value of zero (a <span class="bold"><strong>null</strong></span> pointer)using the special token <code class="code">NULL</code>. Otherwise the pointer value is represented with the '0' character,- which is then type cast into a pointer.+ which is then cast to a pointer.</p></dd><dt>@@ -570,10 +587,10 @@<dd><p>Set whether the <span class="emphasis"><em>calling convention</em></span> is printed as part of the function- declaration in decompiler output. If this option is turned on, the name of the calling convention+ declaration in Decompiler output. If this option is turned on, the name of the calling conventionis printed just prior to the return value data-type within the function declaration. All functionsin Ghidra have an associated calling convention (or prototype model) that is used during- decompiler analysis. See the discussion in <a class="xref" href="DecompilerConcepts.html#ConceptPrototypeModel" title="Prototype Model">“Prototype Model”</a>.+ Decompiler analysis (see the discussion in <a class="xref" href="DecompilerConcepts.html#ConceptPrototypeModel" title="Prototype Model">Prototype Model</a>).</p></dd></dl></div>@@ -587,7 +604,7 @@<a name="ProgramOptions"></a>Program Options</h2></div></div></div><p>- Changes to these options affect only the decompiler and only for+ Changes to these options affect only the Decompiler and only forthe current Program being analyzed.</p><p>@@ -600,9 +617,9 @@<dd><p>Sets the calling convention (prototype model) used when decompiling a function where- the convention is not known (i.e. marked as "unknown"). Many architectures have multiple- calling conventions, <code class="code">__stdcall</code>, <code class="code">__thiscall</code> etc. See the- discussion in <a class="xref" href="DecompilerConcepts.html#ConceptPrototypeModel" title="Prototype Model">“Prototype Model”</a>.+ the convention is not known; i.e., marked as <span class="bold"><strong>unknown</strong></span>. Many architectures have multiple+ calling conventions, <span class="bold"><strong>__stdcall</strong></span>, <span class="bold"><strong>__thiscall</strong></span>, etc.+ (see the discussion in <a class="xref" href="DecompilerConcepts.html#ConceptPrototypeModel" title="Prototype Model">Prototype Model</a>).</p></dd></dl></div>@@ -615,25 +632,25 @@<a name="ExtensionOptions"></a>Specification Extensions</h2></div></div></div><p>- This tab displays elements from the Program's <span class="emphasis"><em>compiler specification</em></span> and+ This entry displays elements from the Program's <span class="emphasis"><em>compiler specification</em></span> and<span class="emphasis"><em>processor specification</em></span> and allows the user to add or remove<span class="bold"><strong>extensions</strong></span>, including prototype models, call-fixups, andcallother-fixups.</p><p>Every program has a <span class="emphasis"><em>core</em></span> set of specification elements,- loaded from the <a class="xref" href="DecompilerConcepts.html#ConceptSpecification" title="SLEIGH Specification Files">“SLEIGH Specification Files”</a>, that cannot+ loaded from the <a class="xref" href="DecompilerConcepts.html#ConceptSpecification" title="SLEIGH Specification Files">SLEIGH Specification Files</a>, that cannotbe modified or removed. Extensions, however, can be added to this core specification. Any extensionimported from this dialog is directly associated with the active Program and is stored permanentlywith it.</p><p>- Users can change or reimport an extension, if new information points to a better definition.+ Users can change or reimport an extension if new information points to a better definition.Users have full control over an extension, and unlike a core element, can tailor it specificallyto the Program.</p><p>- This options tab presents a table of all specification elements.+ This options entry presents a table of all specification elements.Each element, whether core or an extension, is displayed on a separate row with three columns:</p><div class="informalexample">@@ -648,7 +665,7 @@</div><p>The core elements of the specification have a blank Status column, and any extension- is labeled either as "extension" or "override".+ is labeled either as <span class="bold"><strong>extension</strong></span> or <span class="bold"><strong>override</strong></span>.</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title">@@ -665,14 +682,14 @@<dt><span class="term"><span class="bold"><strong>prototype</strong></span></span></dt><dd><p>- This element is a <a class="xref" href="DecompilerConcepts.html#ConceptPrototypeModel" title="Prototype Model">“Prototype Model”</a> that holds a specific named set- of parameter passing details. It- can be applied to individual functions by name, typically via the "Calling Convention" menu+ This element is a named <a class="xref" href="DecompilerConcepts.html#ConceptPrototypeModel" title="Prototype Model">Prototype Model</a> that holds a specific set+ of parameter-passing details. It+ can be applied to individual functions by name, typically via the <span class="bold"><strong>Calling Convention</strong></span> menuin the <a class="ulink" href="help/topics/FunctionPlugin/Variables.htm#Edit_Function" target="_top">Function Editor Dialog</a>.- See the documentation on <a class="xref" href="DecompilerAnnotations.html#AnnotePrototype" title="Function Prototypes">“Function Prototypes”</a> for how they affect decompilation.+ See the documentation on <a class="xref" href="DecompilerAnnotations.html#AnnotePrototype" title="Function Prototypes">Function Prototypes</a> for how they affect decompilation.</p><p>- The XML tag, <code class="code"><prototype></code> always has a <span class="bold"><strong>name</strong></span> attribute+ The XML <code class="code"><prototype></code> tag always has a <span class="bold"><strong>name</strong></span> attributethat defines the formal name of the prototype model, which must be unique across all models.</p><pre class="programlisting">@@ -693,7 +710,7 @@<p>This element is a Call-fixup, which can be used to substitute a specific p-codesequence for CALL instructions during decompilation, as described in- <a class="xref" href="DecompilerAnnotations.html#AnnotePrototype" title="Function Prototypes">“Function Prototypes”</a>.+ <a class="xref" href="DecompilerAnnotations.html#AnnotePrototype" title="Function Prototypes">Function Prototypes</a>.</p><p>The <code class="code"><callfixup></code> tag has a <span class="bold"><strong>name</strong></span>@@ -719,7 +736,7 @@<p>This element is a Callother-fixup, which can be used to substitute a specific p-codesequence for CALLOTHER p-code operations. A CALLOTHER- is a black-box, or unspecified p-code operation, see <a class="xref" href="DecompilerConcepts.html#ConceptCallother" title="User-defined P-code Operations - CALLOTHER">“User-defined P-code Operations - CALLOTHER”</a>.+ is a black-box, or unspecified p-code operation (see <a class="xref" href="DecompilerConcepts.html#ConceptCallother" title="User-defined P-code Operations - CALLOTHER">User-defined P-code Operations - CALLOTHER</a>).</p><p>The <code class="code"><callotherfixup></code> tag has a@@ -769,7 +786,7 @@<dt><span class="term"><span class="bold"><strong>extension</strong></span></span></dt><dd><p>- Indicates that the element is a program specific extension that has been+ Indicates that the element is a program-specific extension that has beenadded to the specification.</p></dd>@@ -778,7 +795,7 @@<p>Indicates that the element, which must be a <span class="bold"><strong>callotherfixup</strong></span>,is an extension that overrides a core element with the same target. The extension- effectively replaces the p-code injection of the core element with a user supplied one.+ effectively replaces the p-code injection of the core element with a user-supplied one.If this type of extension is later removed, the core element becomes active again.</p></dd>@@ -789,7 +806,7 @@<p>If the user has either imported additional extensions or selected an extension for removal buthas not yet clicked the <span class="emphasis"><em>Apply</em></span> button in the Options dialog, the Status column- may show one of the following values, indicating a pending change.+ may show one of the following values, indicating a pending change:</p><div class="informalexample"><div class="variablelist"><dl class="variablelist">@@ -830,7 +847,7 @@<p>The <span class="emphasis"><em>Import</em></span> button at the bottom of the- "Specification Extensions" pane allows the user to import one of the+ <span class="bold"><strong>Specification Extensions</strong></span> pane allows the user to import one of thethree element types, <span class="bold"><strong>prototype</strong></span>,<span class="bold"><strong>callfixup</strong></span>, or <span class="bold"><strong>callotherfixup</strong></span>,into the program as a new extension.@@ -850,8 +867,8 @@The XML file describing the extension <span class="emphasis"><em>must</em></span> have one of the tags,<code class="code"><prototype></code>, <code class="code"><callfixup></code>, or <code class="code"><callotherfixup></code>,as its single root element. Users can find numerous examples within the compiler- and processor specification files that come as part of Ghidra's installation.- See <a class="xref" href="DecompilerConcepts.html#ConceptSpecification" title="SLEIGH Specification Files">“SLEIGH Specification Files”</a>.+ and processor specification files that come as part of Ghidra's installation+ (see <a class="xref" href="DecompilerConcepts.html#ConceptSpecification" title="SLEIGH Specification Files">SLEIGH Specification Files</a>).</p><p>In the case of <span class="bold"><strong>prototype</strong></span> and <span class="bold"><strong>callfixup</strong></span>@@ -868,7 +885,7 @@<a name="ExtendRemove"></a>Removing an Extension</h3></div></div></div><p>- The <span class="emphasis"><em>Remove</em></span> button at the bottom of the "Specification Extensions" pane allows+ The <span class="emphasis"><em>Remove</em></span> button at the bottom of the <span class="bold"><strong>Specification Extensions</strong></span> pane allowsthe user to remove a previously installed extension. A row from the table is selected first, whichmust have a Status of <span class="bold"><strong>extension</strong></span> or <span class="bold"><strong>override</strong></span>.Core elements of the specification cannot be removed.diff --git a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerWindow.html b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerWindow.htmlindex 8fa2a9fa0c..e2aac0be72 100644--- a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerWindow.html+++ b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerWindow.html@@ -14,21 +14,21 @@<a name="DecompilerWindow"></a>Decompiler Window</h1></div></div></div><p>- To display the decompiler window, position the cursor on a+ To display the Decompiler window, position the cursor on afunction in the Code Browser, then select the<span class="guiicon"><span class="inlinemediaobject"><img src="images/decompileFunction.gif" width="16" height="16"></span>- </span> icon from the tool bar, or the+ </span>�icon from the tool bar, or the<span class="bold"><strong>Decompile</strong></span> option from the<span class="bold"><strong>Window</strong></span> menu in the tool.</p><p>- A decompiler window always displays one <span class="emphasis"><em>function</em></span> at a time.+ A Decompiler window always displays one <span class="emphasis"><em>function</em></span> at a time.The initial window that comes up in the Code Browser is called the <span class="bold"><strong>Main</strong></span>- window (See <a class="xref" href="DecompilerWindow.html#MainWindow" title="Main Window">“Main Window”</a>), and it automatically decompiles and displays the function at the+ window (see <a class="xref" href="DecompilerWindow.html#MainWindow" title="Main Window">Main Window</a>), and it automatically decompiles and displays the function at the<span class="emphasis"><em>current address</em></span>, following the user's navigation. Other<span class="bold"><strong>Snapshot</strong></span> windows can also- be opened that show different functions at the same time (See <a class="xref" href="DecompilerWindow.html#Snapshot" title="Snapshot Windows">“Snapshot Windows”</a>). But any window+ be opened that show different functions at the same time (see <a class="xref" href="DecompilerWindow.html#Snapshot" title="Snapshot Windows">Snapshot Windows</a>). But any windowonly shows one function at a time.</p><p>@@ -79,7 +79,7 @@one or more warnings during the process. These warnings are integrated into the output assource code comments starting with label <code class="code">WARNING:</code>. They occur either at thebeginning of the function as part of the function header or at the point in the code directly- associated with the warning. (See <a class="xref" href="DecompilerAnnotations.html#CommentWarnings" title="Warning Comments">“Warning Comments”</a>)+ associated with the warning (see <a class="xref" href="DecompilerAnnotations.html#CommentWarnings" title="Warning Comments">Warning Comments</a>).</p></div>@@ -88,29 +88,29 @@<a name="MainWindow"></a>Main Window</h2></div></div></div><p>- Initially pushing+ Initially pressing<span class="guiicon"><span class="inlinemediaobject"><img src="images/decompileFunction.gif" width="16" height="16"></span>- </span> or selecting+ </span>�or selecting<span class="bold"><strong>Decompile</strong></span> from the <span class="bold"><strong>Window</strong></span> menu in the toolbrings up the <span class="emphasis"><em>main</em></span> window. The main window always displays the functionat the <span class="emphasis"><em>current address</em></span> within the Code Browser and follows as the user navigateswithin the Program. Any mouse click, menu option, or other action causing the cursor to move to a newaddress in the Listing also causes the main window to display the function containing that address.Navigation to new functions is also possible from within the window by double-clicking on function- tokens (See <a class="xref" href="DecompilerWindow.html#MouseActions" title="Mouse Actions">“Mouse Actions”</a>).+ tokens (see <a class="xref" href="DecompilerWindow.html#MouseActions" title="Mouse Actions">Mouse Actions</a>).</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="CrossHighlighting"></a>Cross Highlighting</h3></div></div></div>+<a name="CrossHighlighting"></a>Cross-Highlighting</h3></div></div></div><p>The main window maintains a map between the individual variable and operator tokens displayed in- the window and the machine instructions which correspond to them. This can give the user instant- feedback about the correspondence between the decompiler and disassembly views of the function,- and it is frequently useful to have both the Listing window and the Decompiler window side- by side. Clicking on tokens in the Decompiler window causes the Listing window to navigate+ the window and the machine instructions which correspond to them. Disassembled machine instructions+ are displayed by any Listing window, and having both a Listing and Decompiler window side by side+ lets the user see this correspondence between the decompiled and disassembled views of the function.+ Clicking on tokens in the Decompiler window causes the Listing window to navigateto the corresponding instruction, and clicking instructions in the Listing windowcauses the Decompiler window to navigate to the corresponding line. Highlighting a region ofcode in either window causes the corresponding region in the other window to be highlighted.@@ -135,7 +135,7 @@<th align="left"></th></tr><tr><td align="left" valign="top">- In general, the map between machine instructions and tokens is not one to one because the decompiler+ In general, the map between machine instructions and tokens is not one-to-one because the Decompilertransforms its underlying representation of the function.An instruction may no longer have any operator that corresponds to it in the decompiled result.Tokens may be transformed from the natural operation of the machine instruction they are associated@@ -153,28 +153,27 @@Pressing the<span class="guiicon"><span class="inlinemediaobject"><img src="images/camera-photo.png" width="16" height="16"></span>- </span> icon- in another Decompiler window's toolbar causes a <span class="emphasis"><em>Snapshot</em></span> window- to be created, which initially shows decompilation of the same function. Multiple- Snapshot windows can be brought up to show decompilation of different functions+ </span>�icon+ in any Decompiler window's toolbar causes a <span class="emphasis"><em>Snapshot</em></span> window+ to be created, which shows decompilation of the same function.+ Unlike the <span class="emphasis"><em>main</em></span> window however, the <span class="emphasis"><em>Snapshot</em></span> window+ does not change the function it displays in response to external navigation events.+ A Snapshot window can be used to hold a function fixed while the user navigates to+ different functions in Listing or other windows.+ </p>+ <p>+ Multiple Snapshot windows can be brought up to show decompilation of different functionssimultaneously. Snapshotwindows are visually distinguished from the <span class="emphasis"><em>main</em></span> Decompiler windowby their colored outline.</p>- <p>- The Snapshot- window, unlike the <span class="emphasis"><em>main</em></span> window, is not linked to the Listing window- and does not change the function it displays in response to external navigation events.- A Snapshot window can be used to hold a function fixed while the user navigates to- different functions in the Listing or other windows.- </p><p>Navigating to new functions within a Snapshot window is possible when the window is<span class="emphasis"><em>active</em></span>. The window responds to the actions</p><div class="informalexample"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">-<li class="listitem" style="list-style-type: disc">Go To ... <span class="emphasis"><em>(pressing the 'g' key)</em></span>+<li class="listitem" style="list-style-type: disc">Go To... <span class="emphasis"><em>(pressing the 'G' key)</em></span></li><li class="listitem" style="list-style-type: disc">Go to previous location <span class="emphasis"><em>(Back)</em></span></li>@@ -184,6 +183,10 @@</div><p></p>+ <p>+ Double-clicking on specific tokens within the Snapshot window may also cause it to navigate+ to a new location (see <a class="xref" href="DecompilerWindow.html#MouseDouble" title="Double-Click">Double-Click</a>).+ </p></div><div class="section">@@ -193,7 +196,7 @@<p>If the current location within the Code Browser is in disassembled code, but that codeis not contained in a <a class="link" href="DecompilerAnnotations.html#AnnoteFormalFunctionBody" title="Formal Function Body">Formal Function Body</a>,- then the decompiler window invents a function body on the fly called an+ then the Decompiler invents a function body, on the fly, called an<span class="bold"><strong>Undefined Function</strong></span>. The background color of the windowis changed to gray to indicate this special state.</p>@@ -202,21 +205,21 @@</p><p>The <span class="emphasis"><em>entry point</em></span> address of the Undefined Function is chosen by- backtracking through the code's control-flow from the current location to the start of+ backtracking through the code's control flow from the current location to the start ofa basic block that has no flow coming in except possibly from <span class="emphasis"><em>call</em></span> instructions.During decompilation, a function body is computed from the selected entry point (as with any function)- based on control-flow up to instructions with <span class="emphasis"><em>terminator</em></span> semantics.+ based on control flow up to instructions with <span class="emphasis"><em>terminator</em></span> semantics.</p><p>- The current address, as indicated by the cursor in the Listing Window for instance, is- generally <span class="emphasis"><em>not</em></span> the entry of the invented function, but the current address will be+ The current address, as indicated by the cursor in the Listing for instance, is+ generally <span class="emphasis"><em>not</em></span> the entry point of the invented function, but the current address will becontained somewhere in the body.</p><p>For display purposes in the window, the invented function is given a name based on thecomputed entry point address with the prefix <code class="code">UndefinedFunction</code>. The functionis assigned the default calling convention, and parameters are discovered as part of- the decompiler's analysis.+ the Decompiler's analysis.</p></div>@@ -225,9 +228,9 @@<a name="ToolBar"></a>Tool Bar</h2></div></div></div><p>- This is a group of actions that can be triggered by pressing a button in the tool/title- bar at the top of individual decompiler windows, both <span class="emphasis"><em>main</em></span> and- <span class="emphasis"><em>Snapshot</em></span>. The action applies to the function and decompiler results+ The following actions are available by pressing the corresponding icon in the title/tool+ bar at the top of each individual Decompiler window.+ The action applies to the function and Decompiler resultsdisplayed in that particular window.</p><div class="sect2">@@ -237,7 +240,7 @@<p><span class="guiicon"><span class="inlinemediaobject"><img src="images/page_edit.png" width="16" height="16"></span>- </span> - button+ </span>�- button</p><p>Exports the decompiled result of the current function to a file. A file chooser@@ -248,7 +251,7 @@<p>This action exports a single function at a time. The user can export all functionssimultaneously from the Code Browser, by selecting the menu- <span class="bold"><strong>File -> Export Program ...</strong></span> and then choosing+ <span class="bold"><strong>File -> Export Program...</strong></span> and then choosing<a class="ulink" href="help/topics/ExporterPlugin/exporter.htm#c_cpp" target="_top">C/C++</a>from the drop-down menu. See the full documentation forthe <a class="ulink" href="help/topics/ExporterPlugin/exporter.htm" target="_top">Export</a> dialog.@@ -262,13 +265,13 @@<p><span class="guiicon"><span class="inlinemediaobject"><img src="images/camera-photo.png" width="16" height="16"></span>- </span> - button+ </span>�- button</p><p>Creates a new <span class="emphasis"><em>Snapshot</em></span> window. The <span class="emphasis"><em>Snapshot</em></span> window- initially displays the same function as the decompiler window on which the action was triggered,- but if that window navigates to other functions, the <span class="emphasis"><em>Snapshot</em></span> does not- follow and continues to display the original function. (See <a class="xref" href="DecompilerWindow.html#Snapshot" title="Snapshot Windows">“Snapshot Windows”</a>)+ displays the same function as the Decompiler window on which the action was triggered,+ and if that window navigates to other functions, the <span class="emphasis"><em>Snapshot</em></span> does not+ follow but continues to display the original function (see <a class="xref" href="DecompilerWindow.html#Snapshot" title="Snapshot Windows">Snapshot Windows</a>).</p></div>@@ -279,7 +282,7 @@<p><span class="guiicon"><span class="inlinemediaobject"><img src="images/reload3.png" width="16" height="16"></span>- </span> - button+ </span>�- button</p><p>Triggers a re-decompilation of the current function displayed in the window.@@ -293,8 +296,8 @@<tr><td align="left" valign="top">This action is <span class="bold"><strong>not</strong></span> necessary for normal reverseengineering tasks. Re-decompilation is <span class="emphasis"><em>automatically</em></span> triggered for all- decompiler windows by any change to the Program, so the most up-to-date decompilation is- always available to the user without this action. This action is a primarily a debugging+ Decompiler windows by any change to the Program, so the most up-to-date decompilation is+ always available to the user without this action. This action is primarily a debuggingaid for plug-in developers.</td></tr></table></div>@@ -307,10 +310,10 @@<p><span class="guiicon"><span class="inlinemediaobject"><img src="images/page_white_copy.png" width="16" height="16"></span>- </span> - button+ </span>�- button</p><p>- Copies the currently selected text in the decompiler window to the clipboard.+ Copies the currently selected text in the Decompiler window to the clipboard.</p></div>@@ -319,7 +322,7 @@<a name="ToolBarDebug"></a>Debug Function Decompilation</h3></div></div></div><p>- This action is located in the drop-down menu on the right side of the decompiler+ This action is located in the drop-down menu on the right side of the Decompilerwindow tool/title bar.</p><p>@@ -327,7 +330,7 @@the current function is collected and saved to an output file inXML format. A file chooser dialog is presented to the user tochoose the output file. The file is useful when submitting bug reports- about the decompiler as it is generally much smaller than+ about the Decompiler as it is generally much smaller thanthe entire Program and only contains information specific to thefunction. Information is generated by performing the fulldecompilation of the function and collecting all the data and@@ -342,18 +345,13 @@<a name="ToolBarGraph"></a>Graph AST Control Flow</h3></div></div></div><p>- Generate a control-flow graph based upon the results in the active Decompiler Window,+ This action is located in the drop-down menu on the right side of the Decompiler+ window tool/title bar.+ </p>+ <p>+ Generate a control-flow graph based upon the results in the active Decompiler window,and render it using the current Graph Service.</p>- <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning">-<tr>-<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../shared/warning.png"></td>-<th align="left"></th>-</tr>-<tr><td align="left" valign="top">- If no Graph Service is available then this action will not be present.- </td></tr>-</table></div></div></div>@@ -364,15 +362,15 @@<div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="MouseLeft"></a>Left Click</h3></div></div></div>+<a name="MouseLeft"></a>Left-Click</h3></div></div></div><p>- Moves the decompiler window cursor and highlights the token. Within the+ Moves the Decompiler window cursor and highlights the token. Within the<span class="emphasis"><em>main</em></span> window, if a token has a machine address- associated with it, a left click generates a+ associated with it, a left-click generates a<span class="emphasis"><em>navigation</em></span> event to that address, which may cause other- windows to display code near that address.- (See <a class="xref" href="DecompilerWindow.html#CrossHighlighting" title="Cross Highlighting">“Cross Highlighting”</a>)+ windows to display code near that address+ (see <a class="xref" href="DecompilerWindow.html#CrossHighlighting" title="Cross-Highlighting">Cross-Highlighting</a>).</p><p>Selecting a '(' or ')' token causes it and its matching parenthesis to be@@ -385,55 +383,60 @@<div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="MouseRight"></a>Right Click</h3></div></div></div>+<a name="MouseRight"></a>Right-Click</h3></div></div></div><p>- Moves the decompiler window cursor, highlights the token, and brings up the menu of- context sensitive actions. Any highlighting and navigation is identical to a- left click. The menu actions presented depend primarily on the token type and+ Moves the Decompiler window cursor, highlights the token, and brings up the menu of+ context-sensitive actions. Any highlighting and navigation is identical to a+ left-click. The menu actions presented depend primarily on the token type andare tailored to the context at that point in the code.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="MouseDouble"></a>Double Click</h3></div></div></div>+<a name="MouseDouble"></a>Double-Click</h3></div></div></div><p>- Navigates based on the selected symbol or other token (See below). If the selected token represents a formal symbol,- such as a function name or a global variable, double clicking causes a+ Navigates based on the selected symbol or other token (see below).+ If the selected token represents a formal symbol,+ such as a function name or a global variable, double-clicking causes a<span class="emphasis"><em>navigation</em></span> event to the address associated with the symbol.+ </p>+ <p>+ This action is performed by clicking twice on the desired token with the <span class="emphasis"><em>left</em></span>+ mouse button.</p><div class="informalexample"><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="bold"><strong>Function Symbols</strong></span></span></dt><dd><p>- Double clicking a called function name causes the+ Double-clicking a called function name causes thewindow itself to navigate away from its current function to the called function, triggeringa new decompilation if necessary and changing its display.</p></dd><dt><span class="term"><span class="bold"><strong>Global Variables</strong></span></span></dt><dd><p>- Double clicking a global- variable name does <span class="emphasis"><em>not</em></span> have any effect on the decompiler window itself,- but <span class="emphasis"><em>other</em></span> windows, like the Listing window, may navigate to the+ Double-clicking a global+ variable name does <span class="emphasis"><em>not</em></span> have any effect on the Decompiler window itself,+ but Listing or <span class="emphasis"><em>other</em></span> windows may navigate to thestorage address of the global variable.</p></dd><dt><span class="term"><span class="bold"><strong>Constants</strong></span></span></dt><dd><p>- Double clicking a token representing a constant causes the constant to be treated- as an address, and a navigation event to that address is generated. The decompiler+ Double-clicking a token representing a constant causes the constant to be treated+ as an address, and a navigation event to that address is generated. The Decompilerwindow itself navigates depending again on whether the address represents a new function or not.</p></dd><dt><span class="term"><span class="bold"><strong>Labels</strong></span></span></dt><dd><p>- Double clicking the label within a <span class="emphasis"><em>goto</em></span> statement causes the window to navigate+ Double-clicking the label within a <span class="emphasis"><em>goto</em></span> statement causes the window to navigateto the target of the goto, within the function. The cursor is set and the window view is adjusted ifnecessary to ensure that the target is visible.</p></dd><dt><span class="term"><span class="bold"><strong>Braces</strong></span></span></dt><dd><p>- Double clicking a '{' or '}' token, causes the window to navigate to the <span class="emphasis"><em>matching</em></span> brace+ Double-clicking a '{' or '}' token, causes the window to navigate to the <span class="emphasis"><em>matching</em></span> bracewithin the window. The cursor is set and the window view is adjusted ifnecessary to ensure that the matching brace is visible.</p></dd>@@ -445,37 +448,45 @@<div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="MouseControlDouble"></a>Control Double Click</h3></div></div></div>+<a name="MouseControlDouble"></a>Ctrl-Double-Click</h3></div></div></div><p>Opens a new <span class="emphasis"><em>Snapshot</em></span> window, navigating it to the selected symbol.This is a convenience for immediately decompiling and displaying a called function in anew window, without disturbing the active window. The behavior is similar to the- Double Click action, the selected token must represent a function name symbol or possibly+ Double-Click action, the selected token must represent a function name symbol or possiblya constant address, but the navigation occurs in the new Snapshot window.</p>+ <p>+ This action is performed by clicking twice on the desired token with the <span class="emphasis"><em>left</em></span>+ mouse button, while holding down the <span class="emphasis"><em>Ctrl</em></span> key.+ </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="MouseControlShift"></a>Control Shift Click</h3></div></div></div>+<a name="MouseControlShift"></a>Ctrl-Shift-Click</h3></div></div></div><p>Generates a navigation event to the address, within the current function, associated withthe clicked token. This allows <span class="emphasis"><em>Snapshot</em></span> windows to do basic- cross-highlighting in the same way as the <span class="emphasis"><em>main</em></span> decompiler window.- A Control double-click causes the Listing and other windows to navigate to and display the same- portion of code currently being displayed in the Snapshot window. (See <a class="xref" href="DecompilerWindow.html#CrossHighlighting" title="Cross Highlighting">“Cross Highlighting”</a>)+ cross-highlighting in the same way as the <span class="emphasis"><em>main</em></span> Decompiler window.+ A ctrl-shift-click causes Listing and other windows to navigate to and display the same+ portion of code currently being displayed in the Snapshot window (see <a class="xref" href="DecompilerWindow.html#CrossHighlighting" title="Cross-Highlighting">Cross-Highlighting</a>).+ </p>+ <p>+ This action is performed by clicking on the desired token with the <span class="emphasis"><em>left</em></span> mouse+ button, while holding down both the <span class="emphasis"><em>Ctrl</em></span> and <span class="emphasis"><em>Shift</em></span> keys.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="MouseMiddle"></a>Middle Click</h3></div></div></div>+<a name="MouseMiddle"></a>Middle-Click</h3></div></div></div><p>- Highlights every occurrence of a variable, constant, or operator under the current- cursor location, within the decompiler window.+ Highlights every occurrence of a variable, constant, or operator represented by the selected+ token, within the Decompiler window.</p></div>@@ -487,8 +498,8 @@<p>All the actions described in this section can be activated from the menu that pops up- when right-clicking on a token within the decompiler window. The pop-up menu is context sensitive and- the type of token in particular (See <a class="xref" href="DecompilerWindow.html#DecompilerDisplay" title="Display">“Display”</a>) determines what actions are available.+ when right-clicking on a token within the Decompiler window. The pop-up menu is context sensitive and+ the type of token in particular (see <a class="xref" href="DecompilerWindow.html#DecompilerDisplay" title="Display">Display</a>) determines what actions are available.The token clicked provides a local context for the action and may be used to pinpoint the exactvariable or operation affected.</p>@@ -504,7 +515,7 @@<p>The <span class="emphasis"><em>structure</em></span> definition is filled in by examining how the variableis used, assuming it is a pointer to the <span class="emphasis"><em>structure</em></span>, tracing- data-flow to all the expressions the variable is used in. LOAD and STORE operations+ data flow to all the expressions the variable is used in. LOAD and STORE operationstrigger new <span class="emphasis"><em>fields</em></span> and additive offsets are traced to calculatethe offset of the fields within the <span class="emphasis"><em>structure</em></span> definition.</p>@@ -513,8 +524,8 @@retyped to be a pointer to the <span class="emphasis"><em>structure</em></span>. Within the window,the function is decompiled again and references to new fields in the structureshould be immediately apparent. These can be renamed or retyped from the window- to further refine the new <span class="emphasis"><em>structure</em></span> definition.- (See <a class="xref" href="DecompilerWindow.html#ActionRenameVariable" title="Rename Variable">“Rename Variable”</a>)+ to further refine the new <span class="emphasis"><em>structure</em></span> definition+ (see <a class="xref" href="DecompilerWindow.html#ActionRenameVariable" title="Rename Variable">Rename Variable</a>).</p><div class="informalexample"><div class="variablelist"><dl class="variablelist">@@ -543,26 +554,32 @@<p>Set or change a comment at the address of the selected token.</p><p>- These actions bring up the general Comment dialog (See <a class="ulink" href="help/topics/CommentsPlugin/Comments.htm" target="_top">Comments</a>),- which associates the comment with a specific <span class="emphasis"><em>address</em></span> in the Program. For the- decompiler actions, this address is of the machine instruction most closely linked to the selected token.- Comments will be visible in the Listing and other Ghidra windows viewing the same+ These actions bring up the general Comment dialog (see <a class="ulink" href="help/topics/CommentsPlugin/Comments.htm" target="_top">Comments</a>),+ which associates the comment with a specific <span class="emphasis"><em>address</em></span> in the Program. For comment+ actions in the Decompiler, this address is of the machine instruction most closely linked to the selected token.+ Any comments generated from a Decompiler window will be visible in Listing and other windows viewing the samesection of code.</p><p>- The decompiler windows can display all comment types, but this may be affected by the Display options- (See <a class="xref" href="DecompilerAnnotations.html#AnnoteComments" title="Comments">“Comments”</a>).+ A Decompiler window can display all comment types, but this may be affected by the Display options+ (see <a class="xref" href="DecompilerAnnotations.html#AnnoteComments" title="Comments">Comments</a>).</p><div class="informalexample"><div class="variablelist"><dl class="variablelist">-<dt><span class="term"><span class="bold"><strong>Set Plate Comment ...</strong></span></span></dt>+<dt><span class="term"><span class="bold"><strong>Set Plate Comment...</strong></span></span></dt><dd><p>Brings up the dialog for setting or editing a <span class="emphasis"><em>Plate</em></span> comment.</p></dd>-<dt><span class="term"><span class="bold"><strong>Set Pre Comment ...</strong></span></span></dt>+<dt><span class="term"><span class="bold"><strong>Set Pre Comment...</strong></span></span></dt><dd><p>Brings up the dialog for setting or editing a <span class="emphasis"><em>Pre</em></span> comment.</p></dd>+<dt><span class="term"><span class="bold"><strong>Set...</strong></span></span></dt>+<dd><p>+ Brings up the dialog for setting or editing a comment based on the selected token.+ A <span class="emphasis"><em>Plate</em></span> comment is edited if the token is part+ of the function's header. A <span class="emphasis"><em>Pre</em></span> comment is edited otherwise.+ </p></dd></dl></div></div></div>@@ -572,21 +589,21 @@<a name="ActionCommitLocals"></a>Commit Local Names</h3></div></div></div><p>- Commit the names of any local variables discovered during the decompiler's analysis+ Commit the names of any local variables discovered during the Decompiler's analysisto the Program database as new Variable Annotations. The recovered data-type isnot committed as part of the annotation, only the name and storage location.</p><p>- Parameters are not affected by this command, see <a class="xref" href="DecompilerWindow.html#ActionCommitParams" title="Commit Params/Return">“Commit Params/Return”</a>.+ Parameters are not affected by this command (see <a class="xref" href="DecompilerWindow.html#ActionCommitParams" title="Commit Params/Return">Commit Params/Return</a>).The purpose of the command is to synchronize the local variables in the- decompiler's view of a function with the formal Variable Annotations in the disassembly view,+ Decompiler's view of a function with the formal Variable Annotations in the disassembly view,without otherwise affecting the decompilation. After executing this command, additional changes- to local variable can be performed directly on the corresponding annotations in the Listing Window,- using various methods (See <a class="xref" href="DecompilerAnnotations.html#AnnoteVariables" title="Variable Annotations">“Variable Annotations”</a>).+ to local variables can be performed directly on the corresponding annotations displayed in Listing windows,+ using various methods (see <a class="xref" href="DecompilerAnnotations.html#AnnoteVariables" title="Variable Annotations">Variable Annotations</a>).Data-types are not forced for new annotations, they are created with- an <span class="emphasis"><em>undefined</em></span> data-type, which allows the decompiler to refine+ an <span class="emphasis"><em>undefined</em></span> data-type, which allows the Decompiler to refineits view of the variable's data-type as new information becomes available- (See <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">“Forcing Data-types”</a>).+ (see <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">Forcing Data-types</a>).</p></div>@@ -595,28 +612,28 @@<a name="ActionCommitParams"></a>Commit Params/Return</h3></div></div></div><p>- Commit the decompiler's analysis of the input parameters and return value of the current+ Commit the Decompiler's analysis of the input parameters and return value of the currentfunction as annotations to the Program database.</p><p>- In the absence of either <span class="emphasis"><em>imported</em></span> or <span class="emphasis"><em>user defined</em></span>- information about a function's prototype, the decompiler performs its own analysis of what+ In the absence of either <span class="emphasis"><em>imported</em></span> or <span class="emphasis"><em>user-defined</em></span>+ information about a function's prototype, the Decompiler performs its own analysis of whatthe prototype is, determining the storage location and data-type of all parameters and thereturn value. This action commits this analysis permanently for the current functiondisplayed in the window, creating a matching <span class="emphasis"><em>Variable Annotation</em></span> for each input- parameter and the return value. The new annotations will be displayed in the- Listing Window as part of the function header, and the action effectively- <span class="emphasis"><em>synchronizes</em></span> the disassembly view and decompiler's view of the function prototype.+ parameter and the return value. The new annotations will be displayed in a+ Listing window as part of the function header, and the action effectively+ <span class="emphasis"><em>synchronizes</em></span> the disassembly view and Decompiler's view of the function prototype.</p><p>Committed prototype information is used both when decompiling the function itself and when- decompiling other functions that call it.- The committed annotations are <span class="emphasis"><em>forcing</em></span> on the decompiler, and it will- no longer perform prototype recovery analysis for that function. The decompiler assumes the committed parameters,+ decompiling other functions that call it. The committed annotations are <span class="emphasis"><em>forcing</em></span>+ on the Decompiler (see <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">Forcing Data-types</a>), and it will+ no longer perform prototype recovery analysis for that function. The Decompiler assumes the committed parameters,and only the committed parameters, exist and will not modify their data-types, with theexception of parameters that are explicitly marked as having an <span class="emphasis"><em>undefined</em></span>data-type. The user must manually modify individual variables or clear the entire prototype- if they want a change (See <a class="xref" href="DecompilerAnnotations.html#AnnoteVariables" title="Variable Annotations">“Variable Annotations”</a>).+ if they want a change (see <a class="xref" href="DecompilerAnnotations.html#AnnoteVariables" title="Variable Annotations">Variable Annotations</a>).</p></div>@@ -665,10 +682,10 @@<p>This command primarily targets a constant token in the Decompiler window, butif there is a <span class="emphasis"><em>scalar</em></span> operand in an instruction that corresponds- with the selected constant, the same conversion is also applied to the scalar in the Listing+ with the selected constant, the same conversion is also applied to the scalar in any Listingwindow. This is equivalent to selecting the- <a class="ulink" href="help/topics/EquatePlugin/Equates.htm#Convert" target="_top">Convert</a> command from the- Listing. There may not be a scalar operand directly corresponding to the selected constant, in+ <a class="ulink" href="help/topics/EquatePlugin/Equates.htm#Convert" target="_top">Convert</a> command from a+ Listing window. There may not be a scalar operand directly corresponding to the selected constant, inwhich case the conversion will be applied only in the Decompiler window.</p><p>@@ -679,20 +696,20 @@<p>The constant's encoding can be changed by selecting a different <span class="bold"><strong>Convert</strong></span>command, or it can be returned to its <span class="emphasis"><em>default</em></span> encoding by selecting- the <a class="xref" href="DecompilerWindow.html#ActionRemoveEquate" title="Remove Convert/Equate">“Remove Convert/Equate”</a> command.+ the <a class="xref" href="DecompilerWindow.html#ActionRemoveEquate" title="Remove Convert/Equate">Remove Convert/Equate</a> command.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="ActionCopy"></a>Copy/Copy Special ...</h3></div></div></div>+<a name="ActionCopy"></a>Copy</h3></div></div></div><p>- Copy selected code from the decompiler window into the clipboard.+ Copy selected code from the Decompiler window into the clipboard.</p><p>This is part of the standard copy- capabilities for all Ghidra windows and is suitable for copying (sections of) decompiler output+ capabilities for all Ghidra windows and is suitable for copying (sections of) Decompiler outputinto other documents.</p></div>@@ -713,8 +730,8 @@<a class="ulink" href="help/topics/DataTypeEditors/EnumEditor.htm" target="_top">Enum Editor</a>.</p><p>- Any change to the definition of the data-type is automatically incorporated by the decompiler into its output- (see <a class="xref" href="DecompilerAnnotations.html#AnnoteDatatype" title="Variable Data-types">“Variable Data-types”</a>).+ Any change to the definition of the data-type is automatically incorporated by the Decompiler into its output+ (see <a class="xref" href="DecompilerAnnotations.html#AnnoteDatatype" title="Variable Data-types">Variable Data-types</a>).</p></div>@@ -727,7 +744,7 @@details about how it passes parameters.</p><p>- The action is available from any token in the decompiler window. Most tokens trigger editing+ The action is available from any token in the Decompiler window. Most tokens trigger editingof the current function itself, but a called function can be edited by putting the cursor onits name specifically.</p>@@ -758,16 +775,16 @@<p>See documentation for the<a class="ulink" href="help/topics/FunctionPlugin/Variables.htm#Edit_Function" target="_top">Function Editor Dialog</a>.- The decompiler automatically incorporates any changes into its output.+ The Decompiler automatically incorporates any changes into its output.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="ActionFind"></a>Find ...</h3></div></div></div>+<a name="ActionFind"></a>Find...</h3></div></div></div><p>- Search for strings within the active window, in the current decompiler output.+ Search for strings within the active window, in the current Decompiler output.</p><p>The command brings up a dialog where a search pattern can entered as a raw string or regular expression.@@ -783,8 +800,8 @@<a name="ActionHighlight"></a>Highlight</h3></div></div></div><p>- All these actions highlight a specific set of variable tokens tracing the data-flow- of the selected variable within the current function. Data-flow is the directed flow+ All these actions highlight a specific set of variable tokens tracing the <span class="bold"><strong>data flow</strong></span>+ of the selected variable within the current function, defined as the directed flowof data from input variables through operations that manipulate their value to theiroutput variables. The operations and variables chain together to form data-flow<span class="emphasis"><em>paths</em></span>.@@ -863,7 +880,7 @@<a name="ActionSecondaryHighlight"></a>Secondary Highlight</h3></div></div></div><p>- A <span class="emphasis"><em>secondary highlight</em></span> is a semi-permanent token highlight in the decompiler+ A <span class="emphasis"><em>secondary highlight</em></span> is a semi-permanent token highlight in the Decompilerwindow that, unlike normal highlights, will not go away as the user clicks other tokens.The color and text being highlighted is controlled by the user and will persist for<span class="bold"><strong>for the duration of the Ghidra session</strong></span> or until the user@@ -907,31 +924,33 @@Override the function prototype corresponding to the function under the cursor.</p><p>- This action can be triggered at <span class="emphasis"><em>call sites</em></span>, where the function+ This action can be triggered at a <span class="emphasis"><em>call site</em></span>, where the functionbeing decompiled is calling into another function. Users must select either the token representing- the called function's name or the tokens representing the function pointer at the call site.- A dialog is brought up where the a complete <span class="emphasis"><em>function declaration</em></span>, specifying- the return data-type along with the name and data-type for each input parameter. Additionally,- the "Calling Convention", "In Line", and "No Return" properties of the function prototype- can be set (See <a class="xref" href="DecompilerAnnotations.html#AnnotePrototype" title="Function Prototypes">“Function Prototypes”</a>).+ the called function's name or one of the tokens representing the function pointer at the call site.+ The action brings up a dialog where the <span class="emphasis"><em>function prototype</em></span>+ corresponding to the call site can be edited. The dialog provides fine-grained control of+ the return data-type along with the name and data-type of each input parameter.+ The function prototype properties <span class="bold"><strong>Calling Convention</strong></span>,+ <span class="bold"><strong>In Line</strong></span>, and <span class="bold"><strong>No Return</strong></span>+ can also be set (see <a class="xref" href="DecompilerAnnotations.html#AnnotePrototype" title="Function Prototypes">Function Prototypes</a>).</p><p>- Confirming the dialog forces the new function prototype on the decompiler's view of the called function,+ Confirming the dialog forces the new function prototype on the Decompiler's view of the called function,but only for the single selected call site.</p><p>This action is suitable for either indirect calls or direct calls to functions taking a variable numberof arguments; situations where a complete description of all parameters is not available.For direct calls with a fixed number of arguments, it is almost always better to provide- parameter information by setting the function's prototype directly. See the- <a class="xref" href="DecompilerWindow.html#ActionCommitParams" title="Commit Params/Return">“Commit Params/Return”</a> command for instance. In this situation, the "Override Signature"+ parameter information by setting the function's prototype directly (see the+ <a class="xref" href="DecompilerWindow.html#ActionCommitParams" title="Commit Params/Return">Commit Params/Return</a> command). In this situation, the "Override Signature"command is still possible, but it will bring up a confirmation dialog.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="ActionReference"></a>Reference ...</h3></div></div></div>+<a name="ActionReference"></a>References</h3></div></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title">@@ -948,7 +967,7 @@References to parameters and global variables are always listed.If the <span class="emphasis"><em>Dynamic Data Type Discovery</em></span> option is on(see <a class="ulink" href="help/topics/LocationReferencesPlugin/Location_References.html#Data_Types" target="_top">To Find Location References to Data Types</a>),- the decompiler's propagation analysis is invoked on all functions to discover local+ the Decompiler's propagation analysis is invoked on all functions to discover localvariables as well.</p></div>@@ -993,8 +1012,8 @@the constant under the cursor.</p><p>- The selected constant must have had either a <a class="xref" href="DecompilerWindow.html#ActionConvert" title="Convert">“Convert”</a> or a- <a class="xref" href="DecompilerWindow.html#ActionSetEquate" title="Set Equate ...">“Set Equate ...”</a> command applied to it. After applying this command,+ The selected constant must have had either a <a class="xref" href="DecompilerWindow.html#ActionConvert" title="Convert">Convert</a> or a+ <a class="xref" href="DecompilerWindow.html#ActionSetEquate" title="Set Equate...">Set Equate...</a> command applied to it. After applying this command,the conversion is no longer applied, and the selected constant will be displayedusing the decompiler's default strategy, which depends on the data-type of the constant andother display settings (See <a class="xref" href="DecompilerOptions.html#DisplayIntegerFormat"><span class="bold"><strong>Integer format</strong></span></a>).@@ -1010,10 +1029,10 @@</p><p>This action can only be triggered at <span class="emphasis"><em>call sites</em></span>, where an overriding- prototype was previously placed by the <a class="xref" href="DecompilerWindow.html#ActionOverrideSignature" title="Override Signature">“Override Signature”</a> command. As with+ prototype was previously placed by the <a class="xref" href="DecompilerWindow.html#ActionOverrideSignature" title="Override Signature">Override Signature</a> command. As withthis command, users must select either the token representing the called function's name or thetokens representing the function pointer at the call site. The action causes the- override to be removed immediately. Parameter information will be drawn from the decompiler's+ override to be removed immediately. Parameter information will be drawn from the Decompiler'snormal analysis.</p></div>@@ -1027,7 +1046,7 @@</p><p>The current function can be renamed by selecting the name token within the function's- declaration at the top of the decompiler window, or individual called functions+ declaration at the top of the Decompiler window, or individual called functionscan be renamed by selecting their name token within a call expression.This action brings up a dialog containing a text field prepopulated with thename to be changed. The current namespace (and any parent namespaces) is@@ -1037,8 +1056,8 @@</p><p>A new or child namespace can- be specified by prepending the base name with the namespace using the C++ '::'- separator characters. Any namespace path entered this way is considered relative+ be specified by prepending the base name with the namespace using the C++ "::"+ delimiter characters. Any namespace path entered this way is considered relativeto the namespace set in the drop-down menu, so the <span class="bold"><strong>Global</strong></span>namespace may need to be selected if the user wants to specify an absolute path. Ifany path element of the namespace does not exist, it is created.@@ -1049,26 +1068,6 @@</p></div>--<div class="sect2">-<div class="titlepage"><div><div><h3 class="title">-<a name="ActionRenameLabel"></a>Rename Label</h3></div></div></div>-- <p>- Rename the label corresponding to the token under the cursor.- </p>- <p>- A label can be renamed by triggering this action while the corresponding label token is- under the cursor. This action brings up the- <a href="help/topics/LabelMgrPlugin/Labels.htm#AddEditDialog">Edit Label Dialog</a>.- </p>- <p>- The change will be immediately visible across all references to the label- (including in any Decompiler, Listing, and Functions windows).- </p>-</div>--<div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="ActionRenameField"></a>Rename Field</h3></div></div></div>@@ -1084,8 +1083,9 @@</p><p>If the initial name looks like <code class="code">field_0x..</code>, it may be that the field offset was- discovered by the decompiler, and the field does not exist in the structure definition.- In this case, a new field is created at that offset, with the new name and a data-type of "undefined".+ discovered by the Decompiler, and the field does not exist in the structure definition.+ In this case, a new field is created at that offset, with the new name and a data-type of+ <span class="bold"><strong>undefined</strong></span>.</p><p>The change to the definition is visible globally@@ -1093,10 +1093,10 @@is triggered again to incorporate the new name, but the output is otherwise unaffected.</p><p>- Within a decompiler window, field name tokens are presented <span class="emphasis"><em>in context</em></span>,+ Within a Decompiler window, field name tokens are presented <span class="emphasis"><em>in context</em></span>,showing how they are used within the code flow of the current function.- Combined with <a class="xref" href="DecompilerWindow.html#ActionAutoStructure" title="Auto Create Structure">“Auto Create Structure”</a> and- <a class="xref" href="DecompilerWindow.html#ActionRetypeField" title="Retype Field">“Retype Field”</a>, this action allows a+ Combined with <a class="xref" href="DecompilerWindow.html#ActionAutoStructure" title="Auto Create Structure">Auto Create Structure</a> and+ <a class="xref" href="DecompilerWindow.html#ActionRetypeField" title="Retype Field">Retype Field</a>, this action allows a<span class="emphasis"><em>structure</em></span> to be created and filled in based on this context.</p></div>@@ -1117,19 +1117,37 @@</p><p>A new or child namespace can- be specified by prepending the base name with the namespace using the C++ '::'- separator characters. Any namespace path entered this way is considered relative+ be specified by prepending the base name with the namespace using the C++ "::"+ delimiter characters. Any namespace path entered this way is considered relativeto the namespace set in the drop-down menu, so the <span class="bold"><strong>Global</strong></span>namespace may need to be selected if the user wants to specify an absolute path. Ifany path element of the namespace does not exist, it is created.</p><p>The change will be immediately visible across all references to the variable,- including the Decompiler and Listing windows. A new decompilation is triggered+ including in Decompiler and Listing windows. A new decompilation is triggeredto incorporate the new name, but the output is otherwise unaffected.</p></div>+<div class="sect2">+<div class="titlepage"><div><div><h3 class="title">+<a name="ActionRenameLabel"></a>Rename Label</h3></div></div></div>++ <p>+ Rename the label corresponding to the token under the cursor.+ </p>+ <p>+ A label can be renamed by triggering this action while the corresponding label token is+ under the cursor. This action brings up the+ <a class="ulink" href="help/topics/LabelMgrPlugin/Labels.htm#AddEditDialog" target="_top">Edit Label Dialog</a>.+ </p>+ <p>+ The change will be immediately visible across all references to the label+ (including in any Decompiler, Listing, and Functions windows).+ </p>+</div>+<div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="ActionRenameVariable"></a>Rename Variable</h3></div></div></div>@@ -1148,11 +1166,11 @@change, but otherwise the the output is unaffected.</p><p>- Local variables and parameters presented by the decompiler may be invented on-the-fly+ Local variables and parameters presented by the Decompiler may be invented on-the-flyand don't necessarily have a formal annotation in Ghidra- (see <a class="xref" href="DecompilerAnnotations.html#AnnoteVariables" title="Variable Annotations">“Variable Annotations”</a>). Performing this action on+ (see <a class="xref" href="DecompilerAnnotations.html#AnnoteVariables" title="Variable Annotations">Variable Annotations</a>). Performing this action ona variable will create an annotation if one didn't exist previously, which will- generally be visible as part of the function header in the Listing window.+ generally be visible as part of the function header in any Listing window.A new annotation will <span class="emphasis"><em>not</em></span> commit the data-type of the variable,and data-types applied later, and elsewhere in the function, can still propagate intothe variable.@@ -1183,7 +1201,7 @@<p>The change to the definition is visible globally throughout the Program,anywhere the data-type is referenced, and is <span class="emphasis"><em>forcing</em></span>- on the decompiler (see <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">“Forcing Data-types”</a>). Decompilation is triggered+ on the Decompiler (see <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">Forcing Data-types</a>). Decompilation is triggeredagain, and the new data-type is propagated from the point of the field reference(s).Changes to the output may be large and indirect.</p>@@ -1204,8 +1222,8 @@</p><p>The change is visible globally throughout the Program, anywhere the variable is- referenced, and is <span class="emphasis"><em>forcing</em></span> on the decompiler- (see <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">“Forcing Data-types”</a>). Decompilation is triggered+ referenced, and is <span class="emphasis"><em>forcing</em></span> on the Decompiler+ (see <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">Forcing Data-types</a>). Decompilation is triggeredagain, and the new data-type is propagated from the variable reference(s).Changes to the output may be large and indirect.</p>@@ -1220,22 +1238,22 @@</p><p>This action is only available from the data-type token in the function declaration, at the- top of the decompiler's output. It brings up a dialog prepopulated with the current+ top of the Decompiler's output. It brings up a dialog prepopulated with the currentdata-type returned by the function. The user can select any fixed length data-type in the Program.Editing and confirming this dialog immediately changes the data-type. If an annotation forthe return value (named <code class="code"><RETURN></code>) did not exist previously, one is created.</p><p>As input parameter annotations and the return value annotation must be committed as a whole- (see the discussion of function prototype's in <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">“Forcing Data-types”</a>), if+ (see the discussion of function prototype's in <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">Forcing Data-types</a>), ifno prototype existed previously, this action also causes variable annotations for allinput parameters to be created as well. In this situation, the action is equivalent to- <a class="xref" href="DecompilerWindow.html#ActionCommitParams" title="Commit Params/Return">“Commit Params/Return”</a>, and a confirmation dialog comes up to notify the user.+ <a class="xref" href="DecompilerWindow.html#ActionCommitParams" title="Commit Params/Return">Commit Params/Return</a>, and a confirmation dialog comes up to notify the user.</p><p>Setting a data-type on the return value using this action affects decompilation for thefunction itself and, additionally, any function that calls this function. Within a calling- function, the decompiler propagates the data-type into the variable or expression incorporating+ function, the Decompiler propagates the data-type into the variable or expression incorporatingthe return value at each call site.</p></div>@@ -1254,17 +1272,17 @@the data-type.</p><p>- The change to the data-type is <span class="emphasis"><em>forcing</em></span> on the decompiler- (see <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">“Forcing Data-types”</a>). Decompilation is triggered again, and the new+ The change to the data-type is <span class="emphasis"><em>forcing</em></span> on the Decompiler+ (see <a class="xref" href="DecompilerAnnotations.html#AnnoteForcing" title="Forcing Data-types">Forcing Data-types</a>). Decompilation is triggered again, and the newdata-type is propagated from the variable reference(s). Changes to the output may belarge and indirect.</p><p>- Local variables and parameters presented by the decompiler may be invented on-the-fly+ Local variables and parameters presented by the Decompiler may be invented on-the-flyand don't necessarily have a formal annotation in Ghidra- (see <a class="xref" href="DecompilerAnnotations.html#AnnoteVariables" title="Variable Annotations">“Variable Annotations”</a>). Performing this action on a variable+ (see <a class="xref" href="DecompilerAnnotations.html#AnnoteVariables" title="Variable Annotations">Variable Annotations</a>). Performing this action on a variablewill create an annotation if one didn't exist previously, which will generally be- visible as part of the function header in the Listing window.+ visible as part of the function header in any Listing window.</p><p>Performing this action on a function parameter causes a formal annotation to@@ -1282,7 +1300,7 @@<div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="ActionSetEquate"></a>Set Equate ...</h3></div></div></div>+<a name="ActionSetEquate"></a>Set Equate...</h3></div></div></div><p>Change the display of the integer or character constant under the cursor to an <span class="emphasis"><em>equate</em></span>@@ -1300,17 +1318,17 @@OK, completes the action, and the selected equate is substituted for its constant.</p><p>- This command primarily targets a constant token in the Decompiler window, but+ This command primarily targets a constant token in a Decompiler window, butif there is a <span class="emphasis"><em>scalar</em></span> operand in an instruction that corresponds- with the selected constant, the same equate is also applied to the scalar in the Listing+ with the selected constant, the same equate is also applied to the scalar in any Listingwindow. This is equivalent to selecting the- <a class="ulink" href="help/topics/EquatePlugin/Equates.htm#Set_Equate" target="_top">Set Equate</a> command from the- Listing. There may not be a scalar operand directly corresponding to the selected constant, in+ <a class="ulink" href="help/topics/EquatePlugin/Equates.htm#Set_Equate" target="_top">Set Equate</a> command from a+ Listing window. There may not be a scalar operand directly corresponding to the selected constant, inwhich case the equate will be applied only in the Decompiler window.</p><p>Once an equate is applied, the constant can be returned to its <span class="emphasis"><em>default</em></span> display- by selecting the <a class="xref" href="DecompilerWindow.html#ActionRemoveEquate" title="Remove Convert/Equate">“Remove Convert/Equate”</a> command.+ by selecting the <a class="xref" href="DecompilerWindow.html#ActionRemoveEquate" title="Remove Convert/Equate">Remove Convert/Equate</a> command.</p></div>@@ -1323,11 +1341,11 @@possible range.</p><p>- The decompiler defines high-level variables in terms of <a class="link" href="DecompilerConcepts.html#ConceptVarnode" title="Varnodes">varnodes</a> that+ The Decompiler defines high-level variables in terms of <a class="link" href="DecompilerConcepts.html#ConceptVarnode" title="Varnodes">varnodes</a> thatare merged together to produce the final variable. Some merging is speculative, which reduces thenumber of variables overall, but is not strictly necessary for valid decompilation. The merged- variable can be represented with two or more variables that have a smaller range. See the- documentation on <a class="xref" href="DecompilerConcepts.html#ConceptHighVariable" title="HighVariable">“HighVariable”</a>.+ variable can be represented with two or more variables that have a smaller range (see the+ documentation on <a class="xref" href="DecompilerConcepts.html#ConceptHighVariable" title="HighVariable">HighVariable</a>).</p><p>This command is only available if the selected token is part of a high-level variable that hasdiff --git a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/images/document-properties.png b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/images/document-properties.pngnew file mode 100644index 0000000000..ab0e8ea377Binary files /dev/null and b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/images/document-properties.png differdiff --git a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/images/openFolder.png b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/images/openFolder.pngnew file mode 100644index 0000000000..14cf972f07Binary files /dev/null and b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/images/openFolder.png differ