Code Prover and Bug Finder finding race condition bug problem.
1 view (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
See Also
Categories
Find more on Bug Finder Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!