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.

Sleigh NPE 'with blocks' with actions section

See original GitHub issue

Describe the bug If an instruction inside a with block does not have an action section and the with block does, a NullPointerException occurs.

with : epsilon [ dummyContext=1; ] {
   :dummy is epsilon {}
}

Environment (please complete the following information):

  • OS: Microsoft Windows [Version 10.0.18362.418]
  • Java Version: 12.0.2
  • Ghidra Version: 9.1

Additional context I traced it back to SleighCompiler.g line 601. b needs to be created if nil before the call to sc.pushWith but I’m not familiar with ANTLR so I’m unsure if it needs to happen before entering the withblock or just before calling pushWith.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mumbelcommented, Oct 20, 2019

Unfortunate name collision looks like, they don’t have similar design/specs. There are also names that suggest it is example of sleigh/pcode (define pcodeop pcodeop_one;)

0reactions
SamuelWAnderson45commented, Nov 27, 2019

Found a similar NPE related to operands.

with instruction : op0=1 & reg1 {
    :EXMPL reg1 is op1=0 {
    }
}

crashes with

ERROR Unrecoverable error(s), halting compilation (SleighCompile) java.lang.NullPointerException
	at ghidra.pcodeCPort.slgh_compile.SleighCompile.defineInvisibleOperand(SleighCompile.java:1159)
	at ghidra.sleigh.grammar.SleighCompiler.pequation_symbol(SleighCompiler.java:4458)
	at ghidra.sleigh.grammar.SleighCompiler.pequation(SleighCompiler.java:4293)
	at ghidra.sleigh.grammar.SleighCompiler.pequation(SleighCompiler.java:4137)
	at ghidra.sleigh.grammar.SleighCompiler.bitpattern(SleighCompiler.java:3562)
	at ghidra.sleigh.grammar.SleighCompiler.bitpat_or_nil(SleighCompiler.java:3301)
	at ghidra.sleigh.grammar.SleighCompiler.withblock(SleighCompiler.java:3168)
	at ghidra.sleigh.grammar.SleighCompiler.constructorlike(SleighCompiler.java:2963)
	at ghidra.sleigh.grammar.SleighCompiler.root(SleighCompiler.java:481)
	at ghidra.pcodeCPort.slgh_compile.SleighCompileLauncher.run_compilation(SleighCompileLauncher.java:373)
	at ghidra.pcodeCPort.slgh_compile.SleighCompileLauncher.runMain(SleighCompileLauncher.java:277)
	at ghidra.pcodeCPort.slgh_compile.SleighCompileLauncher.launch(SleighCompileLauncher.java:74)
	at ghidra.GhidraLauncher.main(GhidraLauncher.java:79)

Moving reg1 to the constructor like so

with instruction : op0=1 {
    :EXMPL reg1 is op1=0 & reg1 {
    }
}

allows the compilation to finish. After looking at the Sleigh spec, its unclear to me whether operands belong in the with block. Even in that case, the compilation should fail with a proper error, not an NPE.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release Notes - Ghidra
Key Bindings section. (GT-3446); GUI. Improved mouse wheel scrolling in Listing and Byte Viewers. (GT-3473); GUI. Ghidra's action context ...
Read more >
The final word on NPE | plasticstoday.com
The stack cubes indexed to align faces for assembly and the flip tops were pushed into the cap body by ejection action. The...
Read more >
Calculation Reference
Area Reduction Calculation. ... Area Reduction Fails to Calculate. ... calculation analyzes data collected from a test that used a friction table and...
Read more >
iManager 2.7.5 Readme
Section 2.0, Downloading and Installing the iManager Support Pack ... iManager 2.7.5 blocks users from using a GET method for login requests ...
Read more >
Abnormalities in brain structure and behavior in GSK-3alpha ...
In recent years numerous studies have indicated that GSK-3 acts downstream ... The NPE (non pre-exposure) mice were confined to the chamber for...
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