Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* RE: Debugging the debugger
@ 2005-03-01 11:25 Atul Talesara
  2005-03-01 11:58 ` Ramana Radhakrishnan
  2005-03-01 12:13 ` Mansoor Ali Khan
  0 siblings, 2 replies; 4+ messages in thread
From: Atul Talesara @ 2005-03-01 11:25 UTC (permalink / raw)
  To: mkhan, gdb

> 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. 
Best bet is that you have compiled your code with GCC
optimizations ON(-O1, -O2 or -O3). In which case this
apparently weird behaviour is completely normal.

Regards,
Atul P Talesara
http://the-shaolin.blogspot.com/ 
---------------------------------------------------------- 
You can tell more about a person by what he says about
others than you can by what others say about him.

----------------------------------------------------------


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debugging the debugger
  2005-03-01 11:25 Debugging the debugger Atul Talesara
@ 2005-03-01 11:58 ` Ramana Radhakrishnan
  2005-03-01 12:13 ` Mansoor Ali Khan
  1 sibling, 0 replies; 4+ messages in thread
From: Ramana Radhakrishnan @ 2005-03-01 11:58 UTC (permalink / raw)
  To: mkhan; +Cc: Atul Talesara, gdb

Hi Mansoor

>>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. 
> 
> Best bet is that you have compiled your code with GCC
> optimizations ON(-O1, -O2 or -O3). In which case this
> apparently weird behaviour is completely normal.

The usual reason is as mentioned by Atul in his mail.
In addition it might be better if you posted a complete testcase 
for someone else to be able to reproduce the problem at their end.

cheers
Ramana

-- 
Ramana Radhakrishnan
GNU Tools
codito ergo sum (www.codito.com)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Debugging the debugger
  2005-03-01 11:25 Debugging the debugger Atul Talesara
  2005-03-01 11:58 ` Ramana Radhakrishnan
@ 2005-03-01 12:13 ` Mansoor Ali Khan
  1 sibling, 0 replies; 4+ messages in thread
From: Mansoor Ali Khan @ 2005-03-01 12:13 UTC (permalink / raw)
  To: gdb

Thanks Atul,

Its exactly what u mentioned. I was using autoconf and was not aware of
the fact that the AC_PROG_CC macro by default enables optimization.

Mansoor.

On Tue, 2005-03-01 at 16:24, Atul Talesara wrote:
> > 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. 
> Best bet is that you have compiled your code with GCC
> optimizations ON(-O1, -O2 or -O3). In which case this
> apparently weird behaviour is completely normal.
> 
> Regards,
> Atul P Talesara
> http://the-shaolin.blogspot.com/
> ---------------------------------------------------------- 
> You can tell more about a person by what he says about
> others than you can by what others say about him.
> 
> ----------------------------------------------------------
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Debugging the debugger
@ 2005-03-01 11:17 Mansoor Ali Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Mansoor Ali Khan @ 2005-03-01 11:17 UTC (permalink / raw)
  To: gdb

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)



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-03-01 12:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-01 11:25 Debugging the debugger Atul Talesara
2005-03-01 11:58 ` Ramana Radhakrishnan
2005-03-01 12:13 ` Mansoor Ali Khan
  -- strict thread matches above, loose matches on Subject: below --
2005-03-01 11:17 Mansoor Ali Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox