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 7938589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:51:05+00:00 2026-06-03T22:51:05+00:00

It seems that input redirection in gdb does not work in Cygwin e.g (gdb)

  • 0

It seems that input redirection in gdb does not work in Cygwin e.g

(gdb) run < input.txt

Is there other way to redirect input in gdb of Cygwin??

  • 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-06-03T22:51:06+00:00Added an answer on June 3, 2026 at 10:51 pm

    Unfortunately this is not possible when running gdb in cygwin. The bug exists for a quote long time, but apparently it’s a hard one to fix – and probably the gdb devs prefer spending time on features/issues relevant to more common environments (such as Linux).

    There are various possible workarounds; I’d prefer the first one since it’s the cleanest and also useful while not debugging / running on cygwin:

    • Add a command line argument, e.g. -f whatever with whatever being the filename to read from. If the argument is not present or set to -, read from stdin. The -f - option is optional of course but for arguments accepting filenames it’s a common standard (as long as it makes sense) to handle - as “use stdin/out”.
    • Use the gdb hack mentioned here to remap stdin to a manually opened file inside the application:

      > gdb yourexecutable
      (gdb) break main
      (gdb) run
      (gdb) call dup2(open("input.txt", 0), 0)
      (gdb) continue
      

      This sets a breakpoint on the main function, then executes the program which will break right after entering main. Then dup2 is used to replace the stdin fd (0) with a file descriptor of the input file.

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

Sidebar

Related Questions

It seems that the only way to add an onPaste event to an input
It seems that the only way to select a checkable input that is actually
It seems that flex doesn't support UTF-8 input. Whenever the scanner encounter a non-ASCII
It seems that there are several really fast prime factorization algorithms around (one that
it seems that on Rails or erb, the only way to output anything is
I read the other password recovery questions on SO and it seems that most
It seems that even when using shivs you can't do something like input[type=search] to
I have got a very strange input issue in which it seems that my
It seems that in PostgreSQL, empty_field != 1 (or some other value) is FALSE
It seems that my input boxes seem to come up twice, even though their

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.