Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
  • linux
  • kernel
  • trace
  • trace.c
Find file BlameHistoryPermalink
  • Ye Bin's avatar
    tracing/probes: support '%pD' type for print struct file's name · 20fe4d07
    Ye Bin authored Mar 22, 2024
    As like '%pd' type, this patch supports print type '%pD' for print file's
    name. For example "name=$arg1:%pD" casts the `$arg1` as (struct file*),
    dereferences the "file.f_path.dentry.d_name.name" field and stores it to
    "name" argument as a kernel string.
    Here is an example:
    [tracing]# echo 'p:testprobe vfs_read name=$arg1:%pD' > kprobe_event
    [tracing]# echo 1 > events/kprobes/testprobe/enable
    [tracing]# grep -q "1" events/kprobes/testprobe/enable
    [tracing]# echo 0 > events/kprobes/testprobe/enable
    [tracing]# grep "vfs_read" trace | grep "enable"
                grep-15108   [003] .....  5228.328609: testprobe: (vfs_read+0x4/0xbb0) name="enable"
    
    Note that this expects the given argument (e.g. $arg1) is an address of struct
    file. User must ensure it.
    
    Link: https://lore.kernel.org/all/20240322064308.284457-3-yebin10@huawei.com/
    
    
    [Masami: replaced "previous patch" with '%pd' type]
    
    Signed-off-by: default avatarYe Bin <yebin10@huawei.com>
    Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
    20fe4d07
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7