13 Apr, 2012

2 commits

  • commit 3751d3e85cf693e10e2c47c03c8caa65e171099b upstream.

    There has long been a limitation using software breakpoints with a
    kernel compiled with CONFIG_DEBUG_RODATA going back to 2.6.26. For
    this particular patch, it will apply cleanly and has been tested all
    the way back to 2.6.36.

    The kprobes code uses the text_poke() function which accommodates
    writing a breakpoint into a read-only page. The x86 kgdb code can
    solve the problem similarly by overriding the default breakpoint
    set/remove routines and using text_poke() directly.

    The x86 kgdb code will first attempt to use the traditional
    probe_kernel_write(), and next try using a the text_poke() function.
    The break point install method is tracked such that the correct break
    point removal routine will get called later on.

    Cc: x86@kernel.org
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: H. Peter Anvin
    Inspried-by: Masami Hiramatsu
    Signed-off-by: Jason Wessel
    Signed-off-by: Greg Kroah-Hartman

    Jason Wessel
     
  • commit 98b54aa1a2241b59372468bd1e9c2d207bdba54b upstream.

    There is extra state information that needs to be exposed in the
    kgdb_bpt structure for tracking how a breakpoint was installed. The
    debug_core only uses the the probe_kernel_write() to install
    breakpoints, but this is not enough for all the archs. Some arch such
    as x86 need to use text_poke() in order to install a breakpoint into a
    read only page.

    Passing the kgdb_bpt structure to kgdb_arch_set_breakpoint() and
    kgdb_arch_remove_breakpoint() allows other archs to set the type
    variable which indicates how the breakpoint was installed.

    Signed-off-by: Jason Wessel
    Signed-off-by: Greg Kroah-Hartman

    Jason Wessel
     

27 Jul, 2011

1 commit

  • This allows us to move duplicated code in
    (atomic_inc_not_zero() for now) to

    Signed-off-by: Arun Sharma
    Reviewed-by: Eric Dumazet
    Cc: Ingo Molnar
    Cc: David Miller
    Cc: Eric Dumazet
    Acked-by: Mike Frysinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arun Sharma
     

19 Mar, 2011

1 commit

  • Notify GDB of the machine halting, rebooting or powering off by sending it an
    exited command (remote protocol command 'W'). This is done by calling:

    void gdbstub_exit(int status)

    from the arch's machine_{halt,restart,power_off}() functions with an
    appropriate exit status to be reported to GDB.

    Signed-off-by: David Howells

    David Howells
     

30 Oct, 2010

1 commit

  • The kgdb_disable_hw_debug() was an architecture specific function for
    disabling all hardware breakpoints on a per cpu basis when entering
    the debug core.

    This patch will remove the weak function kdbg_disable_hw_debug() and
    change it into a call back which lives with the rest of hw breakpoint
    call backs in struct kgdb_arch.

    Signed-off-by: Dongdong Deng
    Signed-off-by: Jason Wessel

    Dongdong Deng
     

05 Aug, 2010

2 commits

  • The gdbserial 'p' and 'P' packets allow gdb to individually get and
    set registers instead of querying for all the available registers.

    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • The kdb shell specification includes the ability to get and set
    architecture specific registers by name.

    For the time being individual register get and set will be implemented
    on a per architecture basis. If an architecture defines
    DBG_MAX_REG_NUM > 0 then kdb and the gdbstub will use the capability
    for individually getting and setting architecture specific registers.

    Signed-off-by: Jason Wessel

    Jason Wessel
     

21 May, 2010

8 commits

  • The kernel debugger can operate well before mm_init(), but the x86
    hardware breakpoint code which uses the perf api requires that the
    kernel allocators are initialized.

    This means the kernel debug core needs to provide an optional arch
    specific call back to allow the initialization functions to run after
    the kernel has been further initialized.

    The kdb shell already had a similar restriction with an early
    initialization and late initialization. The kdb_init() was moved into
    the debug core's version of the late init which is called
    dbg_late_init();

    CC: kgdb-bugreport@lists.sourceforge.net
    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • If kdb is open on a serial port that is not actually a console make
    sure to call the poll routines to emit and receive characters.

    Signed-off-by: Jason Wessel
    Acked-by: Martin Hicks

    Jason Wessel
     
  • Some kgdb I/O modules require the ability to create a breakpoint
    tasklet, such as kgdboc and external modules such as kgdboe. The
    breakpoint tasklet is used as an asynchronous entry point into the
    debugger which will have a different function scope than the current
    execution path where it might not be safe to have an inline
    breakpoint. This is true of some of the kgdb I/O drivers which share
    code with kgdb and rest of the kernel users.

    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • The only way the debugger can handle a trap in inside rcu_lock,
    notify_die, or atomic_notifier_call_chain without a triple fault is
    to have a low level "first opportunity handler" in the int3 exception
    handler.

    Generally this will be something the vast majority of folks will not
    need, but for those who need it, it is added as a kernel .config
    option called KGDB_LOW_LEVEL_TRAP.

    CC: Ingo Molnar
    CC: Thomas Gleixner
    CC: H. Peter Anvin
    CC: x86@kernel.org
    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • Remove all the references to the kgdb_post_primary_code. This
    function serves no useful purpose because you can obtain the same
    information from the "struct kgdb_state *ks" from with in the
    debugger, if for some reason you want the data.

    Also remove the unintentional duplicate assignment for ks->ex_vector.

    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • Update the kgdb docs to reflect the new directory structure and API.

    Merge in the kdb shell information.

    [Randy Dunlap : grammatical corrections]

    CC: Randy Dunlap
    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • These are the minimum changes to the kgdb core in order to enable an
    API to connect a new front end (kdb) to the debug core.

    This patch introduces the dbg_kdb_mode variable controls where the
    user level I/O is routed. It will be routed to the gdbstub (kgdb) or
    to the kdb front end which is a simple shell available over the kgdboc
    connection.

    You can switch back and forth between kdb or the gdb stub mode of
    operation dynamically. From gdb stub mode you can blindly type
    "$3#33", or from the kdb mode you can enter "kgdb" to switch to the
    gdb stub.

    The logic in the debug core depends on kdb to look for the typical gdb
    connection sequences and return immediately with KGDB_PASS_EVENT if a
    gdb serial command sequence is detected. That should allow a
    reasonably seamless transition between kdb -> gdb without leaving the
    kernel exception state. The two gdb serial queries that kdb is
    responsible for detecting are the "?" and "qSupported" packets.

    CC: Ingo Molnar
    Signed-off-by: Jason Wessel
    Acked-by: Martin Hicks

    Jason Wessel
     
  • Split the former kernel/kgdb.c into debug_core.c which contains the
    kernel debugger exception logic and to the gdbstub.c which contains
    the logic for allowing gdb to talk to the debug core.

    This also created a private include file called debug_core.h which
    contains all the definitions to glue the debug_core to any other
    debugger connections.

    CC: Ingo Molnar
    Signed-off-by: Jason Wessel

    Jason Wessel
     

08 Jan, 2010

1 commit


05 May, 2008

1 commit

  • Noticed by sparse:
    arch/x86/kernel/kgdb.c:556:15: warning: symbol 'kgdb_arch_pc' was not declared. Should it be static?
    kernel/kgdb.c:149:8: warning: symbol 'kgdb_do_roundup' was not declared. Should it be static?
    kernel/kgdb.c:193:22: warning: symbol 'kgdb_arch_pc' was not declared. Should it be static?
    kernel/kgdb.c:712:5: warning: symbol 'remove_all_break' was not declared. Should it be static?

    Related to kgdb_hex2long:
    arch/x86/kernel/kgdb.c:371:28: warning: incorrect type in argument 2 (different signedness)
    arch/x86/kernel/kgdb.c:371:28: expected long *long_val
    arch/x86/kernel/kgdb.c:371:28: got unsigned long *
    kernel/kgdb.c:469:27: warning: incorrect type in argument 2 (different signedness)
    kernel/kgdb.c:469:27: expected long *long_val
    kernel/kgdb.c:469:27: got unsigned long *
    kernel/kgdb.c:470:27: warning: incorrect type in argument 2 (different signedness)
    kernel/kgdb.c:470:27: expected long *long_val
    kernel/kgdb.c:470:27: got unsigned long *
    kernel/kgdb.c:894:27: warning: incorrect type in argument 2 (different signedness)
    kernel/kgdb.c:894:27: expected long *long_val
    kernel/kgdb.c:894:27: got unsigned long *
    kernel/kgdb.c:895:27: warning: incorrect type in argument 2 (different signedness)
    kernel/kgdb.c:895:27: expected long *long_val
    kernel/kgdb.c:895:27: got unsigned long *
    kernel/kgdb.c:1127:28: warning: incorrect type in argument 2 (different signedness)
    kernel/kgdb.c:1127:28: expected long *long_val
    kernel/kgdb.c:1127:28: got unsigned long *
    kernel/kgdb.c:1132:25: warning: incorrect type in argument 2 (different signedness)
    kernel/kgdb.c:1132:25: expected long *long_val
    kernel/kgdb.c:1132:25: got unsigned long *

    Signed-off-by: Harvey Harrison
    Signed-off-by: Jason Wessel

    Harvey Harrison
     

18 Apr, 2008

2 commits

  • Add in the kgdb documentation for kgdb.

    Signed-off-by: Jason Wessel
    Signed-off-by: Ingo Molnar

    Jason Wessel
     
  • kgdb core code. Handles the protocol and the arch details.

    [ mingo@elte.hu: heavily modified, simplified and cleaned up. ]
    [ xemul@openvz.org: use find_task_by_pid_ns ]

    Signed-off-by: Jason Wessel
    Signed-off-by: Ingo Molnar
    Signed-off-by: Jan Kiszka
    Reviewed-by: Thomas Gleixner

    Jason Wessel