2013-09-04 10:25:28 +00:00
|
|
|
#
|
|
|
|
# \brief GDB command line arguments for setting a breakpoint in the 'main()' function
|
|
|
|
# \author Christian Prochaska
|
|
|
|
# \date 2013-09-04
|
|
|
|
#
|
|
|
|
|
2017-01-04 10:38:39 +00:00
|
|
|
proc gdb_initial_breakpoint_cmds { target_binary_name } {
|
2013-09-04 10:25:28 +00:00
|
|
|
|
|
|
|
#
|
2017-01-04 10:38:39 +00:00
|
|
|
# We set a break in the 'binary_ready_hook_for_gdb()' function in the
|
|
|
|
# dynamic linker and load the symbols of the application by using the
|
|
|
|
# following gdb command sequence.
|
2013-09-04 10:25:28 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
set gdb_cmds ""
|
2014-02-21 12:13:45 +00:00
|
|
|
|
2013-09-04 10:25:28 +00:00
|
|
|
# don't ask for y/n when loading a new symbol file
|
|
|
|
append gdb_cmds {-ex "set interactive-mode off" }
|
2014-02-21 12:13:45 +00:00
|
|
|
|
2016-05-17 14:13:23 +00:00
|
|
|
# set a breakpoint in the 'binary_ready_hook_for_gdb' function
|
|
|
|
append gdb_cmds {-ex "b binary_ready_hook_for_gdb" }
|
2014-02-21 12:13:45 +00:00
|
|
|
|
2013-09-04 10:25:28 +00:00
|
|
|
# continue execution until the breakpoint triggers
|
|
|
|
append gdb_cmds {-ex "c" }
|
2014-02-21 12:13:45 +00:00
|
|
|
|
2016-05-17 14:13:23 +00:00
|
|
|
# delete the 'binary_ready_hook_for_gdb' breakpoint
|
2013-09-04 10:25:28 +00:00
|
|
|
append gdb_cmds {-ex "delete 1" }
|
2014-02-21 12:13:45 +00:00
|
|
|
|
2013-09-04 10:25:28 +00:00
|
|
|
# load the symbols of the test application
|
2016-05-17 14:13:23 +00:00
|
|
|
append gdb_cmds "-ex \"file bin/$target_binary_name\" "
|
2014-02-21 12:13:45 +00:00
|
|
|
|
2015-02-06 12:24:28 +00:00
|
|
|
# set search path for "sharedlibrary" to bin
|
|
|
|
append gdb_cmds {-ex "set solib-search-path bin" }
|
|
|
|
|
2013-09-04 10:25:28 +00:00
|
|
|
# load the symbols of loaded shared libraries
|
|
|
|
append gdb_cmds {-ex "sharedlibrary" }
|
2014-02-21 12:13:45 +00:00
|
|
|
|
2013-09-04 10:25:28 +00:00
|
|
|
return $gdb_cmds
|
|
|
|
}
|