From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18263 invoked by alias); 1 Mar 2005 11:17:12 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 17933 invoked from network); 1 Mar 2005 11:16:23 -0000 Received: from unknown (HELO host15.apollohosting.com) (209.239.32.28) by sourceware.org with SMTP; 1 Mar 2005 11:16:23 -0000 Received: from mansoor ([202.141.233.154]) by host15.apollohosting.com (8.12.10/8.12.10) with ESMTP id j21BFqHY018817; Tue, 1 Mar 2005 06:16:21 -0500 Subject: Debugging the debugger From: Mansoor Ali Khan Reply-To: mkhan@hdaar.com To: gdb@sources.redhat.com Content-Type: text/plain Organization: Haval Daar Message-Id: <1109675790.12201.29.camel@mansoor> Mime-Version: 1.0 Date: Tue, 01 Mar 2005 11:17:00 -0000 Content-Transfer-Encoding: 7bit X-SW-Source: 2005-03/txt/msg00002.txt.bz2 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)