HP gnu source-level debugger 5992-4701 Bedienungsanleitung

Stöbern Sie online oder laden Sie Bedienungsanleitung nach Software HP gnu source-level debugger 5992-4701 herunter. HP gnu source-level debugger 5992-4701 User's Manual Benutzerhandbuch

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 369
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen

Inhaltsverzeichnis

Seite 1 - Debugging with GDB Manual

Debugging with GDB ManualThe GNU Source-Level DebuggerHP Part Number: 5992-4701Published: February 2009Edition: 19

Seite 2

14.35.3.1 Printing of locals and globals in a stripped module...24014.35.3.2 Backtrace on stripped frames...

Seite 4 - 4 Table of Contents

9 Using GDB with Different LanguagesAlthough programming languages generally have common aspects, they are rarelyexpressed in the same manner. For ins

Seite 5 - Table of Contents 5

'.cxx','.c++''.f', '.F','.f90'Fortran source file. GDB does not distinguish between Fortran 77 and F

Seite 6 - 6 Table of Contents

9.2 Displaying the languageThe following commands help you find out which language is the working language,and also what language source files were wr

Seite 7 - Table of Contents 7

error 1 + 2.3The second example fails because the CARDINAL 1 is not type-compatible with theREAL 2.3.For the expressions you use in GDB commands, you

Seite 8 - 8 Table of Contents

For expressions you use in GDB commands, you can tell GDB to treat range errors inone of three ways: ignore them, always treat them as errors and aban

Seite 9 - Table of Contents 9

9.4.1 C and C++Since C and C++ are so closely related, many features of GDB apply to both languages.Whenever this is the case, we discuss those langua

Seite 10 - 10 Table of Contents

==, !=Equality and inequality. Defined on scalar types. The value of theseexpressions is 0 for false and non-zero for true.<, >, <=, >=Les

Seite 11 - Table of Contents 11

:: C++ scope resolution operator. Defined on struct, union, andclass types.::Double colons also represent the GDB scope operator (see“Expressions” (pa

Seite 12 - 12 Table of Contents

9.4.1.3 C++ expressionsGDB expression handling can interpret most C++ expressions.WARNING! GDB can only debug C++ code if you use the proper compiler.

Seite 13 - List of Tables

16.2.10 Miscellaneous commands...26516.3 XDB data formats and HP WDB equi

Seite 14 - List of Examples

references are often used for large structures. The address of a reference variableis always shown, unless you have specified 'set print address

Seite 15 - Summary of GDB

Range checking, if turned on, is done on mathematical operations. Array indices arenot checked, since they are often used to index a pointer that is n

Seite 16

searches for a function whose signature matchesthe argument types, using the standard C++conversion rules (see “C++ expressions”(page 109), for detail

Seite 17 - Contributors to GDB 17

integer*1, integer*2,integer*4, integer*8• allocatable• assumed-sizelogical*1, logical*2,• assumed-shapelogical*4, logical*8 byte,• adjustablereal*4,

Seite 18

info common<common_block_name>Lists values of variables in the named commonblock.Fortran entry points are supported.You can set a break point sp

Seite 19 - 1 A Sample GDB Session

10 Examining the Symbol TableThe commands described in this chapter allow you to inquire about the symbols (namesof variables, functions, and types) d

Seite 20 - 1.3 Setting Breakpoints

detailed description, instead of just the name ofthe type.For example, for this variable declaration:struct complex {double real; double imag;} v;the

Seite 21 - 1.8 Printing Variable Values

info functions regexpPrint the names and data types of all definedfunctions whose names contain a match forregular expression regexp. Thus, 'info

Seite 22 - 1.9 Listing Source Code

showsymbol-reloadingShow the current on or offsetting.set opaque-type-resolutiononTell GDB to resolve opaque types. An opaquetype is a type declared a

Seite 23

11 Altering ExecutionOnce you think you have found an error in your program, you might want to find outfor certain whether correcting the apparent err

Seite 24

20.7 Errors...30220.8 Informatio

Seite 25 - 2 Getting In and Out of GDB

((gdb)) p g$1 = 1((gdb)) set g=4((gdb)) p g$2 = 1((gdb)) rThe program being debugged has been started already.Start it from the beginning? (y or n) yS

Seite 26 - 2.1.1 Choosing files

or of local variables. For this reason, the jump command requestsconfirmation if the specified line is not in the function currentlyexecuting. However

Seite 27 - 2.1.2 Choosing modes

return, returnexpressionYou can cancel execution of a function call with the returncommand. If you give an expression argument, its valueis used as th

Seite 28 - Program exited normally

show writeDisplay whether executable files and core files are opened forwriting as well as reading.11.6 Patching programs 123

Seite 30 - 2.2 Quitting GDB

12 GDB FilesGDB needs to know the file name of the program to be debugged, both in order to readits symbol table and in order to start your program. T

Seite 31 - 2.3 Shell commands

filename means to discard information on theexecutable file.symbol-file [ filename ]Read symbol table information from file filename.PATH is searched

Seite 32

option with any of the commands that loadsymbol table information, if you want to be sureGDB has the entire symbol table available.If memory-mapped fi

Seite 33 - 3 GDB Commands

To do this, use the kill command (see “Killingthe child process” (page 45)).add-symbol-file filenameaddress, add-symbol-fileThe add-symbol-file comman

Seite 34 - 34 GDB Commands

info files, info target info files and info target aresynonymous; both commands print the currenttarget (see Chapter 13 (page 133)), including thename

Seite 35 - 3.3 Getting help

List of Tables14-1 Memory Debugging Commands in Interactive and Batch Mode...17716-1 Invocation commands...

Seite 36 - 36 GDB Commands

show auto-solib-addDisplay the current autoloading size threshold,in megabytes.12.2 Specifying shared library locationsOn HP-UX, when the shared libra

Seite 37 - 3.3 Getting help 37

For example, if you want to use /tmp/usr/lib/libsubs.sl and /tmp/usr/share/lib/libsubs.sl, you can set GDB_SHLIB_ROOT' to /tmp. Now whenever GDBe

Seite 38

the preceding source line. This is known to occurin the SunOS 4.1.1 (and earlier) C compiler.GDB circumvents the problem by treating thesymbol scope b

Seite 39 - 4 Running Programs Under GDB

13 Specifying a Debugging TargetA target is the execution environment occupied by your program.Often, GDB runs in the same host environment as your pr

Seite 40 - 40 Running Programs Under GDB

names or host names to connect with, processnumbers, and baud rates.The target command does not repeat if you pressRET again after executing the comma

Seite 41 - 4.4 Program Environment

target simBuiltin CPU simulator. GDB includes simulators formost architectures. In general,the following commandswork:target simloadrunHowever, you ca

Seite 42 - 42 Running Programs Under GDB

set endian bigInstruct GDB to assume the target is big-endian.set endian littleInstruct GDB to assume the target is little-endian.set endian autoInstr

Seite 43 - 4.6 Program Input and Output

14 HP-UX Configuration-Specific InformationWhile nearly all GDB commands are available for all native and cross versions of thedebugger, there are som

Seite 44 - 44 Running Programs Under GDB

• Serial debugging of a parent and child process.• Support for Parallel Processing limited to pthread parallelism, but not the compilergenerated paral

Seite 45 - 4.8 Killing the child process

• Enhanced info symbol ADDRESS command. The info symbol ADDRESScommand has been enhanced to search for a symbol at the given address.Previously, the i

Seite 46 - ((gdb)) thread 1

List of Examples14-1 Sample Output for the find command...19814-2 Sample Commands to

Seite 47

• Support for evaluating macros.• Support for printing the execution path entries in the current frame, or thread.• New Command for Searching a Patter

Seite 48 - 48 Running Programs Under GDB

the standard library routines under libc.so and libdld.so. The following standardlibraries are dependencies for runtime checking:unlink()abort()uwx_re

Seite 49

14.3 Supported Platforms and Modes• Supported PlatformsHP WDB supports source-level debugging of programs written in HP C, HP aC++,and Fortran 90 on I

Seite 50 - 50 Running Programs Under GDB

NOTE: HP WDB cannot be attached to a process that is traced by tools which usettrace, such as Caliper, adb, and tusc. The debugger displays the follow

Seite 51 - 5 Stopping and Continuing

n/a/opt/langtools/bin$WDB_ROOT/binlibrtc.sl locationn/aGDB_SERVER$WDB_ROOT/binNone$LIBRTC_SERVERn/a$WDB_ROOT/lib/opt/langtools/binNOTE: If you define

Seite 52 - 5.1.1 Setting breakpoints

however, may not find source files if the object files arenot available.This minimizes or eliminates the need to specify multipleobjectdir commands wh

Seite 53 - 5.1 Breakpoints 53

The advantages include:• You do not have to recompile and relink the entire program.• You do not have to reload the program into the debugger.• You ca

Seite 54 - 54 Stopping and Continuing

• You cannot add an alloca() function to a frame that did not previously usealloca().• New structure fields can be added at the end of a structure obj

Seite 55 - 5.1 Breakpoints 55

NOTE: You must rebuild the program after you use the fix command because thechanges you make are temporarily patched into the executable image. The ch

Seite 56 - 5.1.2 Setting catchpoints

The problem might be that there is no return for the num function. You can correctthis without leaving the debugger.4. Set a break point at main:(gdb)

Seite 57 - 5.1 Breakpoints 57

Summary of GDBThe purpose of a debugger such as GDB is to allow you to see what is going on “inside”another program while it executes―or what another

Seite 58 - 5.1.4 Disabling breakpoints

10. When you finish with the debugging session, you can exit the debugger normally:(gdb) qThe following modules in /dev/src/mysum have been fixed:/dev

Seite 59 - 5.1.5 Break conditions

3. You can use the following commands for debugging inline functions in HP 9000systems:stepnextlistbacktraceframe <n>info localsinfo argsThe fol

Seite 60 - 60 Stopping and Continuing

The set inline-debug off command disables the inline debugging feature. Youcan disable inline debugging by entering this command before attaching the

Seite 61 - 5.1 Breakpoints 61

(gdb) set inline-debug inline_bp_all or$ gdb --inline = inline_bp_all• To set and modify individual breakpoints on specific instances of inlinefunctio

Seite 62 - 5.1.7 Breakpoint menus

- show macro [macro-name] or info macro [macro-name]Displays the macro definition, source file name, and the line number. For example:(gdb) info macro

Seite 63 - 5.1 Breakpoints 63

The macro debugging features are supported for +objdebug and +noobjdebugcompiler options.14.9.2 Examples for Macro DebuggingThe following example illu

Seite 64 - 5.2 Continuing and stepping

(gdb) b 13Breakpoint 1 at 0x40007d0:0: file scope.c, line 13 from sc.(gdb) b 23Breakpoint 2 at 0x40007d0:2: file scope.c, line 23 from sc.(gdb) b 30Br

Seite 65

Breakpoint 2 at 0x40007d0:2: file scope.c, line 23 from sc1.(gdb) b 30Breakpoint 3 at 0x40007e0:0: file scope.c, line 30 from sc1.(gdb) rStarting prog

Seite 66 - ((gdb)) until

For more information on memory debugging with WDB, see the Debugging DynamicMemory Usage Errors Using HP WDB whitepaper at the HP WDB Documentationweb

Seite 67 - 5.3 Signals

HP WDB offers the following memory-debugging capabilities:• Reports memory leaks• Reports heap allocation profile• Stops program execution if bad writ

Seite 68 - 68 Stopping and Continuing

Plea: Additions to this section are particularly welcome. If you or your friends (orenemies, to be evenhanded) have been unfairly omitted from this li

Seite 69

use info heap, the result does not show anyallocations.info heap filenameWrites heap report output to the specified file.info heap idnumberProduces de

Seite 70 - 70 Stopping and Continuing

info leaks filenameWrites the complete leak report output to thespecified file.info leak leaknumberProduces detailed information on the specifiedleak

Seite 71 - 6 Examining the Stack

and, bcopy. WDB 5.6 and later versions of thedebugger also validates calls to strcat andstrncat.NOTE: HP WDB 6.0 and later versions of thedebugger imp

Seite 72 - 6.4 Backtraces

for the footer is 16 bytes if this option is not used.If the user specifies a value less than 16 for thenumber of bytes, the debugger ignores it andta

Seite 73 - 6.5 Selecting a frame

The debugger assigns each leak a numeric identifier.7. To display a stack trace for a specific leak, use the info leak command andspecify the number f

Seite 74 - 6.6 Information about a frame

frame_count=no_frames (or)set heap-check frame-count<no_frames>Sets the number of frames to be printed for leakcontext.min_heap_size=block_size(

Seite 75

4. Complete one of the following steps to preload the librtc runtime library:• Set the target application to preload librtc by using the +rtc option f

Seite 76

LD_PRELOAD=/opt/langtools/lib/librtc.sl <executable>– For 64-bit IPF applications,LD_PRELOAD=/opt/langtools/lib/pa20_64/librtc.sl <executable

Seite 77 - 7 Examining Source Files

has the filename rtcconfig. If user prefers to set this option, it must include thefilename.◦ Incorrect usage:export GDBRTC_CONFIG=./export GDBRTC_CON

Seite 78 - 7.2 Searching source files

mem_logfile=stderr[+]filenameheap_logfile=stderr[+]filename◦ Specify config_strings for +check=malloc on Itanium or WDB memorycheck batch mode on Inte

Seite 79

Brian Fox is the author of the readline libraries providing command-line editing andcommand history.Andrew Beers of SUNY Buffalo wrote the language-sw

Seite 80 - 7.4 Source and machine code

4. Complete one of the following steps:– Map the shared libraries privately using chatr, as follows:chatr +dbg enable <executable>On HP-UX 11i v

Seite 81

2. The rtcconfig file should contain entries such as the following:check_heap=oncheck_leaks=oncheck_free=onfiles=exec1:exec2:exec3output_dir=/tmp/resu

Seite 82

1. Complete one of the following steps to preload the librtc runtime library:– Set the target application to preload librtc by using the +rtc option f

Seite 83 - 8 Examining Data

2. Run the program.3. Start a debugging session as follows:gdb -leaks <executable-name> <process-id>4. Use info heap and info leaks comman

Seite 84 - 8.2 Program variables

set heap-check min-leak-size numFor example, if you use,set heap-check min-leak-size 100WDB does not collect stack traces for allocations smaller than

Seite 85 - 8.3 Artificial arrays

Syntax:info corruption [<file name>]The run time memory checking must be enabled before using the info corruptioncommand to detect memory corrup

Seite 86 - 8.4 Output formats

NOTE: Software literature names this concept as premature free or Reading/writing freedmemory using a pointer.WDB tracks the dangling pointers and dan

Seite 87 - 8.5 Examining memory

Table 14-1 Memory Debugging Commands in Interactive and Batch ModeBatch modeInteractive modeCommand Descriptioncheck_heap= [on | off] (or)set heap-che

Seite 88 - 88 Examining Data

Table 14-1 Memory Debugging Commands in Interactive and Batch Mode (continued)Batch modeInteractive modeCommand DescriptionNot supported in batch mode

Seite 89 - 8.6 Automatic display

show heap-checkDisplays all current settings for memorychecking.14.10.10.2 info heap arenaThe info heap arena command enables the user to view high le

Seite 91 - 530 if (lquote != def_lquote)

4. When the program is stopped at a breakpoint, use the info heap command:(gdb) info heapAnalyzing heap ...doneActual Heap Usage:Heap Start = 0x404080

Seite 92 - 92 Examining Data

set heap-check high-mem-countX_numberStops when brk() value has moved X_numberof times.Limitations:• This feature assumes that an application has a de

Seite 93 - 8.7 Print settings 93

14.11.2 Backtrace Support for Thread DebuggingThe following commands are available as backtrace support for thread debugging:bt The bt command provide

Seite 94 - 94 Examining Data

• The thread terminates execution, and the resources associated with the terminatedthread continues to exist in the application because the thread has

Seite 95 - 8.8 Value history

features are available as options to the set thread-check command. The syntax forthe set thread-check command is as follows:set thread check { [on|off

Seite 96 - 8.9 Convenience variables

uses the same condition variable in multiple calls,by different threads to pthread_cond_wait()or pthread_cond_timedwait(), but specifiesdifferent mute

Seite 97 - 8.9 Convenience variables 97

read-write locks that are associated with thethread. The debugger transfers the executioncontrol to the user and prints a warning messagewhen this con

Seite 98 - 8.10 Registers

num-waiters [num] The set thread-check num-waiters[num] command checks if the number of threadswaiting on any pthread object exceeds thespecified thre

Seite 99 - 8.12 Floating point hardware

1. Set LD_LIBRARY_PATH to include the appropriate directory, by entering one ofthe following commands:• For 32 bit IPF applications,LD_LIBRARY_PATH=/o

Seite 100

$ chatr +dbg enable ./<executable>(This step is not required on Integrity systems.)To explicitly preload the librtc runtime library and start th

Seite 101

1 A Sample GDB SessionThis chapter describes the most common GDB commands with the help of an example.The following topics are discussed:• Loading the

Seite 102

NOTE: Use the set frame-count setting in the rtconfig file to control the depthof the stack trace file. This command controls the depth of the call st

Seite 103 - 9.3 Type and range checking

NOTE: The configuration file contains lines of the following form:set thread-check [on|off] | [option] [on|off] | [option] [num]And/Orset frame-count

Seite 104

5. Complete one of the following steps to preload the librtc runtime library:• Set the target application to preload librtc by using the +rtc option f

Seite 105 - 9.4 Supported languages

If LD_PRELOAD and chatr +rtc are used to preload the librtc runtimelibrary , the librtc runtime library is loaded from the path specified byLD_PRELOAD

Seite 106 - 9.4.1 C and C++

Behavior of the +check=thread option can be changed by users by providing theirown rtcconfig file. The user specified rtcconfig file can be in the cur

Seite 107 - 9.4 Supported languages 107

14.13 Debugging multiple processes ( programs with fork and vforkcalls)14.13.1 Ask mode for set follow-fork-modeThe ask command prompts the user to se

Seite 108

0x40172b27: (b2) P3lc_gr gr=400x40172b29: (61) R3body rlen=330x40172b2b: (81) B1label_state label=10x40172b2c: (c0) B2epilogue t=440x40172b2e: (00) R1

Seite 109 - 9.4 Supported languages 109

+lengthSpecifies the length of the memory address range. Thisparameter is mandatory when end-address is notspecified.expr1, expr2, ...Specifies a var

Seite 110

Example 14-1 Sample Output for the find command$ cat example.c#include <stdio.h>#include <stdlib.h>int main(){ char *str; str = (char *)

Seite 111 - 9.4 Supported languages 111

where:&a[0] Specifies the start address of the memory address range.&a[10] Specifies the end address of the memory address range.“el”, 'l

Seite 112 - 9.4.2 Fortran

© Copyright 2009 Hewlett-Packard Development Company, L.P.Confidential computer software. Valid license from HP required for possession, use or copyin

Seite 113 - 9.4 Supported languages 113

$ (gdb) m4HP gdb 3.0 for PA-RISC 1.1 or 2.0 (narrow), HP-UX 11.00.Copyright 1986 - 2001 Free Software Foundation, Inc.Hewlett-Packard Wildebeest 3.0 (

Seite 114

NOTE: Following are different ways of representing the /size-char and/max-count parameters:/1b/b1/b /1/1 /b where:1 Specifies that find must display 1

Seite 115 - 10 Examining the Symbol Table

the core file to be used if the packcore directory does not contain a core file. If used,this second argument causes a symbolic link to be created in

Seite 116

NOTE: Limitations for the enhanced info target command on corefile are asfollows:• The enhanced info target command is not supported when theexpanded_

Seite 117

To analyze this core file with HP WDB on HP-UX 11i version 2, you must do thefollowing:• When starting from HP WDB command line:(gdb) core-file [core.

Seite 118 - {<no data fields>}

For example,(gdb) i ep 4 10• info exec-path summaryPrints the summary information about all the local execution path entries in thecurrent frame. This

Seite 119 - 11 Altering Execution

For more information on this feature, see the following example.14.16.2 Example Illustrating Execution Path RecoveryThe following example illustrates

Seite 120 - 120 Altering Execution

(gdb) i epLocal execution path table for main():0 0x4000a80:2 (execpath.c:10)(gdb) i gepGlobal execution path table:G0 0x4000a80:2 main (execpath.c:10

Seite 121

14.18 Invoking GDB Before a Program AbortsThis -crashdebug option enables GDB to monitor the execution of a process or aprogram. It invokes GDB when t

Seite 122 - 11.6 Patching programs

Abort gdb command line call? (y or n) y#0 main () at ./address_error.c:4141 fun (count, count*1.1);(gdb) bt#0 main () at ./address_error.c:41(gdb) qui

Seite 123 - 11.6 Patching programs 123

14.21.3.1 Setting breakpoints in unstripped shared libraryGDB will not be able to put breakpoints using symbolic names(of the symbols not inexport lis

Seite 124

((gdb)) n882 set_quotes((argc >= 2) ? TOKEN_DATA_TEXT(argv[1])\: nil,1.6 Stepping into a subroutineThe set_quotes looks like a promising subroutine

Seite 125 - 12 GDB Files

Setting a breakpoint on a template method with multiple instantiations displays a menushowing all instantiations and the user can choose to set breakp

Seite 126 - 126 GDB Files

14.22.2 Setting Deferred Breakpoints in Shared LibraryOn HP-UX, GDB automatically loads symbol definitions from shared libraries whenyou use the run c

Seite 127

To set the breakpoint you must kill the program and then rerun it so that the dynamiclinker maps a copy of the shared library privately. There are two

Seite 128 - 128 GDB Files

The -mapshared option is implemented on both PA-RISC and Itanium platforms inHP WDB 5.2. This option is provided in the WDB GUI and HP WDB. The defaul

Seite 129

14.23.1.1 Printing Decimal floating point constant(gdb) print <num><df/dd/dl/DF/DD/DL>df, DF - _Decimal32dd, DD - _Decimal64dl, DL - _Deci

Seite 130 - 130 GDB Files

HP WDB supports:• Evaluation of expressions with decimal floating point constants and variables.• Setting or assignment of decimal floating point cons

Seite 131

Conversion of types:GDB handles conversion of data types during assignment, printing, and arithmeticand comparison operation.(gdb) p 1.2df +1.2ddThis

Seite 132 - 132 GDB Files

14.25 Language support14.25.1 Enhanced Java Debugging SupportHP WDB shows stack traces of mixed Java, C, and C++ programs. It supports unwindingacross

Seite 133 - 13.1 Active targets

Additional stack unwind features are available starting with SDK 1.4.2. These featuresfall into three categories: Java stack unwind enhancements, Java

Seite 134

Java VM Debugging CommandsThe following commands have been added to enhance Java debugging support:brbacktrace Prints backtrace of mixed Java and nati

Seite 135

((gdb)) p lquote$1 = 0x35d40 "<QUOTE>"((gdb)) p rquote$2 = 0x35d50 "<UNQUOTE>"1.9 Listing Source Codelquote and rquote

Seite 136

14.25.1.3 Java corefile debugging supportHP WDB shows stack traces of mixed Java, C, and C++ programs for java corefile.GDB_JAVA_UNWINDLIB environment

Seite 137

2. Attach gdb to the running process:$ gdb -p 23989HP gdb 5.0 for HP Itanium (32 or 64 bit) and target HP-UX 11.2x.Copyright 1986 - 2001 Free Software

Seite 138

/* off 453 bits, len 27 bits */float f;/* off 480 bits, len 32 bits */14.25.3 Support for _ _fpreg data type on IPFWDB internally converts __fpreg dat

Seite 139

You do not need to use fully qualified names to access symbols within a namespace.The debugger can compile a list of namespaces active in the scope th

Seite 140 - 14.2 HP-UX dependencies

14.27 Support for output loggingThe Visual Interface for HP WDB terminal user interface (TUI) mode supports thecommand, log logfile_name, that saves t

Seite 141 - 14.2 HP-UX dependencies 141

where, ARRAY is the name of the array, and its size is 5x5.The first two lines are comments about this file and the array. The third line denotesthe a

Seite 142

"Steplast is not meaningful for the current line."For example,(gdb) 4 int k = 10; (gdb) sl ---> alias to "steplast" command err

Seite 143 - 14.4 HP-UX targets

14.29 Debugging optimized codeHP WDB supports debugging of optimized code (compiled with both -g and -O) forHP aC++, HP ANSI C and HP WDB for HP Itani

Seite 144

The following commands are not affected by the optimization level of the programbeing debugged:• attach• catch• commands• continue• core• delete• defi

Seite 145

14.29.1 Debugging Optimized Code at Various Optimization LevelsThe following sections describe debugging optimized code support at each optimizationle

Seite 146

((gdb)) cContinuing.define(baz,defn(<QUOTE>foo<UNQUOTE>))baz0000Success! The new quotes now work just as well as the default ones. The pro

Seite 147 - 14.7.3 Using Fix and Continue

and later versions provide support to prevent the debugged program from stoppingat instructions that are predicated false. The program execution can b

Seite 148

execution pattern and translates only the frequently executed code into native Itanium(R)code at runtime.14.30.1 Debugging the application using GDB u

Seite 149

identically. The exact behavior shown by HP 9000 GDB under ARIES may differfrom that on a HP 9000 HP-UX server.• If the debugged process is blocking i

Seite 150 - 14.8 Inline Support

14.31 Visual Interface for WDBWDB includes an HP-supported Visual Interface for WDB with both graphical andterminal modes. The interface is based on V

Seite 151 - 14.8 Inline Support 151

(wdb) quit14.31.2 Navigating the Visual Interface for WDB displayThe Visual Interface for WDB window consists of two areas:• Source pane at the top• D

Seite 152 - $ gdb --inline = on

Run Resume Stop Up Visual Finish Print Type List Interface for WDBFaq Stop

Seite 153 - 14.9 Debugging Macros

14.31.5 Using the TUI modeTo start Visual Interface for WDB in terminal user interface (TUI) mode, run VisualInterface for WDB with the command: /opt/

Seite 154

14.31.7 Using commands to browse through source filesbrowse. For example, CTRL-B, CTRL-F, CTRL-D, CTRL-U are useful for browsing thedebugger window. T

Seite 155 - 14.9 Debugging Macros 155

To save a session to a file:1. Right-click an empty region of the source or debugger pane.2. Choose "Save Session to vdb.pid" from the pop-u

Seite 156

14.35.1 Support for command line calls in a stripped executable on PA-RISC systemsIn WDB, to perform command line calls in a shared library without th

Seite 158

14.35.2.2 For 64-bit applicationsTo perform command line calls in a stripped executable, linked with end.o, you needto do the following:• In the +std

Seite 159

14.36 Displaying the current block scope informationThe which command takes a symbol as an argument and prints the information on agiven symbol. It pr

Seite 161

15 The HP-UX Terminal User InterfaceBy default, GDB runs in line mode. For users who prefer an interface similar (thoughnot identical) to that of the

Seite 162

When you execute the program up to the first breakpoint by issuing the commandruna right angle bracket (>) points to the current location. So after

Seite 163

The Command pane is always present. The possible configurations of the other panesare:• Source• Disassembly• Source/Disassembly• Disassembly/Register•

Seite 164

15.3.3 Source/Disassembly paneThe Source/Disassembly pane appears when you issue the command:la splitYou can also reach this pane from the Source pane

Seite 165

|;;; print_average (my_list, first, last); |*> |0x3524 <main+8> addil L'-0x800,%dp,%r1

Seite 166

15.4 Cycling through the panesUse the commandsla nextandla prevto move from one pane to another without specifying a window name. If you specifyla nex

Seite 167

:...::flags 29000041 r1 51a800 rp 7f6ce597 :

Seite 168

2 Getting In and Out of GDBThis chapter discusses how to start GDB, and exit out of it. The essentials are:• type '(gdb)' to start GDB.• typ

Seite 169

(gdb) la split(gdb) la regs(gdb) la src(gdb) la regs(gdb) foc nextFocus set to REGS window.(gdb)15.6 Scrolling panesTo scroll within a pane, you can u

Seite 170 - <arguments if any>

*>:32 print_average (my_list, first, last); : :33 print_average (my_list, first, last - 3);

Seite 171

winheight [win_name] [+ | -] num_linesIf you omit win_name, the pane with logical focus is resized. When you increase theheight of a pane, the height

Seite 172

16 XDB to WDB Transition GuideThis transition aid is designed for XDB users who are learning WDB, an HP-supportedversion of the industry-standard GDB

Seite 173

• “Assertion control commands”• “Record and playback commands”• “Macro facility commands”• “Signal control commands”• “Miscellaneous commands”16.1.1 I

Seite 174

Table 16-2 Window mode commands (continued)MeaningWDB EquivalentXDB CommandDisplay general registersgr (with -xdb -tui),display $regs (with -tui)grDis

Seite 175

Table 16-3 File viewing commands (continued)MeaningWDB EquivalentXDB CommandList source directory search path(list all directories)ld (with -xdb), sho

Seite 176

Table 16-4 Data viewing and modification commandsMeaningWDB EquivalentXDB CommandMove view location forward orbackward in source file numberlinesl (wi

Seite 177

Table 16-4 Data viewing and modification commands (continued)MeaningWDB EquivalentXDB CommandPrint address using specified for-matp/format &amp;ex

Seite 178 - 14.10.10 Heap Profiling

Table 16-5 Stack viewing commands (continued)MeaningWDB EquivalentXDB CommandView procedure one level nearerinnermost frame of stack (lowernumber)down

Seite 179 - (gdb) b myfunction

All options and command-line arguments you give are processed in sequential order.The order makes a difference when the `-x' option is used.2.1.1

Seite 180

Table 16-7 Job control commands (continued)MeaningWDB EquivalentXDB CommandGo forward or back given # linesg {+ | -}lines (with-xdb), go {+ | -}lines,

Seite 181 - Enabling thread 1

Table 16-9 Auxillary breakpoint commandsMeaningWDB EquivalentXDB CommandPrint any stringp "any string"any_stringConditionally execute cmdsif

Seite 182

Table 16-10 Breakpoint creation commands (continued)MeaningWDB EquivalentXDB CommandSet a class breakpoint at firstexecutable line of all memberfuncti

Seite 183

Table 16-11 Overall breakpoint commands (continued)MeaningWDB EquivalentXDB CommandSet a breakpoint countbc number expr (with -xdb),ignorenumber expr

Seite 184

16.2.6 Assertion control commandsGDB does not provide the ability to trace by instruction. Watchpoints, however, providesimilar functionality to xdb a

Seite 185

Table 16-13 Macro facility commandsMeaningWDB EquivalentXDB CommandDefine a user-defined commanddef name [GDB prompts forcommands]def name replacement

Seite 186

Table 16-15 Miscellaneous commands (continued)MeaningWDB EquivalentXDB CommandInvoke a shell! cmd line (with -xdb), shecmd line! cmd lineExecute comma

Seite 187

Table 16-16 Data format commands (continued)MeaningWDB EquivalentXDB CommandDecimal integerddLong decimal integerdD (1)e Floating-point notation as fl

Seite 188

Table 16-16 Data format commands (continued)MeaningWDB EquivalentXDB CommandPrint in binarytzPrint in long binarytZ (1)(1) HP WDB will display data in

Seite 189

Table 16-18 Special language operatorsMeaningWDB EquivalentXDB Language OperatorUnary operator, address of objectDepends on language$addrUnary Boolean

Seite 190

-m, -mappedWarning: this option depends on operating system facilitiesthat are not supported on all systems.If memory-mapped files are available on yo

Seite 191 - Set BATCH_RTC=on

16.7 XDB variable identifiers and HP WDB equivalentsTable 16-20 Variable IdentifiersMeaningWDB EquivalentXDB Variable IdentifierSearch for varvarvarSe

Seite 192

Table 16-21 A (continued)Equivalent WDB CommandXDB CommandNo exact equivalent, but display expr is equivalentto abc print exprabc cmdsam (with -xdb),

Seite 193

Table 16-22 B (continued)Equivalent WDB CommandXDB Commandbu [depth] (with -xdb). The finish command isequivalent to the sequence bu, c, db (to contin

Seite 194 - 14.12 Debugging MPI Programs

16.8.4 F through KTable 16-24 F through KEquivalent WDB CommandXDB CommandNo equivalentf ["printf-style-fmt"]fr (with -xdb -tui), display $f

Seite 195

Table 16-25 L (continued)Equivalent WDB CommandXDB Commandshow user [string]lm [string]info func [[class]::][string]lo [[class]::][string]info functio

Seite 196

Table 16-26 M through P (continued)Equivalent WDB CommandXDB CommandNo equivalentpq class::No equivalentpq [+ | -][\format16.8.7 Q through STable 16-2

Seite 197

Table 16-28 T (continued)Equivalent WDB CommandXDB CommandNo equivalenttaNo equivalenttbNo equivalenttctd (with -xdb -tui)tdtf (with -xdb -tui), toggl

Seite 198

Table 16-29 U through Z (continued)Equivalent WDB CommandXDB Commandgdb -xdb program -c corefilexdb program corefilegdb -xdb -d dirxdb -d dirgdb -xdb

Seite 199 - 0x61, 0x61, 0x61, 0x61

Table 16-30 Symbols (continued)Equivalent WDB CommandXDB CommandReturnReturnp "any string""any string"Empty string; for example, p

Seite 200 - 14.15 Debugging Core Files

Table 16-30 Symbols (continued)Equivalent WDB CommandXDB CommandControl-CControl-C# [text]# [text]No equivalent#label16.8 Alphabetical lists of XDB co

Seite 201

'-n'). Exit with nonzero status if an error occurs inexecuting the GDB commands in the command files.Batch mode may be useful for running GD

Seite 203

17 Controlling GDBYou can alter the way GDB interacts with you by using the set command. For commandscontrolling how GDB displays data, see “Print set

Seite 204 - (gdb) i ep 4 10

set editing-mode viThe readline interface uses the .inputrc file tocontrol the settings.set history filename fnameSet the name of the GDB command hist

Seite 205 - Sample Debugging Session:

show commands Display the last ten commands in the commandhistory.show commands nPrint ten commands centered on commandnumber n.show commands + Print

Seite 206

set radix 0xasets the base to decimal. On the other hand, setradix 10 leaves the radix unchanged no matterwhat it was.set output-radix baseSet the def

Seite 207

set confirm on Enables confirmation requests (the default).show confirm Displays state of confirmation requests.17.7 Optional messages about internal

Seite 208 - 14.21.3 Hardware breakpoints

show debug varobj Displays the current state of displaying GDB variableobject debugging info.286 Controlling GDB

Seite 209 - (gdb) break ::

18 Canned Sequences of CommandsIn addition to breakpoint commands (see “Breakpoint command lists” (page 61)), GDBprovides the following two ways to st

Seite 210 - (gdb) b main

are executed repeatedly as long as the expressionevaluates to true.document commandname Document the user-defined command commandname,so that it can b

Seite 211 - 14.22.3 Using catch load

enddefine hook-continuehandle SIGLARM passendYou can define a hook for any single-word command in GDB, and not for commandaliases; Also you should def

Seite 212 - (gdb) set mapshared off

print routines so as to allow Epoch to display values ofexpressions in a separate window.-annotate levelThis option sets the annotation level inside G

Seite 213 - /usr/lib/hpux32/dld.so

• VxWorks (Wind River Systems real-time OS): .vxgdbinit• OS68K (Enea Data Systems real-time OS): .os68gdbinit• ES-1800 (Ericsson Telecom AB M68000 emu

Seite 214

not entered in the value history either. See“Expressions” (page 83).output/fmt expression Print the value of expression in format fmt. Youcan use the

Seite 216

19 Using GDB under gnu EmacsA special interface allows you to use gnu Emacs to view (and edit) the source files forthe program you are debugging with

Seite 217 - 14.25 Language support

In the GDB I/O buffer, you can use these special Emacs commands in addition to thestandard Shell mode commands:C-h mDescribe the features of Emacs&apo

Seite 218 - (gdb) help java

is formatted using the Emacs function format; otherwise thenumber is passed as an argument to the corresponding listelement.In any source file, the Em

Seite 220

20 GDB AnnotationsThis chapter describes annotations in GDB. Annotations are designed to interface GDBto graphical user interfaces or other similar pr

Seite 221 - 14.25 Language support 221

command history, nor will it affect GDB's notion of which command to repeat if RETis pressed on a line by itself.The server prefix does not affec

Seite 222

^Z^Zfield-valuethe-value^Z^Zfield-endwhere field-name is the name of the field, separator-string is text whichseparates the name from the value for th

Seite 223

Table of ContentsSummary of GDB...

Seite 224

'xdb_trans.html', which is usually installed in thedirectory /opt/langtools/wdb/doc on HP-UXsystems.-interpreter interpUse the interpreter i

Seite 225

• ^Z^Zfunction-callfunction-call-stringwhere function-call-string is text designed to convey to the user that thisframe is associated with a function

Seite 226

where source-intro-string separates for the user's benefit the reference fromthe text which precedes it, filename is the name of the source file,

Seite 227

^Z^Zpre-prompt^Z^Zprompt^Z^Zpost-promptThe input types are:prompt When GDB is prompting for a command (the main GDBprompt).commands When GDB prompts f

Seite 228

where header-entry has the same syntax as an entry (see below) but instead ofcontaining data, it contains strings which are intended to convey the mea

Seite 229

is output. Before the stopped annotation, a variety of annotations describe how theprogram stopped.^Z^Zexited exit-status The program exited, and exit

Seite 230 - 14.30 Debugging with ARIES

20.12 Annotations We Might Want in the Future• target-invalidthe target might have changed (registers, heap contents, or execution status). Forperform

Seite 232

21 The GDB/MI InterfaceFunction and purposeGDB/MI is a line based machine oriented text interface to GDB. It is specifically intendedto support the de

Seite 233 - /opt/langtools/bin/vdb -tui

Notes:• The CLI commands are still handled by the MI interpreter; their output is describedbelow.• The token, when present, is passed back when the co

Seite 234

value const | tuple | listconst c-stringtuple → "{}" | "{" result ( "," result )* "}"list "[]"

Seite 235 - HPterm*foreground: white

type the interrupt character at any time because GDB does not allow it to take effectuntil a time when it is safe.You can use the detach command to re

Seite 236 - 14.31.5 Using the TUI mode

21.1.3 Simple examples of GDB/MI interactionThis subsection presents several simple examples of interaction using the GDB/MIinterface. In these exampl

Seite 237 - 14.31.9 Editing source files

21.3 GDB/MI output records21.3.1 GDB/MI result recordsIn addition to a number of out-of-band notifications, the response to a GDB/MI commandincludes o

Seite 238 - 14.32 Support for ddd

Note the line breaks shown in the examples are here only for readability. They do notappear in the real output. Also note that the commands with a non

Seite 239

Example(gdb)-break-insert main^done,bkpt=number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000

Seite 240

addr="0x000100d0",func="main",file="hello.c",line="5",cond="1",times="0",ignore="3&qu

Seite 241 - 14.37 Linux support

-break-list^done,BreakpointTable={nr_rows="1",nr_cols="6",hdr=[{width="3",alignment="-1",col_name="number

Seite 242

ExampleN.A.The -break-insert commandSynopsis-break-insert [ -t ] [ -h ] [ -r ][ -c condition ] [ -i ignore-count ][ -p thread ] [ line | addr ]If spec

Seite 243 - 15.1 Starting the TUI

^done,bkpt=number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0001072c",file="recursi

Seite 244 - 15.3 Screen Layouts

hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",

Seite 245 - 15.3.2 Disassembly pane

(gdb)-exec-continue^running(gdb)*stopped,reason="watchpoint-trigger",wpt=number="2",exp="i",value=old="0",new=

Seite 247 - 15.3.5 Source/Register pane

^done,BreakpointTable=nr_rows="1",nr_cols="6",hdr=[width="3",alignment="-1",col_name="number",colhdr

Seite 248 - 15.5 Changing pane focus

GDB commandThere is no direct mapping from this command to the CLI.ExampleDisassemble from the current value of $pc to $pc + 20:(gdb)-data-disassemble

Seite 249

^done,asm_insns=[src_and_asm_line={line="31",file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \testsuite/gdb.mi/basics.c",li

Seite 250 - 15.6 Scrolling panes

The -data-list-changed-registers CommandSynopsis-data-list-changed-registersDisplay a list of the registers that have changed.GDB commandGDB does not

Seite 251 - 15.8 Changing the pane size

(gdb)-data-list-register-names^done,register-names=["r0","r1","r2","r3","r4","r5","r6

Seite 252

^done,register-values=[{number="0",value="0xfe0043c8"},{number="1",value="0x3fff88"},{number="2",val

Seite 253

'word-format'The format to be used to print the memory words. The notationis the same as for GDB print command (see“Output formats”(page 86)

Seite 254 - 16.1.2 Window mode commands

next-row="0x00001512",prev-row="0x0000150e",next-page="0x00001512",prev-page="0x0000150e",memory=[{addr="

Seite 255 - 16.1.3 File viewing commands

The -display-enable commandSynopsis-display-enable numberEnable display number.GDB commandThe corresponding GDB command is 'enable display'.

Seite 256

Set the GDB working directory.GDB commandThe corresponding GDB command is 'cd'.Example(gdb)-environment-cd /kwikemart/marge/ezannoni/flathea

Seite 257

3 GDB CommandsYou can abbreviate a GDB command to the first few letters of the command name, ifthat abbreviation is unambiguous; and you can repeat ce

Seite 258 - 16.1.6 Stack viewing commands

The -environment-pwd commandSynopsis-environment-pwdShow the current working directory.GDB commandThe corresponding GDB command is 'pwd'.Exa

Seite 259 - 16.1.8 Job control commands

The -exec-abort commandSynopsis-exec-abortKill the inferior running program.GDB commandThe corresponding GDB command is 'kill'.ExampleN.A.Th

Seite 260

The -exec-finish commandSynopsis-exec-finishAsynchronous command. Resumes the execution of the inferior program until thecurrent function is exited. D

Seite 261

Example(gdb)111-exec-continue111^running(gdb)222-exec-interrupt222^done(gdb)111*stopped,signal-name="SIGINT",signal-meaning="Interrupt&

Seite 262

Example(gdb)-exec-next-instruction^running(gdb)*stopped,reason="end-stepping-range",thread-id="1",frame=addr="0x00002a14"

Seite 263

Example(gdb)-break-insert main^done,bkpt=number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000

Seite 264

Regular stepping:-exec-step^running(gdb)~"2"~"3"*stopped,reason="end-stepping-range",thread-id="1",frame=addr=

Seite 265

greater than the current one is reached. The reason for stopping in this case will be'location-reached'.GDB commandThe corresponding GDB com

Seite 266 - GDB: p/fmt expr

GDB commandThe corresponding GDB command is 'exec-file'.Example(gdb)-file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx^done(gdb)T

Seite 267

GDB commandThe corresponding GDB command is info shared.ExampleN.A.The -file-list-symbol-files commandSynopsis-file-list-symbol-filesList symbol files

Seite 268

GDB fills in the rest of the word 'breakpoints', since that is the only infosubcommand beginning with 'bre':((gdb)) info breakpoin

Seite 269 - Table 16-19 Special variables

Exit GDB immediately.GDB commandApproximately corresponds to 'quit'.Example(gdb)-gdb-exitThe -gdb-set commandSynopsis-gdb-setSet an internal

Seite 270 - 16.8.1 A

Show version information for GDB. Used mostly in testing.GDB commandThe corresponding GDB command is 'show version'.Example(gdb)-gdb-version

Seite 271 - 16.8.2 B

ExampleFor a stack with frame levels 0 through 11:(gdb)-stack-info-depth^done,depth="12"(gdb)-stack-info-depth 4^done,depth="4"(gd

Seite 272 - 16.8.3 C through D

file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="27"},frame={level="4 ",addr="0x000107e0",func="m

Seite 273 - 16.8.5 L

arguments (inclusive). If the two arguments are equal, it shows the single frame at thecorresponding level.GDB commandThe corresponding GDB commands a

Seite 274 - 16.8.6 M through P

(gdb)-stack-list-frames 3 3^done,stack=[frame={level="3 ",addr="0x000107a4",func="foo",file="recursive2.c",lin

Seite 275 - 16.8.8 T

21.10 GDB/MI Symbol query commandsThe -symbol-info-address commandSynopsis-symbol-info-address symbolDescribe where symbol is stored.GDB commandThe co

Seite 276 - 16.8.9 U through Z

The -symbol-info-line commandSynopsis-symbol-info-lineShow the core addresses of the code for a source line.GDB commandThe corresponding GDB command i

Seite 277 - 16.8.10 Symbols

List all the type names.GDB commandThe corresponding commands are 'info types' in GDB, 'gdb_search' in gdbtk.ExampleN.A.The -symbo

Seite 278

ExampleN.A.21.11 GDB/MI Target Manipulation CommandsThe -target-attach commandSynopsis-target-attach pid | fileAttach to a process pid or a file file

Seite 279

bubble(double,double) bubble(int,int)((gdb)) b 'bubble(In some cases, GDB can tell that completing a name requires using quotes. When thishappens

Seite 280

Example(gdb)-target-detach^done(gdb)The -target-download commandSynopsis-target-downloadLoads the executable onto the remote target. It prints out an

Seite 281 - 17 Controlling GDB

+download,{section=".text",section-sent="1536",section-size="6668",total-sent="1536",total-size="9880&quo

Seite 282 - 282 Controlling GDB

ExampleN.A.The -target-list-available-targets commandSynopsis-target-list-available-targetsList the possible targets to connect to.GDB commandThe corr

Seite 283 - 17.5 Supported Number Formats

The -target-select commandSynopsis-target-select type parameters ...Connect GDB to the remote target. This command takes two args:'type' The

Seite 284 - ((gdb)) run

GDB commandThe equivalent GDB command is 'info threads'.ExampleN.A.The -thread-list-ids commandSynopsis-thread-list-idsProduces a list of th

Seite 285

^running(gdb)~"0x7f7f0aec"*stopped,reason="end-stepping-range",thread-id="2",frame=addr="0x00002ca4",func=&quo

Seite 286 - 286 Controlling GDB

binary, decimal, hexadecimal, octal, and natural. Natural refers to a default formatautomatically chosen based on the variable type (like decimal for

Seite 287 - 18.1 User-defined commands

The frame under which the expression should be evaluated can be specified byframe-addr. A '*' indicates that the current frame should be use

Seite 288

Returns the number of children of a variable object name:numchild=nThe -var-list-children commandSynopsis-var-list-children nameReturns a list of the

Seite 289 - 18.3 Command files

value=valueThe -var-assign commandSynopsis-var-assign name expressionAssigns the value of expression to the variable object specified by name. The obj

Seite 290

help classUsing one of the general help classes as an argument, you canget a list of the individual commands in that class. For example,here is the he

Seite 292

22 Reporting Bugs in GDBYour bug reports play an essential role in making GDB reliable.Reporting a bug may help you by bringing a solution to your pro

Seite 293 - 19 Using GDB under gnu Emacs

Keep in mind that the purpose of a bug report is to enable us to x the bug. It may bethat the bug has been reported previously, but neither you nor we

Seite 294 - 294 Using GDB under gnu Emacs

• A description of the envelope of the bug.Often people who encounter a bug spend a lot of time investigating which changesto the input file will make

Seite 296

A Installing GDBIf you obtain GDB (WDB) as part of the HP ANSI C, HP ANSI C++ Developer's Kit forHP-UX Release 11.x, or HP Fortran, you do not ha

Seite 297 - 20 GDB Annotations

gdb-gdb-199991101/mmalloc source for the gnu memory-mapped mallocpackageThe simplest way to configure and build GDB is to run configure from thegdb-ve

Seite 298 - 20.3 Values

(GNU make does), running make in each of these directories builds the gdb programspecified there.To build gdb in a separate directory, run configure w

Seite 299 - 20.4 Frames

% sh config.sub i386-linuxi386-pc-linux-gnu% sh config.sub alpha-linuxalpha-unknown-linux-gnu% sh config.sub hp9k700hppa1.1-hp-hpux% sh config.sub sun

Seite 300 - 300 GDB Annotations

--norecursionConfigure only the directory level where configure isexecuted; do not propagate configuration to subdirectories.--target=target Configure

Seite 301 - 20.6 Annotation for GDB input

listings under info and under show in the Index point to all the sub-commands. See???.info This command (abbreviated i) is for describing the state of

Seite 303 - 20.10 Running the program

4 Running Programs Under GDBWhen you run a program under GDB, you must first generate debugging informationwhen you compile it using compiler option c

Seite 304 - 20.11 Displaying source

4.9 Debugging programs with multiple threads...464.10 Debugging programs with multiple pr

Seite 305

variable substitution) in describing thearguments. On Unix systems, you can controlwhich shell is used with the SHELL environmentvariable. GDB uses th

Seite 306

program. See “Program Input and Output”(page 43).WARNING! You can redirect input and output,but you cannot use pipes to pass the output ofthe program

Seite 307 - 21 The GDB/MI Interface

programs you run. When debugging, it can be useful to try running your programwith a modified environment without having to start GDB over again.show

Seite 308 - 21.1.2 GDB/MI Output syntax

You can use the string '$cwd' to refer to whatever is the current working directory atthe time GDB searches the path. If you use '.&apo

Seite 309

NOTE:• You can redirect your program input and output using shell redirection with therun command. For example,run > outfilestarts your program, di

Seite 310 - 310 The GDB/MI Interface

NOTE:• To use attach, your program must be running in an environment which supportsprocesses; for example, attach does not work for programs on bare-b

Seite 311 - 21.3 GDB/MI output records

On some operating systems, a program cannot be executed outside GDB while youhave breakpoints set on it inside GDB. You can use the kill command in th

Seite 312 - -break-after number count

thread identifier whose form varies depending on the particular system. For example,on LynxOS, you might see[New process 35 thread 27]when GDB notices

Seite 313 - GDB command

show threadverbose Display whether set threadverbose is on oroff.Here are commands to get more information about threads:info threadsDisplay a summary

Seite 314 - 314 The GDB/MI Interface

threadno is the internal GDB thread number,as shown in the first field of the 'info threads'display. To apply a command to all threads, uset

Seite 315

8.11 Printing Floating Point Values...998.12 Floating point hardware.

Seite 316 - [ -p thread ] [ line

set follow-fork-mode modeSet the debugger response to a program call offork or vfork. A call to fork or vfork createsa new process. The mode can be:pa

Seite 317 - The -break-list command

5 Stopping and ContinuingThe principal purpose of a debugger is to let you stop your program before it terminatesabnormally or runs into trouble, so t

Seite 318 - The -break-watch command

5.1.1 Setting breakpointsBreakpoints are set with the break command (abbreviated b). The debuggerconvenience variable '$bpnum' records the n

Seite 319

does not leave an active breakpoint. If you usebreak without an argument in the innermostframe, GDB stops the next time it reaches thecurrent location

Seite 320 - 21.6 GDB/MI Data manipulation

are used. Delete or disable unused hardwarebreakpoints before setting new ones (see“Disabling breakpoints” (page 58)). See “Breakconditions” (page 59)

Seite 321

marked to bedisabled or deletedwhen hit.Enabled or DisabledEnabledbreakpoints aremarked with 'y'. 'n'marks breakpointsthat are not

Seite 322

GDB itself sometimes sets breakpoints in your program for special purposes, such asproper handling of longjmp (in C programs). These internal breakpoi

Seite 323

vfork A call to vfork. This is currently onlyavailable for HP-UX.load, loadlibnameThe dynamic loading of any shared library,or the loading of the libr

Seite 324

5.1.3 Deleting breakpointsIt is often necessary to eliminate a breakpoint, watchpoint, or catchpoint once it hasdone its job and you no longer want yo

Seite 325 - The -data-read-memory command

• Enabled once. The breakpoint stops your program, but then becomes disabled.• Enabled for deletion. The breakpoint stops your program, but immediatel

Seite 326

13 Specifying a Debugging Target...13313.1 Active targets..

Seite 327

say, to just set a watchpoint on a variable name, and specify a condition that testswhether the new value is an interesting one.Break conditions can h

Seite 328 - -environment-cd pathdir

instead of stopping, it just decrements the ignore count by one and continues. As aresult, if the ignore count value is n, the breakpoint does not sto

Seite 329

You can use breakpoint commands to start your program up again. Simply use thecontinue command, or step, or any other command that resumes execution.A

Seite 330 - 21.7 GDB/MI program control

always '[0] cancel' and '[1] all'. Typing 1 sets a breakpoint at each definition offunction, and typing 0 aborts the break command

Seite 331 - -exec-continue

When this message is printed, you need to disable or remove some of thehardware-assisted breakpoints and watchpoints, and then continue.5.2 Continuing

Seite 332

stepContinue running your program until control reaches a differentsource line, then stop it and return control to GDB. Thiscommand is abbreviated s.W

Seite 333

until, uContinue running until a source line past the current line, in thecurrent stack frame, is reached. This command is used to avoidsingle steppin

Seite 334 - -exec-run

stepi, stepi arg,siExecute one machine instruction, then stop and return to thedebugger.It is often useful to do 'display/i $pc' when steppi

Seite 335 - -exec-step

NOTE: Use caution if you disable all signals from certain processes. Disabling'SIGTRAP' in your program may cause your program to hang.HP-UX

Seite 336 - -exec-until [ location ]

passGDB should allow your program to see this signal; your program canhandle the signal, or else it may terminate if the signal is fatal and nothandle

Seite 337

14.10.8 Scenarios in memory debugging...17414.10.8.1 Stop when freeing unallocated o

Seite 338 - 338 The GDB/MI Interface

Whenever your program stops under GDB for any reason, all threads of execution stop,not just the current thread. This allows you to examine the overal

Seite 339

6 Examining the StackWhen your program has stopped, the first thing you need to know is where it stoppedand how it got there.Each time your program pe

Seite 340 - 340 The GDB/MI Interface

6.2 Stacks Without framesSome compilers provide a way to compile functions so that they operate without stackframes. (For example, the gcc option&apos

Seite 341

The names where and info stack (abbreviated info s) are additional aliases forbacktrace.Each line in the backtrace shows the frame number and the func

Seite 342

NOTE:• On the SPARC architecture, frame needs two addresses to selectan arbitrary frame: a frame pointer and a stack pointer.• On the MIPS and Alpha a

Seite 343

info frame, infofThis command prints a verbose description of the selectedstack frame, including:• the address of the frame• the address of the next f

Seite 345

7 Examining Source FilesGDB can print parts of the source code of your program, since the debugginginformation recorded in the program tells GDB what

Seite 346 - -symbol-info-function

The following arguments can be given to the list command:list linespec Print lines centered around the line specified by linespec.list first,last Prin

Seite 347 - -symbol-list-types

reverse-search regexp The command 'reverse-search regexp' checkseach line, starting with the one before the last linelisted and going backwa

Seite 348 - -symbol-type variable

14.15.2 Support for the info target Command...20114.15.3 Support for the dumpcore command...

Seite 349 - -target-detach

show directoriesPrint the source path and display the directories itcontains.If your source path is cluttered with directories that are no longer of i

Seite 350 - The -target-download command

The following example shows the disassembly of a range of addresses of HP PA-RISC2.0 code:((gdb)) disas 0x32c4 0x32e4Dump of assembler code from 0x32c

Seite 352 - -target-list-parameters

8 Examining DataThe usual way to examine data in your program is with the print command(abbreviated p), or its synonym inspect. It evaluates and print

Seite 353 - 21.12 GDB/MI thread commands

:: '::' allows you to specify a variable in terms of the file or functionwhere it is defined. See “Program variables” (page 84).{type} addr

Seite 354 - 354 The GDB/MI Interface

This use of '::' is very rarely in conflict with the very similar use of the same notationin C++. GDB also supports use of the C++ scope res

Seite 355 - 21.14 GDB/MI variable objects

p *array@lenThe left operand of '@' must reside in memory. Array values made with '@' in this waybehave just like other arrays in

Seite 356 - The -var-create command

t2Print as integer in binary. The letter 't' stands for “two”2.aPrint as an address, both absolute in hexadecimal and as an offset from the

Seite 357

wWords (four bytes). This is the initial default.gGiant words (eight bytes).Each time you specify a unit size with x, thatsize becomes the default uni

Seite 358 - 358 The GDB/MI Interface

available for use in expressions in the convenience variable $_. The contents of thataddress, as examined, are available in the convenience variable $

Seite 359 - The -var-update command

14.25.3 Support for _ _fpreg data type on IPF...22214.25.4 Support for _Complex variables in HP

Seite 360

disable display dnums... Disable the display of item numbers dnums. Adisabled display item is not printedautomatically, but is not forgotten. It may b

Seite 361 - 22 Reporting Bugs in GDB

set print address offDo not print addresses when displaying theircontents. For example, this is the same stack framedisplayed with set print address o

Seite 362 - 362 Reporting Bugs in GDB

If you have a pointer and you are not sure where it points, try 'set printsymbol-filename on'. Then you can determine the name and source fi

Seite 363 - 22.2 How to report bugs 363

},meat = 0x54 "Pork"}set print pretty offCause GDB to print structures in a compactformat, like this:$1 = {next = 0x0, flags = {sweet = 1, s

Seite 364

} form;};struct thing foo = {Tree, {Acorn}};with set print union on in effect 'p foo'would print$1 = {it = Tree, form = {tree = Acorn, bug

Seite 365 - A Installing GDB

armDecode using the algorithm in the C++Annotated Reference Manual.WARNING! This setting alone is notsufficient to allow debugging cfrontgenerated exe

Seite 366 - 366 Installing GDB

re-read or discarded (for example with the file or symbol-file commands). Whenthe symbol table changes, the value history is discarded, since the valu

Seite 367

Convenience variables are prefixed with '$'. Any name preceded by '$' can be used fora convenience variable, unless it is one of t

Seite 368 - A.3 configure options

8.10 RegistersYou can refer to machine register contents, in expressions, as variables with namesstarting with '$'. The names of registers a

Seite 369 - A.3 configure options 369

Some registers have distinct raw and virtual data formats. This means that the dataformat in which the register contents are saved by the operating sy

Kommentare zu diesen Handbüchern

Keine Kommentare