2 * Copyright 2023 Linaro Ltd.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
19 #include "smatch_slist.h"
25 bool task_not_running(void)
27 if (has_possible_state(my_id
, "task_state", NULL
, ¬_running
))
32 static void state_change_hook(struct expression
*expr
, const char *str
)
34 if (strcmp(str
, "not_running") == 0)
35 set_state(my_id
, "task_state", NULL
, ¬_running
);
37 set_state(my_id
, "task_state", NULL
, &undefined
);
40 static void called_not_running(const char *name
, struct symbol
*sym
, char *key
, char *value
)
42 set_state(my_id
, "task_state", NULL
, ¬_running
);
45 static void match_call_info(struct expression
*expr
)
47 if (task_not_running())
48 sql_insert_caller_info(expr
, TASK_NOT_RUNNING
, -2, "", "");
51 void register_kernel_task_state(int id
)
55 if (option_project
!= PROJ_KERNEL
)
58 add_set_current_state_hook(state_change_hook
);
59 select_caller_info_hook(&called_not_running
, TASK_NOT_RUNNING
);
60 add_hook(&match_call_info
, FUNCTION_CALL_HOOK
);