gdb調試器命令及秘籍

| No Comments | No TrackBacks
調試器能做很多事情, 這裡有一些常用的調試器命令:

call [exp]
調用給定的對象功能, 如:
(gdb) call (void) [array removeObject: @"just a test"]

print [exp]
輸出給定表達式的原始值, 如:
(gdb) print (int) [artist length]

print-object [exp]
輸出表達式返回的對象的值, 該命令可以用po簡化,如
(gdb) print-object [artist description]
         等價於:
(gdb) po artist

set [variable] = [exp]
將表達式的值賦給變量, 如:
(gdb) set artist = @"new artist"

whatis [variable]
輸出變量的類型, 如:
(gdb) whatis artist

help
輸出調試器的命令列表, 演示:
(gdb) help
List of classes of commands:

aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
data -- Examining data
files -- Specifying and examining files
internals -- Maintenance commands
obscure -- Obscure features
running -- Running the program
stack -- Examining the stack
status -- Status inquiries
support -- Support facilities
tracepoints -- Tracing of program execution without stopping the program
user-defined -- User-defined commands

Type "help" followed by a class name for a list of commands in that class.
Type "help" followed by command name for full documentation.
Command name abbreviations are allowed if unambiguous.

No TrackBacks

TrackBack URL: http://iphone.ipsw.info/mt/mt-tb.cgi/196

Leave a comment

About this Entry

This page contains a single entry by lvyile published on August 31, 2008 8:06 PM.

Xcode其他工具及命令行工具介紹 was the previous entry in this blog.

內存管理 Memory Management is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.