5

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.

3
  • 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
    Commented Aug 15, 2017 at 12:13
  • 1
    how did you compile it? was there any optimisation turned on? is it possible to put the binary somewhere? Commented Oct 19, 2017 at 12:02
  • Is the problem still occur? Would you be able to share the binary?
    – Megabeets
    Commented Dec 10, 2017 at 9:01

1 Answer 1

1

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.

4
  • hmm, this might be the problem, could you give me some help with enabling it?
    – Florin
    Commented Aug 16, 2017 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
    Commented Aug 17, 2017 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)
    – Florin
    Commented Aug 17, 2017 at 9:18
  • Why isn't that option the default? Commented Jun 16, 2018 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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