-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Update Ghidra HEAD to commit a6be09898 #167
Conversation
Changed files: ``` M Ghidra/Features/Decompiler/src/decompile/cpp/Makefile M Ghidra/Features/Decompiler/src/decompile/cpp/address.cc M Ghidra/Features/Decompiler/src/decompile/cpp/address.hh M Ghidra/Features/Decompiler/src/decompile/cpp/architecture.cc M Ghidra/Features/Decompiler/src/decompile/cpp/block.cc M Ghidra/Features/Decompiler/src/decompile/cpp/capability.hh M Ghidra/Features/Decompiler/src/decompile/cpp/consolemain.cc M Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc M Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.hh M Ghidra/Features/Decompiler/src/decompile/cpp/error.hh M Ghidra/Features/Decompiler/src/decompile/cpp/filemanage.hh M Ghidra/Features/Decompiler/src/decompile/cpp/float.cc M Ghidra/Features/Decompiler/src/decompile/cpp/flow.cc M Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc M Ghidra/Features/Decompiler/src/decompile/cpp/fspec.hh M Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_block.cc M Ghidra/Features/Decompiler/src/decompile/cpp/ghidra_process.hh M Ghidra/Features/Decompiler/src/decompile/cpp/heritage.cc M Ghidra/Features/Decompiler/src/decompile/cpp/ifacedecomp.cc M Ghidra/Features/Decompiler/src/decompile/cpp/ifacedecomp.hh M Ghidra/Features/Decompiler/src/decompile/cpp/inject_ghidra.cc M Ghidra/Features/Decompiler/src/decompile/cpp/interface.hh M Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.cc M Ghidra/Features/Decompiler/src/decompile/cpp/marshal.cc M Ghidra/Features/Decompiler/src/decompile/cpp/marshal.hh M Ghidra/Features/Decompiler/src/decompile/cpp/merge.cc M Ghidra/Features/Decompiler/src/decompile/cpp/op.cc M Ghidra/Features/Decompiler/src/decompile/cpp/op.hh M Ghidra/Features/Decompiler/src/decompile/cpp/opcodes.hh M Ghidra/Features/Decompiler/src/decompile/cpp/partmap.hh M Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc M Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc M Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc M Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.hh M Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc M Ghidra/Features/Decompiler/src/decompile/cpp/space.cc M Ghidra/Features/Decompiler/src/decompile/cpp/space.hh M Ghidra/Features/Decompiler/src/decompile/cpp/test.cc M Ghidra/Features/Decompiler/src/decompile/cpp/test.hh M Ghidra/Features/Decompiler/src/decompile/cpp/testfunction.cc M Ghidra/Features/Decompiler/src/decompile/cpp/testfunction.hh M Ghidra/Features/Decompiler/src/decompile/cpp/translate.cc M Ghidra/Features/Decompiler/src/decompile/cpp/type.cc M Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc M Ghidra/Features/Decompiler/src/decompile/cpp/variable.cc M Ghidra/Features/Decompiler/src/decompile/cpp/variable.hh M Ghidra/Features/Decompiler/src/decompile/cpp/varnode.cc M Ghidra/Features/Decompiler/src/decompile/cpp/varnode.hh M Ghidra/Features/Decompiler/src/decompile/cpp/xml.hh A Ghidra/Features/Decompiler/src/decompile/datatests/condconst.xml A Ghidra/Features/Decompiler/src/decompile/datatests/condmulti.xml A Ghidra/Features/Decompiler/src/decompile/datatests/retstruct.xml M Ghidra/Features/Decompiler/src/decompile/unittests/testfloatemu.cc A Ghidra/Features/Decompiler/src/decompile/unittests/testfuncproto.cc M Ghidra/Features/Decompiler/src/decompile/unittests/testmarshal.cc M Ghidra/Processors/6502/data/languages/65c02.slaspec M Ghidra/Processors/68000/data/languages/68000.sinc M Ghidra/Processors/AARCH64/certification.manifest M Ghidra/Processors/AARCH64/data/languages/AARCH64_win.cspec A Ghidra/Processors/AARCH64/data/patterns/AARCH64_win_patterns.xml A Ghidra/Processors/AARCH64/data/patterns/prepatternconstraints.xml M Ghidra/Processors/AARCH64/src/main/java/ghidra/app/util/bin/format/elf/relocation/AARCH64_ElfRelocationHandler.java M Ghidra/Processors/AARCH64/src/main/java/ghidra/app/util/bin/format/macho/relocation/AARCH64_MachoRelocationHandler.java M Ghidra/Processors/ARM/data/languages/ARM.ldefs M Ghidra/Processors/ARM/data/languages/ARMTHUMBinstructions.sinc M Ghidra/Processors/ARM/data/languages/ARMneon.sinc M Ghidra/Processors/ARM/src/main/java/ghidra/app/util/bin/format/elf/relocation/ARM_ElfRelocationContext.java M Ghidra/Processors/ARM/src/main/java/ghidra/app/util/bin/format/elf/relocation/ARM_ElfRelocationHandler.java M Ghidra/Processors/ARM/src/main/java/ghidra/app/util/bin/format/macho/relocation/ARM_MachoRelocationHandler.java M Ghidra/Processors/Atmel/data/languages/avr32a.slaspec M Ghidra/Processors/Atmel/data/languages/avr32a_dsp_operations.sinc M Ghidra/Processors/Atmel/src/main/java/ghidra/app/util/bin/format/elf/relocation/AVR32_ElfRelocationHandler.java M Ghidra/Processors/Atmel/src/main/java/ghidra/app/util/bin/format/elf/relocation/AVR8_ElfRelocationHandler.java M Ghidra/Processors/MC6800/data/languages/6x09.sinc M Ghidra/Processors/MIPS/certification.manifest M Ghidra/Processors/MIPS/data/languages/mips.sinc M Ghidra/Processors/MIPS/data/languages/mips32Instructions.sinc M Ghidra/Processors/MIPS/data/languages/mips32R6be.slaspec M Ghidra/Processors/MIPS/data/languages/mips32R6le.slaspec M Ghidra/Processors/MIPS/data/languages/mips32_fp64.cspec M Ghidra/Processors/MIPS/data/languages/mips32be.cspec M Ghidra/Processors/MIPS/data/languages/mips32be.slaspec M Ghidra/Processors/MIPS/data/languages/mips32be_eabi.cspec M Ghidra/Processors/MIPS/data/languages/mips32le.cspec M Ghidra/Processors/MIPS/data/languages/mips32le.slaspec M Ghidra/Processors/MIPS/data/languages/mips32le_eabi.cspec M Ghidra/Processors/MIPS/data/languages/mips64.cspec M Ghidra/Processors/MIPS/data/languages/mips64_32_n32.cspec M Ghidra/Processors/MIPS/data/languages/mips64_32_o32.cspec M Ghidra/Processors/MIPS/data/languages/mips64_32_o64.cspec M Ghidra/Processors/MIPS/data/languages/mips64be.slaspec M Ghidra/Processors/MIPS/data/languages/mips64le.slaspec A Ghidra/Processors/MIPS/data/languages/mips_dsp.sinc A Ghidra/Processors/MIPS/data/languages/mips_mt.sinc M Ghidra/Processors/MIPS/src/main/java/ghidra/app/plugin/core/analysis/MipsAddressAnalyzer.java M Ghidra/Processors/MIPS/src/main/java/ghidra/app/util/bin/format/elf/extend/MIPS_ElfExtension.java A Ghidra/Processors/MIPS/src/main/java/ghidra/app/util/bin/format/elf/relocation/MIPS_ElfRelocationContext.java M Ghidra/Processors/MIPS/src/main/java/ghidra/app/util/bin/format/elf/relocation/MIPS_ElfRelocationHandler.java M Ghidra/Processors/PIC/src/main/java/ghidra/app/util/bin/format/elf/relocation/PIC30_ElfRelocationContext.java M Ghidra/Processors/PIC/src/main/java/ghidra/app/util/bin/format/elf/relocation/PIC30_ElfRelocationHandler.java M Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/extend/PowerPC_ElfExtension.java M Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/relocation/PowerPC64_ElfRelocationHandler.java M Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/relocation/PowerPC_ElfRelocationHandler.java M Ghidra/Processors/RISCV/data/languages/riscv32-fp.cspec M Ghidra/Processors/RISCV/data/languages/riscv32.cspec M Ghidra/Processors/RISCV/data/languages/riscv64-fp.cspec M Ghidra/Processors/RISCV/data/languages/riscv64.cspec M Ghidra/Processors/RISCV/src/main/java/ghidra/app/util/bin/format/elf/relocation/RISCV_ElfRelocationHandler.java M Ghidra/Processors/Sparc/data/languages/SparcV9.sinc M Ghidra/Processors/Sparc/src/main/java/ghidra/app/util/bin/format/elf/relocation/SPARC_ElfRelocationHandler.java M Ghidra/Processors/SuperH4/src/main/java/ghidra/app/util/bin/format/elf/relocation/SH_ElfRelocationHandler.java M Ghidra/Processors/Toy/certification.manifest M Ghidra/Processors/Toy/data/languages/toy.pspec M Ghidra/Processors/tricore/data/languages/tricore.cspec M Ghidra/Processors/tricore/data/languages/tricore.ldefs M Ghidra/Processors/tricore/data/languages/tricore.sinc M Ghidra/Processors/x86/data/languages/ia.sinc M Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/coff/relocation/X86_32_CoffRelocationHandler.java M Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/coff/relocation/X86_64_CoffRelocationHandler.java M Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/relocation/X86_32_ElfRelocationHandler.java A Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/relocation/X86_64_ElfRelocationContext.java M Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/relocation/X86_64_ElfRelocationHandler.java M Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/macho/relocation/X86_32_MachoRelocationHandler.java M Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/macho/relocation/X86_64_MachoRelocationHandler.java ```
4e30ce1
to
afd0cd1
Compare
Better automated refactoring for removal of 'using' declarations in header files. See https://github.com/ekilmer/remusing_cpp for automated tool. Some manual fixes are still required, but they are small. Setting 'using namespace std;' in source files is still a manual process due to edge-cases that are hard to detect.
Only affects 'sleigh_support' library
Use https://github.com/ekilmer/remusing_cpp to regenerate patches for fixing 'using namespace std' in headers.
afd0cd1
to
b38cd4e
Compare
Whoa, this is great. I'm just thinking about how we will go about regenerating these patches when we inevitably get conflicts. Correct me if I'm wrong but my understanding is:
|
Correct. When we do a rebase, it will report conflicts. In the working-tree state when resolving the conflict for the
Correct, if a new file is added (as evidenced by the PR message made by the bot), we'll need to interactively rebase ( 🤞 |
That'd be awesome. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
It has been a while since this bot's PRs have been merged. The reason for that was because generating patches that removed/fixed the
using
declaration pollution was time-consuming. Fortunately, I've been experimenting with writing a tool to automate most (because heuristics) of this process: https://github.com/ekilmer/remusing_cpp.After installation, the tool is run on Ghidra's C++ decompiler
cpp
source directory like the following:I've also split up the large patch into several smaller patches to help with isolating each step. Each patch/step is roughly described as follows (also explained a bit in each patch's commit message):
using namespace std;
to*.cc
files: This can be sort of automated by adding the statement after the last#include
, but this doesn't completely work due to conditional compilation macros, so this step is mostly manual, but it doesn't involve much thinking. Make sure to also update any parser generator files by only addingusing namespace std;
(another manual fix/patch follows for namespace fixing).using
declarations withremusing_cpp
: This patch should be regenerated fresh each time there is an update because merge conflicts will be annoying. However, this automated refactor doesn't fix everything, so the next steps are manual but small in changesremusing_cpp
doesn't parse the*.l
and*.y
files, so we need to manually fix things that are broken. This step can be tested (after all patches are applied) by runninggradle generateParsers
in the root of the Ghidra repo and trying to recompile the new source code.std
variable usage:remusing_cpp
doesn't know anything about the provenance of variable/function names used in expressions (except for special caseiostream
<<
and>>
operators). This PR only contains a small manual fix discovered after compilation failed. Hopefully, this won't become a more common scenario in the future.Changed files: