由于gdb不能够保存设置的断点,所以我们只有用-x 参数导入一个相当于批处理的文件来设置断点了

我先用ctags来生成tag文件:

代码:
pjq@gentoo-pjq ~/svn/gsopcast-read-only/src $ ctags -f gsopcast.tag *.cc

然后再用命令解析出其中的函数:

代码:
cat gsopcast.tag |grep “(“|cut -d “/” -f2|cut -d “(” -f1|cut -d ” ” -f2|awk ‘NF>0’|sed ‘s/\^//g’|sed ‘s/\*//g’|sed ‘s/^/b /g’>bp.list

这样就生成了设置所有函数断点的文件了:

代码:
pjq@gentoo-pjq ~/svn/gsopcast-read-only/src $ cat bp.list
b cell_data_func_card
b cell_data_func_name
b change_notebook_tab
b channel_list_update
b connect_on_idle
b connect_to_server
b create_iochannel
b delete_iochannel
b destroy
b echo
b fill_launch_combo
b fork_channel
b fork_player
b fork_sop
b get_unique_clip
b handle_io_pipe
b handle_stdout_pipe
b io_socket_record
b io_socket_statistics
b is_running
b kill_player
b kill_sop
b launch_record
b list_operate
b list_search_url
b load_config
b load_tree_state
b main
b on_adj_sound_change_value
b on_button_channel_toggled
b on_button_exit_clicked
b on_button_expand_clicked
b on_button_player_clicked
b on_button_record_clicked
b on_button_save_clicked
b on_button_search_clicked
b on_button_sopcast_clicked
b on_button_stop_clicked
b on_channel_update
b on_entry_search_activated
b on_treeview1_row_activated
b on_window1_destroy
b parse_command_line
b pipe_signals
b processSignal
b quit_on_owner_change
b remote_call
b save_config
b save_tree_state
b setup_unique
b start_statistics_monitor
b statistics_monitor
b statistics_show
b store_tree_state
b timeout_me
b tree_search
b tree_search_key
b trim
b unique_paste_uri
b unique_set_text
b vKeyPressReleaseCallback
pjq@gentoo-pjq ~/svn/gsopcast-read-only/src $

有些函数可能解析错误了,
再用

代码:
gdb -x bp.list gsopcast

启动的时候可以看到,然后再将这些有问题的断点从bp.list中去掉,

之后再调度就没问题了。

gdb如何批量设置断点

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.