調試器能做很多事情, 這裡有一些常用的調試器命令:
call [exp]
call [exp]
調用給定的對象功能, 如:print [exp]
(gdb) call (void) [array removeObject: @"just a test"]
輸出給定表達式的原始值, 如:print-object [exp]
(gdb) print (int) [artist length]
輸出表達式返回的對象的值, 該命令可以用po簡化,如set [variable] = [exp]
(gdb) print-object [artist description]
等價於:
(gdb) po artist
將表達式的值賦給變量, 如:whatis [variable]
(gdb) set artist = @"new artist"
輸出變量的類型, 如:help
(gdb) whatis artist
輸出調試器的命令列表, 演示:
(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.

Leave a comment