1/* 2 * Copyright (c) 2007-2009, ETH Zurich. 3 * Copyright (c) 2015, Hewlett Packard Enterprise Development LP. 4 * All rights reserved. 5 * 6 * This file is distributed under the terms in the attached LICENSE file. 7 * If you do not find this file, copies can be found by writing to: 8 * ETH Zurich D-INFK, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group. 9 */ 10 11#include <barrelfish/barrelfish.h> 12#include <barrelfish/caddr.h> 13#include <barrelfish/debug.h> 14#include <barrelfish/dispatch.h> 15#include <barrelfish_kpi/registers_arch.h> 16 17void debug_dump(arch_registers_state_t *archregs) 18{ 19 union registers_aarch64 *regs = archregs; 20 21 debug_printf("Dumping stack (0x%lx)...\n", regs->named.stack); 22 debug_dump_mem_around_addr(regs->named.stack); 23} 24 25void debug_call_chain(arch_registers_state_t *archregs) 26{ 27 // TODO: use regs argument 28 void* fp = __builtin_frame_address(0); 29 void* ra = __builtin_return_address(0); 30 if (fp != NULL) { 31 debug_printf("%8d frame %p return %p\n", 0, fp, ra); 32 } 33} 34 35void debug_print_save_area(arch_registers_state_t *state) 36{ 37#define dpr(reg) debug_printf("%-6s 0x%016"PRIx64"\n", #reg, state->named.reg) 38#define dprv(reg) debug_printf("%-6s 0x%016"PRIx64" 0x%016"PRIx64" \n", #reg, state->named.reg[0], state->named.reg[1]) 39 dpr(x0); dpr(x1); dpr(x2); dpr(x3); 40 dpr(x4); dpr(x5); dpr(x6); dpr(x7); 41 dpr(x8); dpr(x9); dpr(x10); dpr(x11); 42 dpr(x12); dpr(x13); dpr(x14); dpr(x15); 43 dpr(x16); dpr(x17); dpr(x18); dpr(x19); 44 dpr(x20); dpr(x21); dpr(x22); dpr(x23); 45 dpr(x24); dpr(x25); dpr(x26); dpr(x27); 46 dpr(x28); dpr(x29); dpr(x30); 47 48 dpr(stack); dpr(pc); dpr(spsr); 49 50 dprv(v[0]); dprv(v[1]); dprv(v[2]); dprv(v[3]); 51 dprv(v[4]); dprv(v[5]); dprv(v[6]); dprv(v[7]); 52 dprv(v[8]); dprv(v[9]); dprv(v[10]); dprv(v[11]); 53 dprv(v[12]); dprv(v[13]); dprv(v[14]); dprv(v[15]); 54 dprv(v[16]); dprv(v[17]); dprv(v[18]); dprv(v[19]); 55 dprv(v[20]); dprv(v[21]); dprv(v[22]); dprv(v[23]); 56 dprv(v[24]); dprv(v[25]); dprv(v[26]); dprv(v[27]); 57 dprv(v[28]); dprv(v[29]); dprv(v[30]); dprv(v[31]); 58} 59