4 * Copyright (C) 2009-2009, Eric Pouech
5 * Copyright (C) 2010, André Hentschel
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #define WIN32_NO_STATUS
26 #include "dbghelp_private.h"
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
32 static unsigned arm_get_addr(HANDLE hThread, const CONTEXT* ctx,
33 enum cpu_addr ca, ADDRESS64* addr)
35 addr->Mode = AddrModeFlat;
36 addr->Segment = 0; /* don't need segment */
40 case cpu_addr_pc: addr->Offset = ctx->Pc; return TRUE;
41 case cpu_addr_stack: addr->Offset = ctx->Sp; return TRUE;
42 case cpu_addr_frame: addr->Offset = ctx->Fp; return TRUE;
44 default: addr->Mode = -1;
49 static BOOL arm_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CONTEXT* context)
51 FIXME("not done for ARM\n");
55 static unsigned arm_map_dwarf_register(unsigned regno)
57 if (regno <= 15) return CV_ARM_R0 + regno;
58 if (regno == 128) return CV_ARM_CPSR;
60 FIXME("Don't know how to map register %d\n", regno);
64 static void* arm_fetch_context_reg(CONTEXT* ctx, unsigned regno, unsigned* size)
69 case CV_ARM_R0 + 0: *size = sizeof(ctx->R0); return &ctx->R0;
70 case CV_ARM_R0 + 1: *size = sizeof(ctx->R1); return &ctx->R1;
71 case CV_ARM_R0 + 2: *size = sizeof(ctx->R2); return &ctx->R2;
72 case CV_ARM_R0 + 3: *size = sizeof(ctx->R3); return &ctx->R3;
73 case CV_ARM_R0 + 4: *size = sizeof(ctx->R4); return &ctx->R4;
74 case CV_ARM_R0 + 5: *size = sizeof(ctx->R5); return &ctx->R5;
75 case CV_ARM_R0 + 6: *size = sizeof(ctx->R6); return &ctx->R6;
76 case CV_ARM_R0 + 7: *size = sizeof(ctx->R7); return &ctx->R7;
77 case CV_ARM_R0 + 8: *size = sizeof(ctx->R8); return &ctx->R8;
78 case CV_ARM_R0 + 9: *size = sizeof(ctx->R9); return &ctx->R9;
79 case CV_ARM_R0 + 10: *size = sizeof(ctx->R10); return &ctx->R10;
80 case CV_ARM_R0 + 11: *size = sizeof(ctx->Fp); return &ctx->Fp;
81 case CV_ARM_R0 + 12: *size = sizeof(ctx->Ip); return &ctx->Ip;
83 case CV_ARM_SP: *size = sizeof(ctx->Sp); return &ctx->Sp;
84 case CV_ARM_LR: *size = sizeof(ctx->Lr); return &ctx->Lr;
85 case CV_ARM_PC: *size = sizeof(ctx->Pc); return &ctx->Pc;
86 case CV_ARM_CPSR: *size = sizeof(ctx->Cpsr); return &ctx->Cpsr;
89 FIXME("Unknown register %x\n", regno);
93 static const char* arm_fetch_regname(unsigned regno)
97 case CV_ARM_R0 + 0: return "r0";
98 case CV_ARM_R0 + 1: return "r1";
99 case CV_ARM_R0 + 2: return "r2";
100 case CV_ARM_R0 + 3: return "r3";
101 case CV_ARM_R0 + 4: return "r4";
102 case CV_ARM_R0 + 5: return "r5";
103 case CV_ARM_R0 + 6: return "r6";
104 case CV_ARM_R0 + 7: return "r7";
105 case CV_ARM_R0 + 8: return "r8";
106 case CV_ARM_R0 + 9: return "r9";
107 case CV_ARM_R0 + 10: return "r10";
108 case CV_ARM_R0 + 11: return "r11";
109 case CV_ARM_R0 + 12: return "r12";
111 case CV_ARM_SP: return "sp";
112 case CV_ARM_LR: return "lr";
113 case CV_ARM_PC: return "pc";
114 case CV_ARM_CPSR: return "cpsr";
116 FIXME("Unknown register %x\n", regno);
120 struct cpu cpu_arm = {
121 IMAGE_FILE_MACHINE_ARM,
123 CV_ARM_NOREG, /* FIXME */
127 arm_map_dwarf_register,
128 arm_fetch_context_reg,