使用gdb调试wget命令

时间:2017-01-16 10:34:12

标签: linux gdb

我想使用特殊网址调试wget

那么如何将url传递给gdb?我已经尝试了--args <the url>,但它不起作用。

请帮帮我。

PS: 我以错误的方式gdb使用了gdb wget --args http://www.google.com/,它应该是gdb --args wget http://www.google.com/

1 个答案:

答案 0 :(得分:0)

这应该有效:

[ ~]$ gdb -q --args /usr/bin/wget https://www.google.com/
Reading symbols from /usr/bin/wget...Reading symbols from /usr/lib/debug/usr/bin/wget.debug...done.
done.
(gdb) start 
Temporary breakpoint 1 at 0xbda0: file main.c, line 1186.
Starting program: /usr/bin/wget https://www.google.com/
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Temporary breakpoint 1, main (argc=2, argv=0x7fffffffdce8) at main.c:1186
1186    {
Missing separate debuginfos, use: dnf debuginfo-install gnutls-3.5.7-3.fc25.x86_64
(gdb) list 
1181    const char *program_name; /* Needed by lib/error.c. */
1182    const char *program_argstring; /* Needed by wget_warc.c. */
1183    
1184    int
1185    main (int argc, char **argv)
1186    {
1187      char **url, **t, *p;
1188      int i, ret, longindex;
1189      int nurl;
1190      int retconf;
(gdb)