summaryrefslogtreecommitdiff
path: root/main/astmm.c
AgeCommit message (Collapse)Author
2017-02-13cli: Fix various CLI documentation and completion issuesSean Bright
* app_minivm: Use built-in completion facilities to complete optional arguments. * app_voicemail: Use built-in completion facilities to complete optional arguments. * app_confbridge: Add missing colons after 'Usage' text. * chan_alsa: Use built-in completion facilities to complete optional arguments. * chan_sip: Use built-in completion facilities to complete optional arguments. Add completions for 'load' for 'sip show user', 'sip show peer', and 'sip qualify peer.' * chan_skinny: Correct and extend completions for 'skinny reset' and 'skinny show line.' * func_odbc: Correct completions for 'odbc read' and 'odbc write' * main/astmm: Use built-in completion facilities to complete arguments for 'memory' commands. * main/bridge: Correct completions for 'bridge kick.' * main/ccss: Use built-in completion facilities to complete arguments for 'cc cancel' command. * main/cli: Add 'all' completion for 'channel request hangup.' Correct completions for 'core set debug channel.' Correct completions for 'core show calls.' * main/pbx_app: Remove redundant completions for 'core show applications.' * main/pbx_hangup_handler: Remove unused completions for 'core show hanguphandlers all.' * res_sorcery_memory_cache: Add completion for 'reload' argument of 'sorcery memory cache stale' and properly implement. Change-Id: Iee58c7392f6fec34ad9d596109117af87697bbca
2016-10-27Remove ASTERISK_REGISTER_FILE.Corey Farrell
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes all traces of it. Previously exported symbols removed: * __ast_register_file * __ast_unregister_file * ast_complete_source_filename This also removes the mtx_prof static variable that was declared when MTX_PROFILE was enabled. This variable was only used in lock.c so it is now initialized in that file only. ASTERISK-26480 #close Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-01-14astmm.c: Add more stats to CLI "memory show" commands.Richard Mudgett
* Add freed regions totals to allocations and summary. * Add totals for all allocations and not just the selected allocations. Change-Id: I61d5a5112617b0733097f2545a3006a344b4032a
2015-05-13MALLOC_DEBUG: Replace WRAP_LIBC_MALLOC with ASTMM_LIBC.Corey Farrell
There are 3 ways that calls directly to standard allocator functions can be dealt with: 1. Block their use, cause them to generate an error. This is the default. 2. Replace them with the Asterisk equivalent function calls. 3. Leave them alone. This change allows one of these 3 options to be selected by any source. The source just needs to define ASTMM_LIBC to ASTMM_BLOCK, ASTMM_REDIRECT, or ASTMM_IGNORE to use option 1, 2 or 3 respectively. Normally ASTMM_BLOCK is the correct option, so it is default when ASTMM_LIBC is not defined. In some cases when building 3rd party code it is desirable to have it use Asterisk functions, without changing the whole source - ASTMM_REDIRECT accomplishes this. When using 3rd party libraries sometimes a static inline function will make use of malloc or free. In these cases it may be unsafe to replace the allocator in the header, as it's possible the memory could be freed by the library using standard allocators. For those cases ASTMM_IGNORE is needed. Change-Id: I8afef4bc7f3b93914263ae27d3a5858b69663fc7
2015-04-13git migration: Refactor the ASTERISK_FILE_VERSION macroMatt Jordan
Git does not support the ability to replace a token with a version string during check-in. While it does have support for replacing a token on clone, this is somewhat sub-optimal: the token is replaced with the object hash, which is not particularly easy for human consumption. What's more, in practice, the source file version was often not terribly useful. Generally, when triaging bugs, the overall version of Asterisk is far more useful than an individual SVN version of a file. As a result, this patch removes Asterisk's support for showing source file versions. Specifically, it does the following: * Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and remove passing the version in with the macro. Other facilities than 'core show file version' make use of the file names, such as setting a debug level only on a specific file. As such, the act of registering source files with the Asterisk core still has use. The macro rename now reflects the new macro purpose. * main/asterisk: - Refactor the file_version structure to reflect that it no longer tracks a version field. - Remove the "core show file version" CLI command. Without the file version, it is no longer useful. - Remove the ast_file_version_find function. The file version is no longer tracked. - Rename ast_register_file_version/ast_unregister_file_version to ast_register_file/ast_unregister_file, respectively. * main/manager: Remove value from the Version key of the ModuleCheck Action. The actual key itself has not been removed, as doing so would absolutely constitute a backwards incompatible change. However, since the file version is no longer tracked, there is no need to attempt to include it in the Version key. * UPGRADE: Add notes for: - Modification to the ModuleCheck AMI Action - Removal of the "core show file version" CLI command Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2015-03-26Replace most uses of ast_register_atexit with ast_register_cleanup.Corey Farrell
Since 'core stop now' and 'core restart now' do not stop modules, it is unsafe for most of the core to run cleanups. Originally all cleanups used ast_register_atexit, and were only changed when it was shown to be unsafe. ast_register_atexit is now used only when absolutely required to prevent corruption and close child processes. Exceptions that need to use ast_register_atexit: * CDR: Flush records. * res_musiconhold: Kill external applications. * AstDB: Close the DB. * canary_exit: Kill canary process. ASTERISK-24142 #close Reported by: David Brillert ASTERISK-24683 #close Reported by: Peter Katzmann ASTERISK-24805 #close Reported by: Badalian Vyacheslav ASTERISK-24881 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4500/ Review: https://reviewboard.asterisk.org/r/4501/ ........ Merged revisions 433495 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433497 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433498 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-09MALLOC_DEBUG: Change fence magic number to be completely different from the ↵Richard Mudgett
freed magic number. Race conditions between freeing a nul terminated string and ast_strdup()'ing it are more likely to be detected if the fence and freed magic numbers are completely different. ........ Merged revisions 398703 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 398721 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 398726 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398732 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-27Made MALLOC_DEBUG less CPU intensive by default.Richard Mudgett
Storing a backtrace for each allocation in anticipation of a memory management problem is very CPU intensive. * Added the CLI "memory backtrace {on|off}" command to request that the backtrace be gathered only on request. The backtrace is off by default. (issue ASTERISK-22221) Reported by: Matt Jordan ........ Merged revisions 397809 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397811 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23Fix memory corruption when trying to get "core show locks".Richard Mudgett
Review https://reviewboard.asterisk.org/r/2580/ tried to fix the mismatch in memory pools but had a math error determining the buffer size and didn't address other similar memory pool mismatches. * Effectively reverted the previous patch to go in the same direction as trunk for the returned memory pool of ast_bt_get_symbols(). * Fixed memory leak in ast_bt_get_symbols() when BETTER_BACKTRACES is defined. * Fixed some formatting in ast_bt_get_symbols(). * Fixed sig_pri.c freeing memory allocated by libpri when MALLOC_DEBUG is enabled. * Fixed __dump_backtrace() freeing memory from ast_bt_get_symbols() when MALLOC_DEBUG is enabled. * Moved __dump_backtrace() because of compile issues with the utils directory. (closes issue ASTERISK-22221) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2778/ ........ Merged revisions 397525 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 397528 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-08Add backtrace generation to MALLOC_DEBUG memory corruption reportsMatthew Jordan
This patch allows astmm to access the backtrace generation code in Asterisk. When memory is allocated, a backtrace is created and stored with the memory region that tracks the allocation. If a memory corruption is detected, the backtrace is printed to the astmm log. The backtrace will make use of the BETTER_BACKTRACES build option if available. As a result, this patch moves the backtrace generation code into its own file and uses the non-wrapped versions of the C library memory allocation routines. This allows the memory allocation code to safely use the backtrace generation routines without infinitely recursing. Review: https://reviewboard.asterisk.org/r/2567 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391012 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-07MALLOC_DEBUG: Only wait if we want atexit allocation dumps.Richard Mudgett
........ Merged revisions 377398 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 377399 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 377401 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@377402 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-29Add MALLOC_DEBUG atexit unreleased malloc memory summary.Richard Mudgett
* Adds the following CLI commands to control MALLOC_DEBUG reporting of unreleased malloc memory when Asterisk is shut down. memory atexit list on memory atexit list off memory atexit summary byline memory atexit summary byfunc memory atexit summary byfile memory atexit summary off * Made check all remaining allocated region blocks atexit for fence violations. * Increased the allocated region hash table size by about three times. It still isn't large enough considering the number of malloced blocks Asterisk uses. * Made CLI "memory show allocations anomalies" use regions_check_all_fences(). Review: https://reviewboard.asterisk.org/r/2196/ ........ Merged revisions 376788 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 376789 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 376790 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376791 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-29Enhance MALLOC_DEBUG CLI commands.Richard Mudgett
* Fixed CLI "memory show allocations" misspelling of anomalies option. The command will still accept the original misspelling. * Miscellaneous tweaks to CLI "memory show allocations" command output format. * Made CLI "memory show summary" summarize by line number instead of by function if a filename is given. * Made CLI "memory show summary" sort its output by filename or function-name/line-number depending upon request. * Miscellaneous tweaks to CLI "memory show summary" command output format. ........ Merged revisions 376758 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 376759 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 376760 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376761 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-08Add MALLOC_DEBUG enhancements.Richard Mudgett
* Makes malloc() behave like calloc(). It will return a memory block filled with 0x55. A nonzero value. * Makes free() fill the released memory block and boundary fence's with 0xdeaddead. Any pointer use after free is going to have a pointer pointing to 0xdeaddead. The 0xdeaddead pointer is usually an invalid memory address so a crash is expected. * Puts the freed memory block into a circular array so it is not reused immediately. * When the circular array rotates out a memory block to the heap it checks that the memory has not been altered from 0xdeaddead. * Made the astmm_log message wording better. * Made crash if the DO_CRASH menuselect option is enabled and something is found. * Fixed a potential alignment issue on 64 bit systems. struct ast_region.data[] should now be aligned correctly for all platforms. * Extracted region_check_fences() from __ast_free_region() and handle_memory_show(). * Updated handle_memory_show() CLI usage help. Review: https://reviewboard.asterisk.org/r/2182/ ........ Merged revisions 376029 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 376030 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 376048 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376049 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-07Fix MALLOC_DEBUG version of ast_strndup().Richard Mudgett
(closes issue ASTERISK-20349) Reported by: Brent Eagles ........ Merged revisions 372655 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 372656 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 372657 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-31Clean up and ensure proper usage of alloca()Kinsey Moore
This replaces all calls to alloca() with ast_alloca() which calls gcc's __builtin_alloca() to avoid BSD semantics and removes all NULL checks on memory allocated via ast_alloca() and ast_strdupa(). (closes issue ASTERISK-20125) Review: https://reviewboard.asterisk.org/r/2032/ Patch-by: Walter Doekes (wdoekes) ........ Merged revisions 370642 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 370643 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-15Multiple revisions 369001-369002Kevin P. Fleming
........ r369001 | kpfleming | 2012-06-15 10:56:08 -0500 (Fri, 15 Jun 2012) | 11 lines Add support-level indications to many more source files. Since we now have tools that scan through the source tree looking for files with specific support levels, we need to ensure that every file that is a component of a 'core' or 'extended' module (or the main Asterisk binary) is explicitly marked with its support level. This patch adds support-level indications to many more source files in tree, but avoids adding them to third-party libraries that are included in the tree and to source files that don't end up involved in Asterisk itself. ........ r369002 | kpfleming | 2012-06-15 10:57:14 -0500 (Fri, 15 Jun 2012) | 3 lines Add a script to enable finding source files without support-levels defined. ........ Merged revisions 369001-369002 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 369005 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369013 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-22Kill off red blobs in most of main/*Kinsey Moore
Everything still compiled after making these changes, so I assume these whitespace-only changes didn't break anything (and shouldn't have). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-22Two more minor fixes due to constificationTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196272 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-05Janitor, use ARRAY_LEN() when possible.Eliel C. Sardanons
(closes issue #13990) Reported by: eliel Patches: array_len.diff uploaded by eliel (license 64) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161218 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-19If malloc returns NULL, we need to return NULL immediately orMark Michelson
else Asterisk will crash when attempting to dereference the NULL pointer (closes issue #13858) Reported by: eliel Patches: astmm.c.patch uploaded by eliel (license 64) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157632 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-27Merged revisions 144924-144925 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r144924 | kpfleming | 2008-09-27 10:00:48 -0500 (Sat, 27 Sep 2008) | 6 lines improve header inclusion process in a few small ways: - it is no longer necessary to forcibly include asterisk/autoconfig.h; every module already includes asterisk.h as its first header (even before system headers), which serves the same purpose - astmm.h is now included by asterisk.h when needed, instead of being forced by the Makefile; this means external modules will build properly against installed headers with MALLOC_DEBUG enabled - simplify the usage of some of these headers in the AEL-related stuff in the utils directory ........ r144925 | kpfleming | 2008-09-27 10:13:30 -0500 (Sat, 27 Sep 2008) | 2 lines fix some minor issues with rev 144924 ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@144949 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-17If attempting to free a NULL pointer when MALLOC_DEBUGMark Michelson
is set, don't bother searching for a region to free, just immediately exit. This has the dual benefit of suppressing a warning message about freeing memory at (nil) and of optimizing the free() replacement by not having to do any futile searching for the proper region to free. (closes issue #13498) Reported by: pj Patches: 13498.patch uploaded by putnopvut (license 60) Tested by: pj git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@143400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-11Merged revisions 129966 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r129966 | kpfleming | 2008-07-11 09:03:52 -0500 (Fri, 11 Jul 2008) | 5 lines fix a flaw found while experimenting with structure alignment and padding; low-fence checking would not work properly on 64-bit platforms, because the compiler was putting 4 bytes of padding between the fence field and the allocation memory block added a very obvious runtime warning if this condition reoccurs, so the developer who broke it can be chastised into fixing it :-) ........ r129967 | kpfleming | 2008-07-11 09:03:52 -0500 (Fri, 11 Jul 2008) | 5 lines simplify calculation ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@129968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-05Get rid of any remaining ast_verbose calls in the code in favor of Mark Michelson
ast_verb (closes issue #11934) Reported by: mvanbaak Patches: 20080205_astverb-2.diff.txt uploaded by mvanbaak (license 7) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@102525 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-24Increase the size of filenames stored when astmm is used. If the path James Golovich
length was long they would be truncated and grouped together with whatever matches git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@100224 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-18remove unnecessary (char *) casts for ast_config_AST_* variables.Luigi Rizzo
There are some left in the .flex files, left to the maintainer... git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21remove a bunch of useless #include "options.h"Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89511 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21add missing paths.hLuigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89476 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-19another bunch of include removals (errno.h and asterisk/logger.h)Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89425 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-16Start untangling header inclusion in a way that does not affectLuigi Rizzo
build times - tested, there is no measureable difference before and after this commit. In this change: use asterisk/compat.h to include a small set of system headers: inttypes.h, unistd.h, stddef.h, stddint.h, sys/types.h, stdarg.h, stdlib.h, alloca.h, stdio.h Where available, the inclusion is conditional on HAVE_FOO_H as determined by autoconf. Normally, source files should not include any of the above system headers, and instead use either "asterisk.h" or "asterisk/compat.h" which does it better. For the time being I have left alone second-level directories (main/db1-ast, etc.). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89333 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-07Fix another CLI command so it doesn't run the real code when called for ↵Russell Bryant
initialization. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89076 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-06Fix the memory show allocations CLI command so that it doesn't spew out allRussell Bryant
of the current memory allocations when you start Asterisk, when the command's handler gets called for initialization. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-29Merged revisions 87373 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r87373 | russell | 2007-10-29 14:21:06 -0500 (Mon, 29 Oct 2007) | 5 lines Remove a lock that doesn't make any sense. The regions lock needs to be held when traversing the list of allocated chunks so that they can be printed out to the CLI. (Thanks to eliel on #asterisk-dev for pointing this out!) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@87392 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-22Switch from AST_CLI (formerly NEW_CLI) to AST_CLI_DEFINE, since the former ↵Jason Parker
didn't make much sense git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-22Merged revisions 86787 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r86787 | tilghman | 2007-10-22 12:38:13 -0500 (Mon, 22 Oct 2007) | 2 lines Minor FreeBSD build fix ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86790 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-19Convert NEW_CLI to AST_CLI.Jason Parker
Closes issue #11039, as suggested by seanbright. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86536 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-20More NEW_CLI conversions.Jason Parker
(issue #10724) Patches: app_playback.c.patch uploaded by moy (license 222) app_minivm.c.patch uploaded by eliel (license 64) astmm.c.patch uploaded by eliel (license 64) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@83381 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-03Merged revisions 78095 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r78095 | russell | 2007-08-03 14:39:49 -0500 (Fri, 03 Aug 2007) | 28 lines Add some improvements to lock debugging. These changes take effect with DEBUG_THREADS enabled and provide the following: * This will keep track of which locks are held by which thread as well as which lock a thread is waiting for in a thread-local data structure. A reference to this structure is available on the stack in the dummy_start() function, which is the common entry point for all threads. This information can be easily retrieved using gdb if you switch to the dummy_start() stack frame of any thread and print the contents of the lock_info variable. * All of the thread-local structures for keeping track of this lock information are also stored in a list so that the information can be dumped to the CLI using the "core show locks" CLI command. This introduces a little bit of a performance hit as it requires additional underlying locking operations inside of every lock/unlock on an ast_mutex. However, the benefits of having this information available at the CLI is huge, especially considering this is only done in DEBUG_THREADS mode. It means that in most cases where we debug deadlocks, we no longer have to request access to the machine to analyze the contents of ast_mutex_t structures. We can now just ask them to get the output of "core show locks", which gives us all of the information we needed in most cases. I also had to make some additional changes to astmm.c to make this work when both MALLOC_DEBUG and DEBUG_THREADS are enabled. I disabled tracking of one of the locks in astmm.c because it gets used inside the replacement memory allocation routines, and the lock tracking code allocates memory. This caused infinite recursion. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78096 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-14Merged revisions 50820 via svnmerge from Joshua Colp
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r50820 | file | 2007-01-14 16:59:05 -0500 (Sun, 14 Jan 2007) | 2 lines Add missing newlines for two memory CLI commands. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@50821 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-27Merged revisions 48987 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r48987 | kpfleming | 2006-12-27 12:29:13 -0600 (Wed, 27 Dec 2006) | 2 lines allow 'show memory' and 'show memory summary' to distinguish memory allocations that were done for caching purposes, so they don't look like memory leaks ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48989 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-21Remove deprecated CLI apps from the coreTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-20Merged revisions 43383 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r43383 | russell | 2006-09-20 18:13:16 -0400 (Wed, 20 Sep 2006) | 2 lines Fix the total allocation count and total byte count in the memory summary ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-20Fix the memory summary so that it doesn't print the first file in the list overRussell Bryant
and over again. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43375 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-20fix some breakage from the CLI command changesRussell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43372 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-18merge qwell's CLI verbification workKevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43212 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-08-21various cleanups, including ...Russell Bryant
- Create an astmm_log() macro that logs the same message to both stderr as well as the mmlog file if it is open instead of duplicating the code everywhere. - Use for loops for list traversals instead of while loops - reduce nesting - ensure locking isn't put around more than is necessary - localize a struct definition - change the limit of the path to the mmlog to PATH_MAX instead of 80 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@40780 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-08-21merge new_loader_completion branch, including (at least):Kevin P. Fleming
- restructured build tree and makefiles to eliminate recursion problems - support for embedded modules - support for static builds - simpler cross-compilation support - simpler module/loader interface (no exported symbols) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@40722 65c4cc65-6c06-0410-ace0-fbb531ad65f3