Using Frama-C, I am trying to slice just one source code as follows:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
typedef struct
{
int event;
int status;
int* msg;
}pbBLEEvt_t;
int msgq_receive(pbBLEEvt_t *buff);
void PB_Main_event_send(int, int, void*);
static int PB_ble_ps_state = 0;
static void PB_PacketProcess_IDLE_STATE(int *buf) {
int service_id = buf[0];
switch (service_id) {
case 5:
PB_Main_event_send(0, 0, ((void *)0));
break;
default:
break;
}
}
static void PB_IncomingPacketHandler(int *buf) {
switch (PB_ble_ps_state) {
case 3:
task_sleep(100);
break;
case 4:
PB_PacketProcess_IDLE_STATE(buf);
break;
default:
break;
}
}
void PB_ble_control_task(void * arg) {
int r;
pbBLEEvt_t BLE_msgRxBuffer;
for(;;) {
r = msgq_receive(&BLE_msgRxBuffer);
switch(BLE_msgRxBuffer.event) {
case 1 :
switch(BLE_msgRxBuffer.status) {
case 2 :
PB_IncomingPacketHandler(BLE_msgRxBuffer.msg);
break;
default:
break;
}
default:
break;
}
}
}
The slice command is the following:
SOURCE="test.c"
MAIN="PB_ble_control_task"
CALLS="PB_Main_event_send"
OUTPUT="framac_output.c"
frama-c -c11 $SOURCE -lib-entry -main $MAIN -slice-calls $CALLS -slicing-level 2 \
-then-on 'Slicing export' -print -ocode $OUTPUT \
2>&1 | tee framac_msg
I found the following frama-c message:
[from] Non-terminating function PB_PacketProcess_IDLE_STATE (no dependencies)
When I change the local variable of "BLE_msgRxBuffer" in the PB_ble_control_task() function into a global variable, I obtained a sliced code that I wanted.
- What does the message of "no dependencies" mean?
- Why did I obtain the sliced code that I wanted after changing the local variable of "BLE_msgRxBuffer" in the PB_ble_control_task() function into a global variable?