Skip to content
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

Refactor all base type accesses to use the RzAnalysisBaseType API #368

Closed
thestr4ng3r opened this issue Jan 16, 2021 · 1 comment
Closed
Assignees
Labels
refactor Refactoring requests RzType
Milestone

Comments

@thestr4ng3r
Copy link
Member

thestr4ng3r commented Jan 16, 2021

The RzAnalysisBaseType API designed in last year's gsoc is the only way that the base types should be accessed:

RZ_API RzAnalysisBaseType *rz_analysis_get_base_type(RzAnalysis *analysis, const char *name);
RZ_API void rz_parse_pdb_types(const RzAnalysis *analysis, const RzPdb *pdb);
RZ_API void rz_analysis_save_base_type(const RzAnalysis *analysis, const RzAnalysisBaseType *type);
RZ_API void rz_analysis_base_type_free(RzAnalysisBaseType *type);
RZ_API RzAnalysisBaseType *rz_analysis_base_type_new(RzAnalysisBaseTypeKind kind);
RZ_API void rz_analysis_dwarf_process_info(const RzAnalysis *analysis, RzAnalysisDwarfContext *ctx);
RZ_API void rz_analysis_dwarf_integrate_functions(RzAnalysis *analysis, RzFlag *flags, Sdb *dwarf_sdb);

Currently there may be some accesses that still access the sdb directly and there are some other functions here:

RZ_API int rz_type_set(Sdb *TDB, ut64 at, const char *field, ut64 val);
RZ_API void rz_type_del(Sdb *TDB, const char *name);
RZ_API int rz_type_kind(Sdb *TDB, const char *name);
RZ_API char *rz_type_enum_member(Sdb *TDB, const char *name, const char *member, ut64 val);
RZ_API char *rz_type_enum_getbitfield(Sdb *TDB, const char *name, ut64 val);
RZ_API RzList* rz_type_get_enum (Sdb *TDB, const char *name);
RZ_API ut64 rz_type_get_bitsize (Sdb *TDB, const char *type);
RZ_API RzList* rz_type_get_by_offset(Sdb *TDB, ut64 offset);
RZ_API char *rz_type_get_struct_memb(Sdb *TDB, const char *type, int offset);
RZ_API char *rz_type_link_at (Sdb *TDB, ut64 addr);
RZ_API int rz_type_set_link (Sdb *TDB, const char *val, ut64 addr);
RZ_API int rz_type_unlink(Sdb *TDB, ut64 addr);
RZ_API int rz_type_link_offset (Sdb *TDB, const char *val, ut64 addr);
RZ_API char *rz_type_format(Sdb *TDB, const char *t);

All such cases shall be refactored to use only the new api above to completely abstract them away from sdb.

As explained in the end of the description in #369, it might be helpful to do this partially in parallel with it.

@XVilka
Copy link
Member

XVilka commented Apr 19, 2021

I think this one can be closed, since all sdb_types accesses are already isolated in RzTypes and now are part of the #371 and #275

@XVilka XVilka closed this as completed Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactoring requests RzType
Projects
None yet
Development

No branches or pull requests

2 participants