From: Mansoor Ali Khan <mkhan@hdaar.com>
To: gdb@sources.redhat.com
Subject: Debugging the debugger
Date: Tue, 01 Mar 2005 11:17:00 -0000 [thread overview]
Message-ID: <1109675790.12201.29.camel@mansoor> (raw)
GNU gdb 6.3
gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-34)
I want to get to the root of the problem. The problem is that when I run
my application through gdb, the program flow does not appear to be
'normal'. The same statement (line) keeps on repeating multiple times
until it finally gets executed. To elaborate further I am attaching the
piece of code that I am trying to debug, followed by the 'weird' actual
gdb output which is then followed by the output that I should be
expecting from gdb under normal circumstances. Note that DEBUG and
SAFE_FREE are macros. I am not using any threads etc. This might be a
simple configuration problem or may be some other trivial issue but I
have no idea how to go about it. Your help would be HIGHLY appreciated.
Thanks,
Mansoor.
The Program code:
int main()
{
//Instruct the debugger to use console for printing.
set_output_on_console(true);
struct cli_state *c;
struct in_addr ip;
DEBUG(0, ("Initializing cli_state ...\n")); //Its a macro
if (!(c=cli_initialise(NULL)))
{
DEBUG(0, ("unable to init cli_state. Exiting ...\n"));
return 1;
}
zero_ip(&ip);
ip = *(interpret_addr2("192.168.1.30"));
cli_connect(c, NULL, &ip);
SAFE_FREE(c); //Its a macro
return 0;
}
The ACTUAL gdb output:
(gdb) run
Starting program: /home/mkhan/libcifs/src/libcifs
Breakpoint 1, main () at main.c:11
11 set_output_on_console(true);
(gdb) next
17 DEBUG(0, ("Initializing cli_state ...\n"));
(gdb) next
0x08049224 22 return 1;
(gdb) next
Initializing cli_state ...
19 if (!(c=cli_initialise(NULL)))
(gdb) next
25 zero_ip(&ip);
(gdb) next
27 ip = *(interpret_addr2("192.168.1.30"));
(gdb) next
28 cli_connect(c, NULL, &ip);
(gdb) next
27 ip = *(interpret_addr2("192.168.1.30"));
(gdb) next
28 cli_connect(c, NULL, &ip);
(gdb) next
27 ip = *(interpret_addr2("192.168.1.30"));
(gdb) next
28 cli_connect(c, NULL, &ip);
(gdb) next
31 SAFE_FREE(c);
(gdb) next
33 return 0;
(gdb) next
34 }
(gdb) next
0xb74b1768 in __libc_start_main () from /lib/tls/libc.so.6
(gdb) next
Single stepping until exit from function __libc_start_main,
which has no line number information.
Program exited normally.
(gdb)
The EXPECTED gdb output (which gdb should have given under normal
circumstances):
(gdb) run
Starting program: /home/mkhan/libcifs/src/libcifs
Breakpoint 1, main () at main.c:11
11 set_output_on_console(true);
(gdb) next
17 DEBUG(0, ("Initializing cli_state ...\n"));
(gdb) next
Initializing cli_state ...
19 if (!(c=cli_initialise(NULL)))
(gdb) next
25 zero_ip(&ip);
(gdb) next
27 ip = *(interpret_addr2("192.168.1.30"));
(gdb) next
28 cli_connect(c, NULL, &ip);
(gdb) next
31 SAFE_FREE(c);
(gdb) next
33 return 0;
(gdb) next
34 }
(gdb) next
0xb74b1768 in __libc_start_main () from /lib/tls/libc.so.6
(gdb) next
Single stepping until exit from function __libc_start_main,
which has no line number information.
Program exited normally.
(gdb)
next reply other threads:[~2005-03-01 11:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-01 11:17 Mansoor Ali Khan [this message]
2005-03-01 11:25 Atul Talesara
2005-03-01 11:58 ` Ramana Radhakrishnan
2005-03-01 12:13 ` Mansoor Ali Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1109675790.12201.29.camel@mansoor \
--to=mkhan@hdaar.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox