OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/debug/debugger.h" | 5 #include "base/debug/debugger.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 | 7 |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <fcntl.h> | 9 #include <fcntl.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // +-------+-----------------+-----------------+ | 192 // +-------+-----------------+-----------------+ |
193 // | Linux | N | Y | | 193 // | Linux | N | Y | |
194 // | Mac | Y | N | | 194 // | Mac | Y | N | |
195 // +-------+-----------------+-----------------+ | 195 // +-------+-----------------+-----------------+ |
196 // | 196 // |
197 // Thus we do the following: | 197 // Thus we do the following: |
198 // Linux: Debug mode if a debugger is attached, send SIGTRAP; otherwise send | 198 // Linux: Debug mode if a debugger is attached, send SIGTRAP; otherwise send |
199 // SIGABRT | 199 // SIGABRT |
200 // Mac: Always send SIGTRAP. | 200 // Mac: Always send SIGTRAP. |
201 | 201 |
202 #if defined(ARCH_CPU_ARM_FAMILY) | 202 #if defined(ARCH_CPU_ARMEL) |
203 #define DEBUG_BREAK_ASM() asm("bkpt 0") | 203 #define DEBUG_BREAK_ASM() asm("bkpt 0") |
| 204 #elif defined(ARCH_CPU_ARM64) |
| 205 #define DEBUG_BREAK_ASM() asm("brk 0") |
204 #elif defined(ARCH_CPU_MIPS_FAMILY) | 206 #elif defined(ARCH_CPU_MIPS_FAMILY) |
205 #define DEBUG_BREAK_ASM() asm("break 2") | 207 #define DEBUG_BREAK_ASM() asm("break 2") |
206 #elif defined(ARCH_CPU_X86_FAMILY) | 208 #elif defined(ARCH_CPU_X86_FAMILY) |
207 #define DEBUG_BREAK_ASM() asm("int3") | 209 #define DEBUG_BREAK_ASM() asm("int3") |
208 #endif | 210 #endif |
209 | 211 |
210 #if defined(NDEBUG) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 212 #if defined(NDEBUG) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
211 #define DEBUG_BREAK() abort() | 213 #define DEBUG_BREAK() abort() |
212 #elif defined(OS_NACL) | 214 #elif defined(OS_NACL) |
213 // The NaCl verifier doesn't let use use int3. For now, we call abort(). We | 215 // The NaCl verifier doesn't let use use int3. For now, we call abort(). We |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 // attach the debugger, inspect the state of the program and then resume it by | 264 // attach the debugger, inspect the state of the program and then resume it by |
263 // setting the 'go' variable above. | 265 // setting the 'go' variable above. |
264 #elif defined(NDEBUG) | 266 #elif defined(NDEBUG) |
265 // Terminate the program after signaling the debug break. | 267 // Terminate the program after signaling the debug break. |
266 _exit(1); | 268 _exit(1); |
267 #endif | 269 #endif |
268 } | 270 } |
269 | 271 |
270 } // namespace debug | 272 } // namespace debug |
271 } // namespace base | 273 } // namespace base |
OLD | NEW |