Function report |
Source Code:kernel\trace\trace_kprobe.c |
Create Date:2022-07-28 12:39:33 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:trace_kprobe_create
Proto:static int trace_kprobe_create(int argc, const char *argv[])
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| int | argc | |
| const char * | argv |
| 736 | struct trace_kprobe * tk = NULL |
| 737 | ret = 0 |
| 738 | bool is_return = false |
| 740 | event = NULL , group = KPROBE_EVENT_SYSTEM |
| 741 | maxactive = 0 |
| 742 | offset = 0 |
| 743 | void * addr = NULL |
| 745 | flags = TPARG_FL_KERNEL |
| 748 | Case argv[0][0] == 'r' |
| 752 | Case argv[0][0] == 'p' |
| 753 | Break |
| 754 | Default |
| 755 | Return -ECANCELED |
| 760 | trace_probe_log_init("trace_kprobe", argc, argv) |
| 762 | event = strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for |
| 767 | If Not is_return Then |
| 768 | trace_probe_log_err(1, MAXACT_NO_KPROBE) |
| 769 | Go to parse_error |
| 775 | If len > MAX_EVENT_NAME_LEN - 1 Then |
| 776 | trace_probe_log_err(1, BAD_MAXACT) |
| 777 | Go to parse_error |
| 779 | No 3D Now!(buf, & argv[0][1], len) |
| 783 | trace_probe_log_err(1, BAD_MAXACT) |
| 784 | Go to parse_error |
| 789 | If maxactive > KRETPROBE_MAXACTIVE_MAX Then |
| 790 | trace_probe_log_err(1, MAXACT_TOO_BIG) |
| 791 | Go to parse_error |
| 798 | trace_probe_log_set_index(1) |
| 805 | symbol = kstrdup(argv[1], GFP_KERNEL) |
| 809 | ret = traceprobe_split_symbol_offset(symbol, & offset) |
| 811 | trace_probe_log_err(0, BAD_PROBE_ADDR) |
| 812 | Go to parse_error |
| 814 | If kprobe_on_func_entry(NULL, symbol, offset) Then flags |= TPARG_FL_FENTRY |
| 816 | If offset && is_return && Not (flags & TPARG_FL_FENTRY) Then |
| 817 | trace_probe_log_err(0, BAD_RETPROBE) |
| 818 | Go to parse_error |
| 822 | trace_probe_log_set_index(0) |
| 823 | If event Then |
| 826 | If ret Then Go to parse_error |
| 828 | Else |
| 849 | argc -= 2 |
| 849 | argv += 2 |
| 852 | When i < argc && i < MAX_TRACE_ARGS cycle |
| 866 | ret = traceprobe_set_print_fmt( & tp, is_return) |
| 871 | If ret Then |
| 872 | trace_probe_log_set_index(1) |
| 873 | If ret == -EILSEQ Then trace_probe_log_err(0, BAD_INSN_BNDRY) |
| 875 | Else if ret == -ENOENT Then trace_probe_log_err(0, BAD_PROBE_ADDR) |
| 877 | Else if ret != -ENOMEM && ret != -EEXIST Then trace_probe_log_err(0, FAIL_REG_PROBE) |
| 879 | Go to error |
| 882 | out : |
| 883 | trace_probe_log_clear() |
| 885 | Return ret |
| 887 | parse_error : |
| 889 | error : |
| 890 | free_trace_kprobe(tk) |
| 891 | Go to out |
| Name | Describe |
|---|---|
| create_or_delete_trace_kprobe |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |