rizinorg / rizin

UNIX-like reverse engineering framework and command-line toolset.
https://rizin.re
GNU Lesser General Public License v3.0
2.71k stars 363 forks source link

Alllow to specify the "default" type for each size in SDB #4618

Open XVilka opened 2 months ago

XVilka commented 2 months ago

Currently, if Rizin needs to flip the sign of the type during the analysis using the rz_type_integral_set_sign() function, it calls internally rz_type_typeclass_get_default_sized() which internally just chooses first type of the selected typeclass and size without any preference, thus it largely depends on the loading order. We should find a way to specify the "defaultness" property of the type somehow. Maybe by introducing a new typeclass Default?

If we introduce new Defaullt typeclass, then the parser and code in librz/type/typeclass.c should be changed to allow the sum of typeclasses, e.g. Signed Integral + Default where it belongs to exactly two typeclasses: Signed Integral and Default.

wargio commented 2 months ago

yes it should. ghidra has those unknown8/16/32/64

wargio commented 2 months ago

check what the clangd language server does for this.

XVilka commented 2 months ago

yes it should. ghidra has those unknown8/16/32/64

We already have unknown_t, it's not a problem. Problem that the default should be either intXX_t or uintXX_t or float depending on the sign and typeclass.