X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fdoc%2Fgdb.texinfo;h=be65d528d28fdd796af25049eec7adf42184f854;hb=a8eab7c6d529ddd248ff5243bb22e9346196e376;hp=9a0320e5d8f826e3381424808f5c118186440981;hpb=30056ea04ae3ecd828e2a06e12e6f174ae6659c9;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 9a0320e5d8..be65d528d2 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -874,16 +874,17 @@ specified: @value{GDBP} @var{program} @var{core} @end smallexample -You can, instead, specify a process ID as a second argument, if you want -to debug a running process: +You can, instead, specify a process ID as a second argument or use option +@code{-p}, if you want to debug a running process: @smallexample @value{GDBP} @var{program} 1234 +@value{GDBP} -p 1234 @end smallexample @noindent -would attach @value{GDBN} to process @code{1234} (unless you also have a file -named @file{1234}; @value{GDBN} does check for a core file first). +would attach @value{GDBN} to process @code{1234}. With option @option{-p} you +can omit the @var{program} filename. Taking advantage of the second command-line argument requires a fairly complete operating system; when you use @value{GDBN} as a remote @@ -1560,6 +1561,7 @@ show you the alternatives available, if there is more than one possibility). @menu * Command Syntax:: How to give commands to @value{GDBN} +* Command Settings:: How to change default behavior of commands * Completion:: Command completion * Command Options:: Command options * Help:: How to ask @value{GDBN} for help @@ -1616,6 +1618,98 @@ commands. This command accepts the current line, like @key{RET}, and then fetches the next line relative to the current line from the history for editing. + +@node Command Settings +@section Command Settings +@cindex default behavior of commands, changing +@cindex default settings, changing + +Many commands change their behavior according to command-specific +variables or settings. These settings can be changed with the +@code{set} subcommands. For example, the @code{print} command +(@pxref{Data, ,Examining Data}) prints arrays differently depending on +settings changeable with the commands @code{set print elements +NUMBER-OF-ELEMENTS} and @code{set print array-indexes}, among others. + +You can change these settings to your preference in the gdbinit files +loaded at @value{GDBN} startup. @xref{Startup}. + +The settings can also be changed interactively during the debugging +session. For example, to change the limit of array elements to print, +you can do the following: +@smallexample +(@value{GDBN}) set print elements 10 +(@value{GDBN}) print some_array +$1 = @{0, 10, 20, 30, 40, 50, 60, 70, 80, 90...@} +@end smallexample + +The above @code{set print elements 10} command changes the number of +elements to print from the default of 200 to 10. If you only intend +this limit of 10 to be used for printing @code{some_array}, then you +must restore the limit back to 200, with @code{set print elements +200}. + +Some commands allow overriding settings with command options. For +example, the @code{print} command supports a number of options that +allow overriding relevant global print settings as set by @code{set +print} subcommands. @xref{print options}. The example above could be +rewritten as: +@smallexample +(@value{GDBN}) print -elements 10 -- some_array +$1 = @{0, 10, 20, 30, 40, 50, 60, 70, 80, 90...@} +@end smallexample + +Alternatively, you can use the @code{with} command to change a setting +temporarily, for the duration of a command invocation. + +@table @code +@kindex with command +@kindex w @r{(@code{with})} +@cindex settings +@cindex temporarily change settings +@item with @var{setting} [@var{value}] [-- @var{command}] +@itemx w @var{setting} [@var{value}] [-- @var{command}] +Temporarily set @var{setting} to @var{value} for the duration of +@var{command}. + +@var{setting} is any setting you can change with the @code{set} +subcommands. @var{value} is the value to assign to @code{setting} +while running @code{command}. + +If no @var{command} is provided, the last command executed is +repeated. + +If a @var{command} is provided, it must be preceded by a double dash +(@code{--}) separator. This is required because some settings accept +free-form arguments, such as expressions or filenames. + +For example, the command +@smallexample +(@value{GDBN}) with print array on -- print some_array +@end smallexample +@noindent +is equivalent to the following 3 commands: +@smallexample +(@value{GDBN}) set print array on +(@value{GDBN}) print some_array +(@value{GDBN}) set print array off +@end smallexample + +The @code{with} command is particularly useful when you want to +override a setting while running user-defined commands, or commands +defined in Python or Guile. @xref{Extending GDB,, Extending GDB}. + +@smallexample +(@value{GDBN}) with print pretty on -- my_complex_command +@end smallexample + +To change several settings for the same command, you can nest +@code{with} commands. For example, @code{with language ada -- with +print elements 10} temporarily changes the language to Ada and sets a +limit of 10 elements to print for arrays and strings. + +@end table + @node Completion @section Command Completion @@ -18334,8 +18428,7 @@ information. Inspecting the type of a (global) variable for which of such variables. @kindex info types -@item info types @var{regexp} -@itemx info types +@item info types [-q] [@var{regexp}] Print a brief description of all types whose names match the regular expression @var{regexp} (or all types in your program, if you supply no argument). Each complete typename is matched as though it were a @@ -18355,6 +18448,11 @@ This command differs from @code{ptype} in two ways: first, like @code{whatis}, it does not print a detailed description; second, it lists all source files and line numbers where a type is defined. +The output from @samp{into types} is proceeded with a header line +describing what types are being listed. The optional flag @samp{-q}, +which stands for @samp{quiet}, disables printing this header +information. + @kindex info type-printers @item info type-printers Versions of @value{GDBN} that ship with Python scripting enabled may @@ -30026,9 +30124,9 @@ and @samp{tcatch throw} (@pxref{Set Catchpoints}). @smallexample -catch-throw -r exception_type -^done,bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", - addr="0x00000000004006c0",what="exception throw", - catch-type="throw",thread-groups=["i1"], +^done,bkpt=@{number="1",type="catchpoint",disp="keep",enabled="y", + what="exception throw",catch-type="throw", + thread-groups=["i1"], regexp="exception_type",times="0"@} (gdb) -exec-run @@ -30070,9 +30168,9 @@ and @samp{tcatch rethrow} (@pxref{Set Catchpoints}). @smallexample -catch-rethrow -r exception_type -^done,bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", - addr="0x00000000004006c0",what="exception rethrow", - catch-type="rethrow",thread-groups=["i1"], +^done,bkpt=@{number="1",type="catchpoint",disp="keep",enabled="y", + what="exception rethrow",catch-type="rethrow", + thread-groups=["i1"], regexp="exception_type",times="0"@} (gdb) -exec-run @@ -30114,9 +30212,9 @@ and @samp{tcatch catch} (@pxref{Set Catchpoints}). @smallexample -catch-catch -r exception_type -^done,bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", - addr="0x00000000004006c0",what="exception catch", - catch-type="catch",thread-groups=["i1"], +^done,bkpt=@{number="1",type="catchpoint",disp="keep",enabled="y", + what="exception catch",catch-type="catch", + thread-groups=["i1"], regexp="exception_type",times="0"@} (gdb) -exec-run @@ -37626,12 +37724,20 @@ Shows the result of completing the @code{maint test-options} subcommands. This is used by the testsuite to validate completion support in the command options framework. -@kindex maint test-settings -@item maint test-settings set @var{kind} -@itemx maint test-settings show @var{kind} +@kindex maint set test-settings +@kindex maint show test-settings +@item maint set test-settings @var{kind} +@itemx maint show test-settings @var{kind} These are representative commands for each @var{kind} of setting type @value{GDBN} supports. They are used by the testsuite for exercising the settings infrastructure. + +@kindex maint with +@item maint with @var{setting} [@var{value}] [-- @var{command}] +Like the @code{with} command, but works with @code{maintenance set} +variables. This is used by the testsuite to exercise the @code{with} +command's infrastructure. + @end table The following command is useful for non-interactive invocations of @@ -44863,8 +44969,8 @@ You can also start with both an executable program and a core file specified: gdb program core @end smallexample -You can, instead, specify a process ID as a second argument, if you want -to debug a running process: +You can, instead, specify a process ID as a second argument or use option +@code{-p}, if you want to debug a running process: @smallexample gdb program 1234 @@ -44872,9 +44978,8 @@ gdb -p 1234 @end smallexample @noindent -would attach @value{GDBN} to process @code{1234} (unless you also have a file -named @file{1234}; @value{GDBN} does check for a core file first). -With option @option{-p} you can omit the @var{program} filename. +would attach @value{GDBN} to process @code{1234}. With option @option{-p} you +can omit the @var{program} filename. Here are some of the most frequently needed @value{GDBN} commands: