lkml.org 
[lkml]   [2013]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v5 04/20] scripts/gdb: Add module iteration helper
    Date
    Will soon be used for loading symbols, printing global variables or
    listing modules.

    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    ---
    scripts/gdb/module.py | 28 ++++++++++++++++++++++++++++
    1 files changed, 28 insertions(+), 0 deletions(-)
    create mode 100644 scripts/gdb/module.py

    diff --git a/scripts/gdb/module.py b/scripts/gdb/module.py
    new file mode 100644
    index 0000000..01b23df
    --- /dev/null
    +++ b/scripts/gdb/module.py
    @@ -0,0 +1,28 @@
    +#
    +# gdb helper commands and functions for Linux kernel debugging
    +#
    +# module tools
    +#
    +# Copyright (c) Siemens AG, 2013
    +#
    +# Authors:
    +# Jan Kiszka <jan.kiszka@siemens.com>
    +#
    +# This work is licensed under the terms of the GNU GPL version 2.
    +#
    +
    +import gdb
    +
    +from utils import *
    +
    +module_type = CachedType("struct module")
    +
    +def for_each_module(func, arg = None):
    + global module_type
    + module_ptr_type = module_type.get_type().pointer()
    + modules = gdb.parse_and_eval("modules")
    + entry = modules['next']
    + while entry != modules.address:
    + module = container_of(entry, module_ptr_type, "list")
    + func(module, arg)
    + entry = entry['next']
    --
    1.7.3.4


    \
     
     \ /
      Last update: 2013-01-29 15:21    [W:4.031 / U:0.780 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site