Giter Site home page Giter Site logo

Comments (6)

brasko avatar brasko commented on June 22, 2024

On Fri, Jul 25, 2014 at 02:37:40PM -0700, yurivict wrote:

I have a terminal program that senses if the standard output is a terminal (based on isatty(1)), and automatically prints control sequences when it is a terminal.

The problem is that when run under cgdb, for some reason, isatty(1) returns 'true', but output isn't printed as colored, and control sequences are printed as clear text.
When run under just gdb, output is colored.

This test case demonstrates this problem:

#include <unistd.h>
#include <stdio.h>

main() {
  if (isatty(1)) {
    printf("\033\[31mWe are on the terminal, this is a red text\033\[m\n");
  } else {
    printf("We are not on the terminal, this is a black text\n");
  }
}

I run on kde4 konsole terminal, if this matters, on FreeBSD 9.

In general, cgdb will not make debugging other terminal programs easy.

If it's possible, you should start your program from the terminal, and
then attach to that program with cgdb from another terminal.

This way your program will have complete access to the terminal and you
can use it in any way that you previously would.

I hope this is helpful. In the future, I might provide better support
for this in CGDB.

Bob Rossi

from cgdb.

yurivict avatar yurivict commented on June 22, 2024

I think that cgdb tries to send terminal output to libncurses window, it strips part of the control sequence (0x1b) and this causes this problem. This appears to be a design problem: terminal output shouldn't be sent to the channel that can't accept it.

cgdb should use something 'setupterm' call from libncurses, like tmux does. But this is a major redesign.

from cgdb.

brasko avatar brasko commented on June 22, 2024

On Fri, Jul 25, 2014 at 08:43:36PM -0700, yurivict wrote:

I think that cgdb tries to send terminal output to libncurses window, it strips part of the control sequence (0x1b) and this causes this problem. This appears to be a design problem: terminal output shouldn't be sent to the channel that can't accept it.

cgdb should use something like this: setupterm, like tmux does. But this is a major redesign.

CGDB is going to get lots of major redesigns in the next 6-12 months i
hope. I'll keep this in mind.

Bob Rossi

from cgdb.

brasko avatar brasko commented on June 22, 2024

On Sun, Jul 27, 2014 at 07:39:19AM -0400, Bob Rossi wrote:

On Fri, Jul 25, 2014 at 08:43:36PM -0700, yurivict wrote:

I think that cgdb tries to send terminal output to libncurses window, it strips part of the control sequence (0x1b) and this causes this problem. This appears to be a design problem: terminal output shouldn't be sent to the channel that can't accept it.

cgdb should use something like this: setupterm, like tmux does. But this is a major redesign.

CGDB is going to get lots of major redesigns in the next 6-12 months i
hope. I'll keep this in mind.

The correct thing to do here, might be to have CGDB require tmux for
improved terminal interaction. Then CGDB could spread it's windows
across different tmux windows, and the user could display them however
they want.

I'm posting this here so I'll remember this idea when I get back to it.

Tmux is really good at terminal emulation. This isn't a problem CGDB
should be solving.

Bob Rossi

from cgdb.

crowell avatar crowell commented on June 22, 2024

this is still an issue, is there a reason this is closed?

the problem is with scr_add in scroller.c, I'd be interested in tackling this.

from cgdb.

yurivict avatar yurivict commented on June 22, 2024

I think this is still a problem.

from cgdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.