Code Monkey home page Code Monkey logo

Comments (5)

mmueller avatar mmueller commented on July 28, 2024

Weird. I don't reproduce this using cgdb from git master. Also this code hasn't changed in a long time. What version of cgdb are you running? How many lines is the source file, and how big was your terminal?

If you look at sources.c:604, there's a check for this condition and it should just draw a ~ (tilde) vim-style where the buffer is outside of the file boundaries:

/* Outside of file, just finish drawing the vertical line */
if (line < 0 || line >= sview->cur->buf.length) {

I also tried running through valgrind, but it reports no memory access issues.

from cgdb.

frankdeath avatar frankdeath commented on July 28, 2024

I'm running both git master and v0.6.7. Both reliably crash.

I was able to recreate the problem with a very small C program (9 lines):

/* Author: Me */

#include <stdio.h>

int main(int argc, char *argv[])
{
  printf("Hello world!\n");
  return(0);
}

When my terminal is 19 lines tall I can see the entire source file. If I increase the source window by pressing "=" once or by making my terminal one line larger in the vertical direction, cgdb crashes.

My source file uses a single new-line as the line terminator:

$ hexdump -C main.c 
00000000  2f 2a 20 41 75 74 68 6f  72 3a 20 4d 65 20 2a 2f  |/* Author: Me */|
00000010  0a 0a 23 69 6e 63 6c 75  64 65 20 3c 73 74 64 69  |..#include <stdi|
00000020  6f 2e 68 3e 0a 0a 69 6e  74 20 6d 61 69 6e 28 69  |o.h>..int main(i|
00000030  6e 74 20 61 72 67 63 2c  20 63 68 61 72 20 2a 61  |nt argc, char *a|
00000040  72 67 76 5b 5d 29 0a 7b  0a 20 20 70 72 69 6e 74  |rgv[]).{.  print|
00000050  66 28 22 48 65 6c 6c 6f  20 77 6f 72 6c 64 21 5c  |f("Hello world!\|
00000060  6e 22 29 3b 0a 20 20 72  65 74 75 72 6e 28 30 29  |n");.  return(0)|
00000070  3b 0a 7d 0a                                       |;.}.|
00000074

Maybe the trailing '\n' is the problem?

from cgdb.

mmueller avatar mmueller commented on July 28, 2024

Thanks for the additional info. Still weird though, I don't see this when I run the same program through cgdb and resize the terminal a bunch of times. I've tried cgdb master on linux and 0.6.7 on mac. Tried with my terminal set to 19 lines tall, too.

The trailing newline shouldn't be an issue, those are pretty standard (vim always adds a newline by default, for example).

from cgdb.

frankdeath avatar frankdeath commented on July 28, 2024

I can successfully run cgdb in xterm on OS X.
I can successfully run cgdb in xterm and GNOME Terminal on Linux.

The problem appears to be with Terminal.app on OS X. It declares itself as "xterm-color", but I don't see any color when I run cgdb. Instead of "~" for non-existent lines I see "(null)".

Now that I know I can simply run it in an xterm, there is little incentive to figure out what is wrong when Terminal.app is used.

from cgdb.

mikesart avatar mikesart commented on July 28, 2024

Closing really old issues. Please open a new bug if this problem still exists. Thanks.

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.