| 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 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 StringPiece::size_type pid_index = status.find(tracer); | 155 StringPiece::size_type pid_index = status.find(tracer); |
| 156 if (pid_index == StringPiece::npos) | 156 if (pid_index == StringPiece::npos) |
| 157 return false; | 157 return false; |
| 158 | 158 |
| 159 // Our pid is 0 without a debugger, assume this for any pid starting with 0. | 159 // Our pid is 0 without a debugger, assume this for any pid starting with 0. |
| 160 pid_index += tracer.size(); | 160 pid_index += tracer.size(); |
| 161 return pid_index < status.size() && status[pid_index] != '0'; | 161 return pid_index < status.size() && status[pid_index] != '0'; |
| 162 } | 162 } |
| 163 | 163 |
| 164 #elif defined(OS_FUCHSIA) |
| 165 |
| 166 bool BeingDebugged() { |
| 167 // TODO(scottmg): Port. |
| 168 return false; |
| 169 } |
| 170 |
| 164 #else | 171 #else |
| 165 | 172 |
| 166 bool BeingDebugged() { | 173 bool BeingDebugged() { |
| 167 NOTIMPLEMENTED(); | 174 NOTIMPLEMENTED(); |
| 168 return false; | 175 return false; |
| 169 } | 176 } |
| 170 | 177 |
| 171 #endif | 178 #endif |
| 172 | 179 |
| 173 // We want to break into the debugger in Debug mode, and cause a crash dump in | 180 // We want to break into the debugger in Debug mode, and cause a crash dump in |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 // attach the debugger, inspect the state of the program and then resume it by | 263 // attach the debugger, inspect the state of the program and then resume it by |
| 257 // setting the 'go' variable above. | 264 // setting the 'go' variable above. |
| 258 #elif defined(NDEBUG) | 265 #elif defined(NDEBUG) |
| 259 // Terminate the program after signaling the debug break. | 266 // Terminate the program after signaling the debug break. |
| 260 _exit(1); | 267 _exit(1); |
| 261 #endif | 268 #endif |
| 262 } | 269 } |
| 263 | 270 |
| 264 } // namespace debug | 271 } // namespace debug |
| 265 } // namespace base | 272 } // namespace base |
| OLD | NEW |