📄 libmpatrol.3
字号:
following information:.TSl l.\fBField\fP \fBDescription\fP\fBacount\fP Total number of allocated blocks.\fBatotal\fP Total size of allocated blocks.\fBfcount\fP Total number of free blocks.\fBftotal\fP Total size of free blocks.\fBgcount\fP Total number of freed blocks.\fBgtotal\fP Total size of freed blocks.\fBicount\fP Total number of internal blocks.\fBitotal\fP Total size of internal blocks.\fBmcount\fP Total number of marked blocks.\fBmtotal\fP Total size of marked blocks..TE.TP\fB__mp_check\fPForces the library to perform an immediate check of the overflow buffers ofevery memory allocation and to ensure that nothing has overwritten any freeblocks. If any memory allocations made by the \fBalloca\fP family of functionsare out of scope then this function will also cause them to be freed..TP\fB__mp_prologue\fPInstalls a prologue function to be called before any memory allocation,reallocation or deallocation function. This function will return a pointer tothe previously installed prologue function, or the null pointer if no prologuefunction had been previously installed. The following arguments will be usedto call the prologue function (the last four arguments contain the functionname, file name, line number and the return address of the calling function, ornull pointers and zero if they cannot be determined):.TSc c c l.\fBArgument 1\fP \fBArgument 2\fP \fBArgument 3\fP \fBCalled by\fP\fI-1\fP \fIsize\fP \fIalign\fP \fBmalloc\fP, etc.\fIptr\fP \fIsize\fP \fIalign\fP \fBrealloc\fP, etc.\fIptr\fP \fI-1\fP \fI0\fP \fBfree\fP, etc.\fIptr\fP \fI-2\fP \fI1\fP \fBstrdup\fP, etc..TE.TP\fB__mp_epilogue\fPInstalls an epilogue function to be called after any memory allocation,reallocation or deallocation function. This function will return a pointer tothe previously installed epilogue function, or the null pointer if no epiloguefunction had been previously installed. The following arguments will be usedto call the epilogue function (the last four arguments contain the functionname, file name, line number and the return address of the calling function, ornull pointers and zero if they cannot be determined):.TSc l.\fBArgument\fP \fBCalled by\fP\fIptr\fP \fBmalloc\fP, \fBrealloc\fP, \fBstrdup\fP, etc.\fI-1\fP \fBfree\fP, etc..TE.TP\fB__mp_nomemory\fPInstalls a low-memory handler and returns a pointer to the previously installedhandler, or the null pointer if no handler had been previously installed. Thiswill be called once by C memory allocation functions, and repeatedly by C++memory allocation functions, when they would normally return \fBNULL\fP. Thefour arguments contain the function name, file name, line number and the returnaddress of the calling function, or null pointers and zero if they cannot bedetermined. Note that this function is equivalent to \fBset_new_handler\fP andwill replace the handler installed by that function..TP\fB__mp_printf\fPWrites format string \fIfmt\fP with variable arguments to the log file, witheach line prefixed by \fI>\fP. The final length of the string that is writtento the log file must not exceed 1024 characters. Returns the number ofcharacters written, or a negative number upon error..TP\fB__mp_vprintf\fPWrites format string \fIfmt\fP with variable argument list \fIargs\fP to the logfile, with each line prefixed by \fI>\fP. The final length of the string thatis written to the log file must not exceed 1024 characters. Returns the numberof characters written, or a negative number upon error..TP\fB__mp_locprintf\fPWrites format string \fIfmt\fP with variable arguments to the log file, witheach line prefixed by \fI>\fP. The final length of the string that is writtento the log file must not exceed 1024 characters. It also writes information tothe log file about where the call to this function was made, which includes thesource file location and the call stack if they are available..TP\fB__mp_vlocprintf\fPWrites format string \fIfmt\fP with variable argument list \fIargs\fP to the logfile, with each line prefixed by \fI>\fP. The final length of the string thatis written to the log file must not exceed 1024 characters. It also writesinformation to the log file about where the call to this function was made,which includes the source file location and the call stack if they areavailable..TP\fB__mp_logmemory\fPDisplays the contents of a block of memory beginning at \fIptr\fP, dumping\fIsize\fP consecutive bytes to the log file in hexadecimal format..TP\fB__mp_logstack\fPDisplays the current call stack, skipping \fIframes\fP stack frames from thecurrent stack frame before writing the symbolic stack trace to the log file.Returns \fI1\fP if successful, or \fI0\fP if the call stack could not bedetermined or if \fIframes\fP was too large for the current call stack..TP\fB__mp_logaddr\fPDisplays information about a specific memory allocation containing \fIptr\fP tothe log file. If \fIptr\fP does not belong to a previously allocated memoryallocation then \fI0\fP will be returned, otherwise \fI1\fP will be returned..TP\fB__mp_edit\fPInvokes a text editor to edit \fIfile\fP at line number \fIline\fP via the\fBmpedit\fP command. Returns \fI1\fP if the text editor was successfullyinvoked, \fI-1\fP if there was an error, or \fI0\fP if there is no support forthis feature. This function will only work on a system where the \fBEDIT\fPoption works..TP\fB__mp_list\fPDisplays a context listing of \fIfile\fP at line number \fIline\fP via the\fBmpedit\fP command. Returns \fI1\fP if the listing was successfullyperformed, \fI-1\fP if there was an error, or \fI0\fP if there is no support forthis feature. This function will only work on a system where the \fBLIST\fPoption works..TP\fB__mp_view\fPEither invokes a text editor to edit \fIfile\fP at line number \fIline\fP ordisplays a context listing of \fIfile\fP at line number \fIline\fP dependingon the setting of the \fBEDIT\fP and \fBLIST\fP options. This is done via the\fBmpedit\fP command and will have no effect if the \fBEDIT\fP and \fBLIST\fPoptions are not set or if these options are not supported on the system.Returns \fI1\fP if the edit or listing was successfully performed, \fI-1\fP ifthere was an error, or \fI0\fP if neither of the options were set or if there isno support for this feature..TP\fB__mp_readcontents\fPReads the contents of a memory allocation contents file into the memoryallocation containing \fIptr\fP. The name of the file is composed of the\fIfile\fP string followed by the allocation index of the memory allocationseparated by a dot. If \fIfile\fP is \fBNULL\fP then it is assumed to be\fI.mpatrol\fP. Returns \fI1\fP if the contents were read successfully and\fI0\fP otherwise..TP\fB__mp_writecontents\fPWrites the contents of the memory allocation containing \fIptr\fP to anallocation contents file. The name of the file is composed of the \fIfile\fPstring followed by the allocation index of the memory allocation separated bya dot. If \fIfile\fP is \fBNULL\fP then it is assumed to be \fI.mpatrol\fP.Returns \fI1\fP if the contents were written successfully and \fI0\fP otherwise..TP\fB__mp_cmpcontents\fPCompares the contents of the memory allocation containing \fIptr\fP with thecontents of a previously written allocation contents file. The name of the fileis composed of the \fIfile\fP string followed by the allocation index of thememory allocation separated by a dot. If \fIfile\fP is \fBNULL\fP then it isassumed to be \fI.mpatrol\fP. Any differences are written to the mpatrol logfile. Returns the number of differences found, or \fI-1\fP if there was anerror..TP\fB__mp_remcontents\fPRemoves the memory allocation contents file that corresponds to the memoryallocation containing \fIptr\fP. The name of the file is composed of the\fIfile\fP string followed by the allocation index of the memory allocationseparated by a dot. If \fIfile\fP is \fBNULL\fP then it is assumed to be\fI.mpatrol\fP. Returns \fI1\fP if the file was removed successfully and\fI0\fP otherwise..PPThe following global variable is available for additional control in the mpatrollibrary. To use it you should include the \fImpatrol.h\fP header file:.TP\fB__mp_errno\fPContains the most recent error code encountered by the mpatrol library. Itsvalue can be reset to \fIMP_ET_NONE\fP before calling an mpatrol libraryfunction, and then examined afterwards, either by comparison with the knownerror codes in the \fI__mp_errortype\fP enumeration, or with\fB__mp_strerror\fP..SH LINKINGIn order to use the mpatrol library on UNIX platforms, the following librariesmust be linked in before any other library that defines dynamic memoryallocation functions with the same names:.TSl l.\fBLibrary\fP \fBReason\fP\fI\-lmpatrol\fP To use this library.\fI\-lmpatrolmt\fP To use the thread-safe mpatrol library.\fI\-lmpalloc\fP To use the release library.\fI\-lmptools\fP To use the mpatrol tools library.\fI\-lld\fP If built with COFF or XCOFF support.\fI\-lelf\fP If built with ELF support.\fI\-lbfd\fP & \fI\-liberty\fP If built with BFD support.\fI\-lcl\fP If built on HP/UX.\fI\-lexc\fP If built on IRIX or Tru64.\fI\-limagehlp\fP If built on Windows.\fI\-lpthreads\fP If built on AIX with threads support.\fI\-lthread\fP If built on DG/UX with threads support.\fI\-lpthread\fP If built on UNIX with threads support..TE.PPOn UNIX platforms, if there were no calls to memory allocation functions before\fI\-lmpatrol\fP or \fI\-lmpatrolmt\fP appears on the link line then the mpatrollibrary will not be linked in if it is an archive library. However, this can beoverridden by placing \fI\-umalloc\fP just before that point..PPYou may also wish to set your core file size limit to be zero before runningany programs linked with the mpatrol library as the extra memory that thelibrary uses can make such files much larger than normal, and if you areplanning on using a symbolic debugger then you won't need the core files anyway..SH ENVIRONMENTThe library can read certain options at run-time from an environment variablecalled \fBMPATROL_OPTIONS\fP. This variable must contain one or more validoption keywords from the list below and must be no longer than 1024 charactersin length. If \fBMPATROL_OPTIONS\fP is unset or empty then the default settingswill be used..PPThe syntax for options specified within the \fBMPATROL_OPTIONS\fP environmentvariable is \fBOPTION\fP or \fBOPTION\fP=\fIVALUE\fP, where \fBOPTION\fP is akeyword from the list below and \fIVALUE\fP is the setting for that option. If\fIVALUE\fP is numeric then it may be specified using binary, octal, decimal orhexadecimal notation, with binary notation beginning with either \fI0b\fP or\fI0B\fP. If \fIVALUE\fP is a character string containing spaces then it may bequoted using double quotes. No whitespace may appear between the \fI=\fP sign,but whitespace must appear between different options. Note that option keywordscan be given in lowercase as well as uppercase, or a mixture of both..TP\fBALLOCBYTE\fP=\fIunsigned integer\fPSpecifies an 8-bit byte pattern with which to prefill newly-allocated memory.This can be used to detect the use of memory which has not been initialisedafter allocation. Note that this setting will not affect memory allocated with\fBcalloc\fP or \fBrecalloc\fP as these functions always prefill allocatedmemory with an 8-bit byte pattern of zero. Default value:\fBALLOCBYTE\fP=\fI0xFF\fP..TP\fBALLOCSTOP\fP=\fIunsigned integer\fPSpecifies an allocation index at which to stop the program when it is beingallocated. When the number of memory allocations reaches this number theprogram will be halted, and its state may be examined at that point by usinga suitable debugger. Note that this setting will be ignored if its value iszero. Default value: \fBALLOCSTOP\fP=\fI0\fP..TP\
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -