• Jörn Engel's avatar
    [PATCH] Improve `make checkstack' · 0444d9b3
    Jörn Engel authored
    On i386, stack usually grows with "sub $0x8,%esp" and shrinks with
    "add $0x8,%esp" respectively.  In some cases, though, stack grows with
    "add $0xffffff80,%esp" and shrinks with "sub $0xffffff80,%esp".
    Obviously, we don't want to miss those cases.
    
    Since in either case add and sub seem to be balanced and contain the
    same parameter, we don't need a second regex.  We simply accept hex
    numbers of up to 8 digits and treat them as negative numbers when the
    sub appears to be a little too high.
    
    ...or so I thought.  But another day of testing proved me wrong again.
    
    Some functions do stuff like "sub $0x10,%esp", ..., "add $0x20,%esp".
    In other words, add and sub are *NOT* balanced.  Manual inspection
    showed that 0x20 is a more realistic number, so I accept either
    variant, just in case.  We pay for this with a bunch of duplicates in
    our output, but that beats missing some stack hogs.
    
    In the long run, this script has to be replaced by gcc options,
    really.  Looking at the result and guessing back is such a stupid
    idea.
    Signed-off-by: default avatarJörn Engel <joern@wohnheim.fh-wedel.de>
    0444d9b3
checkstack.pl 2.74 KB