-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parsing header files succeeds when it should not, reports mysterious error when it fails #7001
Comments
There are two phases to the parsing just as in normal header parsing. My suspicion is that in both cases the second phase parse is getting to run when the first phase encountered an error.
It might have been as designed originally to allow processing so one could extract as much type information as possible. This probably isn't the best behavior, or at least should be an option to push through any error conditions that is off by default. I've seen some #error conditions that can be ignored in special cases, I think when parsing AVR8 header files, but this probably isn't the norm. I'll take a look and address the issue. |
Describe the bug
When parsing header files, the parser ignores
#error
when it should not. When it correctly does fail due to an#error
it fails to identify the cause of the problem.To Reproduce
There are four very simple header files in the attached tar file. To reproduce, simply process the header files using two different orders:
bbb.h aaa.h ccc.h
andbbb.h aaa.h ccc-fixed.h
. You can use the Ghidra UI, or you can achieve the same results using CParserUtils.parseHeaderFilesExpected Behavior
Ghidra improperly reports success when the parse order is
bbb.h aaa.h ccc.h
although it does have a message with a useful warning (but it should have failed). Alternatively, Ghidra properly reports failure if the parse order isbbb.h aaa.h ccc-fixed.h
but then it provides meaningless information about the actual error.The only difference between
ccc.h
andccc-fixed.h
is the inclusion of a typedef before the#error
Why should this affect the success or failure of parsing? The files were designed such that the only valid parse order isaaa.h bbb.h ccc.h
Screenshots
Attachments
ghidrabug.tar.gz
a gzipped tar file containing four files
Environment
Ghidra version 11.2 using headless analyzer and a custom script,
Ghidra version 11.03 using UI
The text was updated successfully, but these errors were encountered: