Linux Application Debugger

Table of Contents

Introduction

The Linux Application Debugger (LDB) is a Fortran/C/C++ source-level, symbolic debugger. It is intended to develop and test applications running in Linux* on the Intel® Pentium® or Intel® Itanium™ architecture families. LDB is a text-driven debugger with a command set similar to the GNU* debugger (GDB*). This document assumes familiarity with the GDB debugger command set. See http://www.gnu.org/doc/doc.html for more information on GDB.

The debugger has the following features and benefits:

  • Source-level debugging. You can set and display breakpoints directly in the source code, and examine the function call chain.
  • Watch expressions. You can select specific program variables to display, and watch the values of these variables change as you step through your program.
  • Breakpoints. You can define a breakpoint on a function name, source-code line, or an assembly instruction.
  • Data breakpoints. You can define a breakpoint on modification of a data item.
  • Stepping. You can execute your program in single assembly-instruction steps, source-line steps, or return steps.
  • Register access. You can examine and modify processor/application-visible registers.
  • Memory access. You can examine and modify memory using various type formats.
  • Symbolic support. You can use symbolics to debug all programs written in C, C++, and Fortran language. You can also display and modify program memory using program symbolics.
  • Debug format. Supports the DWARF 2.0 debug format.

LDB does not support the following expression evaluation features:

Feature Support Restrictions
function evaluation
  • Supports integral, logical, pointer, and void types of arguments and return values only.
aggregates
  • Does not support user-defined operators (arithmetic, relational, equality) or setting an aggregate value.
convenience variables
  • Supports setting a value when convenience variables are register names.
  • Does not support convenience variables in expressions for the print command. You can display register values via the info registers command.
arrays (FORTRAN)
  • Supports all operations with array elements.
  • Does not support all operations with whole arrays and sections, except for their content displaying.
type cast (C/C++)
  • Supports the type casts from integral to integral, from floating point to floating point, and from integral or pointer to pointer.
other features
  • Does not support operations with 128-bit floating point values (FORTRAN) and scope resolution operator.

Back to TOC

LDB Interface

LDB is a command line interface for debugging Linux applications. LDB can be used with version 3.3 of the DDD GUI debugger interface application.

Back to TOC

Using the LDB

Start the debugger with the following command:

ldb my_executable

See a LDB sample session to understand how the LDB commands work.

If you use DDD, start the debugger with the command:

ddd --debugger ldb my_executable

or:

ldb --ddd my_executable

Back to TOC

Commands Comparison

This section provides a comparative analysis of the LDB and GNU Debugger commands. The LDB commands are grouped by their functionality, similar to the way they are listed in GDB documentation, and divided into three color groups:

GDB commands supported by LDB
GDB commands partially supported by LDB
GDB commands not supported by LDB

Back to TOC

Entering and Exiting the Debugger

GDB Command LDB Implementation
quit supported
shell not supported
make not supported

Back to TOC

Debugger Commands

GDB Command LDB Implementation
# supported
help supported
complete supported

Back to TOC

Running Programs

GDB Command LDB Implementation
run [arguments] redirection (e. g. >, <) not supported
set args supported
show args supported
path not supported
show paths not supported
set environment supported
show environment supported
unset environment not supported
cd supported
pwd supported
info terminal not supported
tty not supported
attach not supported
detach not supported
kill not supported
info proc not supported
thread not supported
info threads not supported
thread apply not supported
set follow-fork-mode not supported
show follow-fork-mode not supported

Back to TOC

Stopping and Continuing

GDB Command LDB Implementation
[t][h]break [thread no] [if expression] t and h prefixes not supported; thread and if clauses not supported
rbreak not supported
xbreak not supported
[r][a]watch [if expression] if clause not supported
info breakpoints [expression] supported
info watchpoints [expression] supported
maintenance info breakpoints not supported
clear supported
delete breakpoints supported
disable breakpoints supported
enable breakpoints [once | delete] once and delete not supported
condition supported
ignore not supported
commands not supported
continue [expression] expression not supported
step [expression] expression not supported
next [expression] expression not supported
finish supported
until not supported
stepi supported
nexti supported
info ( signals | handle ) partially suppported
set scheduler-locking not supported
show scheduler-locking not supported

Back to TOC

Examining the Stack

GDB Command LDB Implementation
frame supported
select-frame not supported
info frame not supported
info args not supported
info locals supported
backtrace [full] [expression] full not supported
up supported
down supported
up-silently not supported
down-silently not supported

Back to TOC

Examining Source Files

GDB Command LDB Implementation
set listsize not supported
show listsize not supported
forward-search not supported
reverse-search not supported
directory not supported
show directories not supported
info line supported
disassemble supported
set disassembly-flavor supported
show disassembly-flavor supported
set architecture only i386 architecture supported
show architecture supported

Back to TOC

Examining Data

GDB Command LDB Implementation
print [/fmt] [expression] add a space before /
x [/fmt] expression add a space before /; s and i formats not supported
display [/fmt] [expression] add a space before /; s and i formats not supported
undisplay supported
disable display supported
enable display supported
info display supported
set print not supported
show print not supported
show values not supported
show convenience not supported
info all-registers supported
info float supported
info udot supported

Back to TOC

Using Languages

GDB Command LDB Implementation
set language only fortran and c++ languages supported
show language supported
info source partially supported
info sources partially supported
info extensions not supported
set extension-language not supported
set check not supported
show check not supported

Back to TOC

Examining the Symbol Table

GDB Command LDB Implementation
info address not supported
whatis supported
ptype not supported
info types not supported
info functions not supported
info variables not supported
maintenance not supported

Back to TOC

Altering Execution

GDB Command LDB Implementation
set [variable] expression partially supported
jump not supported
return not supported
call not supported
set write not supported
show write not supported

Back to TOC

Controlling Debugger

GDB Command LDB Implementation
set prompt supported
show prompt supported
set editing not supported
show editing not supported
set history filename not supported
show history filename not supported
set history save not supported
show history save not supported
set history size not supported
show history size not supported
set history expansion not supported
show history expansion not supported
show commands not supported
set height supported but does not affect the output
show height supported
set width supported but does not affect the output
show width supported
set input-radix not supported
show input-radix not supported
set output-radix not supported
show output-radix not supported
set verbose not supported
show verbose not supported
set complaints not supported
show complaints not supported
set confirm not supported
show confirm not supported

Back to TOC

Canned Sequences of Commands

GDB Command LDB Implementation
define not supported
show user not supported
source not supported
echo not supported
output partially supported
printf not supported

LDB Sample Session

This is a sample of the code generated by the Linux Application Debugger during the debugging session. User input is emphasized in this font.

[prompt]$ ldb maincall
Linux Application Debugger, Version 5.0.1 Build 20010509.
Copyright (c) 2001 Intel Corporation. All Rights Reserved.
Linux Debugger.
Gdb-subset text interface version.
File /home/lmcglinc/test/filecalls/maincall loaded, 32-bit executable
(ldb) break main
Breakpoint 1 at 0x8048113: file maincall.c, line 15.
(ldb) run
Executable has no shared library list.
Unable to set breakpoint on exception throw.
Starting program: maincall
Breakpoint 1: file maincall.c line 15.
15      {
(ldb) list
10      extern int inc7(int, int);
11      extern int inc8(int, int);
12      extern int inc9(int, int);
13
14      main( int argc, char *argv[])
15      {
16          /* Test the call stack */
17          int a;
18          int b;
19          int c;
20
(ldb) next
21          switch(argc)
(ldb) next
25                        argv[0]);
(ldb) list
20
21          switch(argc)
22          {
23            case 1:
24                fprintf(stdout, "argv: %s\n",
25                        argv[0]);
26                break;
27            case 2:
28                fprintf(stdout, "argv: %s %s\n",
29                        argv[0],argv[1]);
30                break;
(ldb) break inc1
Breakpoint 2 at 0x80483a3: file inc1.c, line 4.
(ldb) continue
argv: maincall
Breakpoint 2: file inc1.c line 4.
4       {
(ldb) list
1       #include 
2
3       inc1( int a, int b )
4       {
5           /* Test the call stack */
6           int c;
7           c = inc2( ++a, ++b);
8           fprintf(stdout, "Result: %d  (inc1 original values a:%d b:%d)\n", c, a, b);
9           return(a+b);
(ldb) next
7           c = inc2( ++a, ++b);
(ldb) print a
$2 = 1
(ldb) print b
$3 = 1
(ldb) next
Result: 22  (inc9 original values a:10 b:10)
Result: 20  (inc8 original values a:9 b:9)
Result: 18  (inc7 original values a:8 b:8)
Result: 16  (inc6 original values a:7 b:7)
Result: 14  (inc5 original values a:6 b:6)
Result: 12  (inc4 original values a:5 b:5)
Result: 10  (inc3 original values a:4 b:4)
Result: 8  (inc2 original values a:3 b:3)
8           fprintf(stdout, "Result: %d  (inc1 original values a:%d b:%d)\n", c, a, b);
(ldb) print c
$4 = 6
(ldb) continue
Result: 6  (inc1 original values a:2 b:2)
Result: 4  (inc0 original values a:1 b:1)
Result: 2  (original values a:0 b:0)
(ldb) quit

[prompt]$

Back to TOC

Copyright Notice

Copyright © 2001 Intel Corporation. All rights reserved.

*Other names and brands may be claimed as the property of others.

Intel and Itanium are trademarks or registered trademarks of Intel Corporation or
its subsidiaries in the United States and in other countries.

Back to TOC

Disclaimer

INFORMATION IN THIS ONLINE HELP FILE IS PROVIDED IN CONNECTION WITH INTEL® PRODUCTS. THIS INFORMATION IS PROVIDED "AS IS" FOR THE ASSOCIATED PROCESSORS. INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY RELATING TO USE OF THIS INFORMATION, INCLUDING LIABILITY OR WARRANTY RELATING TO MERCHANTABILITY, FITNESS FOR ANY PARTICULAR PURPOSE, INFRINGEMENT OF ANY PATENT, COPYRIGHT, OR OTHER INTELLECTUAL PROPERTY RIGHT, OR ANY WARRANTY OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE.

Intel products are not intended for use in medical, life saving, or life sustaining applications. Intel may make changes to specifications and product descriptions at any time, without notice.

Designers must not rely on the absence or characteristic of any features or instructions marked "reserved" or "undefined" for processors. Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them.

The processors referred to in this online help may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.

Back to TOC