Merge remote-tracking branch 'origin/GP-821_PiecePathologyInfiniteLoop'

(Closes #2851)
This commit is contained in:
ghidra1 2021-04-02 17:39:58 -04:00
commit 636102a409
3 changed files with 41 additions and 7 deletions

View file

@ -17,6 +17,7 @@ src/decompile/datatests/forloop_thruspecial.xml||GHIDRA||||END|
src/decompile/datatests/forloop_varused.xml||GHIDRA||||END|
src/decompile/datatests/forloop_withskip.xml||GHIDRA||||END|
src/decompile/datatests/loopcomment.xml||GHIDRA||||END|
src/decompile/datatests/multiret.xml||GHIDRA||||END|
src/decompile/datatests/namespace.xml||GHIDRA||||END|
src/decompile/datatests/nestedoffset.xml||GHIDRA||||END|
src/decompile/datatests/noforloop_alias.xml||GHIDRA||||END|

View file

@ -3174,17 +3174,20 @@ void FuncProto::setOutputLock(bool val)
store->getOutput()->setTypeLock(val);
}
/// This value can be used as a hint as to how much of the return value is important and
/// is used to inform the dead code \e consume algorithm.
/// \param val is the estimated number of bytes or 0
/// \return \b true if the value was changed
/// Provide a hint as to how many bytes of the return value are important.
/// The smallest hint is used to inform the dead-code removal algorithm.
/// \param val is the hint (number of bytes or 0 for all bytes)
/// \return \b true if the smallest hint has changed
bool FuncProto::setReturnBytesConsumed(int4 val)
{
int4 oldVal = returnBytesConsumed;
if (oldVal == 0 || val < oldVal)
if (val == 0)
return false;
if (returnBytesConsumed == 0 || val < returnBytesConsumed) {
returnBytesConsumed = val;
return (oldVal != val);
return true;
}
return false;
}
/// \brief Assuming \b this prototype is locked, calculate the \e extrapop

View file

@ -0,0 +1,30 @@
<decompilertest>
<binaryimage arch="x86:LE:64:default:gcc">
<!--
Contrived example that seems to set up multiple return value sizes.
This used to make the decompiler enter an infinite loop.
-->
<bytechunk space="ram" offset="0x100000" readonly="true">
4883ec1864488b042528000000488944
240831c083fe01744f83fe02742a897c
2404488d7c2404e8dc0f00008b442404
488b542408644833142528000000753d
4883c418c3000000488d7c2404b8e903
00006689442404e8ac0f00008b442404
ebce000000000000488d7c2404c64424
0461e8910f00008b442404ebb3e88e0f
0000
</bytechunk>
</binaryimage>
<script>
<com>map fun r0x100000 getval</com>
<com>override flow r0x10007d callreturn</com>
<com>lo fu getval</com>
<com>decompile</com>
<com>print C</com>
<com>quit</com>
</script>
<stringmatch name="Multi-size return #1" min="1" max="1">Stack20 = CONCAT31.*0x61</stringmatch>
<stringmatch name="Multi-size return #2" min="1" max="1">Stack20 = CONCAT22.*0x3e9</stringmatch>
<stringmatch name="Multi-size return #3" min="1" max="1">Stack20 = param_1</stringmatch>
</decompilertest>