Code Prover and Bug Finder finding race condition bug problem.

1 visualizzazione (ultimi 30 giorni)
typedef struct
{
uint8_ t var_u8;
uint16_t var_u16;
uint32_t var_u32;
}global_struct;
% Global Variables
global_struct gs;
uint32_t global_variable = 0;
void increment(uint32_t* i)
{
(*i)++;
}
void Task_1(void)
{
while(1)
{
global_variable++;
increment(&gs.var_u32);
}
}
void Task_2(void)
{
while(1)
{
global_variable++;
increment(&gs.var_u32);
}
}
In the code above we run bug finder and code prover. After completing the analysis bug finder finds only global_variable++ using task1 and task2 race condition.
Code prover finds same error as an protected variable in orange check for global_variable and also finds same error in inside of increment function. Eventhough code prover finding error it shows error on gs struct but it does not point the variable which inside of gs struct(var_u8, var_16, var_u32). That is not enough to understand for error in which variable. How can i find the exactly error inside of the struct ? Is there any sample of this kind of code ?
Note: I followed documentation for all the configuration. In multitasking, i defined my tasks, interrupts and critical sections.

Risposte (1)

Anirban
Anirban il 9 Gen 2023
You can see which structure field is accessed on the Variable Access pane.
For more information, see Variable Access.
  1 Commento
Husnu umut Okur
Husnu umut Okur il 13 Gen 2023
Hello Mr.Anirban,
Yes it shows Variable Access but it is not enough for my project because in my project it shows variable which can be cause for error but it does not show that variable used in which function and where ?

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by