Putting It All Together - Red Hat ENTERPRISE LINUX 4 - DEBUGGING WITH GDB Manual

Debugging with gdb
Hide thumbs Also See for ENTERPRISE LINUX 4 - DEBUGGING WITH GDB:
Table of Contents

Advertisement

Chapter 19. Debugging remote programs

19.5.3. Putting it all together

In summary, when your program is ready to debug, you must follow these steps.
1. Make sure you have defined the supporting low-level routines (refer to Section 19.5.2 What you
must do for the stub):
,
getDebugChar
flush_i_cache
2. Insert these lines near the top of your program:
set_debug_traps();
breakpoint();
3. For the 680x0 stub only, you need to provide a variable called
just use:
void (*exceptionHook)() = 0;
but if before calling
that function is called when
The function indicated by
exception number.
4. Compile and link together: your program, the gdb debugging stub for your target architecture,
and the supporting subroutines.
5. Make sure you have a serial connection between your target machine and the gdb host, and
identify the serial port on the host.
6. Download your program to your target machine (or get it there by whatever means the manu-
facturer provides), and start it.
7. Start gdb on the host, and connect to the target (refer to Section 19.1 Connecting to a remote
target).
,
putDebugChar
,
,
memset
exceptionHandler
set_debug_traps
continues after stopping on a trap (for example, bus error).
gdb
exceptionHook
.
exceptionHook
, you set it to point to a function in your program,
is called with one parameter: an
159
. Normally you
which is the
int

Advertisement

Table of Contents
loading

Table of Contents