rizin
rizin copied to clipboard
Add default enums to database
Is your feature request related to a problem? Please describe. There are many const values in default libs have readable names. During programming time, it's easy to understand. For example, I have this code:
#include <unistd.h>
#include <stdio.h>
int main() {
printf("%d\n", access("/etc/passwd", W_OK));
return 0;
}
Const values are int
. So when Rizin disassembly the code, It looks harder to understand, requires users checking the documentation (or the header files of source code).
psudo code
int32_t main (void) {
eax = access ("/etc/passwd", 2);
esi = eax;
eax = 0;
printf (0x00002010);
eax = 0;
return eax;
}
Describe the solution you'd like
I think a dictionary of const
of system libraries is really useful (for example: socket
). It helps users reduce time to check non famous int value.
Describe alternatives you've considered
- It could be really hard to check
push
ormove
int before function is called. So maybe use this method is decompiler plugins is easier than do it it show disassembly code. - In comment of disassembly, I can see
mov esi, 2 ; int mode
so likely Rizin is supporting some sort of checking here. So I guess it's possible to show values in here likemove esi, 2 ; int mode (W_OK)
orUNIX_ACCESS_WRITE
orunistd.h W_OK
Update: deroad
sent the db of linux-functions on telegram https://github.com/rizinorg/rizin/blob/dev/librz/analysis/d/functions-linux.sdb.txt so i think it's possible to do this idea but it requires different db reader method.
Update: There are some examples in MacOS db https://github.com/rizinorg/rizin/blob/dev/librz/analysis/d/types-macos.sdb.txt#L4
This issue has been automatically marked as stale because it has not had recent activity. Considering a lot has probably changed since its creation, we kindly ask you to check again if the issue you reported is still relevant in the current version of rizin. If it is, update this issue with a comment, otherwise it will be automatically closed if no further activity occurs. Thank you for your contributions.
Hi, I am Sainithin , currently undergraduate final year student , i am willing to work on this task as part of qualification task for gsoc 2023. I was wondering if you could possibly elaborate a bit more on what you just mentioned? I would greatly appreciate any additional information you could share with me, like what files should be modified .Thank you
Hi, I am Sainithin , currently undergraduate final year student , i am willing to work on this task as part of qualification task for gsoc 2023. I was wondering if you could possibly elaborate a bit more on what you just mentioned? I would greatly appreciate any additional information you could share with me, like what files should be modified .Thank you
Hello! The idea is very simple: There are default values in libraries / syscalls and it'd be much easier if the framework shows the values in enum-like values instead of digital numbers. For example, here are some default consts of socket
https://man7.org/linux/man-pages/man2/socket.2.html. You can check the values and write it to the db of rizin as same as the MacOS db as the comment above.