Ticket #6160: 0001-ppc-Save-debug-register-state-and-shorten-stack-trac.patch

File 0001-ppc-Save-debug-register-state-and-shorten-stack-trac.patch, 1.6 KB (added by andreasf, 14 years ago)

proposed patch

  • headers/private/kernel/arch/ppc/arch_debug.h

    From e698a9abe7299f37b5a1e565c602093a9887ee39 Mon Sep 17 00:00:00 2001
    From: Andreas Faerber <andreas.faerber@web.de>
    Date: Sat, 12 Jun 2010 01:19:44 +0200
    Subject: [PATCH] ppc: Save debug register state and shorten stack trace
    
    ---
     headers/private/kernel/arch/ppc/arch_debug.h |    1 +
     src/system/kernel/arch/ppc/arch_debug.cpp    |    6 +++++-
     2 files changed, 6 insertions(+), 1 deletions(-)
    
    diff --git a/headers/private/kernel/arch/ppc/arch_debug.h b/headers/private/kernel/arch/ppc/arch_debug.h
    index 745874d..f4ff5ee 100644
    a b  
    1010
    1111
    1212struct arch_debug_registers {
     13    addr_t r1;
    1314};
    1415
    1516
  • src/system/kernel/arch/ppc/arch_debug.cpp

    diff --git a/src/system/kernel/arch/ppc/arch_debug.cpp b/src/system/kernel/arch/ppc/arch_debug.cpp
    index dc7179a..d0a2b52 100644
    a b stack_trace(int argc, char **argv)  
    124124
    125125    if (argc < 2) {
    126126        thread = thread_get_current_thread();
    127         framePointer = (addr_t)get_current_stack_frame()->previous;
     127        int32 cpu = smp_get_current_cpu();
     128        framePointer = debug_get_debug_registers(cpu)->r1;
    128129    } else {
    129130// TODO: Add support for stack traces of other threads.
    130131/*      thread_id id = strtoul(argv[1], NULL, 0);
    return 0;  
    258259void
    259260arch_debug_save_registers(struct arch_debug_registers* registers)
    260261{
     262    // get the caller's frame pointer
     263    stack_frame* frame = (stack_frame*)get_current_stack_frame()->previous;
     264    registers->r1 = (uint32)frame->previous;
    261265}
    262266
    263267