HPlogo HP/DDE Debugger User's Guide: HP 9000 Series 700/800 Computers > Appendix A Line-Mode User Interface

Examples

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

The following examples illustrate some of the capabilities of the line-mode user interface.

Invoke the debugger to debug the program average.

$ dde -ui ui_line average Executing image in process 23640: "/home/smith/average".
Break at: \\average\main\44
Source File: /home/smith/average.c
44 B> print_average (my_list, first, last);

Print source lines and assembly code in the transcript area.

dde> property transcript -source -asm
dde> step -instruction
Stepped to: \\average\main\44 (0000202C)
44 B) print_average (my_list, first, last);
asm: 0000202C main+000c LDO R'6d8(%r1),%r26

Set a watchpoint and the print source and the watched variable in the transcript area.

dde> watchpoint \\average\print_average\total
(Warning) The location of variable 'total' is not in an active frame.
dde> property transcript -source -variable
dde> step -over
The initial value of \\`main(4)\average\print_average\total is 0
var: 33) \\`main(4)\average\print_average\total: 0
The value of \\`main(4)\average\print_average\total has changed from 0 to 36.
var: 33) \\`main(4)\average\print_average\total: 36
31 > num_elements = high - low;/* note this is an off-by-one bug */
asm: 31: 00001FBC print_average+0030 LDW -108(%r30),%r1
Stopped at: \\average\print_average\31

Use the predefined alias w to print the 10 source lines surrounding the current line.

dde> w
26 V int list[], low, high;
27 #endif
28 {
29 int total, num_elements, average;
30 total = sum(list, low, high);
31 > num_elements = high - low;
32
33 average = total / num_elements;
34 printf("%10.d\n", average);
35 }

Print source, assembly, watched variables, and traceback in the transcript area.

dde> property transcript -source -asm -variable -tb

dde> step
Stepped to: \\average\print_average\33
33 > average = total / num_elements;
asm: > 33: 00001FCC print_average+0040 LDW -64(%r30),%r26
tb: 1 $START$+0094 (0000192C)
tb: 2 _start+0068 (80041D9C)
tb: 3 \\average\main\44 (0000203C)
tb: 4 > \\average\print_average\33

Single step one statement using the predefined alias s.

dde> property transcript -source

dde> s
Stepped to: \\average\print_average\34
34 > printf("%10.d\n", average);

Repeat the last command (single step). (The 4 is the output of the printf call on the previous line.)

dde> <RETURN> 
4
Stepped to: \\average\print_average\35
35 > }

Use the predefined alias up to walk up the stack.

dde> property transcript -source -asm -tb
dde> up
Environment: \\average\main\44 (0000203C) (frame `main(3))
Stopped at: \\average\print_average\35
44 B= print_average (my_list, first, last);
asm: = 0000203C main+001c BLE R'78c(%sr4,%r31)
tb: 1 $START$+0094 (0000192C)
tb: 2 _start+0068 (80041D9C)
tb: 3 > \\average\main\44 (0000203C)
tb: 4 \\average\print_average\35