diff --git a/lib/modules/Debug.pmod/module.pmod b/lib/modules/Debug.pmod/module.pmod index a5d5861d2078e326ab60d3f3ea3f32e39e175d98..3770a60fdad46f2524fc8eed9715692a1a753d93 100644 --- a/lib/modules/Debug.pmod/module.pmod +++ b/lib/modules/Debug.pmod/module.pmod @@ -1,53 +1,37 @@ -// $Id: module.pmod,v 1.5 2005/03/24 17:38:26 nilsson Exp $ +// $Id: module.pmod,v 1.6 2010/07/19 15:30:47 mast Exp $ #pike __REAL_VERSION__ -#if constant(_assembler_debug) -constant assembler_debug = _assembler_debug; -#endif - -#if constant(_compiler_trace) -constant compiler_trace = _compiler_trace; -#endif +constant verify_internals = _verify_internals; +constant memory_usage = _memory_usage; +constant gc_status = _gc_status; +constant describe_program = _describe_program; #if constant(_debug) +// These functions require --with-rtldebug. constant debug = _debug; -#endif - -#if constant(_describe) +constant optimizer_debug = _optimizer_debug; +constant assembler_debug = _assembler_debug; +constant dump_program_tables = _dump_program_tables; +constant locate_references = _locate_references; constant describe = _describe; -#endif - -#if constant(_describe_program) -constant describe_program = _describe_program; +constant gc_set_watch = _gc_set_watch; +constant dump_backlog = _dump_backlog; #endif #if constant(_dmalloc_set_name) +// These functions require --with-dmalloc. +constant reset_dmalloc = _reset_dmalloc; constant dmalloc_set_name = _dmalloc_set_name; -#endif - -#if constant(_dump_backlog) -constant dump_backlog = _dump_backlog; -#endif - -#if constant(_gc_set_watch) -constant gc_set_watch = _gc_set_watch; -#endif - -#if constant(_gc_status) -constant gc_status = _gc_status; -#endif - -#if constant(_list_open_fds) constant list_open_fds = _list_open_fds; +constant dump_dmalloc_locations = _dump_dmalloc_locations; #endif -#if constant(_locate_references) -constant locate_references = _locate_references; +#if constant(_compiler_trace) +// Requires -DYYDEBUG. +constant compiler_trace = _compiler_trace; #endif -constant memory_usage = _memory_usage; - //! Returns a pretty printed version of the //! output from @[memory_usage]. string pp_memory_usage() { @@ -62,18 +46,6 @@ string pp_memory_usage() { return ret; } -#if constant(_optimizer_debug) -constant optimizer_debug = _optimizer_debug; -#endif - -#if constant(_reset_dmalloc) -constant reset_dmalloc = _reset_dmalloc; -#endif - -#if constant(_verify_internals) -constant verify_internals = _verify_internals; -#endif - //! Returns the number of objects of every kind in memory. mapping(string:int) count_objects() { int orig_enabled = Pike.gc_parameters()->enabled; diff --git a/src/builtin_functions.c b/src/builtin_functions.c index e819433b28fc3b40cdb2d89425e01ddaccda2fc9..c1d33ada84144da85ff61a76145427af86fd6089 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: builtin_functions.c,v 1.701 2010/05/31 13:59:04 grubba Exp $ +|| $Id: builtin_functions.c,v 1.702 2010/07/19 15:30:48 mast Exp $ */ #include "global.h" @@ -5019,7 +5019,8 @@ PMOD_EXPORT void f__assembler_debug(INT32 args) a_flag = l; } -/*! @decl void _dump_program_tables(program p, int|void indent) +/*! @decl void dump_program_tables(program p, int|void indent) + *! @belongs Debug *! *! Dumps the internal tables for the program @[p] on stderr. *! @@ -7909,6 +7910,22 @@ PMOD_EXPORT void f__list_open_fds(INT32 args) extern void list_open_fds(void); list_open_fds(); } + +/*! @decl void dump_dmalloc_locations(string|array|mapping| @ + *! multiset|function|object| @ + *! program|type o) + *! @belongs Debug + *! + *! @note + *! Only available when compiled with dmalloc. + */ +PMOD_EXPORT void f__dump_dmalloc_locations(INT32 args) +{ + ASSERT_SECURITY_ROOT("_dump_dmalloc_locations"); + if(args) + debug_malloc_dump_references (Pike_sp[-args].u.refs, 2, 1, 0); + pop_n_elems(args-1); +} #endif #ifdef PIKE_DEBUG @@ -9651,6 +9668,8 @@ void init_builtin_efuns(void) tOr(tFunc(tStr tInt,tVoid), tFunc(tVoid,tVoid)),OPT_SIDE_EFFECT); ADD_EFUN("_list_open_fds",f__list_open_fds, tFunc(tVoid,tVoid),OPT_SIDE_EFFECT); + ADD_EFUN("_dump_dmalloc_locations",f__dump_dmalloc_locations, + tFunc(tSetvar(1,tMix),tVar(1)),OPT_SIDE_EFFECT); #endif #ifdef PIKE_DEBUG