5 * Dynamic Binary Instrumentation Module based on KProbes
6 * modules/driver/sspt/sspt_debug.h
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * Copyright (C) Samsung Electronics, 2013
24 * 2013 Vyacheslav Cherkashin <v.cherkashin@samsung.com>
28 static inline void print_jprobe(struct jprobe *jp)
30 printk("### JP: entry=%lx, pre_entry=%lx\n",
31 (unsigned long)jp->entry, (unsigned long)jp->pre_entry);
34 static inline void print_retprobe(struct uretprobe *rp)
36 printk("### RP: handler=%lx\n",
37 (unsigned long)rp->handler);
40 static inline void print_page_probes(const struct sspt_page *page)
45 printk("### offset=%lx\n", page->offset);
46 list_for_each_entry(ip, &page->ip_list, list) {
48 printk("### addr[%2d]=%lx, J_addr=%lx, R_addr=%lx\n",
49 i, (unsigned long)ip->offset, (unsigned long)ip->jprobe.up.kp.addr,
50 (unsigned long)ip->retprobe.up.kp.addr);
51 print_jprobe(&ip->jprobe);
52 print_retprobe(&ip->retprobe);
57 static inline void print_file_probes(const struct sspt_file *file)
60 unsigned long table_size;
61 struct sspt_page *page = NULL;
62 struct hlist_node *node = NULL;
63 struct hlist_head *head = NULL;
64 static unsigned char *NA = "N/A";
68 printk("### file_p == NULL\n");
72 table_size = (1 << file->page_probes_hash_bits);
73 name = (file->dentry) ? file->dentry->d_iname : NA;
75 printk("### print_file_probes: path=%s, d_iname=%s, table_size=%lu, vm_start=%lx\n",
76 file->name, name, table_size, file->vm_start);
78 for (i = 0; i < table_size; ++i) {
79 head = &file->page_probes_table[i];
80 swap_hlist_for_each_entry_rcu(page, node, head, hlist) {
81 print_page_probes(page);
86 static inline void print_proc_probes(const struct sspt_procs *procs)
88 struct sspt_file *file;
90 printk("### print_proc_probes\n");
91 list_for_each_entry(file, &procs->file_list, list) {
92 print_file_probes(file);
94 printk("### print_proc_probes\n");
97 static inline void print_inst_us_proc(const inst_us_proc_t *task_inst_info)
100 int cnt = task_inst_info->libs_count;
101 printk( "### BUNDLE PRINT START ###\n");
102 printk("\n### BUNDLE PRINT START ###\n");
103 printk("### task_inst_info.libs_count=%d\n", cnt);
105 for (i = 0; i < cnt; ++i) {
108 us_proc_lib_t *lib = &task_inst_info->p_libs[i];
109 int cnt_j = lib->ips_count;
110 char *path = lib->path;
111 printk("### path=%s, cnt_j=%d\n", path, cnt_j);
113 for (j = 0; j < cnt_j; ++j) {
114 us_proc_ip_t *ips = &lib->p_ips[j];
115 unsigned long offset = ips->offset;
116 printk("### offset=%lx\n", offset);
119 printk("### BUNDLE PRINT END ###\n");
122 #endif /* __SSPT_DEBUG__ */