4 ms·
Not to burst any bubbles, but the static analysis technique shown is capable of detecting recursion only in static call chains. It doesn't seem to even have an
by ajross 15y ago
Not to burst any bubbles, but the static analysis technique shown is capable of detecting recursion only in static call chains. It doesn't seem to even have any handling (even to say "warning! unhandled call!") for something like function pointers. Feed this a C++ program with recursive virtual functions and it will, apparently, return "OK!"
- ttsiodras 15y agoActually, function pointers are... not allowed in space SW. And remember, this is just a hack I did - I wanted to show people the things one can do with objdump. From the article: "This kind of functionality is usually part of far more mature tools than... quickly-hacked Python scripts. Don't use this to send your spaceship in orbit :-)"
- ajross 15y agoStill misses the point. A quickly hacked script can be really useful if it shows real bugs (where a recursive call in this case is a "bug"). There's nothing wrong with the development methodology: who cares how ugly the code is that found the bug as long as it's fixed? The problem is that the mathematical problem being attacked is undecidable. This script only approximates a solution in the case where function pointers don't exist. Even that would be OK if you knew about the limitation and the script flagged indirect jumps as errors too. It looked like you didn't realize that though, so I thought it had to be mentioned.
- eru 15y agoYou could send in a patch.
- ajross 15y ago... that solves the halting problem?
- eru 15y agoIf you can. Honestly I meant something along the lines of "Even that would be OK if you knew about the limitation and the script flagged indirect jumps as errors too."
- wlievens 15y agoYou're using the Turing Tarpit here. You do not need to "solve the Halting Problem" in order to make useful static analysis software. When the software can prove X, return True. When the software can prove !X, return False. When the software can't do either, return Sorry.