LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-12-2020, 04:59 PM   #16
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930

You can either modify to read from an array so you don't need to use stdin, or use the terminal capabilities https://sourceware.org/gdb/current/o...02fOutput.html
 
Old 09-13-2020, 02:54 AM   #17
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018
Quote:
Originally Posted by Arct1c_f0x View Post
So the problem that I'm running into now is using GDB (with emacs or even just by itself) and not being able to accept user input from stdin. I'll keep searching stack exchange and other sites for how to do this but if you know how to accomplish this (and I strongly suspect that you do), it would be a welcomed advancement.
When you use gdb through emacs you'll get an input/output buffer that you can use for providing stdin and reading stdout. It's a little clunky but it works. Best bet is to split your emacs screen into 3 so you can see, source, in/out and the gdb control window all at the same time.

The other option is to connect it to external ttys: which was described in the link rtmistler provided above, but unless you're doing some terminal programming (using escape sequences, or ncurses) that'll likely be more trouble than its worth.
 
2 members found this post helpful.
Old 09-13-2020, 12:54 PM   #18
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
This all started with a segmentation fault. That should be easy to track down by inspecting the core file in the debugger. Backtrace on the core file.

I agree that normal validation is faster using print statements.

Also agree that designing a solution in advance of coding is the right thing to do. Too many people get too distracted by simple code tasks as opposed to the problem and solution.
 
1 members found this post helpful.
Old 09-14-2020, 01:55 AM   #19
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
about debuggers: you may try ddd, a graphical frontend to gdb, probably easier (this works without emacs).
 
1 members found this post helpful.
Old 09-14-2020, 07:49 AM   #20
Arct1c_f0x
Member
 
Registered: Feb 2020
Posts: 123

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by GazL View Post
When you use gdb through emacs you'll get an input/output buffer that you can use for providing stdin and reading stdout. It's a little clunky but it works. Best bet is to split your emacs screen into 3 so you can see, source, in/out and the gdb control window all at the same time.

The other option is to connect it to external ttys: which was described in the link rtmistler provided above, but unless you're doing some terminal programming (using escape sequences, or ncurses) that'll likely be more trouble than its worth.
Thanks! I'm going to try that.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] K&R Exercise 1-6: What is this asking me to do? anon033 Programming 5 05-23-2019 06:00 PM
[SOLVED] K&R Exercise 1-4: Help Checking My Math anon033 Programming 18 05-23-2019 05:10 PM
[SOLVED] K&R Exercise 1.10 - A Question About Backspaces killingthemonkey Programming 4 02-04-2017 08:25 PM
Phục hồi dữ liệu bị mất???, cứ pollsite General 1 06-27-2005 12:39 PM
Gotta love those ٱٱٱٱٱٱٱ&# iLLuSionZ Linux - General 5 11-18-2003 07:14 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration