You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm currently trying to write a script for exporting the PCode representation of a program
for use in a different project of mine. While writing the script, I noticed that basic blocks
representing switch-case blocks do not contain information describing which outgoing basic block
corresponds to which switch-case label.
Depending on what proposal is more favorable, I can also work on a pull request implementing
the feature.
Describe the solution you'd like
Proposal 1.)
Expose the default case address in JumpTable for the corresponding switch-case block. This can be
either done by defining a new field (like Address defaultCase = null;) in the class or adding a
case address to the cases field, specifying that the last entry always corresponds to the default case.
Proposal 2.)
Expose the default case through the label field in BlockEdge. Right now, the field seems to be unused
even though in the decompiler the field gets populated (and also has a flag marking the default switch case).
Describe alternatives you've considered
See above.
Additional context
code from Ghidra/Features/Decompiler/src/decompile/cpp/block.cc: label is populated but does not get encoded.
The text was updated successfully, but these errors were encountered:
inetbowser
changed the title
PCode: Expose default case address for switch statements
PCode: Expose default case address for switch statements in Ghidra API
Oct 9, 2024
Is your feature request related to a problem? Please describe.
I'm currently trying to write a script for exporting the PCode representation of a program
for use in a different project of mine. While writing the script, I noticed that basic blocks
representing switch-case blocks do not contain information describing which outgoing basic block
corresponds to which switch-case label.
Depending on what proposal is more favorable, I can also work on a pull request implementing
the feature.
Describe the solution you'd like
Proposal 1.)
Expose the default case address in
JumpTable
for the corresponding switch-case block. This can beeither done by defining a new field (like
Address defaultCase = null;
) in the class or adding acase address to the
cases
field, specifying that the last entry always corresponds to the default case.Proposal 2.)
Expose the default case through the label field in
BlockEdge
. Right now, the field seems to be unusedeven though in the decompiler the field gets populated (and also has a flag marking the default switch case).
Describe alternatives you've considered
See above.
Additional context
code from
Ghidra/Features/Decompiler/src/decompile/cpp/block.cc
: label is populated but does not get encoded.The text was updated successfully, but these errors were encountered: