Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Is this possible with gdb?
@ 2005-05-25 15:05 Ismail Donmez
  2005-05-25 15:10 ` Bob Rossi
  0 siblings, 1 reply; 7+ messages in thread
From: Ismail Donmez @ 2005-05-25 15:05 UTC (permalink / raw)
  To: gdb

Hi all,

Sorry if this question came up early before but a Google search didn't result 
in much answer. What I want to do is to see currently executed line to be 
printed on console while using gdb.

Say I got this in foo.cpp

int main()
{
	i=2;
	return 0;
}

compiled into foo and I want gdb to print 

foo.cpp: line 3 
foo.cpp line 4
<exit>

So I just want to see porgram flow. Is this possible with gdb or can anyone 
suggest any other solution?

Any help is grealy appreciated.

Regards,
ismail

-- 
They say people don't believe in heroes anymore


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

* Re: Is this possible with gdb?
  2005-05-25 15:05 Is this possible with gdb? Ismail Donmez
@ 2005-05-25 15:10 ` Bob Rossi
  2005-05-25 15:14   ` Manoj Iyer
  2005-05-25 15:14   ` Ismail Donmez
  0 siblings, 2 replies; 7+ messages in thread
From: Bob Rossi @ 2005-05-25 15:10 UTC (permalink / raw)
  To: Ismail Donmez; +Cc: gdb

On Wed, May 25, 2005 at 06:05:59PM +0300, Ismail Donmez wrote:
> Hi all,
> 
> Sorry if this question came up early before but a Google search didn't result 
> in much answer. What I want to do is to see currently executed line to be 
> printed on console while using gdb.
> 
> Say I got this in foo.cpp
> 
> int main()
> {
> 	i=2;
> 	return 0;
> }
> 
> compiled into foo and I want gdb to print 
> 
> foo.cpp: line 3 
> foo.cpp line 4
> <exit>
> 
> So I just want to see porgram flow. Is this possible with gdb or can anyone 
> suggest any other solution?
> 
> Any help is grealy appreciated.

GDB is not a code coverage tool. You could look into use gcov.

However, with GDB you can step through your program. Try this,
gdb ./foo

b main
r
n
n
n
n

If you like what you see, try reading the manual.

Bob Rossi


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

* Re: Is this possible with gdb?
  2005-05-25 15:10 ` Bob Rossi
  2005-05-25 15:14   ` Manoj Iyer
@ 2005-05-25 15:14   ` Ismail Donmez
  1 sibling, 0 replies; 7+ messages in thread
From: Ismail Donmez @ 2005-05-25 15:14 UTC (permalink / raw)
  To: gdb

Hi,
On Wednesday 25 May 2005 18:10, Bob Rossi wrote:
[..]
> > compiled into foo and I want gdb to print
> >
> > foo.cpp: line 3
> > foo.cpp line 4
> > <exit>
> >
> > So I just want to see porgram flow. Is this possible with gdb or can
> > anyone suggest any other solution?
> >
> > Any help is grealy appreciated.
>
> GDB is not a code coverage tool. You could look into use gcov.

Thanks I will check it.

>
> However, with GDB you can step through your program. Try this,
> gdb ./foo
>
> b main
> r
> n
> n
> n
> n

No I can't use this as the program is threaded and I need to do some input 
from the gui thread. ( KDE/Qt app )

Regards,
ismail



-- 
They say people don't believe in heroes anymore


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

* Re: Is this possible with gdb?
  2005-05-25 15:10 ` Bob Rossi
@ 2005-05-25 15:14   ` Manoj Iyer
  2005-05-25 15:14   ` Ismail Donmez
  1 sibling, 0 replies; 7+ messages in thread
From: Manoj Iyer @ 2005-05-25 15:14 UTC (permalink / raw)
  To: Bob Rossi; +Cc: Ismail Donmez, gdb



> > <exit>
> >
> > So I just want to see porgram flow. Is this possible with gdb or can anyone
> > suggest any other solution?
> >
> > Any help is grealy appreciated.
>
> GDB is not a code coverage tool. You could look into use gcov.
>
> However, with GDB you can step through your program. Try this,
> gdb ./foo


Check out http://ltp.sourceforge.net/coverage/lcov.php, this might be what
you are looking for.

--
manjo


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

* Re: Is this possible with gdb?
  2005-05-25 15:38 ` Ismail Donmez
@ 2005-05-25 16:06   ` Ismail Donmez
  0 siblings, 0 replies; 7+ messages in thread
From: Ismail Donmez @ 2005-05-25 16:06 UTC (permalink / raw)
  To: gdb

On Wednesday 25 May 2005 18:39, Ismail Donmez wrote:
> On Wednesday 25 May 2005 18:29, Bloch, Jack wrote:
> > set height 0
> >    b main
> >    run
> >    while 1
> >       step
> >    end
> > end
>
> Only traces main() part but the interesting stuff happens in threads :( .
> Any way to get it to trace all parts including threads?

The line problematic is one exec() call after that I don't see any line 
printed.

Regards,
ismail

-- 
They say people don't believe in heroes anymore


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

* Re: Is this possible with gdb?
  2005-05-25 15:29 Bloch, Jack
@ 2005-05-25 15:38 ` Ismail Donmez
  2005-05-25 16:06   ` Ismail Donmez
  0 siblings, 1 reply; 7+ messages in thread
From: Ismail Donmez @ 2005-05-25 15:38 UTC (permalink / raw)
  To: gdb

On Wednesday 25 May 2005 18:29, Bloch, Jack wrote:
> set height 0
>    b main
>    run
>    while 1
>       step
>    end
> end

Only traces main() part but the interesting stuff happens in threads :( . Any 
way to get it to trace all parts including threads?


-- 
They say people don't believe in heroes anymore


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

* RE: Is this possible with gdb?
@ 2005-05-25 15:29 Bloch, Jack
  2005-05-25 15:38 ` Ismail Donmez
  0 siblings, 1 reply; 7+ messages in thread
From: Bloch, Jack @ 2005-05-25 15:29 UTC (permalink / raw)
  To: 'Ismail Donmez', gdb

Try this 


start you program under GDB 
define mytrace
   set height 0
   b main
   run
   while 1
      step
   end
end

type mytrace at the gdb prompt

  

-----Original Message-----
From: gdb-owner@sources.redhat.com
[mailto:gdb-owner@sources.redhat.com]On Behalf Of Ismail Donmez
Sent: Wednesday, May 25, 2005 11:06 AM
To: gdb@sources.redhat.com
Subject: Is this possible with gdb?


Hi all,

Sorry if this question came up early before but a Google search didn't
result 
in much answer. What I want to do is to see currently executed line to be 
printed on console while using gdb.

Say I got this in foo.cpp

int main()
{
	i=2;
	return 0;
}

compiled into foo and I want gdb to print 

foo.cpp: line 3 
foo.cpp line 4
<exit>

So I just want to see porgram flow. Is this possible with gdb or can anyone 
suggest any other solution?

Any help is grealy appreciated.

Regards,
ismail

-- 
They say people don't believe in heroes anymore


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

end of thread, other threads:[~2005-05-25 16:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-25 15:05 Is this possible with gdb? Ismail Donmez
2005-05-25 15:10 ` Bob Rossi
2005-05-25 15:14   ` Manoj Iyer
2005-05-25 15:14   ` Ismail Donmez
2005-05-25 15:29 Bloch, Jack
2005-05-25 15:38 ` Ismail Donmez
2005-05-25 16:06   ` Ismail Donmez

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