Skip to content
Advertisement

debug wget command with gdb

I want to debug wget with a special url.

So how to pass the url to gdb? I already tried with --args <the url>, but it dosen’t work.

Please help me.

ps: I used gdb in the wrong way gdb wget --args http://www.google.com/, it should be gdb --args wget http://www.google.com/

Advertisement

Answer

This should work:

[ ~]$ 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) 
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement