Читаем Linux программирование в примерах полностью

1062080258: 1: not freed: '0x804c008|s1' (30 bytes) from 'ch15-badmem2.c:13'

1062080258: 1: total-size count source

1062080258: 1:         30     1 ch15-badmem2.с:13

1062080258: 1:         30     1 Total of 1

...

(Файл ch15-badmem2.c является аналогичным ch15-badmem1.с, за исключением того, что он включает "dmalloc.h", поэтому мы не стали беспокоиться с его отображением).

Отдельные возможности отладки включаются или выключаются посредством использования лексем (tokens) — специально распознаваемых идентификаторов — и опций для добавления лексем (свойств) или -m для их удаления. Имеются предопределенные комбинации, 'low', 'med' и 'high'. Чем являются эти комбинации, вы можете увидеть с помощью 'dmalloc -Lv'.

$ dmalloc low /* Установить low */

$ dmalloc -Lv /* Показать установки */

Debug Malloc Utility: http://dmalloc.com/

For a list of the command-line options enter: dmalloc --usage

Debug-Flags 0x4e40503 (82052355) (low) /* Текущие лексемы */

log-stats, log-non-free, log-bad-space, log-elapsed-time, check-fence,

free-blank, error-abort, alloc-blank, catch-null

Address not-set

Interval 100

Lock-On not-set

Logpath 'log2'

Start-File not-set

Полный список лексем вместе с кратким объяснением и соответствующим каждой лексеме числовым значением можно получить с помощью 'dmalloc -DV':

$ dmalloc -DV

Debug Tokens:

none (nil) -- no functionality (0)

log-stats (lst) -- log general statistics (0x1)

log-non-free (lnf) -- log non-freed pointers (0x2)

log-known (lkn) -- log only known non-freed (0x4)

log-trans (ltr) -- log memory transactions (0x8)

log-admin (lad) -- log administrative info (0x20)

log-blocks (lbl) -- log blocks when heap-map (0x40)

log-bad-space (lbs) -- dump space from bad pnt (0x100)

log-nonfree-space (lns) -- dump space from non-freed pointers (0x200)

log-elapsed-time (let) -- log elapsed-time for allocated pointer (0x40000)

log-current-time (let) -- log current-time for allocated pointer (0x80000)

check-fence (cfe) -- check fence-post errors (0x400)

check-heap (che) -- check heap adm structs (0x800)

check-lists (cli) -- check free lists (0x1000)

check-blank (cbl) -- check mem overwritten by alloc-blank, free-blank (0x2000)

check-funcs (cfu) -- check functions (0x4000)

force-linear (fli) -- force heap space to be linear (0x10000)

catch-signals (csi) -- shutdown program on SIGHUP, SIGINT, SIGTERM (0x20000)

realloc-copy (rco) -- copy all re-allocations (0x100000)

free-blank (fbl) -- overwrite freed memory space with BLANK_CHAR (0x200000)

error-abort (eab) -- abort immediately on error (0x400000)

alloc-blank (abl) -- overwrite newly alloced memory with BLANK_CHAR (0x800000)

heap-check-map (hem) -- log heap-map on heap-check (0x1000000)

print-messages (pme) -- write messages to stderr (0x2000000)

catch-null (cnu) -- abort if no memory available (0x4000000)

Перейти на страницу:

Похожие книги

C++ Primer Plus
C++ Primer Plus

C++ Primer Plus is a carefully crafted, complete tutorial on one of the most significant and widely used programming languages today. An accessible and easy-to-use self-study guide, this book is appropriate for both serious students of programming as well as developers already proficient in other languages.The sixth edition of C++ Primer Plus has been updated and expanded to cover the latest developments in C++, including a detailed look at the new C++11 standard.Author and educator Stephen Prata has created an introduction to C++ that is instructive, clear, and insightful. Fundamental programming concepts are explained along with details of the C++ language. Many short, practical examples illustrate just one or two concepts at a time, encouraging readers to master new topics by immediately putting them to use.Review questions and programming exercises at the end of each chapter help readers zero in on the most critical information and digest the most difficult concepts.In C++ Primer Plus, you'll find depth, breadth, and a variety of teaching techniques and tools to enhance your learning:• A new detailed chapter on the changes and additional capabilities introduced in the C++11 standard• Complete, integrated discussion of both basic C language and additional C++ features• Clear guidance about when and why to use a feature• Hands-on learning with concise and simple examples that develop your understanding a concept or two at a time• Hundreds of practical sample programs• Review questions and programming exercises at the end of each chapter to test your understanding• Coverage of generic C++ gives you the greatest possible flexibility• Teaches the ISO standard, including discussions of templates, the Standard Template Library, the string class, exceptions, RTTI, and namespaces

Стивен Прата

Программирование, программы, базы данных