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/manual/gdb 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.

Back to TOC

LDB Limitations

LDB does not support or support with some limitations the following features:

Feature Support Restrictions
Multithread applications LDB does not allow debugging of multithread applications.
Function evaluation LDB supports integral, logical, pointer, and void types of arguments and return values only.
Aggregates LDB does not support user-defined operators (arithmetic, relational, equality) or setting an aggregate value.
Convenience variables For the convenience variables of aggregate type: can not display the fields of such variable.
For the convenience variables of array type: can not display the elements of such variable.
Fortran arrays LDB does not support any operations with whole arrays and sections, except for their content displaying.
Command line editing You can edit the command line with Backspace only. You cannot recall previous commands and edit them.
128-bit floats LDB does not support Fortran 128-bit floating point values.

Back to TOC

LDB Interface

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

Back to TOC

Using the LDB

Start the debugger with the following command:

ldb [options] executable-file

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 executable-file

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 supported
make 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] h prefixes not supported;
thread clause not supported;
if clause not supported (use condition command instead)
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] parameters 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] space before / is mandatory
x [/fmt] expression space before / is mandatory;
s and i formats not supported
display [/fmt] [expression] space before / is mandatory;
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 supported
info registers 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 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

Debugger Files

GDB Command LDB Implementation
file supported
exec-file not supported
symbol-file not supported
core-file not supported
load not supported
add-symbol-file not supported
add-shared-symbol-file not supported
section not supported
info files partially supported
info share not supported
share 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

Back to TOC

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.


$ ldb maincall
Linux Application Debugger, Version 6.0 Beta,Build 20020108.
Copyright (c) 2001-2002 Intel Corporation. All Rights Reserved.

(ldb) break main
Breakpoint 1 at 0x8048113: file maincall.c, line 15.
(ldb) run
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

$

Back to TOC

Copyright Notice

Copyright © 2001-2002 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 is provided in connection with Intel® products. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted by this document. Except as provided in Intel's Terms and Conditions of Sale for such products, Intel assumes no liability whatsoever, and Intel disclaims any express or implied warranty, relating to sale and/or use of Intel® products including liability or warranties relating to fitness for a particular purpose, merchantability, or infringement of any patent, copyright or other intellectual property right. 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