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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 volatile int go = 0; \ | 215 volatile int go = 0; \ |
216 while (!go) { \ | 216 while (!go) { \ |
217 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); \ | 217 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); \ |
218 } \ | 218 } \ |
219 } \ | 219 } \ |
220 } while (0) | 220 } while (0) |
221 #else | 221 #else |
222 // ARM && !ANDROID | 222 // ARM && !ANDROID |
223 #define DEBUG_BREAK() asm("bkpt 0") | 223 #define DEBUG_BREAK() asm("bkpt 0") |
224 #endif | 224 #endif |
| 225 #elif defined(ARCH_CPU_MIPS_FAMILY) |
| 226 #define DEBUG_BREAK() asm("break 2") |
225 #else | 227 #else |
226 #define DEBUG_BREAK() asm("int3") | 228 #define DEBUG_BREAK() asm("int3") |
227 #endif | 229 #endif |
228 | 230 |
229 void BreakDebugger() { | 231 void BreakDebugger() { |
230 DEBUG_BREAK(); | 232 DEBUG_BREAK(); |
231 #if defined(OS_ANDROID) && !defined(OFFICIAL_BUILD) | 233 #if defined(OS_ANDROID) && !defined(OFFICIAL_BUILD) |
232 // For Android development we always build release (debug builds are | 234 // For Android development we always build release (debug builds are |
233 // unmanageably large), so the unofficial build is used for debugging. It is | 235 // unmanageably large), so the unofficial build is used for debugging. It is |
234 // helpful to be able to insert BreakDebugger() statements in the source, | 236 // helpful to be able to insert BreakDebugger() statements in the source, |
235 // attach the debugger, inspect the state of the program and then resume it by | 237 // attach the debugger, inspect the state of the program and then resume it by |
236 // setting the 'go' variable above. | 238 // setting the 'go' variable above. |
237 #elif defined(NDEBUG) | 239 #elif defined(NDEBUG) |
238 // Terminate the program after signaling the debug break. | 240 // Terminate the program after signaling the debug break. |
239 _exit(1); | 241 _exit(1); |
240 #endif | 242 #endif |
241 } | 243 } |
242 | 244 |
243 } // namespace debug | 245 } // namespace debug |
244 } // namespace base | 246 } // namespace base |
OLD | NEW |