Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 394713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:22:58+00:00 2026-05-12T16:22:58+00:00

Say I have a two programs named blah and ret . I want to

  • 0

Say I have a two programs named blah and ret. I want to debug blah program which receives input from ret program via I/O redirection. How do I debug the blah program in the following case using gdb?

bash> ret | blah 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T16:22:58+00:00Added an answer on May 12, 2026 at 4:22 pm

    At first, you may run the program and debug it by pid. This solution, of course, doesn’t cover all cases.

    Another approach is to use Linux capabilities for inter-process communication. In short, you redirect the output of ret to a FIFO special file (“named pipe”) and then read from that FIFO via debugger. Here’s how it’s done. From bash, run:

    mkfifo foo
    

    This creates a special file in your directory that will serve as a named pipe. When you write text to this file (using the same syntax echo "Hello" >foo), the writing program will block until someone reads the data from the file (cat <foo, for instance). In our case, a gdb-controlled process will read from this file.

    After you created a fifo, run from bash:

    ret > foo &   # ampersand because it may block as nobody is reading from foo
    gdb blah
    

    Then, in gdb prompt, run

    run <foo
    

    And get the desired effect. Note that you can’t read the data from the fifo (as well as from a usual pipe) twice: when you’ve read all the data, the blah process dies and you should repeat the command writing to foo (you may do it from the other shell window).

    When you’re done, remove the fifo with rm foo (or place it into the directory where it will automatically be removed upon system restart, such as /tmp).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have a C++ program and I want to call functions from
I'm using linux. Let's say I have a program named add. The program takes
Lets say I have this program below. Now I want to pass both the
I have a program that consists of two programs: Updater and WorkMaker. Whenever there
Let's say I have a server, and two clients connected to it. (via TCP,
Say we have two tables in an MS Access db: Service Users: | ID
Say I have two classes and have a requirement that the primary key property
Say I have two functions that expect ...rest parameters private function a(...myParams):void { trace(myParams.length);
Say I have two tables called A (fields: id, phase, name) and B(fields: id,
Say you have two classes, A and B. Is it possible to instantiate both

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.