Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Passing piped commands as argument to gdb
@ 2014-12-22 10:09 Mahmood N
  2014-12-22 10:16 ` Jan Kratochvil
  0 siblings, 1 reply; 7+ messages in thread
From: Mahmood N @ 2014-12-22 10:09 UTC (permalink / raw)
  To: gdb

Hi

I have a large bz file which is piped to a program like this
    bzcat file.bz2 |./run_prog 6
Now I want to use gdb, however the following command fails
    gdb --args  bzcat file.bz2 |./run_prog 6



What is the correct format?

Regards,
Mahmood


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

* Re: Passing piped commands as argument to gdb
  2014-12-22 10:09 Passing piped commands as argument to gdb Mahmood N
@ 2014-12-22 10:16 ` Jan Kratochvil
  2014-12-22 10:40   ` Mahmood N
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kratochvil @ 2014-12-22 10:16 UTC (permalink / raw)
  To: Mahmood N; +Cc: gdb

On Mon, 22 Dec 2014 11:09:21 +0100, Mahmood N wrote:
> I have a large bz file which is piped to a program like this
>     bzcat file.bz2 |./run_prog 6
> Now I want to use gdb, however the following command fails
>     gdb --args  bzcat file.bz2 |./run_prog 6

mknod pipe p
bzcat file.bz2 >pipe &
gdb ./run_prog -ex 'run <pipe 6'


Jan


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

* Re: Passing piped commands as argument to gdb
  2014-12-22 10:16 ` Jan Kratochvil
@ 2014-12-22 10:40   ` Mahmood N
  2014-12-22 13:55     ` Jan Kratochvil
  0 siblings, 1 reply; 7+ messages in thread
From: Mahmood N @ 2014-12-22 10:40 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb

Thanks. Generally it works. However, when I start the command, the program is run, I want to set a breakpoint at line 26 in my code which is the beginning of the readings

However, here is what I get

$ g++ -g -ggdb -o dir-pred dir-pred.cpp
$ rm pipe
$ mknod pipe p
$ bzcat file.bz2 > pipe &
[1] 18321
$ gdb
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6)
(gdb) break dir-pred.cpp:26
No symbol table is loaded.  Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n])



Should I say Y or N?

 Regards,
Mahmood


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

* Re: Passing piped commands as argument to gdb
  2014-12-22 10:40   ` Mahmood N
@ 2014-12-22 13:55     ` Jan Kratochvil
  2014-12-22 14:43       ` Mahmood N
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kratochvil @ 2014-12-22 13:55 UTC (permalink / raw)
  To: Mahmood N; +Cc: gdb

On Mon, 22 Dec 2014 11:40:12 +0100, Mahmood N wrote:
> $ gdb

I wrote:
	gdb ./run_prog -ex 'run <pipe 6'

You typed a different command - so it does not work.


Jan


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

* Re: Passing piped commands as argument to gdb
  2014-12-22 13:55     ` Jan Kratochvil
@ 2014-12-22 14:43       ` Mahmood N
  2014-12-22 14:46         ` Jan Kratochvil
  0 siblings, 1 reply; 7+ messages in thread
From: Mahmood N @ 2014-12-22 14:43 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb

Yes I know. As I said in my previous email, your method generally works and I tested that. This is a different problem.

What you wrote, and what I tested results in the execution of the program under gdb. So it start and run the program. Now, I want to first set a breakpoint then run the program under gdb. Pasting the commands one more time, I get this error

 
$ g++ -g -ggdb -o dir-pred dir-pred.cpp
$ rm pipe
$ mknod pipe p
$ bzcat file.bz2 > pipe &
[1] 18321
$ gdb
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6)
(gdb) break dir-pred.cpp:26
No symbol table is loaded.  Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n])

Regards,
Mahmood


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

* Re: Passing piped commands as argument to gdb
  2014-12-22 14:43       ` Mahmood N
@ 2014-12-22 14:46         ` Jan Kratochvil
  2014-12-22 17:20           ` Mahmood N
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kratochvil @ 2014-12-22 14:46 UTC (permalink / raw)
  To: Mahmood N; +Cc: gdb

On Mon, 22 Dec 2014 15:43:00 +0100, Mahmood N wrote:
> What you wrote, and what I tested results in the execution of the program
> under gdb. So it start and run the program. Now, I want to first set
> a breakpoint then run the program under gdb.

OK, sorry.


> $ g++ -g -ggdb -o dir-pred dir-pred.cpp
> $ rm pipe
> $ mknod pipe p
> $ bzcat file.bz2 > pipe &
> [1] 18321
> $ gdb
> GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6)
> (gdb) break dir-pred.cpp:26
> No symbol table is loaded.  Use the "file" command.
> Make breakpoint pending on future shared library load? (y or [n])

When running just plain "gdb" you need to do what it says to you, that is:

(gdb) file ./run_prog
(gdb) break dir-pred.cpp:26
 - There will be no question due to the "file" command above.
(gdb) run <pipe 6


Regards,
Jan


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

* Re: Passing piped commands as argument to gdb
  2014-12-22 14:46         ` Jan Kratochvil
@ 2014-12-22 17:20           ` Mahmood N
  0 siblings, 0 replies; 7+ messages in thread
From: Mahmood N @ 2014-12-22 17:20 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb

Thank you very much

 Regards,
Mahmood


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

end of thread, other threads:[~2014-12-22 17:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-22 10:09 Passing piped commands as argument to gdb Mahmood N
2014-12-22 10:16 ` Jan Kratochvil
2014-12-22 10:40   ` Mahmood N
2014-12-22 13:55     ` Jan Kratochvil
2014-12-22 14:43       ` Mahmood N
2014-12-22 14:46         ` Jan Kratochvil
2014-12-22 17:20           ` Mahmood N

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