Update Ghidra and regenerate patches (#167)

* Bump Ghidra HEAD commit a6be09898

* Bump to stable Ghidra 10.2.3

* Add new 'testfuncproto' source file for testing

* Regenerate patches

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.

* Add missing include path for libconfig.h

Only affects 'sleigh_support' library

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
```
This commit is contained in:
auto-updater[bot]
2023-03-22 19:14:38 -04:00
committed by GitHub
parent 186b4fe693
commit ddfe4bff8e
18 changed files with 4116 additions and 3869 deletions
@@ -1,7 +1,7 @@
From a43241edd759d507287ebd37f4a69ae3d6ef4a2f Mon Sep 17 00:00:00 2001
From 0ca6d7c5c7f927a37482962df4399031581cf8af Mon Sep 17 00:00:00 2001
From: Eric Kilmer <eric.d.kilmer@gmail.com>
Date: Thu, 28 Jul 2022 09:20:03 -0400
Subject: [PATCH 1/4] Add include guards to decompiler C++ headers
Subject: [PATCH 1/7] Add include guards to decompiler C++ headers
---
Ghidra/Features/Decompiler/src/decompile/cpp/bfd_arch.hh | 5 +++++
@@ -92,7 +92,7 @@ index 2245840a0..490abf901 100644
+#endif
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.hh
index e7ab19185..8fd9ba2fd 100644
index 91e12244b..2b18e10fc 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.hh
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.hh
@@ -16,6 +16,9 @@
@@ -105,7 +105,7 @@ index e7ab19185..8fd9ba2fd 100644
#include "sleighbase.hh"
#include "pcodecompile.hh"
#include "filemanage.hh"
@@ -446,3 +449,5 @@ class SleighCompile : public SleighBase {
@@ -450,3 +453,5 @@ class SleighCompile : public SleighBase {
extern SleighCompile *slgh; ///< A global reference to the SLEIGH compiler accessible to the parse functions
extern int yydebug; ///< Debug state for the SLEIGH parse functions
@@ -133,5 +133,5 @@ index d395fb8a3..6371148b0 100644
+
+#endif
--
2.39.0
2.40.0
@@ -1,7 +1,7 @@
From 0f35ed587ed7eabed6e87be0a09c9f2fddefdd7e Mon Sep 17 00:00:00 2001
From 1f00ab9f7c53b6611fc1cf16455bb6069c0c0b69 Mon Sep 17 00:00:00 2001
From: Alex Cameron <asc@tetsuo.sh>
Date: Mon, 7 Feb 2022 02:02:03 +1100
Subject: [PATCH 2/4] Fix UBSAN errors in decompiler
Subject: [PATCH 2/7] Fix UBSAN errors in decompiler
---
.../Decompiler/src/decompile/cpp/address.cc | 4 ++--
@@ -20,7 +20,7 @@ Subject: [PATCH 2/4] Fix UBSAN errors in decompiler
13 files changed, 59 insertions(+), 23 deletions(-)
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc
index b3758ddd1..0b3bf04c8 100644
index 26694b558..395fee432 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc
@@ -685,7 +685,7 @@ uintb sign_extend(uintb in,int4 sizein,int4 sizeout)
@@ -42,10 +42,10 @@ index b3758ddd1..0b3bf04c8 100644
mask <<= 1;
val &= (~mask);
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
index 19ed41c63..d1bd842d8 100644
index 0f8c95d60..95ab4b0ee 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
@@ -2656,8 +2656,12 @@ void ProtoModelMerged::decode(Decoder &decoder)
@@ -2659,8 +2659,12 @@ void ProtoModelMerged::decode(Decoder &decoder)
modellist.push_back(mymodel);
}
decoder.closeElement(elemId);
@@ -80,10 +80,10 @@ index 0a641091b..70acfad8f 100644
uint4 vnFlags = vn->getFlags() & (Varnode::directwrite|Varnode::addrforce);
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/op.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/op.cc
index 697e42372..6267ed750 100644
index 4c0749590..24551ed11 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/op.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/op.cc
@@ -667,7 +667,11 @@ uintb PcodeOp::getNZMaskLocal(bool cliploop) const
@@ -666,7 +666,11 @@ uintb PcodeOp::getNZMaskLocal(bool cliploop) const
break;
case CPUI_PIECE:
resmask = getIn(0)->getNZMask();
@@ -159,7 +159,7 @@ index 49128f7e6..133da8178 100644
return res;
}
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
index 652eefbe5..c84df0848 100644
index 9068f2a81..216f2f45f 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
@@ -974,7 +974,12 @@ int4 RulePullsubIndirect::applyOp(PcodeOp *op,Funcdata &data)
@@ -188,7 +188,7 @@ index 652eefbe5..c84df0848 100644
Varnode *vn1 = op->getIn(1);
if (!vn1->isConstant()) return 0;
Varnode *outvn = op->getOut();
@@ -8467,7 +8473,11 @@ int4 RuleSubvarSubpiece::applyOp(PcodeOp *op,Funcdata &data)
@@ -8469,7 +8475,11 @@ int4 RuleSubvarSubpiece::applyOp(PcodeOp *op,Funcdata &data)
Varnode *outvn = op->getOut();
int4 flowsize = outvn->getSize();
uintb mask = calc_mask( flowsize );
@@ -235,7 +235,7 @@ index 3b836244c..1fbd169c9 100644
type=op2.type; value=op2.value; value_real=op2.value_real; select=op2.select; }
ConstTpl(const_type tp,uintb val);
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
index fb9e94d34..7d09dd209 100644
index b92a3de3b..ac9a70c93 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
@@ -2157,8 +2157,8 @@ string SleighCompile::checkSymbols(SymbolScope *scope)
@@ -249,10 +249,10 @@ index fb9e94d34..7d09dd209 100644
msg << " Label <" << sym->getName() << "> was placed but not used" << endl;
else if (!sym->isPlaced())
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc
index dbb8f9e51..85bd54261 100644
index 8516dbf10..352a0ae99 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc
@@ -2565,7 +2565,7 @@ void ContextOp::restoreXml(const Element *el,SleighBase *trans)
@@ -2566,7 +2566,7 @@ void ContextOp::restoreXml(const Element *el,SleighBase *trans)
const List &list(el->getChildren());
List::const_iterator iter;
iter = list.begin();
@@ -262,7 +262,7 @@ index dbb8f9e51..85bd54261 100644
}
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
index 844bb2776..1296b82dd 100644
index 9fc48aa7d..8b75afb6d 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
@@ -3233,8 +3233,8 @@ void TypeFactory::recalcPointerSubmeta(Datatype *base,sub_metatype sub)
@@ -276,10 +276,10 @@ index 844bb2776..1296b82dd 100644
++iter;
if (ptr->submeta == sub) {
diff --git a/Ghidra/Features/Decompiler/src/decompile/unittests/testfloatemu.cc b/Ghidra/Features/Decompiler/src/decompile/unittests/testfloatemu.cc
index ab99382a3..67d92c573 100644
index f88b4d000..3b16ed13c 100644
--- a/Ghidra/Features/Decompiler/src/decompile/unittests/testfloatemu.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/unittests/testfloatemu.cc
@@ -338,7 +338,7 @@ TEST(float_opTrunc_to_int) {
@@ -343,7 +343,7 @@ TEST(float_opTrunc_to_int) {
for(float f:float_test_values) {
// avoid undefined behavior
@@ -289,5 +289,5 @@ index ab99382a3..67d92c573 100644
uintb true_result = ((uintb)(int32_t)f) & 0xffffffff;
uintb encoding = format.getEncoding(f);
--
2.39.0
2.40.0
@@ -1,7 +1,7 @@
From a208e9b0de5aba873248ceb583db842978868bd4 Mon Sep 17 00:00:00 2001
From ad4a5782300ff499c1633da6923669545b78a2cc Mon Sep 17 00:00:00 2001
From: Alex Cameron <asc@tetsuo.sh>
Date: Wed, 3 Aug 2022 20:01:18 +1000
Subject: [PATCH 3/4] Use `stroull` instead of `stroul` to parse address
Subject: [PATCH 3/7] Use `stroull` instead of `stroul` to parse address
offsets
---
@@ -9,7 +9,7 @@ Subject: [PATCH 3/4] Use `stroull` instead of `stroul` to parse address
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/space.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/space.cc
index 40a3e3bfe..ff6f282ca 100644
index b511f8919..4ae8f18a6 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/space.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/space.cc
@@ -16,6 +16,8 @@
@@ -21,7 +21,7 @@ index 40a3e3bfe..ff6f282ca 100644
AttributeId ATTRIB_BASE = AttributeId("base",89);
AttributeId ATTRIB_DEADCODEDELAY = AttributeId("deadcodedelay",90);
AttributeId ATTRIB_DELAY = AttributeId("delay", 91);
@@ -268,7 +270,10 @@ uintb AddrSpace::read(const string &s,int4 &size) const
@@ -288,7 +290,10 @@ uintb AddrSpace::read(const string &s,int4 &size) const
}
}
catch(LowlevelError &err) { // Name doesn't exist
@@ -34,5 +34,5 @@ index 40a3e3bfe..ff6f282ca 100644
enddata = (const char *) tmpdata;
if (enddata - s.c_str() == s.size()) { // If no size or offset override
--
2.39.0
2.40.0
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,51 @@
From 24a158c4514567a0cc253f0c0a4b7a9f5df7384d Mon Sep 17 00:00:00 2001
From: Eric Kilmer <eric.d.kilmer@gmail.com>
Date: Wed, 15 Mar 2023 23:04:28 -0400
Subject: [PATCH 6/7] (3/4) decompiler: Manually fix std namespace in generated
file
We must manually fix the symbols from std namespace because the
automated tool does not know how to parse yacc/bison files.
---
.../Decompiler/src/decompile/cpp/slghparse.y | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slghparse.y b/Ghidra/Features/Decompiler/src/decompile/cpp/slghparse.y
index 0e2172f79..039963cd5 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slghparse.y
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slghparse.y
@@ -32,24 +32,24 @@ using namespace std;
char ch;
uintb *i;
intb *big;
- string *str;
- vector<string> *strlist;
- vector<intb> *biglist;
- vector<ExprTree *> *param;
+ std::string *str;
+ std::vector<std::string> *strlist;
+ std::vector<intb> *biglist;
+ std::vector<ExprTree *> *param;
SpaceQuality *spacequal;
FieldQuality *fieldqual;
StarQuality *starqual;
VarnodeTpl *varnode;
ExprTree *tree;
- vector<OpTpl *> *stmt;
+ std::vector<OpTpl *> *stmt;
ConstructTpl *sem;
SectionVector *sectionstart;
Constructor *construct;
PatternEquation *pateq;
PatternExpression *patexp;
- vector<SleighSymbol *> *symlist;
- vector<ContextChange *> *contop;
+ std::vector<SleighSymbol *> *symlist;
+ std::vector<ContextChange *> *contop;
SleighSymbol *anysym;
SpaceSymbol *spacesym;
SectionSymbol *sectionsym;
--
2.40.0
@@ -0,0 +1,29 @@
From ed427a72a0d2f70565752902f274a748835afa1a Mon Sep 17 00:00:00 2001
From: Eric Kilmer <eric.d.kilmer@gmail.com>
Date: Wed, 15 Mar 2023 23:10:22 -0400
Subject: [PATCH 7/7] (4/4) decompiler: Manually fix missed std variable usage
Unfortunately, the heuristics in remusing are unable to automatically
fix this case of variables from the C++ standard library.
This was fixed by resolving the error(s) produced by the compiler.
---
Ghidra/Features/Decompiler/src/decompile/cpp/ghidra_process.hh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/ghidra_process.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/ghidra_process.hh
index 64fd45e35..428319a65 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/ghidra_process.hh
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/ghidra_process.hh
@@ -79,7 +79,7 @@ class GhidraCommand {
virtual void loadParameters(void); ///< Read parameters directing command execution
virtual void sendResult(void); ///< Send results of the command (if any) back to the Ghidra client
public:
- GhidraCommand(void) : sin(cin),sout(cout) {
+ GhidraCommand(void) : sin(std::cin),sout(std::cout) {
ghidra = (ArchitectureGhidra *)0;
} ///< Construct given i/o streams
virtual ~GhidraCommand(void) {} ///< Destructor
--
2.40.0
@@ -1,7 +1,7 @@
From 1f0f87b4f14bbe60250ca1c7a23300fc5e1766f0 Mon Sep 17 00:00:00 2001
From 2ade75baba3f2945d5b53e5c1eedb53ebe10f61b Mon Sep 17 00:00:00 2001
From: Eric Kilmer <eric.d.kilmer@gmail.com>
Date: Sun, 13 Feb 2022 12:59:42 -0500
Subject: [PATCH 1/5] Small improvements to C++ decompiler testing from CLI
Subject: [PATCH 1/8] Small improvements to C++ decompiler testing from CLI
* Fixes argument parsing to accept more than one option for specifying
paths.
@@ -161,5 +161,5 @@ index 52125b401..46abd6bce 100644
#endif
--
2.39.0
2.40.0
@@ -1,7 +1,7 @@
From b3aaad14dea43fd05d1049c7b7ba7ba723e7b2f8 Mon Sep 17 00:00:00 2001
From 9f82d92228afeaac6e8482a1e842fea9d195e750 Mon Sep 17 00:00:00 2001
From: Eric Kilmer <eric.d.kilmer@gmail.com>
Date: Thu, 28 Jul 2022 09:20:03 -0400
Subject: [PATCH 2/5] Add include guards to decompiler C++ headers
Subject: [PATCH 2/8] Add include guards to decompiler C++ headers
---
Ghidra/Features/Decompiler/src/decompile/cpp/bfd_arch.hh | 5 +++++
@@ -133,5 +133,5 @@ index d395fb8a3..6371148b0 100644
+
+#endif
--
2.39.0
2.40.0
@@ -1,7 +1,7 @@
From e2eb3c6789bb5e84720174f9c3652165174c5c3a Mon Sep 17 00:00:00 2001
From 4fa4b34e64c277f699a0c4d9cda1a2de739b9130 Mon Sep 17 00:00:00 2001
From: Alex Cameron <asc@tetsuo.sh>
Date: Mon, 7 Feb 2022 02:02:03 +1100
Subject: [PATCH 3/5] Fix UBSAN errors in decompiler
Subject: [PATCH 3/8] Fix UBSAN errors in decompiler
---
.../Decompiler/src/decompile/cpp/address.cc | 4 ++--
@@ -42,10 +42,10 @@ index b3758ddd1..0b3bf04c8 100644
mask <<= 1;
val &= (~mask);
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
index 19ed41c63..d1bd842d8 100644
index c52d92c80..937b57157 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
@@ -2656,8 +2656,12 @@ void ProtoModelMerged::decode(Decoder &decoder)
@@ -2649,8 +2649,12 @@ void ProtoModelMerged::decode(Decoder &decoder)
modellist.push_back(mymodel);
}
decoder.closeElement(elemId);
@@ -61,7 +61,7 @@ index 19ed41c63..d1bd842d8 100644
void ParameterBasic::setTypeLock(bool val)
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc
index 0c4275f15..bdbda0ae6 100644
index 63784131d..ff8bb6a23 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc
@@ -501,7 +501,13 @@ void Funcdata::setHighLevel(void)
@@ -262,7 +262,7 @@ index dbb8f9e51..85bd54261 100644
}
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
index 316074389..91bf4bc77 100644
index 8d5dc17ed..f50e07f84 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
@@ -3233,8 +3233,8 @@ void TypeFactory::recalcPointerSubmeta(Datatype *base,sub_metatype sub)
@@ -289,5 +289,5 @@ index ab99382a3..67d92c573 100644
uintb true_result = ((uintb)(int32_t)f) & 0xffffffff;
uintb encoding = format.getEncoding(f);
--
2.39.0
2.40.0
@@ -1,7 +1,7 @@
From e4f947f20ef0d35e8f5e85da5f2ef97d1bf8df3b Mon Sep 17 00:00:00 2001
From a5f1be9df17f10db97dbd12243b001591d8b64d9 Mon Sep 17 00:00:00 2001
From: Alex Cameron <asc@tetsuo.sh>
Date: Wed, 3 Aug 2022 20:01:18 +1000
Subject: [PATCH 4/5] Use `stroull` instead of `stroul` to parse address
Subject: [PATCH 4/8] Use `stroull` instead of `stroul` to parse address
offsets
---
@@ -34,5 +34,5 @@ index 40a3e3bfe..ff6f282ca 100644
enddata = (const char *) tmpdata;
if (enddata - s.c_str() == s.size()) { // If no size or offset override
--
2.39.0
2.40.0
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,51 @@
From 893e32017fb08c773bfedafe790667db3a39cf62 Mon Sep 17 00:00:00 2001
From: Eric Kilmer <eric.d.kilmer@gmail.com>
Date: Sun, 19 Mar 2023 15:46:26 -0400
Subject: [PATCH 7/8] (3/4) decompiler: Manually fix std namespace in generated
file
We must manually fix the symbols from std namespace because the
automated tool does not know how to parse yacc/bison files.
---
.../Decompiler/src/decompile/cpp/slghparse.y | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slghparse.y b/Ghidra/Features/Decompiler/src/decompile/cpp/slghparse.y
index 0e2172f79..039963cd5 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slghparse.y
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slghparse.y
@@ -32,24 +32,24 @@ using namespace std;
char ch;
uintb *i;
intb *big;
- string *str;
- vector<string> *strlist;
- vector<intb> *biglist;
- vector<ExprTree *> *param;
+ std::string *str;
+ std::vector<std::string> *strlist;
+ std::vector<intb> *biglist;
+ std::vector<ExprTree *> *param;
SpaceQuality *spacequal;
FieldQuality *fieldqual;
StarQuality *starqual;
VarnodeTpl *varnode;
ExprTree *tree;
- vector<OpTpl *> *stmt;
+ std::vector<OpTpl *> *stmt;
ConstructTpl *sem;
SectionVector *sectionstart;
Constructor *construct;
PatternEquation *pateq;
PatternExpression *patexp;
- vector<SleighSymbol *> *symlist;
- vector<ContextChange *> *contop;
+ std::vector<SleighSymbol *> *symlist;
+ std::vector<ContextChange *> *contop;
SleighSymbol *anysym;
SpaceSymbol *spacesym;
SectionSymbol *sectionsym;
--
2.40.0
@@ -0,0 +1,29 @@
From 92dd6f2579323dba0b5438c245f342507d27ec01 Mon Sep 17 00:00:00 2001
From: Eric Kilmer <eric.d.kilmer@gmail.com>
Date: Sun, 19 Mar 2023 15:47:28 -0400
Subject: [PATCH 8/8] (4/4) decompiler: Manually fix missed std variable usage
Unfortunately, the heuristics in remusing are unable to automatically
fix this case of variables from the C++ standard library.
This was fixed by resolving the error(s) produced by the compiler.
---
Ghidra/Features/Decompiler/src/decompile/cpp/ghidra_process.hh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/ghidra_process.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/ghidra_process.hh
index 64fd45e35..428319a65 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/ghidra_process.hh
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/ghidra_process.hh
@@ -79,7 +79,7 @@ class GhidraCommand {
virtual void loadParameters(void); ///< Read parameters directing command execution
virtual void sendResult(void); ///< Send results of the command (if any) back to the Ghidra client
public:
- GhidraCommand(void) : sin(cin),sout(cout) {
+ GhidraCommand(void) : sin(std::cin),sout(std::cout) {
ghidra = (ArchitectureGhidra *)0;
} ///< Construct given i/o streams
virtual ~GhidraCommand(void) {} ///< Destructor
--
2.40.0
+10 -4
View File
@@ -22,7 +22,7 @@ set_property(CACHE sleigh_RELEASE_TYPE PROPERTY STRINGS "stable" "HEAD")
find_package(Git REQUIRED)
# Ghidra pinned stable version commit
set(ghidra_version "10.2.2")
set(ghidra_version "10.2.3")
set(ghidra_git_tag "Ghidra_${ghidra_version}_build")
set(ghidra_shallow TRUE)
@@ -42,7 +42,10 @@ set(ghidra_patches
"${CMAKE_CURRENT_LIST_DIR}/patches/stable/0002-Add-include-guards-to-decompiler-C-headers.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/stable/0003-Fix-UBSAN-errors-in-decompiler.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/stable/0004-Use-stroull-instead-of-stroul-to-parse-address-offse.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/stable/0005-Remove-using-namespace-std-from-headers.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/stable/0005-1-4-decompiler-Add-using-namespace-std-to-all-.cc.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/stable/0006-2-4-decompiler-Remusing-automated-std-namespace-fix.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/stable/0007-3-4-decompiler-Manually-fix-std-namespace-in-generat.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/stable/0008-4-4-decompiler-Manually-fix-missed-std-variable-usag.patch"
)
# Ghidra pinned commits used for pinning last known working HEAD commit
@@ -51,7 +54,7 @@ if("${sleigh_RELEASE_TYPE}" STREQUAL "HEAD")
# TODO: CMake only likes numeric characters in the version string....
set(ghidra_head_version "10.3")
set(ghidra_version "${ghidra_head_version}")
set(ghidra_head_git_tag "d55b7e9aa9e667359b097b6f07a077942cd259e8")
set(ghidra_head_git_tag "a6be09898f46e4c6bd2c48c3df7b89a1737e9af3")
set(ghidra_git_tag "${ghidra_head_git_tag}")
set(ghidra_shallow FALSE)
set(ghidra_patches
@@ -61,7 +64,10 @@ if("${sleigh_RELEASE_TYPE}" STREQUAL "HEAD")
"${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0001-Add-include-guards-to-decompiler-C-headers.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0002-Fix-UBSAN-errors-in-decompiler.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0003-Use-stroull-instead-of-stroul-to-parse-address-offse.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0004-Remove-using-namespace-std-from-headers.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0004-1-4-decompiler-Add-using-namespace-std-to-all-.cc-fi.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0005-2-4-decompiler-Automated-std-namespace-fix-with-remu.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0006-3-4-decompiler-Manually-fix-std-namespace-in-generat.patch"
"${CMAKE_CURRENT_LIST_DIR}/patches/HEAD/0007-4-4-decompiler-Manually-fix-missed-std-variable-usag.patch"
)
string(SUBSTRING "${ghidra_git_tag}" 0 7 ghidra_short_commit)
else()
+2
View File
@@ -59,6 +59,8 @@ target_include_directories(sleigh_support
SYSTEM
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
# For libconfig.h
"$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>"
)
if(NOT CMAKE_SKIP_INSTALL_RULES)
+5 -4
View File
@@ -24,10 +24,11 @@ add_executable(sleigh_ghidra_test
"${library_root}/../unittests/testmarshal.cc"
)
#if(sleigh_RELEASE_IS_HEAD)
# target_sources(sleigh_ghidra_test PRIVATE
# )
#endif()
if(sleigh_RELEASE_IS_HEAD)
target_sources(sleigh_ghidra_test PRIVATE
"${library_root}/../unittests/testfuncproto.cc"
)
endif()
target_compile_features(sleigh_ghidra_test PRIVATE cxx_std_11)
target_include_directories(sleigh_ghidra_test PRIVATE "${library_root}")