CALLS edges from the nodes named src_name into nodes named tgt_name that * carry tgt_label: the name-only probes cannot tell the header Function from * its struct-member namesake. */
| 9073 | * carry tgt_label: the name-only probes cannot tell the header Function from |
| 9074 | * its struct-member namesake. */ |
| 9075 | static int labelled_call_count(cbm_store_t *s, const char *project, const char *src_name, |
| 9076 | const char *tgt_name, const char *tgt_label) { |
| 9077 | cbm_node_t *srcs = NULL; |
| 9078 | cbm_node_t *tgts = NULL; |
| 9079 | int sc = 0; |
| 9080 | int tc = 0; |
| 9081 | int n = 0; |
| 9082 | cbm_store_find_nodes_by_name(s, project, src_name, &srcs, &sc); |
| 9083 | cbm_store_find_nodes_by_name(s, project, tgt_name, &tgts, &tc); |
| 9084 | for (int i = 0; i < sc; i++) { |
| 9085 | cbm_edge_t *edges = NULL; |
| 9086 | int ec = 0; |
| 9087 | cbm_store_find_edges_by_source_type(s, srcs[i].id, "CALLS", &edges, &ec); |
| 9088 | for (int j = 0; j < ec; j++) { |
| 9089 | for (int k = 0; k < tc; k++) { |
| 9090 | if (edges[j].target_id == tgts[k].id && tgts[k].label && |
| 9091 | strcmp(tgts[k].label, tgt_label) == 0) { |
| 9092 | n++; |
| 9093 | } |
| 9094 | } |
| 9095 | } |
| 9096 | if (edges) { |
| 9097 | cbm_store_free_edges(edges, ec); |
| 9098 | } |
| 9099 | } |
| 9100 | if (srcs) { |
| 9101 | cbm_store_free_nodes(srcs, sc); |
| 9102 | } |
| 9103 | if (tgts) { |
| 9104 | cbm_store_free_nodes(tgts, tc); |
| 9105 | } |
| 9106 | return n; |
| 9107 | } |
| 9108 | |
| 9109 | TEST(pipeline_c_call_reaches_header_function_beside_field) { |
| 9110 | /* 2026-10-13 kernel audit: `put_page(page)` 345 -> 9 callers. The struct |
no test coverage detected