public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Debuggee cmd-line arguments bug
@ 2005-07-25 14:15 Konstantin Karganov
  2005-07-25 14:24 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Konstantin Karganov @ 2005-07-25 14:15 UTC (permalink / raw)
  To: gdb

Hello.

Playing with the program startup arguments I've found the following 
"feature" of gdb. I have a program that prints its argc/argv parameters.

(gdb) set args a b c d
(gdb) run
Starting program: /home/kostik/Work/a.out a b c d
Argc=5, Argv=/home/kostik/Work/a.out,a,b,c,d
 
Program exited normally.
(gdb) set args a b c d
(gdb) run >out
Starting program: /home/kostik/Work/a.out >out

Program exited normally.
(gdb)

In file out there are the folowing:

Argc=1, Argv=/home/kostik/Work/a.out

So when trying to redirect debuggee IO we've lost all cmd-line parameters.
The same of cource happens with MI (and breaks the debugging startup for 
MPI program!).

Is it a bug?

And what is about my previous posts (still unanswered) on:

- running out of source code (stepping past main)
  http://sources.redhat.com/ml/gdb/2005-07/msg00152.html

- incorrect breakpoint diagnostics in MI
  http://sources.redhat.com/ml/gdb/2005-07/msg00175.html

- vanishing stopping reason in MI
  http://sources.redhat.com/ml/gdb/2005-07/msg00173.html

"And there's no doing anything about it" ?


Best regards,
Konstantin.


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

* Re: Debuggee cmd-line arguments bug
  2005-07-25 14:15 Debuggee cmd-line arguments bug Konstantin Karganov
@ 2005-07-25 14:24 ` Daniel Jacobowitz
  2005-07-25 18:21   ` Konstantin Karganov
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2005-07-25 14:24 UTC (permalink / raw)
  To: Konstantin Karganov; +Cc: gdb

On Mon, Jul 25, 2005 at 05:59:31PM +0400, Konstantin Karganov wrote:
> Hello.
> 
> Playing with the program startup arguments I've found the following 
> "feature" of gdb. I have a program that prints its argc/argv parameters.
> 
> (gdb) set args a b c d
> (gdb) run
> Starting program: /home/kostik/Work/a.out a b c d
> Argc=5, Argv=/home/kostik/Work/a.out,a,b,c,d
>  
> Program exited normally.
> (gdb) set args a b c d
> (gdb) run >out
> Starting program: /home/kostik/Work/a.out >out
> 
> Program exited normally.
> (gdb)
> 
> In file out there are the folowing:
> 
> Argc=1, Argv=/home/kostik/Work/a.out
> 
> So when trying to redirect debuggee IO we've lost all cmd-line parameters.
> The same of cource happens with MI (and breaks the debugging startup for 
> MPI program!).
> 
> Is it a bug?

No.  If you provide any options on the "run" command line, you are
replacing the arguments set by set args.  I think the text in section
4.3, "Your program's arguments", is pretty clear; please let us know if
it isn't.

> And what is about my previous posts (still unanswered) on:

Please don't reply to list messages to post to the list, by the way. 
It messes up threading; you can see the problem in the list archives.

> - running out of source code (stepping past main)
>   http://sources.redhat.com/ml/gdb/2005-07/msg00152.html

Your assumption that with step-mode set the PC will always be in user
code is incorrect.  For instance, you could be stopped by a signal, or
by a user interrupt, or by a breakpoint in a function without source
code available.

> - incorrect breakpoint diagnostics in MI
>   http://sources.redhat.com/ml/gdb/2005-07/msg00175.html

If someone knew the answer, they would have responded.  Sorry, that
just happens sometimes.

> - vanishing stopping reason in MI
>   http://sources.redhat.com/ml/gdb/2005-07/msg00173.html
> 
> "And there's no doing anything about it" ?

You _got_ an answer.  Bob agreed that there ought to be a reason.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

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

* Re: Debuggee cmd-line arguments bug
  2005-07-25 14:24 ` Daniel Jacobowitz
@ 2005-07-25 18:21   ` Konstantin Karganov
  2005-07-25 18:24     ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Konstantin Karganov @ 2005-07-25 18:21 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb


> No.  If you provide any options on the "run" command line, you are
> replacing the arguments set by set args.
But I don't provide any options, I did only IO redirection.
And this also killed args set before.
Ok, then is it possible to redirect IO via set args?

I do need to redirect IO every time I use MI, since otherwise MI 
output does not fit the grammar and breaks the parser (because mixed with 
debuggee output) - this thing is not very well designed, I think.

> You _got_ an answer.  Bob agreed that there ought to be a reason.
Ok. Sorry for bothering.

Best regards,
Konstantin.


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

* Re: Debuggee cmd-line arguments bug
  2005-07-25 18:21   ` Konstantin Karganov
@ 2005-07-25 18:24     ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2005-07-25 18:24 UTC (permalink / raw)
  To: Konstantin Karganov; +Cc: gdb

On Mon, Jul 25, 2005 at 10:05:55PM +0400, Konstantin Karganov wrote:
> 
> > No.  If you provide any options on the "run" command line, you are
> > replacing the arguments set by set args.
> But I don't provide any options, I did only IO redirection.
> And this also killed args set before.

IO redirection is an argument.

> Ok, then is it possible to redirect IO via set args?

Yes.

> I do need to redirect IO every time I use MI, since otherwise MI 
> output does not fit the grammar and breaks the parser (because mixed with 
> debuggee output) - this thing is not very well designed, I think.

You can find plenty of information about this problem in the list
archives, including the shiny new -inferior-set-tty command which
offers another solution.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

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

end of thread, other threads:[~2005-07-25 18:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-25 14:15 Debuggee cmd-line arguments bug Konstantin Karganov
2005-07-25 14:24 ` Daniel Jacobowitz
2005-07-25 18:21   ` Konstantin Karganov
2005-07-25 18:24     ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).