Fix 'Cannot find return type for' calling convention issues when saving a project (#18638) ##anal

This commit is contained in:
pancake 2021-04-27 13:32:17 +02:00 committed by GitHub
parent c093e68c48
commit cd59901e5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 6 deletions

View File

@ -114,12 +114,12 @@ R_API char *r_anal_cc_get(RAnal *anal, const char *name) {
int i;
// get cc by name and print the expr
if (r_str_cmp (sdb_const_get (DB, name, 0), "cc", -1)) {
eprintf ("This is not a valid calling convention name\n");
eprintf ("This is not a valid calling convention name (%s)\n", name);
return NULL;
}
const char *ret = sdb_const_get (DB, sdb_fmt ("cc.%s.ret", name), 0);
if (!ret) {
eprintf ("Cannot find return key\n");
eprintf ("Cannot find return type for %s\n", name);
return NULL;
}
RStrBuf *sb = r_strbuf_new (NULL);

View File

@ -4,8 +4,8 @@ cdecl=cc
cc.cdecl.argn=stack
cc.cdecl.ret=eax
cdecl-thiscall-ms=cc
cc.cdecl-thiscall-ms.arg0=ecx
cdecl-fastcall-ms=cc
cc.cdecl-fastcall-ms.arg0=ecx
cc.cdecl-fastcall-ms.argn=stack
cc.cdecl-fastcall-ms.ret=eax
@ -27,12 +27,14 @@ cc.fastcall.argn=stack
cc.fastcall.ret=eax
borland=cc
cc.borland.ret=eax
cc.borland.arg0=eax
cc.borland.arg1=edx
cc.borland.arg2=ecx
cc.borland.argn=stack_rev
watcom=cc
cc.watcom.ret=eax
cc.watcom.arg0=eax
cc.watcom.arg1=edx
cc.watcom.arg2=ebx
@ -40,4 +42,5 @@ cc.watcom.arg3=ecx
cc.watcom.argn=stack
pascal=cc
cc.pascal.ret=eax
cc.pascal.argn=stack_rev

View File

@ -2657,9 +2657,10 @@ EXPECT=<<EOF
"cc.borland.arg1=edx",
"cc.borland.arg2=ecx",
"cc.borland.argn=stack_rev",
"cc.borland.ret=eax",
"cc.cdecl-fastcall-ms.arg0=ecx",
"cc.cdecl-fastcall-ms.argn=stack",
"cc.cdecl-fastcall-ms.ret=eax",
"cc.cdecl-thiscall-ms.arg0=ecx",
"cc.cdecl.argn=stack",
"cc.cdecl.ret=eax",
"cc.fastcall.arg0=ecx",
@ -2672,6 +2673,7 @@ EXPECT=<<EOF
"cc.optlink.argn=stack",
"cc.optlink.ret=eax",
"cc.pascal.argn=stack_rev",
"cc.pascal.ret=eax",
"cc.reg.arg0=eax",
"cc.reg.arg1=ebx",
"cc.reg.arg2=ecx",
@ -2684,8 +2686,9 @@ EXPECT=<<EOF
"cc.watcom.arg2=ebx",
"cc.watcom.arg3=ecx",
"cc.watcom.argn=stack",
"cc.watcom.ret=eax",
"cdecl=cc",
"cdecl-thiscall-ms=cc",
"cdecl-fastcall-ms=cc",
"default.cc=cdecl",
"fastcall=cc",
"optlink=cc",