필터 지우기
필터 지우기

Code Prover and Bug Finder finding race condition bug problem.

조회 수: 4 (최근 30일)
Husnu umut Okur
Husnu umut Okur 2023년 1월 7일
댓글: Husnu umut Okur 2023년 1월 13일
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.

답변 (1개)

Anirban
Anirban 2023년 1월 9일
You can see which structure field is accessed on the Variable Access pane.
For more information, see Variable Access.
  댓글 수: 1
Husnu umut Okur
Husnu umut Okur 2023년 1월 13일
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 ?

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by