18 Feb, 2015

7 commits

  • This function allows to obtain a per-cpu variable, either of the current
    or an explicitly specified CPU.

    Note: sparc64 version is untested.

    Signed-off-by: Jan Kiszka
    Cc: "David S. Miller"
    Cc: Thomas Gleixner
    Cc: Jason Wessel
    Cc: Andi Kleen
    Cc: Ben Widawsky
    Cc: Borislav Petkov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kiszka
     
  • Add the helper task_by_pid that can look up a task by its PID. Also
    export it as a convenience function.

    Signed-off-by: Jan Kiszka
    Cc: Thomas Gleixner
    Cc: Jason Wessel
    Cc: Andi Kleen
    Cc: Ben Widawsky
    Cc: Borislav Petkov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kiszka
     
  • This pokes into the log buffer of the debugged kernel, dumping it to the
    gdb console. Helping in case the target should or can no longer execute
    dmesg itself.

    Signed-off-by: Jan Kiszka
    Cc: Kay Sievers
    Cc: Thomas Gleixner
    Cc: Jason Wessel
    Cc: Andi Kleen
    Cc: Ben Widawsky
    Cc: Borislav Petkov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kiszka
     
  • Add the internal helper get_module_by_name to obtain the module structure
    corresponding to the given name. Also export this service as a
    convenience function.

    Signed-off-by: Jan Kiszka
    Cc: Thomas Gleixner
    Cc: Jason Wessel
    Cc: Andi Kleen
    Cc: Ben Widawsky
    Cc: Borislav Petkov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kiszka
     
  • This is probably the most useful helper when debugging kernel modules:
    lx-symbols first reloads vmlinux. Then it searches recursively for *.ko
    files in the specified paths and the current directory. Finally it walks
    the kernel's module list, issuing the necessary add-symbol-file command
    for each loaded module so that gdb knows which module symbol corresponds
    to which address. It also looks up variable sections (bss, data, rodata)
    and appends their address to the add-symbole-file command line. This
    allows to access global module variables just like any other variable.

    Signed-off-by: Jan Kiszka
    Cc: Thomas Gleixner
    Cc: Jason Wessel
    Cc: Andi Kleen
    Cc: Ben Widawsky
    Cc: Borislav Petkov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kiszka
     
  • Provide an internal helper with container_of semantics. As type lookups
    are very slow in gdb-python and we need a type "long" for this, cache the
    reference to this type object. Then export the helper also as a
    convenience function form use at the gdb command line.

    Signed-off-by: Jan Kiszka
    Cc: Thomas Gleixner
    Cc: Jason Wessel
    Cc: Andi Kleen
    Cc: Ben Widawsky
    Cc: Borislav Petkov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kiszka
     
  • This provides the basic infrastructure to load kernel-specific python
    helper scripts when debugging the kernel in gdb.

    The loading mechanism is based on gdb loading for -gdb.py when
    opening . Therefore, this places a corresponding link to the
    main helper script into the output directory that contains vmlinux.

    The main scripts will pull in submodules containing Linux specific gdb
    commands and functions. To avoid polluting the source directory with
    compiled python modules, we link to them from the object directory.

    Due to gdb.parse_and_eval and string redirection for gdb.execute, we
    depend on gdb >= 7.2.

    This feature is enabled via CONFIG_GDB_SCRIPTS.

    Signed-off-by: Jan Kiszka
    Acked-by: Michal Marek [kbuild stuff]
    Cc: Thomas Gleixner
    Cc: Jason Wessel
    Cc: Andi Kleen
    Cc: Ben Widawsky
    Cc: Borislav Petkov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kiszka