mirror of
https://github.com/radareorg/radare2.git
synced 2025-03-03 03:35:37 +00:00
Add a parse plugin for tweaking references to r0 ##disasm
This commit is contained in:
parent
6bf4f8db06
commit
630a9ab8e8
@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2020-2021 - pancake */
|
||||
/* radare - LGPL - Copyright 2020-2022 - pancake */
|
||||
|
||||
#include <r_lib.h>
|
||||
#include <r_flag.h>
|
||||
@ -198,10 +198,29 @@ static int parse(RParse *p, const char *data, char *str) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool subvar(RParse *p, RAnalFunction *f, ut64 addr, int oplen, char *data, char *str, int len) {
|
||||
char *r0 = strstr (data, "[r0]");
|
||||
if (r0) {
|
||||
char *neg = strstr (data, " -");
|
||||
if (neg && neg < r0) {
|
||||
int negdelta = atoi (neg);
|
||||
*neg = 0;
|
||||
ut64 addr = UT32_MAX + negdelta + 1;
|
||||
char *res = r_str_newf ("%s 0x%"PFMT64x"%s", data, addr, r0 + 4);
|
||||
strcpy (str, res);
|
||||
free (res);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
strcpy (str, data);
|
||||
return false;
|
||||
}
|
||||
|
||||
RParsePlugin r_parse_plugin_v850_pseudo = {
|
||||
.name = "v850.pseudo",
|
||||
.desc = "v850 pseudo syntax",
|
||||
.parse = parse,
|
||||
.subvar = &subvar,
|
||||
};
|
||||
|
||||
#ifndef R2_PLUGIN_INCORE
|
||||
|
Loading…
x
Reference in New Issue
Block a user