LMDBG ¼øÀ§ ¹× ¿ä¾à
- ƯÇã:
- MIT/X Consortium Lic...
- °Ô½ÃÀÚ À̸§:
- Aleksey Cheusov
LMDBG ű×
LMDBG ¼³¸í
°æ·® malloc µð¹ö°Å LMDBG´Â ¸Þ¸ð¸® ´©¼³ ¹× ÀÌÁß ÇØÁ¦¸¦ ŽÁö ÇÒ ¼öÀÖ´Â ÀÀ¿ë ÇÁ·Î±×·¥ÀÔ´Ï´Ù. ±×·¯³ª ´Ù¸¥ ±âŸ¿Í ´Þ¸® LMDBG´Â * FULL * StackTraces¿Í ÇØ´ç ºÐ¼®¿¡¼ ·Î±ëÀ» ºÐ¸®ÇÏ¿© ¸ðµâº°·Î ÀÀ¿ë ÇÁ·Î±×·¥À» ºÐ¼®ÇÕ´Ï´Ù .- LMDBG-RUNÀº ÁÖ¿ä LMDBG À¯Æ¿¸®Æ¼ÀÔ´Ï´Ù. ÀÀ¿ë ÇÁ·Î±×·¥À» ½ÇÇàÇÏ°í È£Ãâ µÈ ¸ðµç malloc / calloc / realloc / free / memalign / posix_memalign È£ÃâÀÌ ÀÔ·Â (¹ÙÀÌÆ® Ä«¿îÆ®, Æ÷ÀÎÅÍ), Ãâ·Â (Æ÷ÀÎÅÍ) ¹× (!!! Uniques)¿¡ µî·Ï µÈ ·Î±× ÆÄÀÏ (¶Ç´Â FIFO)À» »ý¼ºÇÕ´Ï´Ù. ±â´É !!!) Àüü ½ºÅà Ʈ·¹À̽º (Æ÷ÀÎÅÍ) .Example : $ cat tests / test2.c #include int main () {void * p1 = null; void * p2 = null; p1 = malloc (555); P2 = REALLOC (P2, 666); P2 = REALLOC (P2, 777); P2 = REALLOC (P2, 888); ¹Ýȯ 0; } $ gcc -o0 -g -o _test2 tests / test2.c $ lmdbg-run -o _log ./_test2 $ cat _log malloc (555) -> 0xB9014000xBBBE58E80xBBBE58E80xBBBBE5B030xBBBBE5B030xBBBBE5B030x80487380x80485840x80484E7 realloc (null, 666) -> 0xbb9018000xbbbe58e80xbbbe5a370x804874e 0x80485840x80484e7 reallocÀ» (0xbb901800, 777) -> 0xbb901c000xbbbe58e80xbbbe5a370x80487640x80485840x80484e7 reallocÀ» (0xbb901c00, 888) -> 0xbb9018000xbbbe58e80xbbbe5a370x804877a 0x80485840x80484e7 $ Âü°í : Àüü ½ºÅà Ʈ·¹À̽º´Â ÀÀ¿ë ÇÁ·Î±×·¥À» ºÐ¼® ÇÒ ¼ö ÀÖ½À´Ï´Ù Áï, ´ç½Å ¾î¶² ºí·Ï / ±¸¼º ¿ä¼Ò°¡ ´Ù¸¥ ¸Þ¸ð¸®º¸´Ù ´õ ¸¹Àº ¸Þ¸ð¸®¸¦ ÇÊ¿ä·ÎÇÏ´ÂÁö ŽÁö ÇÒ ¼ö ÀÖ½À´Ï´Ù. lmdbg-symÀº ¸Å¿ì Áß¿äÇÑ µµ±¸ÀÔ´Ï´Ù.-lmdbg-limeaks´Â LMDBG ½ÇÇà ¹× Ãâ·Â¿¡ ÀÇÇØ »ý¼º µÈ ·Î±× ÆÄÀÏÀ» ºÐ¼®ÇÕ´Ï´Ù. $ lmdbg-leaks _log realloc (0xBB901C00, 888) -> 0xB9018000xBBBE58E80xBBBBE5A370x804877A 0x80484E7 MALLOC (555) -> 0xBBBE58E80xBBBE58E80xBBBBE58E80xBBBBE58E80xBBBBE58E80xBBBBE5B030xBBBBE58E80xBBBBE58E80xBBBBE58E80x80487380x80485840x80485840x80484E7 $-lmdbg-symÀº Source.c¿¡ ÁÖ¼Ò¸¦ º¯È¯ÇÕ´Ï´Ù .c : 999 FacrimentExample (GDB (1)ÀÌ ÀÛµ¿ ÁßÀÓ) : $ lmdbg-sym ./ _test2 _logÀÇ malloc (555) -> 0xbb9014000xbbbe58e80xbbbe5b030x8048738 Å×½ºÆ® / test2.c 8 ÁÖ 0x80485840x80484e7À¸·Î realloc (NULL, 666) -> 0xbb9018000xbbbe58e80xbbbe5a370x804874e Å×½ºÆ® / test2.c : 9 ÁÖ 0x80485840x80484e7 reallocÀ» (0xbb901800, 777) -> 0xbb901c000xbbbe58e80xbbbe5a370x8048764 Å×½ºÆ® / test2.c 10 ÁÖ 0x80485840x80484e7 reallocÀ» (0xbb901c00, 888) -> 0xbb9018000xbbbe58e80xbbbe5a370x804877a Å×½ºÆ® / test2.c 11 ÁÖ 0x80485840x80484e7 $ ¿¹ (Àº addr2line (1) ÀÛµ¿ ¿©±â) : $ lmdbg-sym -a ./_test2 _log malloc (555 ) -> 0xbb9014000xbbbe58e80xbbbe5b030x8048738 Å×½ºÆ® / test2.c 80x80485840x80484e7À¸·Î realloc (NULL, 666) -> 0xbb9018000xbbbe58e80xbbbe5a370x804874e Å×½ºÆ® / test2.c 90x80485840x80484e7 reallocÀ» (0xbb901800, 777) -> 0xbb901c000xbbbe58e80xbbbe5a370x8048764 Å×½ºÆ® / test2.c 100x80485840x80484e7 reallocÀ» (0xbb901c00, 888) -> 0xbb9018000xbbbe58e80xbbbe5a370x804877a Å×½ºÆ® / test2.c 110x80485840x80484e7 $ - lmdbg-sysleaks - greps ¶Ç´Â ½Ã½ºÅÛ ¸Þ¸ð¸® ´©Ãâ libcÀÇ ¹ß°ß °Ç³Ê ¶Ù libdl , C ++ STL µî TESTS / LMDBG * .conf ÆÄÀÏÀ» ÂüÁ¶ÇϽʽÿÀ. ±âº» ±¸¼º ÆÄÀÏÀº ´ÙÀ½°ú °°½À´Ï´Ù. ~ / .lmdbg.conf ¹× /etc/lmdbg.conf-lmdbg = lmdbg-run + lmdbg-lueaks + lmdbg-sym + lmdbg-sysleaksthat´Â LMDBG°¡ ¿ÃÀοø ´õ ³ôÀº ·¹º§ ÅøÀÔ´Ï´Ù. example : $ lmdbg -v -o _log ./_test2 ¸Þ¸ð¸® ´©¼ö°¡ '_log'$ cat _log realloc (0xBB901C00, 888) -> 0xBB9018000xBBBE5A370xBBBE5A370xBBBE5A370xBBBE5A370xBBBE5A370xBBBBE5A370xBBBE5A370xBBBE5A370XBBBE5A37 : 11 ¸ÞÀÎ 0x80485840x80484E7 Malloc ( 555) -> 0xBB9014000xBBBE58E80xBBBE58E80xBBBE5B030xBBBBE5B030x8048738 TESTS / TEST2.C : 8 MAIN 0x80485840x80484E7 $
LMDBG °ü·Ã ¼ÒÇÁÆ®¿þ¾î