Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add convienient way for passing data to stdin #22

Open
gizlu opened this issue Sep 16, 2021 · 2 comments
Open

Add convienient way for passing data to stdin #22

gizlu opened this issue Sep 16, 2021 · 2 comments

Comments

@gizlu
Copy link

gizlu commented Sep 16, 2021

Let's say i have prog which reads data from stdin
I run it using my shell's input redirection:

$ ./some-exec --foo --bar < redirected_file.txt
$ printf "some-string\ndupa\n" | ./some-exec --foo --bar

It would be nice if ugdb took stdin and passed it to debugged program so we could use it that way:

$ ugdb -- ./some-exec --foo --bar < redirected_file.txt
$ printf "some-string\ndupa\n" | ugdb -- ./some-exec --foo --bar
@ftilde
Copy link
Owner

ftilde commented Oct 26, 2021 via email

@gizlu
Copy link
Author

gizlu commented Jan 7, 2022

Also sorry for taking so long to respond. I've had misconfigured github notfications.

Sorry for taking so long to respond. I've been quite busy with work lately. In general I like the idea and see how it would be useful to something to stdin via a script or something. I wonder about the best way to that, though. Consider that you might want to restart the debugging session after you've stepped over a critical function. When restarting the execution the program would possibly miss some part of the data passed via stdin.

Good point, I missed that.

What do you think about passing a script via commandline argument that would be executed to the program whenever it is started?

$ ugdb --stdin-script script.sh ./some-exec

where script.sh contains cat redirected_file.txt or printf "some-string\ndupa\n"?

Sounds good. If you pass stdin-script to shell (using something like popen() rather than fork/exec) it could be even used without writing separate script like that:

$ ugdb --stdin-script "curl something | tail"  ./some-exec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants