RzAnalysisILVM wraps around the low-level RzILVM and enables emulation of real code from disassembly, rather than raw IL. Analysis plugins now don't actively initialize the vm anymore, but return a fully declarative description RzAnalysisILConfig of how to set up the vm and optionally its initial state. This also enables multiple IL vms to exist at the same time as plugins can not mess with the global vm anymore. See the added integration test for an example.
40 lines
936 B
C
40 lines
936 B
C
// SPDX-FileCopyrightText: 2021 heersin <teablearcher@gmail.com>
|
|
// SPDX-License-Identifier: LGPL-3.0-only
|
|
|
|
#include <rz_il/definitions/label.h>
|
|
|
|
RZ_API RzILEffectLabel *rz_il_effect_label_new(RZ_NONNULL const char *name, RzILEffectLabelType type) {
|
|
RzILEffectLabel *lbl = RZ_NEW0(RzILEffectLabel);
|
|
if (!lbl) {
|
|
return NULL;
|
|
}
|
|
lbl->label_id = strdup(name);
|
|
lbl->type = type;
|
|
return lbl;
|
|
}
|
|
|
|
RZ_API void rz_il_effect_label_free(RzILEffectLabel *lbl) {
|
|
if (!lbl) {
|
|
return;
|
|
}
|
|
free(lbl->label_id);
|
|
if (lbl->type == EFFECT_LABEL_ADDR) {
|
|
rz_bv_free(lbl->addr);
|
|
}
|
|
free(lbl);
|
|
return;
|
|
}
|
|
|
|
RZ_API RzILEffectLabel *rz_il_effect_label_dup(RZ_NONNULL RzILEffectLabel *lbl) {
|
|
rz_return_val_if_fail(lbl, NULL);
|
|
RzILEffectLabel *r = rz_il_effect_label_new(lbl->label_id, lbl->type);
|
|
if (!r) {
|
|
return NULL;
|
|
}
|
|
if (lbl->type == EFFECT_LABEL_ADDR) {
|
|
r->addr = rz_bv_dup(lbl->addr);
|
|
} else {
|
|
r->hook = lbl->hook;
|
|
}
|
|
return r;
|
|
}
|