diff options
Diffstat (limited to 'scripts/gdb')
| -rw-r--r-- | scripts/gdb/linux/modules.py | 5 | ||||
| -rw-r--r-- | scripts/gdb/linux/proc.py | 41 | ||||
| -rw-r--r-- | scripts/gdb/linux/symbols.py | 2 | ||||
| -rw-r--r-- | scripts/gdb/vmlinux-gdb.py | 1 | 
4 files changed, 46 insertions, 3 deletions
| diff --git a/scripts/gdb/linux/modules.py b/scripts/gdb/linux/modules.py index 25db8cff44a2..0a35d6dbfb80 100644 --- a/scripts/gdb/linux/modules.py +++ b/scripts/gdb/linux/modules.py @@ -73,10 +73,11 @@ class LxLsmod(gdb.Command):                  "        " if utils.get_long_type().sizeof == 8 else ""))          for module in module_list(): +            layout = module['core_layout']              gdb.write("{address} {name:<19} {size:>8}  {ref}".format( -                address=str(module['module_core']).split()[0], +                address=str(layout['base']).split()[0],                  name=module['name'].string(), -                size=str(module['core_size']), +                size=str(layout['size']),                  ref=str(module['refcnt']['counter'])))              source_list = module['source_list'] diff --git a/scripts/gdb/linux/proc.py b/scripts/gdb/linux/proc.py new file mode 100644 index 000000000000..6e6709c1830c --- /dev/null +++ b/scripts/gdb/linux/proc.py @@ -0,0 +1,41 @@ +# +# gdb helper commands and functions for Linux kernel debugging +# +#  Kernel proc information reader +# +# Copyright (c) 2016 Linaro Ltd +# +# Authors: +#  Kieran Bingham <kieran.bingham@linaro.org> +# +# This work is licensed under the terms of the GNU GPL version 2. +# + +import gdb + + +class LxCmdLine(gdb.Command): +    """ Report the Linux Commandline used in the current kernel. +        Equivalent to cat /proc/cmdline on a running target""" + +    def __init__(self): +        super(LxCmdLine, self).__init__("lx-cmdline", gdb.COMMAND_DATA) + +    def invoke(self, arg, from_tty): +        gdb.write(gdb.parse_and_eval("saved_command_line").string() + "\n") + +LxCmdLine() + + +class LxVersion(gdb.Command): +    """ Report the Linux Version of the current kernel. +        Equivalent to cat /proc/version on a running target""" + +    def __init__(self): +        super(LxVersion, self).__init__("lx-version", gdb.COMMAND_DATA) + +    def invoke(self, arg, from_tty): +        # linux_banner should contain a newline +        gdb.write(gdb.parse_and_eval("linux_banner").string()) + +LxVersion() diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py index 627750cb420d..9a0f8923f67c 100644 --- a/scripts/gdb/linux/symbols.py +++ b/scripts/gdb/linux/symbols.py @@ -108,7 +108,7 @@ lx-symbols command."""      def load_module_symbols(self, module):          module_name = module['name'].string() -        module_addr = str(module['module_core']).split()[0] +        module_addr = str(module['core_layout']['base']).split()[0]          module_file = self._get_module_file(module_name)          if not module_file and not self.module_files_updated: diff --git a/scripts/gdb/vmlinux-gdb.py b/scripts/gdb/vmlinux-gdb.py index ce82bf5c3943..d5943eca19cd 100644 --- a/scripts/gdb/vmlinux-gdb.py +++ b/scripts/gdb/vmlinux-gdb.py @@ -29,3 +29,4 @@ else:      import linux.tasks      import linux.cpus      import linux.lists +    import linux.proc | 
