## 3 Preparations for Fault Localization
### Data Analysis
#### 3.3.2 Computation of Memory-Updated Information  
The HiL tests require a periodic memory dump to trace the running software. Because the tester is prohibited from using additional storage space inside the ECU for testing, we previously developed a method to transfer large amounts of data while taking into account the communication load of an ECU [21]. Using this method, the memory sections for variables can be dumped periodically without data loss and beyond the bandwidth of CAN. The memory data of the k-th dump is defined as a k-frame at the interval of the period T of the main task of the system from the 0-frame in Equation (1) and is represented by \(\mathrm{F_{k}}\). \[\mathrm{F_{k}}\equiv\{\forall V_{A,\,k}\,\mathrm{V_{A,\,k}}\text{ is the value of the address A at time T }\times\mathrm{k};\,\mathrm{k}\text{ is an index number}\} \tag{1}\]  
\(\mathrm{F_{k}}\) is a set of values corresponding to each address at the point of dumping. Therefore, \(\mathrm{F_{k}}\) can be regarded as a memory snapshot at the k-th point. The ECU state at a specific point can be confirmed using this memory snapshot. By examining the values of memory stored in the frame, we can trace the ECU states at time intervals. A change in value in a specific address means that a new value has been updated to that location. This indicates that the symbol corresponding to that address was used as a left-hand side variable in the program. Accordingly, \"MU (Memory Updated)\" is defined as Equation (2):  
\[\mathrm{MU_{A,\,k}}=\left\{ \begin{array}{ll}1,\ V_{A,\,k-1}\
eq V_{A,\,k}\\ 0,\ V_{A,\,k-1}=V_{A,\,k}\end{array} ;\,\mathrm{k}\text{ is a frame}-\text{ index number}\right. \tag{2}\]  
In Equation (2), the memory updated (\(\mathrm{MU_{A,\,k}}\)) compares \(V_{A,\,k-1}\) with \(V_{A,\,k}\). If both values are equal, the value is 0; otherwise, the value is 1. If \(\mathrm{MU_{A,\,k}}\) is 1, it means that the address A is updated in the k-frame and that the ECU has performed an operation related to the address A. By accumulating the MU between specific ranges, we know how frequent the address is used. We refer to it as the memory-updated frequency (\(\mathrm{MU_{A,\,R}}\)) which is defined as shown in Equation (3). \[\mathrm{MU_{A,\,R}}=\sum_{k=R.start}^{R.end}\mathrm{MU_{A,\,k}};\,\mathrm{R }\text{ is a set of the frame index between R.start and R.end} \tag{3}\]  
\(\mathrm{MU_{A,\,R}}\) represents the number of times the updates occurred from the range of the R.start to the R.end of the frame index to which address A is to be observed. If we trace the \(\mathrm{MU_{A,\,R}}\) for each address, we can know the addresses used during the operations that are performed over the specific frame range (R). Equation (4) defines the memory data (\(\mathrm{MD_{A,\,R}}\)) using the previous equation. In Equation (4), memory data (\(\mathrm{MD_{A,\,R}}\)) includes the address A, the update frequency of the address in the range R of the frame observed (\(\mathrm{MU_{A,\,R}}\)) and the value set of each frame of the address. We define memory-updated information (\(\mathrm{MUI}\)) as shown in Equation (5), together with the symbol name (\(\mathrm{Sym_{A}}\)) of the address A obtained by static analysis and \(\mathrm{MD_{A,\,R}}\). \[\mathrm{MD_{A,\,R}}\ \equiv\ \{\mathrm{A,\,MUF_{A,\,R}},\,\{\mathrm{V_{A,\,k}} \}|\mathrm{k}\ \in\mathrm{R}\} \tag{4}\]\[\text{MUI}_{\text{A, R}}\;\equiv\;\left\{\left(\text{MD}_{\text{A, R}},\;\text{Sym}_{\text{A}}\right)\; \begin{array}{c}\text{Sym}_{ \text{A}}\text{ is the symbol name of the address A},\\ \text{R is a set of the frame index}\end{array} \right\} \tag{5}\]  
Algorithm 1 shows an algorithm for generating MUI. In line 7-12, the update is determined by the change of the value in each frame according to Equation (2) and the update frequency is calculated in line 13 how many times the value has changed in the full range according to Equation (3). For the updated memory according to Equations (4) and (5), the symbol, the address, the update frequency and the values in each frame are stored as line 15.