| Nowadays embedded system has been widely used in various fields,ranging from game player to aeronautics and space equipment.When it comes to embedded system,memory is viewed as precious resource.It is a common practice to use bit-field when appropriate to reduce the consumption of memory resource.However,developers tend to introduce some potential bugs to software without the knowledge of it due to the complexity of the memory layout,which necessitates the development of an automated testing system.DTS(Defect testing system)is a static code analysis tool,which takes advantage of interval analysis to track the interval values of variables in program.This paper proposes a bit-field oriented interval compute method,which achieves as follows:(1)propose a 'Variable-Location-Value' ternery abstract memory model based on the classification of structural regions.It is able to express complex data type including struct containing bit-field.Besides,it can precisely simulate almost all C semantics,such as pointer arithmetic operation,serialized pointer de-reference,type cast,variable scope and so on.(2)provide solutions to interval compute problem involving bit-filed,including sizeof operator,assignment operation,and bit manipulation.The author of this paper has successfully applied methods listed above to DTS.Through the verification of experiment,methods this paper provides can be used to detect defects introduced by the bad use of bit-filed in program,including numerical overflow,buffer overflow,and out-of-boundary access of array. |