-
-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Types: add more missing atomic types and fix structure format size calculation #4624
Conversation
a2a9b51
to
56f10b8
Compare
56f10b8
to
466574d
Compare
466574d
to
061814e
Compare
uint16_t=type | ||
type.uint16_t=w | ||
type.uint16_t.size=16 | ||
type.uint16_t.typeclass=Unsigned Integral | ||
|
||
uint_fast16_t=type | ||
type.uint_fast16_t=w |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
w
for word
? Isn't this again architecture specific if it is a word
or half-word
? Also below with potentially w = 32bit
, d == 64bit
, q == 128bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't find anything in the C standard (looked briefly). But I find 16 = halfword
more intuitive nowadays. The bit-widths don't get smaller in the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's how it's defined in the pf
, see the pf?
:
Formats:
| b # byte (unsigned)
| B # resolve enum bitfield (see t?)
| c # char (signed byte)
| C # byte in decimal
| d # 0xHEX value (4 bytes) (see 'i' and 'x' formats)
| D # disassemble one opcode
| e # temporarily swap endian
| E # resolve enum name (see t?)
| f # float value (4 bytes)
| F # double float value (8 bytes)
| i # signed integer value (4 bytes) (see 'd' and 'x' formats)
| n # next char specifies size of signed value (1, 2, 4, or 8 byte(s))
| N # next char specifies size of unsigned value (1, 2, 4, or 8 byte(s))
| o # octal value (4 bytes)
| p # pointer reference (2, 4, or 8 bytes)
| q # quadword (8 bytes)
| Q # octoword (uint128_t) (16 bytes)
| r # CPU register (`pf r (eax)plop`)
| s # 32 bit pointer to string (4 bytes)
| s # 32 bit pointer to string (4 bytes)
| t # 32 bit UNIX timestamp (4 bytes)
| T # show ten first bytes of buffer
| u # uleb128 (variable length)
| w # word (2 bytes unsigned short in hex)
@@ -1682,7 +1688,7 @@ RZ_API int rz_type_format_struct_size(const RzTypeDB *typedb, const char *f, int | |||
free(o); | |||
return 0; | |||
} | |||
int newsize = rz_type_format_struct_size(typedb, format, mode, n + 1); | |||
int newsize = format_struct_size(typedb, f, format, mode, depth + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename f
to something descriptive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't because it would require renaming in many places, I try to keep changes in the formatting code to the minimum.
Your checklist for this pull request
Detailed description
After testing Rizin on some firmwares I found these two problems:
Test plan
CI is green