Update ghidra-native to the resynced decompiler sources

This commit is contained in:
phix33 authored and pancake committed 2026-08-23 13:27:35 +02:00
1 parent 971478749d
commit 20d6ae1924
25 files changed
+270 -237

No files matched your search

+1 -1
View File
@@ -35,7 +35,7 @@ TI_MSP430
Toy
V850
Z80
hexagon
Hexagon
tricore
x86
Xtensa
+1 -1
View File
@@ -14,7 +14,7 @@ MC6800
MIPS
MCS96
PowerPC
hexagon
Hexagon
tricore
SuperH
TI_MSP430
+3
View File
@@ -31,10 +31,13 @@ G_DECOMPILER+=merge.cc double.cc coreaction.cc condexe.cc override.cc
G_DECOMPILER+=dynamic.cc crc32.cc prettyprint.cc printlanguage.cc
G_DECOMPILER+=printc.cc printjava.cc memstate.cc opbehavior.cc
G_DECOMPILER+=paramid.cc transform.cc string_ghidra.cc constseq.cc
G_DECOMPILER+=signature.cc bitfield.cc
G_DECOMPILER+=ghidra_arch.cc inject_ghidra.cc ghidra_translate.cc
G_DECOMPILER+=loadimage_ghidra.cc typegrp_ghidra.cc database_ghidra.cc
G_DECOMPILER+=ghidra_context.cc cpool_ghidra.cc comment_ghidra.cc
# signature_ghidra.cc needs GhidraCommand from ghidra_process.cc, whose main() clashes with sleighc
# G_DECOMPILER+=signature_ghidra.cc
# G_DECOMPILER+=ghidra_process.cc
G_DECOMPILER+= $(GHIDRA_LIBDECOMP_SRCS)
+1 -1
View File
@@ -143,7 +143,7 @@ static const std::map<std::string, ArchMapper> arch_map = {
{ "dalvik", { S("Dalvik"), CUSTOM_FLAVOR((RCore *core) {
return DalvikFlavorFromCore (core);
}), B(32), E(false), 2, 10 }},
{ "hexagon", { S("hexagon"), S("default"), B(32), E(false) } },
{ "hexagon", { S("Hexagon"), S("default"), B(32), E(false) } },
{ "wasm", { S("wasm"), S("default"), B(32) } },
{ "6502", { S("6502"), S("default"), B(16) } },
{ "65c02", { S("65c02"), S("default"), B(16) } },
+3 -3
View File
@@ -192,7 +192,7 @@ void PcodeFixupPreprocessor::fixupSharedReturnJumpToRelocs(RAnalFunction *r2Func
if (op->type == R_ANAL_OP_TYPE_JMP) {
Address callAddr (space, refi->at);
R_LOG_INFO ("OverridingCallReturn %s", impname? normalize_callee (impname).c_str (): "(local fcn)");
ghFunc->getOverride().insertFlowOverride(callAddr, Override::CALL_RETURN);
ghFunc->getOverride().insertFlowOverride(callAddr, Override::CallReturn::NAME);
}
r_anal_op_free (op);
}
@@ -237,7 +237,7 @@ void PcodeFixupPreprocessor::fixupNoreturnCallsBeforeData(RAnalFunction *r2Func,
const ut64 next = addr + size;
if ((type == R_ANAL_OP_TYPE_CALL || type == R_ANAL_OP_TYPE_UCALL)
&& next <= fcnMax && has_data_xref_at (core, next)) {
ghFunc->getOverride ().insertFlowOverride (Address (space, addr), Override::CALL_RETURN);
ghFunc->getOverride ().insertFlowOverride (Address (space, addr), Override::CallReturn::NAME);
}
addr = next;
}
@@ -271,7 +271,7 @@ void PcodeFixupPreprocessor::fixupResolvedIndirectCalls(RAnalFunction *r2Func, F
}
auto target = regs.find (tolower (op_first_reg (op, false)));
if (target != regs.end ()) {
ghFunc->getOverride ().insertIndirectOverride (
ghFunc->getOverride ().insertDeindirect (
Address (space, op->addr),
Address (space, target->second));
}
+1 -2
View File
@@ -76,8 +76,7 @@ void R2PrintC::pushUnnamedLocation(const Address &addr, const Varnode *vn, const
if (space->getType() == IPTR_PROCESSOR) {
pushOp (&dereference, op);
auto type = glb->types->getTypePointer (space->getAddrSize (), vn->getType (), space->getWordSize ());
// pushConstant (addr.getOffset (), type, vn, op);
pushConstant(addr.getOffset(),type,vartoken,vn, op);
pushConstant (addr.getOffset (), type, vartoken, vn, op, type->getDisplayFormat ());
} else {
PrintC::pushUnnamedLocation (addr,vn, op);
}
+13 -4
View File
@@ -776,6 +776,11 @@ Symbol *R2Scope::registerFlag(RFlagItem *flag) const {
const char *name = (core->flags->realnames && flag->realname) ? flag->realname : flag->name;
const ut64 at = flag->addr;
// a mapping whose end wraps below its start would throw out of addSymbol and abort the decompilation
if (type->getSize () > 0 && at + type->getSize () - 1 < at) {
arch->addWarning ("Flag " + to_string (name) + " extends beyond the end of the address space");
return nullptr;
}
SymbolEntry *entry = cache->addSymbol (name, type, Address (arch->getDefaultCodeSpace(), at), Address());
if (entry == nullptr) {
return nullptr;
@@ -833,6 +838,10 @@ Symbol *R2Scope::registerGlobalVar(RFlagItem *glob, const char *type_str) const
const char *name = (core->flags->realnames && glob->realname)
? glob->realname : glob->name;
if (type->getSize () > 0 && addr + type->getSize () - 1 < addr) {
arch->addWarning ("Global " + to_string (name) + " extends beyond the end of the address space");
return nullptr;
}
SymbolEntry *entry = cache->addSymbol (name, type,
Address (arch->getDefaultCodeSpace (), addr), Address ());
if (!entry) {
@@ -933,8 +942,8 @@ LabSymbol *R2Scope::queryR2FunctionLabel(const Address &addr) const {
return nullptr;
}
SymbolEntry *R2Scope::findAddr(const Address &addr, const Address &usepoint) const {
SymbolEntry *entry = cache->findAddr(addr,usepoint);
MapEntry *R2Scope::findAddr(const Address &addr, const Address &usepoint) const {
MapEntry *entry = cache->findAddr(addr,usepoint);
if (entry) {
return entry->getAddr() == addr ? entry : nullptr;
}
@@ -948,8 +957,8 @@ SymbolEntry *R2Scope::findAddr(const Address &addr, const Address &usepoint) con
return (entry && entry->getAddr() == addr) ? entry : nullptr;
}
SymbolEntry *R2Scope::findContainer(const Address &addr, int4 size, const Address &usepoint) const {
SymbolEntry *entry = cache->findClosestFit (addr, size, usepoint);
MapEntry *R2Scope::findContainer(const Address &addr, int4 size, const Address &usepoint) const {
MapEntry *entry = cache->findClosestFit (addr, size, usepoint);
if (!entry) {
Symbol *sym = queryR2 (addr, true);
entry = sym ? sym->getMapEntry (addr) : nullptr;
+11 -11
View File
@@ -40,8 +40,8 @@ protected:
// TODO? void addRange(AddrSpace *spc,uintb first,uintb last) override;
void removeRange(AddrSpace *spc,uintb first,uintb last) override { throw LowlevelError("remove_range should not be performed on radare2 scope"); }
void addSymbolInternal(Symbol *sym) override { throw LowlevelError("addSymbolInternal unimplemented"); }
SymbolEntry *addMapInternal(Symbol *sym, uint4 exfl, const Address &addr, int4 off, int4 sz, const RangeList &uselim) override { throw LowlevelError("addMapInternal unimplemented"); }
SymbolEntry *addDynamicMapInternal(Symbol *sym, uint4 exfl, uint8 hash, int4 off, int4 sz, const RangeList &uselim) override { throw LowlevelError("addMap unimplemented"); }
void addMapInternal(Symbol *sym, MapEntry *entry) override { throw LowlevelError("addMapInternal unimplemented"); }
void addDynamicMapInternal(Symbol *sym, DynamicEntry *entry) override { throw LowlevelError("addMap unimplemented"); }
public:
explicit R2Scope(R2Architecture *arch);
@@ -49,7 +49,7 @@ public:
Scope *buildSubScope(uint8 id, const string &nm) override;
void clear(void) override { cache->clear(); }
SymbolEntry *addSymbol(const string &name, Datatype *ct, const Address &addr, const Address &usepoint) override { return cache->addSymbol(name, ct, addr, usepoint); }
MapEntry *addSymbol(const string &name, Datatype *ct, const Address &addr, const Address &usepoint) override { return cache->addSymbol(name, ct, addr, usepoint); }
string buildVariableName(const Address &addr, const Address &pc, Datatype *ct,int4 &index,uint4 flags) const override { return cache->buildVariableName(addr,pc,ct,index,flags); }
string buildUndefinedName(void) const override { return cache->buildUndefinedName(); }
void setAttribute(Symbol *sym,uint4 attr) override { cache->setAttribute(sym,attr); }
@@ -57,25 +57,25 @@ public:
void setDisplayFormat(Symbol *sym,uint4 attr) override { cache->setDisplayFormat(sym,attr); }
void adjustCaches(void) override { cache->adjustCaches(); }
SymbolEntry *findAddr(const Address &addr,const Address &usepoint) const override;
SymbolEntry *findContainer(const Address &addr,int4 size, const Address &usepoint) const override;
SymbolEntry *findClosestFit(const Address &addr,int4 size, const Address &usepoint) const override { throw LowlevelError("findClosestFit unimplemented"); }
MapEntry *findAddr(const Address &addr,const Address &usepoint) const override;
MapEntry *findContainer(const Address &addr,int4 size, const Address &usepoint) const override;
MapEntry *findClosestFit(const Address &addr,int4 size, const Address &usepoint) const override { throw LowlevelError("findClosestFit unimplemented"); }
Funcdata *findFunction(const Address &addr) const override;
ExternRefSymbol *findExternalRef(const Address &addr) const override;
LabSymbol *findCodeLabel(const Address &addr) const override;
bool isNameUsed(const string &name, const Scope *op2) const override { throw LowlevelError("isNameUsed unimplemented"); }
Funcdata *resolveExternalRefFunction(ExternRefSymbol *sym) const override;
SymbolEntry *findOverlap(const Address &addr,int4 size) const override { throw LowlevelError("findOverlap unimplemented"); }
MapEntry *findOverlap(const Address &addr,int4 size) const override { throw LowlevelError("findOverlap unimplemented"); }
SymbolEntry *findBefore(const Address &addr) const { throw LowlevelError("findBefore unimplemented"); }
SymbolEntry *findAfter(const Address &addr) const { throw LowlevelError("findAfter unimplemented"); }
void findByName(const string &name,vector<Symbol *> &res) const override { throw LowlevelError("findByName unimplemented"); }
MapIterator begin() const override { throw LowlevelError("begin unimplemented"); }
MapIterator end() const override { throw LowlevelError("end unimplemented"); }
list<SymbolEntry>::const_iterator beginDynamic() const override { throw LowlevelError("beginDynamic unimplemented"); }
list<SymbolEntry>::const_iterator endDynamic() const override { throw LowlevelError("endDynamic unimplemented"); }
list<SymbolEntry>::iterator beginDynamic() override { throw LowlevelError("beginDynamic unimplemented"); }
list<SymbolEntry>::iterator endDynamic() override { throw LowlevelError("endDynamic unimplemented"); }
list<DynamicEntry *>::const_iterator beginDynamic() const override { throw LowlevelError("beginDynamic unimplemented"); }
list<DynamicEntry *>::const_iterator endDynamic() const override { throw LowlevelError("endDynamic unimplemented"); }
list<DynamicEntry *>::iterator beginDynamic() override { throw LowlevelError("beginDynamic unimplemented"); }
list<DynamicEntry *>::iterator endDynamic() override { throw LowlevelError("endDynamic unimplemented"); }
void clearCategory(int4 cat) override { throw LowlevelError("clearCategory unimplemented"); }
void clearUnlockedCategory(int4 cat) override { throw LowlevelError("clearUnlockedCategory unimplemented"); }
void clearUnlocked() override { throw LowlevelError("clearUnlocked unimplemented"); }
+1 -1
View File
@@ -498,7 +498,7 @@ Datatype *R2TypeFactory::queryR2Struct(const string &n, std::set<std::string> &s
structSize += (maxAlign - rem);
}
}
setFields (fields, r, structSize, maxAlign, 0);
setFields (fields, {}, r, structSize, maxAlign, 0);
return r;
} catch (std::invalid_argument &e) {
arch->addWarning ("Failed to load struct " + n + " from sdb.");
+1 -1
View File
@@ -80,7 +80,7 @@ SleighParserContext *R2Sleigh::getParserContext(Address &addr, SleighInstruction
SleighParserContext *R2Sleigh::newSleighParserContext(Address &addr, SleighInstructionPrototype *proto)
{
SleighParserContext *pos = new SleighParserContext(getContextCache(), this);
pos->initialize(1, 0, getConstantSpace());
pos->initialize(getConstantSpace(), 1);
pos->setAddr(addr);
pos->setPrototype(proto);
// resolve(*pos); // Resolve ALL the constructors involved in the instruction at this address
+24 -12
View File
@@ -122,9 +122,13 @@ static uint4 hashConstructState(ConstructState *cs, uint4 hashCode) {
hashCode = crc_update(hashCode, id >> 8);
hashCode = crc_update(hashCode, id);
for (ConstructState *p: cs->resolve) {
if (p != nullptr) {
hashCode = hashConstructState(p, hashCode);
if (cs->resolve != nullptr) {
int4 numOperands = cs->ct->getNumOperands();
for (int4 i = 0; i < numOperands; i++) {
ConstructState *p = cs->resolve[i];
if (p != nullptr) {
hashCode = hashConstructState(p, hashCode);
}
}
}
@@ -298,7 +302,7 @@ public:
void clearCache();
LRUCache<uintm, SleighInstruction *> *getInsCache() { return &ins_cache; }
ParserContext *getContext(const Address &addr,int4 state) const
ParserContext *getContext(const Address &addr,ParserContext::parse_state state) const
{
return obtainContext(addr, state);
}
@@ -415,13 +419,12 @@ public:
}
void clearRootState(ConstructState *curr) {
// Classic DFS
if (curr) {
for (auto iter = curr->resolve.begin(); iter != curr->resolve.end(); iter++) {
if (*iter) {
clearRootState(*iter);
}
delete *iter;
// Classic DFS; the nodes own their child arrays, so only the child nodes are deleted here
if (curr && curr->resolve && curr->ct) {
int4 numOperands = curr->ct->getNumOperands();
for (int4 i = 0; i < numOperands; i++) {
clearRootState(curr->resolve[i]);
delete curr->resolve[i];
}
}
}
@@ -438,6 +441,12 @@ public:
}
void allocateOperand(int4 i) {
if (i >= ParserContext::MAX_OPERAND) {
throw LowlevelError("SLEIGH parser out of state space");
}
if (depth > ParserContext::MAX_DEPTH - 2) {
throw LowlevelError("SLEIGH exceeded maximum parse depth");
}
ConstructState *opstate = new ConstructState;
opstate->ct = nullptr;
opstate->parent = point;
@@ -445,7 +454,10 @@ public:
opstate->hand.space = opstate->hand.offset_space = opstate->hand.temp_space = nullptr;
opstate->hand.size = opstate->hand.offset_offset = opstate->hand.offset_size = opstate->hand.temp_offset = 0;
point->resolve.emplace_back(opstate);
if (point->resolve == nullptr) {
point->resolve = new ConstructState *[ParserContext::MAX_OPERAND]();
}
point->resolve[i] = opstate;
breadcrumb[depth++] += 1;
point = opstate;
breadcrumb[depth] = 0;
+1 -2
View File
@@ -808,8 +808,7 @@ static void sleigh_esil(RAnal *a, RAnalOp *anal_op, ut64 addr, const ut8 *data,
case CPUI_CALLOTHER:
case CPUI_NEW:
case CPUI_SEGMENTOP:
case CPUI_INSERT:
case CPUI_EXTRACT: /* Above don't have explicit definition */
case CPUI_INSERT: /* Above don't have explicit definition */
case CPUI_MULTIEQUAL:
case CPUI_INDIRECT:
case CPUI_CAST:
+1 -1
View File
@@ -290,7 +290,7 @@ static void Decompile(RCore *core, ut64 addr, DecompileMode mode, std::stringstr
//func->encode (out_stream);
//PrettyXmlEncode enc(out_stream);
XmlEncode enc(out_stream);
func->encode(enc, 0, true);
func->encode(enc, 0, true, true);
}
out_stream << "</function><code>";
}
+1 -1
View File
@@ -107,7 +107,7 @@ void HarvestFuncdata(R2Architecture &arch, Funcdata *func, Harvest &out) {
return;
}
for (MapIterator it = scope->begin (); it != scope->end (); ++it) {
const SymbolEntry *entry = *it;
const MapEntry *entry = *it;
if (!entry || entry->isPiece ()) {
continue;
}
+5 -5
View File
@@ -1,23 +1,23 @@
# This file is autogenerated by acr-wrap
WRAP_wrap_git_url:=https://github.com/radareorg/ghidra-native
WRAP_wrap_git_revision:=0.6.4
WRAP_wrap_git_revision:=483ae94bcbc661a77667e52f1eff75928cb6aa2e
WRAP_wrap_git_directory:=ghidra-native
WRAP_wrap_git_patch_directory:=ghidra-native
WRAP_wrap_git_diff_files:=ghidra-native/patches/0001-space-after-comma.patch,ghidra-native/patches/0002-make-sleigharch-public.patch,ghidra-native/patches/0004-public-fields.patch,ghidra-native/patches/0006-readonly-warning.patch,ghidra-native/patches/0010-null-subflow.patch,ghidra-native/patches/0020-Fix-double-free-crash-when-deinitializing-multiple-X.patch,ghidra-native/patches/0023-Undef-LoadImage-for-windows.patch,ghidra-native/patches/0024-ignore-symbol-beyond-space.patch,ghidra-native/patches/0044-bad-unicode-codepoint.patch,ghidra-native/patches/0055-datatype-clone.patch,ghidra-native/patches/0056-nullderef-workaround.patch,ghidra-native/patches/0080-getparent-flow.patch,ghidra-native/patches/0090-nocasts-warnings.patch,ghidra-native/patches/0091-decompiler-xml-packer.patch,ghidra-native/patches/0092-badvar-segfault.patch,ghidra-native/patches/0093-no-virtual-destructor.patch,ghidra-native/patches/0100-CHAR-windows.patch,ghidra-native/patches/ghidra-native.patch
WRAP_wrap_git_diff_files:=ghidra-native/patches/0001-space-after-comma.patch,ghidra-native/patches/0002-make-sleigharch-public.patch,ghidra-native/patches/0004-public-fields.patch,ghidra-native/patches/0006-readonly-warning.patch,ghidra-native/patches/0010-null-subflow.patch,ghidra-native/patches/0020-Fix-double-free-crash-when-deinitializing-multiple-X.patch,ghidra-native/patches/0023-Undef-LoadImage-for-windows.patch,ghidra-native/patches/0044-bad-unicode-codepoint.patch,ghidra-native/patches/0055-datatype-clone.patch,ghidra-native/patches/0056-nullderef-workaround.patch,ghidra-native/patches/0080-getparent-flow.patch,ghidra-native/patches/0090-nocasts-warnings.patch,ghidra-native/patches/0091-decompiler-xml-packer.patch,ghidra-native/patches/0092-badvar-segfault.patch,ghidra-native/patches/0093-no-virtual-destructor.patch,ghidra-native/patches/0094-parse-64bit-integers.patch,ghidra-native/patches/0100-CHAR-windows.patch,ghidra-native/patches/ghidra-native.patch
WRAP_wrap_git_depth:=1
.PHONY: ghidra-native_clean ghidra-native_all
ghidra-native:
if [ ! -d "ghidra-native" -o "0.6.4" != "$(shell cd ghidra-native 2>/dev/null && git rev-parse HEAD)" ]; then rm -rf "ghidra-native"; ${MAKE} ghidra-native_all; fi
if [ ! -d "ghidra-native" -o "483ae94bcbc661a77667e52f1eff75928cb6aa2e" != "$(shell cd ghidra-native 2>/dev/null && git rev-parse HEAD)" ]; then rm -rf "ghidra-native"; ${MAKE} ghidra-native_all; fi
ghidra-native_all:
git clone --no-checkout --depth=1 https://github.com/radareorg/ghidra-native ghidra-native
cd ghidra-native && git fetch --depth=1 origin 0.6.4
cd ghidra-native && git fetch --depth=1 origin 483ae94bcbc661a77667e52f1eff75928cb6aa2e
cd ghidra-native && git checkout FETCH_HEAD
cp -rf packagefiles/ghidra-native/* ghidra-native
for a in ghidra-native/patches/0001-space-after-comma.patch ghidra-native/patches/0002-make-sleigharch-public.patch ghidra-native/patches/0004-public-fields.patch ghidra-native/patches/0006-readonly-warning.patch ghidra-native/patches/0010-null-subflow.patch ghidra-native/patches/0020-Fix-double-free-crash-when-deinitializing-multiple-X.patch ghidra-native/patches/0023-Undef-LoadImage-for-windows.patch ghidra-native/patches/0024-ignore-symbol-beyond-space.patch ghidra-native/patches/0044-bad-unicode-codepoint.patch ghidra-native/patches/0055-datatype-clone.patch ghidra-native/patches/0056-nullderef-workaround.patch ghidra-native/patches/0080-getparent-flow.patch ghidra-native/patches/0090-nocasts-warnings.patch ghidra-native/patches/0091-decompiler-xml-packer.patch ghidra-native/patches/0092-badvar-segfault.patch ghidra-native/patches/0093-no-virtual-destructor.patch ghidra-native/patches/0100-CHAR-windows.patch ghidra-native/patches/ghidra-native.patch ; do echo "patch -d ghidra-native -p1 < $$a" ; patch -d ghidra-native -p1 < $$a ; done
for a in ghidra-native/patches/0001-space-after-comma.patch ghidra-native/patches/0002-make-sleigharch-public.patch ghidra-native/patches/0004-public-fields.patch ghidra-native/patches/0006-readonly-warning.patch ghidra-native/patches/0010-null-subflow.patch ghidra-native/patches/0020-Fix-double-free-crash-when-deinitializing-multiple-X.patch ghidra-native/patches/0023-Undef-LoadImage-for-windows.patch ghidra-native/patches/0044-bad-unicode-codepoint.patch ghidra-native/patches/0055-datatype-clone.patch ghidra-native/patches/0056-nullderef-workaround.patch ghidra-native/patches/0080-getparent-flow.patch ghidra-native/patches/0090-nocasts-warnings.patch ghidra-native/patches/0091-decompiler-xml-packer.patch ghidra-native/patches/0092-badvar-segfault.patch ghidra-native/patches/0093-no-virtual-destructor.patch ghidra-native/patches/0094-parse-64bit-integers.patch ghidra-native/patches/0100-CHAR-windows.patch ghidra-native/patches/ghidra-native.patch ; do echo "patch -d ghidra-native -p1 < $$a" ; patch -d ghidra-native -p1 < $$a ; done
ghidra-native_clean:
rm -rf ghidra-native
+2 -2
View File
@@ -1,7 +1,7 @@
[wrap-git]
url = https://github.com/radareorg/ghidra-native
revision = 0.6.4
revision = 483ae94bcbc661a77667e52f1eff75928cb6aa2e
directory = ghidra-native
patch_directory = ghidra-native
diff_files = ghidra-native/patches/0001-space-after-comma.patch, ghidra-native/patches/0002-make-sleigharch-public.patch, ghidra-native/patches/0004-public-fields.patch, ghidra-native/patches/0006-readonly-warning.patch, ghidra-native/patches/0010-null-subflow.patch, ghidra-native/patches/0020-Fix-double-free-crash-when-deinitializing-multiple-X.patch, ghidra-native/patches/0023-Undef-LoadImage-for-windows.patch, ghidra-native/patches/0024-ignore-symbol-beyond-space.patch, ghidra-native/patches/0044-bad-unicode-codepoint.patch, ghidra-native/patches/0055-datatype-clone.patch, ghidra-native/patches/0056-nullderef-workaround.patch, ghidra-native/patches/0080-getparent-flow.patch, ghidra-native/patches/0090-nocasts-warnings.patch, ghidra-native/patches/0091-decompiler-xml-packer.patch, ghidra-native/patches/0092-badvar-segfault.patch, ghidra-native/patches/0093-no-virtual-destructor.patch, ghidra-native/patches/0100-CHAR-windows.patch, ghidra-native/patches/ghidra-native.patch
diff_files = ghidra-native/patches/0001-space-after-comma.patch, ghidra-native/patches/0002-make-sleigharch-public.patch, ghidra-native/patches/0004-public-fields.patch, ghidra-native/patches/0006-readonly-warning.patch, ghidra-native/patches/0010-null-subflow.patch, ghidra-native/patches/0020-Fix-double-free-crash-when-deinitializing-multiple-X.patch, ghidra-native/patches/0023-Undef-LoadImage-for-windows.patch, ghidra-native/patches/0044-bad-unicode-codepoint.patch, ghidra-native/patches/0055-datatype-clone.patch, ghidra-native/patches/0056-nullderef-workaround.patch, ghidra-native/patches/0080-getparent-flow.patch, ghidra-native/patches/0090-nocasts-warnings.patch, ghidra-native/patches/0091-decompiler-xml-packer.patch, ghidra-native/patches/0092-badvar-segfault.patch, ghidra-native/patches/0093-no-virtual-destructor.patch, ghidra-native/patches/0094-parse-64bit-integers.patch, ghidra-native/patches/0100-CHAR-windows.patch, ghidra-native/patches/ghidra-native.patch
depth = 1
@@ -68,8 +68,10 @@ decompiler_sources = [
'src/decompiler/memstate.cc',
'src/decompiler/opbehavior.cc',
'src/decompiler/paramid.cc',
'src/decompiler/signature.cc',
'src/decompiler/string_ghidra.cc',
'src/decompiler/constseq.cc',
'src/decompiler/bitfield.cc',
]
libdecomp_sources = [
@@ -85,6 +87,7 @@ ghidra_sources = [
'src/decompiler/ghidra_context.cc',
'src/decompiler/cpool_ghidra.cc',
'src/decompiler/comment_ghidra.cc',
'src/decompiler/signature_ghidra.cc',
'src/decompiler/inject_ghidra.cc',
'src/decompiler/ghidra_translate.cc',
]
@@ -127,28 +130,32 @@ incs = include_directories('src/decompiler')
ghidra_base_static = static_library('base',
base_sources,
include_directories: incs
include_directories: incs,
implicit_include_directories: false
)
ghidra_decompiler_static = static_library('ghidra',
decompiler_sources,
dependencies: zlib,
link_with: ghidra_base_static,
include_directories: incs
include_directories: incs,
implicit_include_directories: false
)
slgh_static = static_library('slgh',
slgh_sources, # + sleigh_compiler_sources,
dependencies: zlib,
link_with: ghidra_base_static,
include_directories: incs
include_directories: incs,
implicit_include_directories: false
)
libdecomp_static = static_library('libdecomp',
libdecomp_sources,
dependencies: zlib,
link_with: [ghidra_decompiler_static, slgh_static],
include_directories: incs
include_directories: incs,
implicit_include_directories: false
)
sleighc_exe = executable('sleighc',
@@ -156,6 +163,7 @@ sleighc_exe = executable('sleighc',
dependencies: zlib,
link_with: slgh_static,
include_directories: incs,
implicit_include_directories: false,
override_options : ['c_std=c11', 'cpp_std=c++14'],
install: true
)
@@ -1,25 +1,37 @@
diff --git a/src/decompiler/context.hh b/src/decompiler/context.hh
index 3372e5a..5d2e108 100644
index abe1701..b3d9d45 100644
--- a/src/decompiler/context.hh
+++ b/src/decompiler/context.hh
@@ -89,6 +89,8 @@ private:
ConstructState *base_state;
int4 alloc; // Number of ConstructState's allocated
int4 delayslot; // delayslot depth
@@ -124,6 +124,8 @@ private:
ConstructState *base_state; ///< Root node of the constructor tree
int4 alloc; ///< Number of unallocated ConstructState nodes remaining
int4 delayslot; ///< delayslot depth
+protected:
+ ConstructState **getBaseState(void) { return &base_state; }
public:
ParserContext(ContextCache *ccache);
~ParserContext(void) { if (context != (uintm *)0) delete [] context; }
ParserContext(ContextCache *ccache,Translate *trans); ///< Constructor
~ParserContext(void); ///< Destructor
diff --git a/src/decompiler/sleigh.hh b/src/decompiler/sleigh.hh
index 1a758a4..1e96c2c 100644
index 95249cf..379ee73 100644
--- a/src/decompiler/sleigh.hh
+++ b/src/decompiler/sleigh.hh
@@ -166,6 +166,7 @@ protected:
ParserContext *obtainContext(const Address &addr,int4 state) const;
@@ -170,6 +170,7 @@ protected:
ParserContext *obtainContext(const Address &addr,ParserContext::parse_state state) const;
void resolve(ParserContext &pos) const; ///< Generate a parse tree suitable for disassembly
void resolveHandles(ParserContext &pos) const; ///< Prepare the parse tree for p-code generation
+ ContextCache *getContextCache(void) { return cache; }
public:
Sleigh(LoadImage *ld,ContextDatabase *c_db); ///< Constructor
virtual ~Sleigh(void); ///< Destructor
diff --git a/src/decompiler/type.hh b/src/decompiler/type.hh
index cc0951c..d7b7533 100644
--- a/src/decompiler/type.hh
+++ b/src/decompiler/type.hh
@@ -861,6 +861,7 @@ class TypeFactory {
void insertWarning(Datatype *dt,string warn); ///< Register a new data-type warning with \b this factory
void removeWarning(Datatype *dt); ///< Remove the warning associated with the given data-type
void resolveIncompleteTypedefs(void); ///< Redefine incomplete typedefs of data-types that are now complete
+public:
void setFields(const vector<TypeField> &fd,const vector<TypeBitField> &bit,TypeStruct *ot,int4 newSize,int4 newAlign,uint4 flags);
void setFields(const vector<TypeField> &fd,TypeUnion *ot,int4 newSize,int4 newAlign,uint4 flags); ///< Set fields on a TypeUnion
protected:
@@ -1,17 +0,0 @@
diff --git a/src/decompiler/database.cc b/src/decompiler/database.cc
index 6eab457..8d17f38 100644
--- a/src/decompiler/database.cc
+++ b/src/decompiler/database.cc
@@ -1805,9 +1805,10 @@ SymbolEntry *ScopeInternal::addMapInternal(Symbol *sym,uint4 exfl,const Address
string msg = "Symbol ";
msg += sym->getName();
msg += " extends beyond the end of the address space";
- throw LowlevelError(msg);
+ fprintf (stderr, "%s\n", msg.c_str());
+ //throw LowlevelError(msg);
}
-
+
list<SymbolEntry>::iterator iter = rangemap->insert(initdata,addr.getOffset(),lastaddress.getOffset());
// Store reference to map in symbol
sym->mapentry.push_back(iter);
@@ -1,8 +1,8 @@
diff --git a/src/decompiler/type.hh b/src/decompiler/type.hh
index 92d4882..26bfa3e 100644
index cc0951c..01dc5ac 100644
--- a/src/decompiler/type.hh
+++ b/src/decompiler/type.hh
@@ -201,12 +201,12 @@ protected:
@@ -204,12 +204,12 @@ protected:
void encodeTypedef(Encoder &encoder) const; ///< Encode \b this as a \e typedef element to a stream
void markComplete(void) { flags &= ~(uint4)type_incomplete; } ///< Mark \b this data-type as completely defined
void setDisplayFormat(uint4 format); ///< Set a specific display format
@@ -13,6 +13,6 @@ index 92d4882..26bfa3e 100644
static int4 calcAlignSize(int4 sz,int4 align); ///< Calculate aligned size, given size and alignment of data-type
public:
+ virtual Datatype *clone(void) const=0; ///< Clone the data-type
/// Construct the base data-type copying low-level properties of another
/// \brief Construct the base data-type copying low-level properties of another
Datatype(const Datatype &op) { size = op.size; name=op.name; displayName=op.displayName; metatype=op.metatype;
submeta=op.submeta; flags=op.flags; id=op.id; typedefImm=op.typedefImm; alignment=op.alignment; alignSize=op.alignSize; }
@@ -0,0 +1,26 @@
diff --git a/src/decompiler/slghscan.cc b/src/decompiler/slghscan.cc
index a8545a5..cfae3d6 100644
--- a/src/decompiler/slghscan.cc
+++ b/src/decompiler/slghscan.cc
@@ -1582,7 +1582,7 @@ int4 scan_number(char *numtext,SLEIGHSTYPE *lval,int4 radix,bool signednum)
{
uintb val;
try {
- val = std::stoul(numtext,(size_t *)0,radix);
+ val = std::stoull(numtext,(size_t *)0,radix);
}
catch(...) {
return BADINTEGER;
diff --git a/src/decompiler/slghscan.l b/src/decompiler/slghscan.l
index 1c25962..29db987 100644
--- a/src/decompiler/slghscan.l
+++ b/src/decompiler/slghscan.l
@@ -461,7 +461,7 @@ int4 scan_number(char *numtext,SLEIGHSTYPE *lval,int4 radix,bool signednum)
{
uintb val;
try {
- val = std::stoul(numtext,(size_t *)0,radix);
+ val = std::stoull(numtext,(size_t *)0,radix);
}
catch(...) {
return BADINTEGER;
@@ -1,34 +1,21 @@
diff --git a/src/decompiler/slghparse.cc b/src/decompiler/slghparse.cc
index ec1f76a..01abe32 100644
--- a/src/decompiler/slghparse.cc
+++ b/src/decompiler/slghparse.cc
@@ -246,7 +246,7 @@ extern int sleighdebug;
ELLIPSIS_KEY = 344,
GLOBALSET_KEY = 345,
BITRANGE_KEY = 346,
- CHAR = 347,
+ CHARVALUE = 347,
INTEGER = 348,
INTB = 349,
STRING = 350,
diff --git a/src/decompiler/slghparse.hh b/src/decompiler/slghparse.hh
index 3d615cc..065e1e9 100644
index 5d72496..d798b4b 100644
--- a/src/decompiler/slghparse.hh
+++ b/src/decompiler/slghparse.hh
@@ -161,7 +161,7 @@ extern int sleighdebug;
ELLIPSIS_KEY = 344,
GLOBALSET_KEY = 345,
BITRANGE_KEY = 346,
- CHAR = 347,
+ CHARVALUE = 347,
INTEGER = 348,
INTB = 349,
STRING = 350,
@@ -166,7 +166,7 @@ extern int sleighdebug;
ELLIPSIS_KEY = 344, /* ELLIPSIS_KEY */
GLOBALSET_KEY = 345, /* GLOBALSET_KEY */
BITRANGE_KEY = 346, /* BITRANGE_KEY */
- CHAR = 347, /* CHAR */
+ CHARVALUE = 347, /* CHAR */
INTEGER = 348, /* INTEGER */
INTB = 349, /* INTB */
STRING = 350, /* STRING */
diff --git a/src/decompiler/slghscan.cc b/src/decompiler/slghscan.cc
index 82f7e82..4e21247 100644
index a8545a5..9709240 100644
--- a/src/decompiler/slghscan.cc
+++ b/src/decompiler/slghscan.cc
@@ -2138,7 +2138,7 @@ YY_RULE_SETUP
@@ -2129,7 +2129,7 @@ YY_RULE_SETUP
YY_BREAK
case 61:
YY_RULE_SETUP
+1 -1
View File
@@ -216,7 +216,7 @@ size: 2
sign: true
type: cmp
cycles: 0
esil: r6,NUM,r7,NUM,-,1,32,<<,1,-,&,psw,NUM,4294967287,&,1,32,<<,1,-,&,r6,NUM,r7,NUM,<,DUP,DUP,3,<<,1,32,<<,1,-,&,4,PICK,2,PICK,|,1,32,<<,1,-,&,psw,=,r6,NUM,r7,NUM,2,PICK,2,PICK,-,1,32,<<,1,-,&,3,PICK,31,>>,1,32,<<,1,-,&,DUP,0,>>,1,8,<<,1,-,&,4,PICK,31,>>,1,32,<<,1,-,&,DUP,0,>>,1,8,<<,1,-,&,5,PICK,31,>>,1,32,<<,1,-,&,DUP,0,>>,1,8,<<,1,-,&,DUP,1,&,1,8,<<,1,-,&,psw,NUM,4294967291,&,1,32,<<,1,-,&,7,PICK,6,PICK,-,!,!,6,PICK,4,PICK,-,!,2,PICK,2,PICK,&,1,8,<<,1,-,&,DUP,DUP,2,<<,1,32,<<,1,-,&,6,PICK,2,PICK,|,1,32,<<,1,-,&,psw,=,psw,NUM,4294967293,&,1,32,<<,1,-,&,22,PICK,0,32,~,SWAP,32,~,SWAP,<,DUP,DUP,1,<<,1,32,<<,1,-,&,4,PICK,2,PICK,|,1,32,<<,1,-,&,psw,=,psw,NUM,4294967294,&,1,32,<<,1,-,&,26,PICK,0,-,!,DUP,3,PICK,2,PICK,|,1,32,<<,1,-,&,psw,=
esil: r6,NUM,r7,NUM,-,1,32,<<,1,-,&,r6,NUM,r7,NUM,<,cyf,=,r6,NUM,r7,NUM,-,31,>>,1,&,DUP,r7,NUM,31,>>,1,&,^,1,^,SWAP,r6,NUM,31,>>,1,&,^,&,ovf,=,DUP,0,32,~,SWAP,32,~,SWAP,<,sf,=,DUP,0,-,!,zf,=
family: cpu
EOF
RUN
+62 -64
View File
@@ -483,6 +483,7 @@ EXPECT=<<EOF
80251:BE:24:default
80390:BE:24:default
8051:BE:16:default
8051:BE:24:cip-51
8051:BE:24:mx51
AARCH64:BE:32:ilp32
AARCH64:BE:64:v8A
@@ -528,6 +529,7 @@ Dalvik:LE:32:Marshmallow
Dalvik:LE:32:ODEX_KitKat
Dalvik:LE:32:default
H6309:BE:16:default
Hexagon:LE:32:default
JVM:BE:32:default
Loongarch:LE:32:ilp32d
Loongarch:LE:32:ilp32f
@@ -537,18 +539,22 @@ M16C/60:LE:16:default
M16C/80:LE:16:default
M8C:BE:16:default
MCS96:LE:16:default
MIPS:BE:32:16e
MIPS:BE:32:R6
MIPS:BE:32:default
MIPS:BE:32:micro
MIPS:BE:64:16e
MIPS:BE:64:64-32R6addr
MIPS:BE:64:64-32addr
MIPS:BE:64:R6
MIPS:BE:64:default
MIPS:BE:64:micro
MIPS:BE:64:micro64-32addr
MIPS:LE:32:16e
MIPS:LE:32:R6
MIPS:LE:32:default
MIPS:LE:32:micro
MIPS:LE:64:16e
MIPS:LE:64:64-32R6addr
MIPS:LE:64:64-32addr
MIPS:LE:64:R6
@@ -578,16 +584,8 @@ PowerPC:LE:64:A2-32addr
PowerPC:LE:64:A2ALT
PowerPC:LE:64:A2ALT-32addr
PowerPC:LE:64:default
RISCV:LE:32:RV32G
RISCV:LE:32:RV32GC
RISCV:LE:32:RV32I
RISCV:LE:32:RV32IC
RISCV:LE:32:RV32IMC
RISCV:LE:32:AndeStar_v5
RISCV:LE:32:default
RISCV:LE:64:RV64G
RISCV:LE:64:RV64GC
RISCV:LE:64:RV64I
RISCV:LE:64:RV64IC
RISCV:LE:64:default
STM8:BE:16:default
STM8:BE:24:default
@@ -597,6 +595,7 @@ SuperH:BE:32:SH-2A
TI_MSP430:LE:16:default
TI_MSP430X:LE:32:default
V850:LE:32:default
V850:LE:32:v850e3v5
Xtensa:BE:32:default
Xtensa:LE:32:default
avr32:BE:32:default
@@ -606,7 +605,6 @@ avr8:LE:16:extended
avr8:LE:24:xmega
eBPF:BE:64:default
eBPF:LE:64:default
hexagon:LE:32:default
sBPF:LE:64:default
sparc:BE:32:default
sparc:BE:64:default
@@ -654,7 +652,7 @@ add eax, 0xf
shr eax, 4
-----
0x08048540: PUSH EBP
(unique,0x20a80,4) = COPY EBP
(unique,0x41500,4) = COPY EBP
ESP = INT_SUB ESP, 0x4
0x08048541: MOV EBP,ESP
EBP = COPY ESP
@@ -664,20 +662,20 @@ shr eax, 4
ESP = INT_SUB ESP, 0x88
SF = INT_SLESS ESP, 0x0
ZF = INT_EQUAL ESP, 0x0
(unique,0x24c00,4) = INT_AND ESP, 0xff
(unique,0x24c80,1) = POPCOUNT (unique,0x24c00,4)
(unique,0x24d00,1) = INT_AND (unique,0x24c80,1), 0x1
PF = INT_EQUAL (unique,0x24d00,1), 0x0
(unique,0x49800,4) = INT_AND ESP, 0xff
(unique,0x49900,1) = POPCOUNT (unique,0x49800,4)
(unique,0x49a00,1) = INT_AND (unique,0x49900,1), 0x1
PF = INT_EQUAL (unique,0x49a00,1), 0x0
0x08048549: AND ESP,0xfffffff0
CF = COPY 0x0
OF = COPY 0x0
ESP = INT_AND ESP, 0xfffffff0
SF = INT_SLESS ESP, 0x0
ZF = INT_EQUAL ESP, 0x0
(unique,0x24c00,4) = INT_AND ESP, 0xff
(unique,0x24c80,1) = POPCOUNT (unique,0x24c00,4)
(unique,0x24d00,1) = INT_AND (unique,0x24c80,1), 0x1
PF = INT_EQUAL (unique,0x24d00,1), 0x0
(unique,0x49800,4) = INT_AND ESP, 0xff
(unique,0x49900,1) = POPCOUNT (unique,0x49800,4)
(unique,0x49a00,1) = INT_AND (unique,0x49900,1), 0x1
PF = INT_EQUAL (unique,0x49a00,1), 0x0
0x0804854c: MOV EAX,0x0
EAX = COPY 0x0
0x08048551: ADD EAX,0xf
@@ -686,58 +684,58 @@ shr eax, 4
EAX = INT_ADD EAX, 0xf
SF = INT_SLESS EAX, 0x0
ZF = INT_EQUAL EAX, 0x0
(unique,0x24c00,4) = INT_AND EAX, 0xff
(unique,0x24c80,1) = POPCOUNT (unique,0x24c00,4)
(unique,0x24d00,1) = INT_AND (unique,0x24c80,1), 0x1
PF = INT_EQUAL (unique,0x24d00,1), 0x0
(unique,0x49800,4) = INT_AND EAX, 0xff
(unique,0x49900,1) = POPCOUNT (unique,0x49800,4)
(unique,0x49a00,1) = INT_AND (unique,0x49900,1), 0x1
PF = INT_EQUAL (unique,0x49a00,1), 0x0
0x08048554: ADD EAX,0xf
CF = INT_CARRY EAX, 0xf
OF = INT_SCARRY EAX, 0xf
EAX = INT_ADD EAX, 0xf
SF = INT_SLESS EAX, 0x0
ZF = INT_EQUAL EAX, 0x0
(unique,0x24c00,4) = INT_AND EAX, 0xff
(unique,0x24c80,1) = POPCOUNT (unique,0x24c00,4)
(unique,0x24d00,1) = INT_AND (unique,0x24c80,1), 0x1
PF = INT_EQUAL (unique,0x24d00,1), 0x0
(unique,0x49800,4) = INT_AND EAX, 0xff
(unique,0x49900,1) = POPCOUNT (unique,0x49800,4)
(unique,0x49a00,1) = INT_AND (unique,0x49900,1), 0x1
PF = INT_EQUAL (unique,0x49a00,1), 0x0
0x08048557: SHR EAX,0x4
(unique,0x55c80,4) = INT_AND 0x4, 0x1f
(unique,0x55d00,4) = COPY EAX
EAX = INT_RIGHT EAX, (unique,0x55c80,4)
(unique,0x28100,1) = INT_NOTEQUAL (unique,0x55c80,4), 0x0
(unique,0x28180,4) = INT_SUB (unique,0x55c80,4), 0x1
(unique,0x28200,4) = INT_RIGHT (unique,0x55d00,4), (unique,0x28180,4)
(unique,0x28280,4) = INT_AND (unique,0x28200,4), 0x1
(unique,0x28380,1) = INT_NOTEQUAL (unique,0x28280,4), 0x0
(unique,0x28400,1) = BOOL_NEGATE (unique,0x28100,1)
(unique,0x28480,1) = INT_AND (unique,0x28400,1), CF
(unique,0x28500,1) = INT_AND (unique,0x28100,1), (unique,0x28380,1)
CF = INT_OR (unique,0x28480,1), (unique,0x28500,1)
(unique,0x28680,1) = INT_EQUAL (unique,0x55c80,4), 0x1
(unique,0x28780,1) = INT_SLESS (unique,0x55d00,4), 0x0
(unique,0x28800,1) = BOOL_NEGATE (unique,0x28680,1)
(unique,0x28880,1) = INT_AND (unique,0x28800,1), OF
(unique,0x28900,1) = INT_AND (unique,0x28680,1), (unique,0x28780,1)
OF = INT_OR (unique,0x28880,1), (unique,0x28900,1)
(unique,0x24e80,1) = INT_NOTEQUAL (unique,0x55c80,4), 0x0
(unique,0x24f80,1) = INT_SLESS EAX, 0x0
(unique,0x25000,1) = BOOL_NEGATE (unique,0x24e80,1)
(unique,0x25080,1) = INT_AND (unique,0x25000,1), SF
(unique,0x25100,1) = INT_AND (unique,0x24e80,1), (unique,0x24f80,1)
SF = INT_OR (unique,0x25080,1), (unique,0x25100,1)
(unique,0x25280,1) = INT_EQUAL EAX, 0x0
(unique,0x25300,1) = BOOL_NEGATE (unique,0x24e80,1)
(unique,0x25380,1) = INT_AND (unique,0x25300,1), ZF
(unique,0x25400,1) = INT_AND (unique,0x24e80,1), (unique,0x25280,1)
ZF = INT_OR (unique,0x25380,1), (unique,0x25400,1)
(unique,0x25500,4) = INT_AND EAX, 0xff
(unique,0x25580,1) = POPCOUNT (unique,0x25500,4)
(unique,0x25600,1) = INT_AND (unique,0x25580,1), 0x1
(unique,0x25700,1) = INT_EQUAL (unique,0x25600,1), 0x0
(unique,0x25780,1) = BOOL_NEGATE (unique,0x24e80,1)
(unique,0x25800,1) = INT_AND (unique,0x25780,1), PF
(unique,0x25880,1) = INT_AND (unique,0x24e80,1), (unique,0x25700,1)
PF = INT_OR (unique,0x25800,1), (unique,0x25880,1)
(unique,0xac000,4) = INT_AND 0x4, 0x1f
(unique,0xac100,4) = COPY EAX
EAX = INT_RIGHT EAX, (unique,0xac000,4)
(unique,0x50200,1) = INT_NOTEQUAL (unique,0xac000,4), 0x0
(unique,0x50300,4) = INT_SUB (unique,0xac000,4), 0x1
(unique,0x50400,4) = INT_RIGHT (unique,0xac100,4), (unique,0x50300,4)
(unique,0x50500,4) = INT_AND (unique,0x50400,4), 0x1
(unique,0x50700,1) = INT_NOTEQUAL (unique,0x50500,4), 0x0
(unique,0x50800,1) = BOOL_NEGATE (unique,0x50200,1)
(unique,0x50900,1) = INT_AND (unique,0x50800,1), CF
(unique,0x50a00,1) = INT_AND (unique,0x50200,1), (unique,0x50700,1)
CF = INT_OR (unique,0x50900,1), (unique,0x50a00,1)
(unique,0x50d00,1) = INT_EQUAL (unique,0xac000,4), 0x1
(unique,0x50f00,1) = INT_SLESS (unique,0xac100,4), 0x0
(unique,0x51000,1) = BOOL_NEGATE (unique,0x50d00,1)
(unique,0x51100,1) = INT_AND (unique,0x51000,1), OF
(unique,0x51200,1) = INT_AND (unique,0x50d00,1), (unique,0x50f00,1)
OF = INT_OR (unique,0x51100,1), (unique,0x51200,1)
(unique,0x49d00,1) = INT_NOTEQUAL (unique,0xac000,4), 0x0
(unique,0x49f00,1) = INT_SLESS EAX, 0x0
(unique,0x4a000,1) = BOOL_NEGATE (unique,0x49d00,1)
(unique,0x4a100,1) = INT_AND (unique,0x4a000,1), SF
(unique,0x4a200,1) = INT_AND (unique,0x49d00,1), (unique,0x49f00,1)
SF = INT_OR (unique,0x4a100,1), (unique,0x4a200,1)
(unique,0x4a500,1) = INT_EQUAL EAX, 0x0
(unique,0x4a600,1) = BOOL_NEGATE (unique,0x49d00,1)
(unique,0x4a700,1) = INT_AND (unique,0x4a600,1), ZF
(unique,0x4a800,1) = INT_AND (unique,0x49d00,1), (unique,0x4a500,1)
ZF = INT_OR (unique,0x4a700,1), (unique,0x4a800,1)
(unique,0x4aa00,4) = INT_AND EAX, 0xff
(unique,0x4ab00,1) = POPCOUNT (unique,0x4aa00,4)
(unique,0x4ac00,1) = INT_AND (unique,0x4ab00,1), 0x1
(unique,0x4ae00,1) = INT_EQUAL (unique,0x4ac00,1), 0x0
(unique,0x4af00,1) = BOOL_NEGATE (unique,0x49d00,1)
(unique,0x4b000,1) = INT_AND (unique,0x4af00,1), PF
(unique,0x4b100,1) = INT_AND (unique,0x49d00,1), (unique,0x4ae00,1)
PF = INT_OR (unique,0x4b000,1), (unique,0x4b100,1)
EOF
CMDS=<<EOF
s main
+62 -65
View File
@@ -481,6 +481,7 @@ EXPECT=<<EOF
80251:BE:24:default
80390:BE:24:default
8051:BE:16:default
8051:BE:24:cip-51
8051:BE:24:mx51
AARCH64:BE:32:ilp32
AARCH64:BE:64:v8A
@@ -526,6 +527,7 @@ Dalvik:LE:32:Marshmallow
Dalvik:LE:32:ODEX_KitKat
Dalvik:LE:32:default
H6309:BE:16:default
Hexagon:LE:32:default
JVM:BE:32:default
Loongarch:LE:32:ilp32d
Loongarch:LE:32:ilp32f
@@ -535,18 +537,22 @@ M16C/60:LE:16:default
M16C/80:LE:16:default
M8C:BE:16:default
MCS96:LE:16:default
MIPS:BE:32:16e
MIPS:BE:32:R6
MIPS:BE:32:default
MIPS:BE:32:micro
MIPS:BE:64:16e
MIPS:BE:64:64-32R6addr
MIPS:BE:64:64-32addr
MIPS:BE:64:R6
MIPS:BE:64:default
MIPS:BE:64:micro
MIPS:BE:64:micro64-32addr
MIPS:LE:32:16e
MIPS:LE:32:R6
MIPS:LE:32:default
MIPS:LE:32:micro
MIPS:LE:64:16e
MIPS:LE:64:64-32R6addr
MIPS:LE:64:64-32addr
MIPS:LE:64:R6
@@ -576,16 +582,8 @@ PowerPC:LE:64:A2-32addr
PowerPC:LE:64:A2ALT
PowerPC:LE:64:A2ALT-32addr
PowerPC:LE:64:default
RISCV:LE:32:RV32G
RISCV:LE:32:RV32GC
RISCV:LE:32:RV32I
RISCV:LE:32:RV32IC
RISCV:LE:32:RV32IMC
RISCV:LE:32:AndeStar_v5
RISCV:LE:32:default
RISCV:LE:64:RV64G
RISCV:LE:64:RV64GC
RISCV:LE:64:RV64I
RISCV:LE:64:RV64IC
RISCV:LE:64:default
STM8:BE:16:default
STM8:BE:24:default
@@ -595,6 +593,7 @@ SuperH:BE:32:SH-2A
TI_MSP430:LE:16:default
TI_MSP430X:LE:32:default
V850:LE:32:default
V850:LE:32:v850e3v5
Xtensa:BE:32:default
Xtensa:LE:32:default
avr32:BE:32:default
@@ -604,7 +603,6 @@ avr8:LE:16:extended
avr8:LE:24:xmega
eBPF:BE:64:default
eBPF:LE:64:default
hexagon:LE:32:default
sBPF:LE:64:default
sparc:BE:32:default
sparc:BE:64:default
@@ -652,7 +650,7 @@ add eax, 0xf
shr eax, 4
-----
0x08048540: PUSH EBP
(unique,0x20a80,4) = COPY EBP
(unique,0x41500,4) = COPY EBP
ESP = INT_SUB ESP, 0x4
0x08048541: MOV EBP,ESP
EBP = COPY ESP
@@ -662,20 +660,20 @@ shr eax, 4
ESP = INT_SUB ESP, 0x88
SF = INT_SLESS ESP, 0x0
ZF = INT_EQUAL ESP, 0x0
(unique,0x24c00,4) = INT_AND ESP, 0xff
(unique,0x24c80,1) = POPCOUNT (unique,0x24c00,4)
(unique,0x24d00,1) = INT_AND (unique,0x24c80,1), 0x1
PF = INT_EQUAL (unique,0x24d00,1), 0x0
(unique,0x49800,4) = INT_AND ESP, 0xff
(unique,0x49900,1) = POPCOUNT (unique,0x49800,4)
(unique,0x49a00,1) = INT_AND (unique,0x49900,1), 0x1
PF = INT_EQUAL (unique,0x49a00,1), 0x0
0x08048549: AND ESP,0xfffffff0
CF = COPY 0x0
OF = COPY 0x0
ESP = INT_AND ESP, 0xfffffff0
SF = INT_SLESS ESP, 0x0
ZF = INT_EQUAL ESP, 0x0
(unique,0x24c00,4) = INT_AND ESP, 0xff
(unique,0x24c80,1) = POPCOUNT (unique,0x24c00,4)
(unique,0x24d00,1) = INT_AND (unique,0x24c80,1), 0x1
PF = INT_EQUAL (unique,0x24d00,1), 0x0
(unique,0x49800,4) = INT_AND ESP, 0xff
(unique,0x49900,1) = POPCOUNT (unique,0x49800,4)
(unique,0x49a00,1) = INT_AND (unique,0x49900,1), 0x1
PF = INT_EQUAL (unique,0x49a00,1), 0x0
0x0804854c: MOV EAX,0x0
EAX = COPY 0x0
0x08048551: ADD EAX,0xf
@@ -684,58 +682,58 @@ shr eax, 4
EAX = INT_ADD EAX, 0xf
SF = INT_SLESS EAX, 0x0
ZF = INT_EQUAL EAX, 0x0
(unique,0x24c00,4) = INT_AND EAX, 0xff
(unique,0x24c80,1) = POPCOUNT (unique,0x24c00,4)
(unique,0x24d00,1) = INT_AND (unique,0x24c80,1), 0x1
PF = INT_EQUAL (unique,0x24d00,1), 0x0
(unique,0x49800,4) = INT_AND EAX, 0xff
(unique,0x49900,1) = POPCOUNT (unique,0x49800,4)
(unique,0x49a00,1) = INT_AND (unique,0x49900,1), 0x1
PF = INT_EQUAL (unique,0x49a00,1), 0x0
0x08048554: ADD EAX,0xf
CF = INT_CARRY EAX, 0xf
OF = INT_SCARRY EAX, 0xf
EAX = INT_ADD EAX, 0xf
SF = INT_SLESS EAX, 0x0
ZF = INT_EQUAL EAX, 0x0
(unique,0x24c00,4) = INT_AND EAX, 0xff
(unique,0x24c80,1) = POPCOUNT (unique,0x24c00,4)
(unique,0x24d00,1) = INT_AND (unique,0x24c80,1), 0x1
PF = INT_EQUAL (unique,0x24d00,1), 0x0
(unique,0x49800,4) = INT_AND EAX, 0xff
(unique,0x49900,1) = POPCOUNT (unique,0x49800,4)
(unique,0x49a00,1) = INT_AND (unique,0x49900,1), 0x1
PF = INT_EQUAL (unique,0x49a00,1), 0x0
0x08048557: SHR EAX,0x4
(unique,0x55c80,4) = INT_AND 0x4, 0x1f
(unique,0x55d00,4) = COPY EAX
EAX = INT_RIGHT EAX, (unique,0x55c80,4)
(unique,0x28100,1) = INT_NOTEQUAL (unique,0x55c80,4), 0x0
(unique,0x28180,4) = INT_SUB (unique,0x55c80,4), 0x1
(unique,0x28200,4) = INT_RIGHT (unique,0x55d00,4), (unique,0x28180,4)
(unique,0x28280,4) = INT_AND (unique,0x28200,4), 0x1
(unique,0x28380,1) = INT_NOTEQUAL (unique,0x28280,4), 0x0
(unique,0x28400,1) = BOOL_NEGATE (unique,0x28100,1)
(unique,0x28480,1) = INT_AND (unique,0x28400,1), CF
(unique,0x28500,1) = INT_AND (unique,0x28100,1), (unique,0x28380,1)
CF = INT_OR (unique,0x28480,1), (unique,0x28500,1)
(unique,0x28680,1) = INT_EQUAL (unique,0x55c80,4), 0x1
(unique,0x28780,1) = INT_SLESS (unique,0x55d00,4), 0x0
(unique,0x28800,1) = BOOL_NEGATE (unique,0x28680,1)
(unique,0x28880,1) = INT_AND (unique,0x28800,1), OF
(unique,0x28900,1) = INT_AND (unique,0x28680,1), (unique,0x28780,1)
OF = INT_OR (unique,0x28880,1), (unique,0x28900,1)
(unique,0x24e80,1) = INT_NOTEQUAL (unique,0x55c80,4), 0x0
(unique,0x24f80,1) = INT_SLESS EAX, 0x0
(unique,0x25000,1) = BOOL_NEGATE (unique,0x24e80,1)
(unique,0x25080,1) = INT_AND (unique,0x25000,1), SF
(unique,0x25100,1) = INT_AND (unique,0x24e80,1), (unique,0x24f80,1)
SF = INT_OR (unique,0x25080,1), (unique,0x25100,1)
(unique,0x25280,1) = INT_EQUAL EAX, 0x0
(unique,0x25300,1) = BOOL_NEGATE (unique,0x24e80,1)
(unique,0x25380,1) = INT_AND (unique,0x25300,1), ZF
(unique,0x25400,1) = INT_AND (unique,0x24e80,1), (unique,0x25280,1)
ZF = INT_OR (unique,0x25380,1), (unique,0x25400,1)
(unique,0x25500,4) = INT_AND EAX, 0xff
(unique,0x25580,1) = POPCOUNT (unique,0x25500,4)
(unique,0x25600,1) = INT_AND (unique,0x25580,1), 0x1
(unique,0x25700,1) = INT_EQUAL (unique,0x25600,1), 0x0
(unique,0x25780,1) = BOOL_NEGATE (unique,0x24e80,1)
(unique,0x25800,1) = INT_AND (unique,0x25780,1), PF
(unique,0x25880,1) = INT_AND (unique,0x24e80,1), (unique,0x25700,1)
PF = INT_OR (unique,0x25800,1), (unique,0x25880,1)
(unique,0xac000,4) = INT_AND 0x4, 0x1f
(unique,0xac100,4) = COPY EAX
EAX = INT_RIGHT EAX, (unique,0xac000,4)
(unique,0x50200,1) = INT_NOTEQUAL (unique,0xac000,4), 0x0
(unique,0x50300,4) = INT_SUB (unique,0xac000,4), 0x1
(unique,0x50400,4) = INT_RIGHT (unique,0xac100,4), (unique,0x50300,4)
(unique,0x50500,4) = INT_AND (unique,0x50400,4), 0x1
(unique,0x50700,1) = INT_NOTEQUAL (unique,0x50500,4), 0x0
(unique,0x50800,1) = BOOL_NEGATE (unique,0x50200,1)
(unique,0x50900,1) = INT_AND (unique,0x50800,1), CF
(unique,0x50a00,1) = INT_AND (unique,0x50200,1), (unique,0x50700,1)
CF = INT_OR (unique,0x50900,1), (unique,0x50a00,1)
(unique,0x50d00,1) = INT_EQUAL (unique,0xac000,4), 0x1
(unique,0x50f00,1) = INT_SLESS (unique,0xac100,4), 0x0
(unique,0x51000,1) = BOOL_NEGATE (unique,0x50d00,1)
(unique,0x51100,1) = INT_AND (unique,0x51000,1), OF
(unique,0x51200,1) = INT_AND (unique,0x50d00,1), (unique,0x50f00,1)
OF = INT_OR (unique,0x51100,1), (unique,0x51200,1)
(unique,0x49d00,1) = INT_NOTEQUAL (unique,0xac000,4), 0x0
(unique,0x49f00,1) = INT_SLESS EAX, 0x0
(unique,0x4a000,1) = BOOL_NEGATE (unique,0x49d00,1)
(unique,0x4a100,1) = INT_AND (unique,0x4a000,1), SF
(unique,0x4a200,1) = INT_AND (unique,0x49d00,1), (unique,0x49f00,1)
SF = INT_OR (unique,0x4a100,1), (unique,0x4a200,1)
(unique,0x4a500,1) = INT_EQUAL EAX, 0x0
(unique,0x4a600,1) = BOOL_NEGATE (unique,0x49d00,1)
(unique,0x4a700,1) = INT_AND (unique,0x4a600,1), ZF
(unique,0x4a800,1) = INT_AND (unique,0x49d00,1), (unique,0x4a500,1)
ZF = INT_OR (unique,0x4a700,1), (unique,0x4a800,1)
(unique,0x4aa00,4) = INT_AND EAX, 0xff
(unique,0x4ab00,1) = POPCOUNT (unique,0x4aa00,4)
(unique,0x4ac00,1) = INT_AND (unique,0x4ab00,1), 0x1
(unique,0x4ae00,1) = INT_EQUAL (unique,0x4ac00,1), 0x0
(unique,0x4af00,1) = BOOL_NEGATE (unique,0x49d00,1)
(unique,0x4b000,1) = INT_AND (unique,0x4af00,1), PF
(unique,0x4b100,1) = INT_AND (unique,0x49d00,1), (unique,0x4ae00,1)
PF = INT_OR (unique,0x4b000,1), (unique,0x4b100,1)
EOF
CMDS=<<EOF
s main
@@ -821,7 +819,6 @@ windows (Visual Studio)
clangwindows (clang)
gcc (gcc)
golang (golang)
swift (Swift)
EOF2
RUN