question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to automatically handle conditional jumps that are actually unconditional

See original GitHub issue

CFR decompiles senseless ifs like iconst_0 iconst_0 if_icmpne L5 to

 if (0 == 0) {
            //this always happens
 }

Please add an option to automatically handle unnecessary if instructions (interpret them as goto, or not). This makes (poorly) obfuscated code easier to read without changing the instructions.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
leibnitz27commented, May 9, 2020

I’m actually ok with removing entirely trivial tautologies/oxymorons which don’t require program analysis - so, for example, I’m DEFINITELY not ok with

a = 1
if (a < 2) {
  foo
}

Even though it’s entirely obvious. (I should note, I do perform some limited program analysis, because without it Kotlin generates absolute junk sometimes - so following a conditional chain with literals is sometimes necessary).

however, if (explicit literal integer condition involving no variables) seems like a reasonable thing to handle in a “heavy” fallback pass, i.e. it’s all gone completely wrong, so let’s have a go at removing impossible code in case it’s making something look like a loop when it isn’t. (at this point it’s usually all about trying to de-spaghettify code)

1reaction
leibnitz27commented, May 9, 2020

(should mention --removedeadconditionals true required, unless it’s triggered in a recovery pass.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

MASM can automate jump-extending with errors?
The follow page in masm states the following: If a source file 8086-80286 program contains a conditional jump outside the range of -128...
Read more >
Conditional Jumps Instructions
The most common way to transfer control in assembly language is to use a conditional jump. This is a two-step process: 1. First...
Read more >
What is difference between conditional and unconditional ...
In unconditional jump program with definitely move to address specified in jump instruction but in conditional based on some condition only it will...
Read more >
Conditional Execution - an overview | ScienceDirect Topics
Conditional execution controls whether or not the core will execute an instruction. Most instructions have a condition attribute that determines if the core ......
Read more >
How a Jump Works
The machine cycle automatically executes instructions in sequence. When a jump instruction executes (in the last step of the machine cycle), it puts...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found