2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2014 Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
23 #include "hphp/util/debug.h"
24 #include "hphp/util/text-util.h"
25 #include "hphp/util/trace.h"
29 * Forcefully always compile this unit with debug enabled, to permit mixing
30 * and matching of optimized and unoptimized binaries.
38 #include "hphp/runtime/vm/php-debug.h"
43 std::set
<string
> enabledFunctions
;
46 const char *env
= getenv("PHPBREAKPOINTS");
49 split(',', env
, names
, true /*ignoreEmpty*/);
50 for (size_t i
= 0; i
< names
.size(); ++i
) {
51 enabledFunctions
.insert(names
[i
]);
56 bool isBpFunction(const char* nm
) const {
57 std::set
<string
>::const_iterator i
= enabledFunctions
.find(string(nm
));
58 return i
!= enabledFunctions
.end();
62 static PhpDebugger dbg
;
63 bool phpBreakpointEnabled(const char* sourceName
) {
64 return dbg
.isBpFunction(sourceName
);
70 * Add or remove functions from the debug-set from gdb. Not exposed in
74 * (gdb) call phpbreak("idx")
78 void phpbreak(const char* name
) {
79 HPHP::dbg
.enabledFunctions
.insert(std::string(name
));
82 void phpdisable(const char *name
) {
83 HPHP::dbg
.enabledFunctions
.erase(std::string(name
));