Dbx 1024 User's Guide Page 16

  • Download
  • Add to my manuals
  • Print
  • Page
    / 158
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 15
2
Chapter 1: Getting Started With dbx
2. Invoke dbx for the failed program as described in “Invoking dbx” on
page 6. dbx automatically reads in the local core file.
3. Perform a stack trace using the where command (described in
“Examining the Stack” on page 46) to locate the failure point.
For example, suppose you examine the core file for a program called test.
Suppose the stack trace appears as follows:
(dbx) where
> 0 foo2(i = 5) [“/usr/tmp/test.c”:44, 0x1000109c]
1 foo(i = 4) [“/usr/tmp/test.c”:38, 0x1000105c]
2 main(argc = 1, argv = 0xffffffad78) [“/usr/tmp/test.c”:55, 0x10001104]
3 __start() [“/shamu/crt1text.s”:137, 0x10000ee4]
In this case, test crashed at line 44 of the source file test.c. The program
crashed while executing the function foo2. foo2 was called from line 38 in
the function foo, which was in turn called from line 55 in the function main.
You can use the other features of dbx to examine values of program variables
and otherwise investigate why test crashed.
If you use dbx to debug code that wasn’t compiled using the g option, local
variables are invisible to dbx, and source lines may appear to jump around
as a result of various optimizations. If the code is stripped of its debugging
information, dbx displays very little information.
Debugging Your Programs
Debugging a program consists primarily of stopping your program under
certain conditions and then examining the state of the program stack and the
values stored in program variables.
You stop execution of your program by setting breakpoints in your program.
Breakpoints can be unconditional, in which case they always stop your
program when encountered, or conditional, in which case they stop your
program only if a test condition that you specify is true. (See “Setting
Breakpoints” on page 59 for more information.)
To use breakpoints to debug your program, examine your program carefully
to determine where problems are likely to occur, and set breakpoints in these
Page view 15
1 2 ... 11 12 13 14 15 16 17 18 19 20 21 ... 157 158

Comments to this Manuals

No comments