7. Set display options
There are more options on the display in GDB. Here I will only exist of most common options.
Set Print Address Set Print Address ON Open Address Output, when the program displays the function information, GDB will display the parameter address of the function. The system defaults to open, such as: (GDB) F # 0 set_quotes (lq = 0x34c78 "<<", RQ = 0x34c88 ">>") AT INPUT.C: 530 530 IF (LQUOTE! = Def_lquote)
Set Print Address Off Parameter Address Display, such as: (GDB) Set Print Addr Off (GDB) F # 0 set_quotes (lq = "<<", RQ = ">>") AT INPUT.C: 530 530 IF (LQUOTE! = Def_lquote)
Show Print Address View whether the current address display option is open. Set Print Array Set Print Array ON ON ON Display, when the array is turned, each element occupies a row, if not open, each element is separated by a comma. This option is closed by default. The two commands related to it are as follows, I will not say more. Set Print Array Off Show Print Array
Set print elements> This option is primarily set to set an array. If your array is too big, you can specify a
$ 1 = {Next = 0x0, Flags = {SWEET = 1, Sour = 1}, meat = 0x54 "pork"}
Set Print Pretty Off Close the Printf Pretty this option, the GDB displays the structure as follows: $ 1 = {Next = 0x0, Flags = {SWEET = 1, SOUR = 1}, meat = 0x54 "Pork"} show print Pretty View GDB How to display structures. Set print sevenbit-strings
Show Print Union Display Methods SET Print Object
You can define your own variables in the GDB debug environment to save running data in some debuggers. To define a variable of a GDB is simple. Use the GDB's set command. GDB's environment variables are the same as UNIX, is also a head. For example: SET $ foo = * Object_ptr When using environment variables, GDB will create this variable when you first use, and in later use, it assigns it directly. Environment variables have no type, you can define any type to the environment variable. Includes structures and arrays. Show convenience This command views all the environment variables currently set. This is a relatively powerful function, environmental variable, and program variable interaction, which will make program debugging and convenient. For example: SET $ I = 0 Print Bar [$ I ] -> Contents, when you don't have to, Print Bar [0] -> Contents, Print Bar [1] -> Contents Enter commands. After entering such a command, only the knock back, repeat the previous statement, the environment variable will be automatically accumulated, thereby completing the function of outputting one by one. Ten, check the register
To view the value of the register, it is easy, you can use the following command: Info Registers to view the register. (In addition to floating point registers) Info all-registers to view all registers. (Including floating point registers) Info registers
(All rights reserved, please indicate the author and the source when reproduced)