开发者

Using gdb info malloc command within xcode (iphone dev)

开发者 https://www.devze.com 2023-01-19 01:13 出处:网络
I\'m playing with gdb within xcode debugging an iphone app. Supposedly, I should be able to use the following command:

I'm playing with gdb within xcode debugging an iphone app.

Supposedly, I should be able to use the following command:

info malloc <0xaddress>

see http://www.friday.com/bbum/2010/01/10/using-malloc-to-debug-memory-misuse-in-cocoa/ and strange GDB error unable to trace

I have env vars MallocStackLoggingNoCompact = 1 and NSZombieEnabled = YES set (via the executable in xcode).

However, I am getting this:

2010-10-03 21:29:01.366 memleaktest[10881:307] *** -[one release]: message sent to deallocated instance 0x1646b0
(gdb) info malloc 0x1646b0
Undefined info command: "malloc 0x1646b0".  Try "help info".

Wh开发者_JAVA百科at am I missing to run this command? (xcode 3.2.4 and iphone SDK 4.1)


Turns out you can only info malloc whilst debugging in the simulator - not on device.


  1. In Xcode go to Run -> Enable Guard Malloc
  2. Set environment variable MallocStackLoggingNoCompact to YES (as you already did)

to make sure the logs are being written, in the debugger console you should see this message:

malloc: stack logs being written into /tmp/stack-logs.xxxx.MyApp.xxxxxx.index

Now you should be able to:

(gdb) info malloc 0x1646b0


Experience the same tough issue, any workable method found? Tough this crash only occurs in device not simulator.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号