I am using radare2, I have disassembled the function: sym.loop, it contains a switch witch has 4 cases that calls different functions. After any of the function call, the program exits the loop function.

Here is my problem: after the first exit displayed in radare the disassembled code stops. I am not able to see the rest of the function's code, although there are jump indicating there is more content after the exit function.

Do I have to press or do anything to display the rest or is it a bug?

Here is the code of the loop function:

void loop(int a) {
    type[0] = a;
    while (true) {
        switch (type[0]) {
        case 1:
            function1(arg);
            break;
        case 2:
            function2(arg);
            break;
        case 3:
            function3(arg);
            break;
        default:
            printf("Command unrecognized.\n");
        case 4:
            function4();
            break;
        }
    }
}

Note: if there is any bug in the code, I may have caused trying to clean the code from debug messages or whatever... But the idea is that the main code has no bugs, it is just the disassembler that doesn't print the entire function. and the disassembly code stops after the case1's break (exit function).

(UPDATE:) Here is an example of the error I am talking about (not the above code, but the same error): Function is not displaying the entire code.No function return.

No return value is displayed.

  • 6
    Can you please share the output of pdf @ sym.loop? Also, do you able to share the binary so we can investigate deeper? – Megabeets Aug 15 '17 at 12:13
  • 1
    how did you compile it? was there any optimisation turned on? is it possible to put the binary somewhere? – Paweł Łukasik Oct 19 '17 at 12:02
  • Is the problem still occur? Would you be able to share the binary? – Megabeets Dec 10 '17 at 9:01

You may also need to enable jumptable analysis options e anal.jmptbl before analysis and you also need latest git version of radare2.

/ 2018 This is now default to true as the functionality have been improved.

  • hmm, this might be the problem, could you give me some help with enabling it? – Fineas Silaghi Aug 16 '17 at 13:50
  • Simpy run e anal.jmptbl=true from inside radare's shell. Read more about configurations: radare.gitbooks.io/radare2book/content/configuration/intro.html – Megabeets Aug 17 '17 at 5:54
  • @Megabeets just got the latest version, also set e anal.jmptbl to true but the result is the same. But: if I press pC to visualize the code in more lines, then, the entire function is displayed (mabe this can help) – Fineas Silaghi Aug 17 '17 at 9:18
  • Why isn't that option the default? – joxeankoret Jun 16 at 17:13

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.