PBD icon indicating copy to clipboard operation
PBD copied to clipboard

Union/Structure Analysis

Open Theldus opened this issue 4 years ago • 0 comments

Description

PBD lacks structures and unions analysis at the moment. Since structures could go arbitrarily deep (like a tree of structs) the dwarf analysis must be changed to accommodate these changes and, at the moment, the inner code -- that does the dwarf analysis -- do not have the proper data structure to handle this.

Some proposed approaches: 1. Recursively parses the structure and for each base type found add into the variables list (as a common variable, instead of a structure item) with the proper variable location calculated too. This approach is 'reasonably' good: 1) require 'few' changes in dwarf analysis stage and 2) requires no changes (or very few) in the variables check stage.

Although good, since each variable member is dealt with as a simple variable, a huge structure could be penalized in terms of performance.

2. During dwarf analysis: create an auxiliary data structure that holds each variable location and uses it in the variable check stage. Although this method requires more change in both (dwarf and variable check) stages, this approach can lead to a more performative code since the entire structure could be scanned as a 'huge' single type, and in case of changes, the offset is searched in this auxiliary data structure.

*Unions analysis implies all the above statements and also: how can I format the output on the screen? If a union holds multiples data types, what data type should be used?

Anyways, any help in that sense is welcome, ;-).

Theldus avatar Nov 22 '19 20:11 Theldus