Console description.
Find the variable name that needs to be viewed.
Then open Xcode's console (command+shift+R) to see the details. Very simple, the master can ignore it. It's really convenient for a rookie like Xcode.
The data is displayed on the console.
Xcode debugger provides users with an interface of GDB, which is an open source debugger organized by GNU. You can do anything in Xcode's graphical interface; However, you can use the GDB command on the command line if necessary. Enter the GDB command line command in the debugging task:
Click the console drawer button in the toolbar to open the console. You can view the commands sent to GDB by Xcode debugger in the console, or you can directly enter GDB commands in the console. Click in the console window and enter the command at the gdb prompt.
Java code
Command interpretation
Break NUM sets a breakpoint at the specified line.
Bt displays all call stack frames. This command can be used to display the calling order of functions.
Clear deletes breakpoints set on specific source files and specific lines. Its usage is: clear the file name: NUM.
Continue to execute the program being debugged. Use this command when the program is processing a signal or breakpoint.
When it stops running.
Displays the value of the expression that EXPR displays every time the program stops. An expression consists of variables defined by a program.
File FILE loads the specified executable file for debugging.
Help Name Displays help information for the specified command.
Information Breakpoints displays the current list of breakpoints, including the number of breakpoints reached.
Info files displays the details of the debug file.
Info func displays all function names.
Info local displays local variable information in a function.
Info prog displays the execution status of the debugged program.
Info var displays all global and static variable names.
Kill terminates the program being debugged.
The list shows the source code snippets.
Make Run the make tool without exiting gdb.
Next executes one line of source code forward without stepping into other functions.
Print EXPR to display the value of expr expression.
Print an object.
Print (int) name print type.
Print-object [artistdescription] calls the function.
Set artist = @"test "sets the variable value.
What is the data type of variational principle?
In Xcode, you can't directly view the values of variables when debugging, like eclipse or VS integrated development. So how do you view XCode variables when debugging? There are some ways.
1, create a new single-view App.
Add some code in viewDidLoad:
- (void)viewDidLoad
{
[super viewdidload];
NSDictionary*dic = [NSDictionary
dictionaryWithObjectsAndKeys:@ " value 1 "、@"key 1 "、@"28 "、@"age "、@"rongfzh "、@"name ",nil];
UILabel * label
=[[ui label alloc]init];
label.frame=
CGRectMake(20,40,250,60);
label.text=
[DIC objectForKey:@ " name "];
[self . view addSubview:label];
}
Break the last line.
2. "Po": Print the object command to print out the object.
Command+R debugging operation, input on lldb of debugging console.
po dic
When you get into the car, you can print out the dictionary.
Try printing the label again.
(lldb) purchase order label
(ui label *)$ 3 = 0x 06 A8 BDD 0 & lt; ui label:0x 6a 8 BDD 0; Frame =
(20 40; 250 60); text = ' rongfzhclipsToBounds = YES
userInteractionEnabled = NOlayer = & ltCALayer:0x 6 A8 be 90 & gt; & gt
The information of the label is also printed.
3. Printing orders
print(char *)[[DIC description]cString]
(char *) $4 = 0x06d79760 "{\n Age = 28; \ n key 1 = value 1; \ n name = rongfzh\n} "
The reserved account of the object was printed, but the object was recycled.
(lldb)print(int)[ label retention count]
(int) $2 = 1
GDB can help us check variable values conveniently.
When execution reaches a breakpoint, you can use po in GDB window to view variables. (po = printobject)
1) View strings or other variables.
Purchase order variable name
2) View an attribute. For example, look at the name property of the item variable.
Po[ project name] <; Wbr>& ltwbr & gt Please note that po item.name doesn't work. & lt/wbr & gt; & lt/wbr & gt;
3) View the array
Myanmar object index
If you need to view the memory data, you can use the gdb command: x/nfu in the output window.
N represents the number of memory cells to be displayed.
-
F stands for display mode, and can take the following values:
X displays variables in hexadecimal format.
Displays variables in decimal format.
U Displays unsigned integers in decimal format.
O Display variables in octal format
Displays variables in binary format.
Displays variables in hexadecimal format.
Instruction address format
Displays variables in character format.
F displays variables in floating-point format.
-
U represents the length of the address unit:
B stands for single byte.
H stands for double bytes
W stands for four bytes
G stands for eight stanzas.