Is there any interest in a talloc extension to gdb-heap

Richard Sharpe realrichardsharpe at gmail.com
Fri Feb 12 02:06:43 UTC 2016


Hi folks,

There is a tool out there called gdb-heap that allows you to scan the heap
for a process or a core file. It can show you info like:

--------------------------------------
    80: 0x00007f62e815a610 -> 0x00007f62e815a64f       64 bytes C:string
data:None:None |2f 68 6f 6d 65 2f 73 61 6d 62 61 2f 6c 6f 63 6b 2f 73 6d 62
58 73 72 76 5f 74 63 6f 6e 5f 67 6c 6f 62 61 6c 2e 74 64 62 00 f4 95 e4 62
7f 00 00 40 00 00 00 00 00 00 00 31 00 00 00 00 00 00 00
|/home/samba/lock/smbXsrv_tcon_global.tdb....b^?.. at .......1.......|
    81: 0x00007f62e815a650 -> 0x00007f62e815a67f       48 bytes
uncategorized::48 bytes:0x7f62e815a650 |90 c3 cc e6 62 7f 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 b0 51 16 e8 62 7f 00 00 00 65 00 00 00
00 00 00 91 00 00 00 00 00 00 00
|....b^?...................Q..b^?...e..............|
---------------------------------------

I have extended it to understand some aspects of talloc. I can now see
things like:

-----------------------------------------------------------
  1381: 0x00007f62e81998d0 -> 0x00007f62e81999cf      256 bytes
talloc:talloc chunk:144 bytes:"struct memcache_element" |d0 a5 1c e8 62 7f
00 00 80 3b 17 e8 62 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3a 0d 6b e6 62 7f 00 00
90 00 00 00 00 00 00 00 70 0c 15 e8 7f 00 00 01 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 14 00 06 00 ff ff ff ff 50 18 18 e8 62 7f 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 e0 3b 17 e8 62 7f 00 00
|....b^?...;..b^?..................................:.k.b^?..........p...^?...........................P...b^?...................;..b^?..|
  1383: 0x00007f62e8199a00 -> 0x00007f62e819ba8f     8336 bytes talloc:free
talloc pool:0 bytes:"../source3/smbd/process.c:3525" |c0 b9 19 e8 62 7f 00
00 01 00 00 00 62 7f 00 00 00 20 00 00 00 00 00 00 f0 99 19 e8 62 7f 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 c0 80 18 e8 62 7f 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 60 3a
3b e6 62 7f 00 00 00 00 00 00 00 00 00 00 77 0c 15 e8 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 20 9a 19 e8 62 7f 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 60 3a 3b e6 62 7f
00 00 22 00 00 00 00 00 00 00 7b 0c 15 e8 00 00 00 00 00 00 00 00 00 00 00
00 00 9a 19 e8 62 7f 00 00 00 00 00 00 00 00 00 00 53 45 43 52 45 54 53 2f
4d 41 43 48 49 4e 45 5f 50 41 53 53 57 4f 52 44 2f 56 4e 41 53 44 4f 4d
|....b^?......b^?...
..........b^?......................b^?..........................`:;.b^?..........w...............................................
...b^?..........................`:;.b^?..".......{...................b^?..........SECRETS/MACHINE_PASSWORD/VNASDOM|
    1 talloc objects, end at 0x7f62e819b9c0, poolsize: 8192,
round_up_pool_size: 8192
Free object at 0x7f62e8199a80
    Flags: 0xe8150c7b
    Size:  34, prefix = 0, used = 144
    Alloc/Dealloc: "../source3/smbd/process.c:3525"
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 9a 19 e8 62 7f 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 60
3a 3b e6 62 7f 00 00 22 00 00 00 00 00 00 00 7b 0c 15 e8 00 00 00 00 00 00
00 00 00 00 00 00 00 9a 19 e8 62 7f 00 00 00 00 00 00 00 00 00 00 53 45 43
52 45 54 53 2f 4d 41 43 48 49 4e 45 5f 50 41 53 53 57 4f 52 44 2f 56 4e 41
53 44 4f 4d 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 |................
...b^?..........................`:;.b^?..".......{...................b^?..........SECRETS/MACHINE_PASSWORD/VNASDOM1...............................|
Free object at 0x7f62e8199b10
    Flags: 0xe8150c7b
    Size:  39, prefix = 0, used = 144
    Alloc/Dealloc: "../source3/smbd/process.c:3525"
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 9a 19 e8 62 7f 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 60
3a 3b e6 62 7f 00 00 27 00 00 00 00 00 00 00 7b 0c 15 e8 00 00 00 00 00 00
00 00 00 00 00 00 00 9a 19 e8 62 7f 00 00 00 00 00 00 00 00 00 00 53 45 43
52 45 54 53 2f 4d 41 43 48 49 4e 45 5f 50 41 53 53 57 4f 52 44 2e 50 52 45
56 2f 56 4e 41 53 44 4f 4d 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 |................
...b^?..........................`:;.b^?..'.......{...................b^?..........SECRETS/MACHINE_PASSWORD.PREV/VNASDOM1..........................|
------------------------------------------------------------

Is this something that would be interesting to people? Should I fork the
gdb-heap project in gitlab or gitgud or something like that?

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list