1. 01 8月, 2008 2 次提交
    • J
      kgdb: fix gdb serial thread queries · 25fc9999
      Jason Wessel 提交于
      The command "info threads" did not work correctly with kgdb.  It would
      result in a silent kernel hang if used.
      
      This patach addresses several problems.
       - Fix use of deprecated NR_CPUS
       - Fix kgdb to not walk linearly through the pid space
       - Correctly implement shadow pids
       - Change the threads per query to a #define
       - Fix kgdb_hex2long to work with negated values
      
      The threads 0 and -1 are reserved to represent the current task.  That
      means that CPU 0 will start with a shadow thread id of -2, and CPU 1
      will have a shadow thread id of -3, etc...
      
      From the debugger you can switch to a shadow thread to see what one of
      the other cpus was doing, however it is not possible to execute run
      control operations on any other cpu execept the cpu executing the
      kgdb_handle_exception().
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      25fc9999
    • J
      kgdb: fix kgdb_validate_break_address to perform a mem write · a9b60bf4
      Jason Wessel 提交于
      A regression to the kgdb core was found in the case of using the
      CONFIG_DEBUG_RODATA kernel option.  When this option is on, a breakpoint
      cannot be written into any readonly memory page.  When an external
      debugger requests a breakpoint to get set, the
      kgdb_validate_break_address() was only checking to see if the address
      to place the breakpoint was readable and lacked a write check.
      
      This patch changes the validate routine to try reading (via the
      breakpoint set request) and also to try immediately writing the break
      point.  If either fails, an error is correctly returned and the
      debugger behaves correctly.  Then an end user can make the
      descision to use hardware breakpoints.
      
      Also update the documentation to reflect that using
      CONFIG_DEBUG_RODATA will inhibit the use of software breakpoints.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      a9b60bf4
  2. 24 6月, 2008 1 次提交
  3. 29 5月, 2008 1 次提交
  4. 15 5月, 2008 1 次提交
  5. 05 5月, 2008 1 次提交
    • H
      kgdb: fix signedness mixmatches, add statics, add declaration to header · 688b744d
      Harvey Harrison 提交于
      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 *<noident>
      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 *<noident>
      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 *<noident>
      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 *<noident>
      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 *<noident>
      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 *<noident>
      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 *<noident>
      Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      688b744d
  6. 18 4月, 2008 8 次提交
    • J
      kgdb: always use icache flush for sw breakpoints · 1a9a3e76
      Jason Wessel 提交于
      On the ppc 4xx architecture the instruction cache must be flushed as
      well as the data cache.  This patch just makes it generic for all
      architectures where CACHE_FLUSH_IS_SAFE is set to 1.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1a9a3e76
    • J
      kgdb: fix SMP NMI kgdb_handle_exception exit race · 56fb7093
      Jason Wessel 提交于
      Fix the problem of protecting the kgdb handle_exception exit
      which had an NMI race condition, while trying to restore
      normal system operation.
      
      There was a small window after the master processor sets cpu_in_debug
      to zero but before it has set kgdb_active to zero where a
      non-master processor in an SMP system could receive an NMI and
      re-enter the kgdb_wait() loop.
      
      As long as the master processor sets the cpu_in_debug before sending
      the cpu roundup the cpu_in_debug variable can also be used to guard
      against the race condition.
      
      The kgdb_wait() function no longer needs to check
      kgdb_active because it is done in the arch specific code
      and handled along with the nmi traps at the low level.
      This also allows kgdb_wait() to exit correctly if it was
      entered for some unknown reason due to a spurious NMI that
      could not be handled by the arch specific code.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      56fb7093
    • J
      kgdb: fix several kgdb regressions · 737a460f
      Jason Wessel 提交于
      kgdb core fixes:
      - Check to see that mm->mmap_cache is not null before calling
        flush_cache_range(), else on arch=ARM it will cause a fatal
        fault.
      
      - Breakpoints should only be restored if they are in the BP_ACTIVE
        state.
      
      - Fix a typo in comments to "kgdb_register_io_module"
      
      x86 kgdb fixes:
      - Fix the x86 arch handler such that on a kill or detach that the
        appropriate cleanup on the single stepping flags gets run.
      
      - Add in the DIE_NMIWATCHDOG call for x86_64
      
      - Touch the nmi watchdog before returning the system to normal
        operation after performing any kind of kgdb operation, else
        the possibility exists to trigger the watchdog.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      737a460f
    • J
      kgdb: fix optional arch functions and probe_kernel_* · b4b8ac52
      Jason Wessel 提交于
      Fix two regressions dealing with the kgdb core.
      
      1) kgdb_skipexception and kgdb_post_primary_code are optional
      functions that are only required on archs that need special exception
      fixups.
      
      2) The kernel address space scope must be set on any probe_kernel_*
      function or archs such as ARCH=arm will not allow access to the kernel
      memory space.  As an example, it is required to allow the full kernel
      address space is when you the kernel debugger to inspect a system
      call.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b4b8ac52
    • J
      kgdb: add x86 HW breakpoints · 64e9ee30
      Jason Wessel 提交于
      Add HW breakpoints into the arch specific portion of x86 kgdb.  In the
      current x86 kernel.org kernels HW breakpoints are changed out in lazy
      fashion because there is no infrastructure around changing them when
      changing to a kernel task or entering the kernel mode via a system
      call.  This lazy approach means that if a user process uses HW
      breakpoints the kgdb will loose out.  This is an acceptable trade off
      because the developer debugging the kernel is assumed to know what is
      going on system wide and would be aware of this trade off.
      
      There is a minor bug fix to the kgdb core so as to correctly call the
      hw breakpoint functions with a valid value from the enum.
      
      There is also a minor change to the x86_64 startup code when using
      early HW breakpoints.  When the debugger is connected, the cpu startup
      code must not zero out the HW breakpoint registers or you cannot hit
      the breakpoints you are interested in, in the first place.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      64e9ee30
    • J
      kgdb: print breakpoint removed on exception · 67baf94c
      Jason Wessel 提交于
      If kgdb does remove a breakpoint that had a problem on the recursion
      check, it should also print the address of the breakpoint.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      67baf94c
    • J
      kgdb: clocksource watchdog · 7c3078b6
      Jason Wessel 提交于
      In order to not trip the clocksource watchdog, kgdb must touch the
      clocksource watchdog on the return to normal system run state.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      7c3078b6
    • J
      kgdb: core · dc7d5527
      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: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NJan Kiszka <jan.kiszka@web.de>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      dc7d5527