You can use an initialization file to execute specific commands when the debugger starts up. For example, you can create an initialization file to load a debuggee as soon as the debugger starts.
You can have an initialization file in your home directory as well as in your project directory. You can connect to the target in the initialization file in your home directory, and use the project initialization file to open a specific executable file and set a breakpoint.
When you start the debugger, it reads .gdbinit. The debugger first looks for the initialization file in your home directory, and then in the current directory.
The following .gdbinit file is stored in the project directory. It does the following:
Opens the executable app_name:
idb file app_name
Sets a breakpoint at main:
break main
Runs app_name:
run
Here is the full sample .gdbinit file:
file app_name break main run
Copyright © 2001-2011, Intel Corporation. All rights reserved.