How to use GDB to find what function a memory address corresponds to

前端 未结 3 1963
情话喂你
情话喂你 2021-01-30 22:56

I am using google\'s heap checker to track down a memory leak. It gives me a stack trace such as:

Leak of 21 bytes in 1 objects allocated from:                          


        
3条回答
  •  误落风尘
    2021-01-30 23:12

    Assuming your binary has debug information g++ -g you may be able to use x/ to get the info, I know that works for vtables.

    x/xw to print hex words of memory, and gdb will annotate the left side with information about what's at the address.

提交回复
热议问题