Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\trace\trace_probe.c Create Date:2022-07-28 12:42:49
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Recursive argument parser

Proto:static int parse_probe_arg(char *arg, const struct fetch_type *type, struct fetch_insn **pcode, struct fetch_insn *end, unsigned int flags, int offs)

Type:int

Parameter:

TypeParameterName
char *arg
const struct fetch_type *type
struct fetch_insn **pcode
struct fetch_insn *end
unsigned intflags
intoffs
358  code = pcode
360  deref = Dereference: .offset
361  offset = 0
363  ret = 0
366  Case arg[0] == '$'
367  ret = parse_probe_vars(arg + 1, type, code, flags, offs)
368  Break
370  Case arg[0] == '%'
371  ret = gs_query_register_offset() - query register offset from its name*@name: the name of a register* regs_query_register_offset() returns the offset of a register in struct* pt_regs from its name. If the name is invalid, this returns -EINVAL;
372  If ret >= 0 Then
374  param = ret
375  ret = 0
376  Else trace_probe_log_err(offs, BAD_REG_NAME)
378  Break
380  Case arg[0] == '@'
381  If isdigit(arg[1]) Then
383  If ret Then
385  Break
389  immediate = param
390  Else if arg[1] == '+' Then
392  If flags & TPARG_FL_KERNEL Then
397  If ret Then
399  Break
403  immediate = offset
404  Else
406  If Not (flags & TPARG_FL_KERNEL) Then
412  data = kstrdup(arg + 1, GFP_KERNEL)
413  If Not data Then Return -ENOMEM
415  If ++code == end Then
420  immediate = 0
423  If ++code == end Then
425  Return -EINVAL
427  pcode = code
428  op = Dereference: .offset
429  offset = offset
430  Break
432  Case arg[0] == '+'
433  Case arg[0] == '-'
434  If arg[1] == 'u' Then
436  arg[1] = arg[0]
437  arg++
439  If arg[0] == '+' Then arg++
441  tmp = 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
442  If Not tmp Then
444  Return -EINVAL
446  tmp = '\0'
447  ret = kstrtol - convert a string to a long*@s: The start of the string. The string must be null-terminated, and may also* include a single newline before its terminating null. The first character* may also be a plus sign or a minus sign.
448  If ret Then
450  Break
452  offs += tmp + 1 - arg + If arg[0] != '-' Then 1 Else 0
453  arg = tmp + 1
454  tmp = strrchr - Find the last occurrence of a character in a string*@s: The string to be searched*@c: The character to search for
455  If Not tmp Then
458  Return -EINVAL
459  Else
460  t2 = find_fetch_type(NULL)
462  tmp = '\0'
464  If ret Then Break
471  If ++code == end Then
475  pcode = code
477  op = deref
478  offset = offset
480  Break
481  Case arg[0] == '\\'
482  If arg[1] == '"' Then
483  ret = __parse_imm_string(arg + 2, & tmp, offs + 2)
484  If ret Then Break
487  data = tmp
488  Else
489  ret = str_to_immediate(arg + 1, & immediate)
490  If ret Then trace_probe_log_err(offs + 1, BAD_IMM)
495  Break
497  If Not ret && op == FETCH_OP_NOP Then
499  trace_probe_log_err(offs, BAD_FETCH_ARG)
500  ret = -EINVAL
502  Return ret
Caller
NameDescribe
parse_probe_argRecursive argument parser
traceprobe_parse_probe_arg_bodyString length checking wrapper