Skip to content
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

Merged
merged 5 commits into from
Mar 22, 2023
Merged

Conversation

auto-updater[bot]
Copy link
Contributor

@auto-updater auto-updater bot commented Mar 20, 2023

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:

parallel -j 8 remusing_cpp -i ::: **/*.hh

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):

  1. Add 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 adding using namespace std; (another manual fix/patch follows for namespace fixing).
  2. Automated refactor for using declarations with remusing_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 changes
  3. Fix namespace in parser generator file(s): remusing_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 running gradle generateParsers in the root of the Ghidra repo and trying to recompile the new source code.
  4. Fix std variable usage: remusing_cpp doesn't know anything about the provenance of variable/function names used in expressions (except for special case iostream << 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:

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

pgoodman and others added 2 commits March 20, 2023 00:18
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
```
@ekilmer ekilmer force-pushed the cron/update-ghidra-a6be09898 branch from 4e30ce1 to afd0cd1 Compare March 20, 2023 13:54
@ekilmer ekilmer requested a review from tetsuo-cpp March 20, 2023 14:14
ekilmer added 3 commits March 20, 2023 15:51
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.
@ekilmer ekilmer force-pushed the cron/update-ghidra-a6be09898 branch from afd0cd1 to b38cd4e Compare March 20, 2023 19:51
@tetsuo-cpp
Copy link
Contributor

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:

  • If the the automated patch just fails to apply (probably the regular case), we should regenerate it with RemUsing but leave the other patches alone.
  • If a new file is added, we should generate decompiler: Add 'using namespace std' to all '.cc' files and decompiler: Automated std namespace fix with remusing tool.

@ekilmer
Copy link
Contributor

ekilmer commented Mar 22, 2023

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:

  • If the the automated patch just fails to apply (probably the regular case), we should regenerate it with RemUsing but leave the other patches alone.

Correct. When we do a rebase, it will report conflicts. In the working-tree state when resolving the conflict for the remusing_cpp commit, we'll want to run (in the Ghidra/Features/Decompiler/src/decompile directory) git checkout HEAD -- **/*.hh to restore the headers, then run the remusing_cpp fix parallel -j 8 remusing_cpp -i ::: **/*.hh, add the files to git staging (git add -u), then git rebase --continue and accept the commit message. (I'll record this into the Wiki after actually doing this for the next update)

  • If a new file is added, we should generate decompiler: Add 'using namespace std' to all '.cc' files and decompiler: Automated std namespace fix with remusing tool.

Correct, if a new file is added (as evidenced by the PR message made by the bot), we'll need to interactively rebase (git rebase -i) and edit the decompiler: Add 'using namespace std' to all '.cc' files commit. The remusing_cpp commit will have conflicts (likely) and we should follow the steps in my previous paragraph.

🤞

@tetsuo-cpp
Copy link
Contributor

(I'll record this into the Wiki after actually doing this for the next update)

That'd be awesome. Thanks!

Copy link
Contributor

@tetsuo-cpp tetsuo-cpp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ekilmer ekilmer merged commit ddfe4bf into master Mar 22, 2023
@ekilmer ekilmer deleted the cron/update-ghidra-a6be09898 branch March 22, 2023 23:14
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants