Coder Social home page Coder Social logo

Comments (10)

bb33bb avatar bb33bb commented on September 22, 2024

for example, i am usingthe following command

print *(struct list_head *)0xffff800009b7ccc8

then the out put will be

_print *(_print *(struct list_head *)0xffff800009b7ccc8

print *(
is the wrong output by debuger or cef
everytime , the first len("print *(") of letters will be added to the front of the command you typed
also the wrongly added letters will be highlighted.

from gef.

ValekoZ avatar ValekoZ commented on September 22, 2024

It seems like the problem comes from the boldify line 11237 (and we should have the same issue on the other cases I guess)
Can you try this patch just to check that I'm right, please?

from gef.

ValekoZ avatar ValekoZ commented on September 22, 2024
diff --git a/gef.py b/gef.py
index ce95e20..4d49b2d 100644
--- a/gef.py
+++ b/gef.py
@@ -11234,7 +11234,7 @@ class GefRemoteSessionManager(GefSessionManager):
             if self == GefRemoteSessionManager.RemoteMode.RR:
                 return Color.boldify("(rr) ")
             if self == GefRemoteSessionManager.RemoteMode.GDBSERVER:
-                return Color.boldify("(remote) ")
+                return "(remote) "
             raise AttributeError("Unknown value")

     def __init__(self, host: str, port: int, pid: int =-1, qemu: Optional[pathlib.Path] = None) -> None:

from gef.

Grazfather avatar Grazfather commented on September 22, 2024

Hm, our colorify makes sure to use normal at the end, and all our codes start with \033, so I don't understand why this would happen. I also don't see it myself. What terminal emulator are you using?

from gef.

ValekoZ avatar ValekoZ commented on September 22, 2024

It is not related to the terminal emulator but to the readline library (which is used by gdb).
You can see it by using the up arrow to go to the previous command multiple times when having a remote connection.
What happens is that ANSI escape codes are counted by the readline library as taking actual columns in the output, while it doesn't. We need to tell it that those chars are special chars that take no place in the output so that when it computes the length of the prompt, it does not take those chars into account.

from gef.

Grazfather avatar Grazfather commented on September 22, 2024

That's exactly what the \033[xxxm is supposed to do. I've dealt with this before and never see those codes.

from gef.

Grazfather avatar Grazfather commented on September 22, 2024

I think it's \[ and \] around each code. Can you try that?

from gef.

ValekoZ avatar ValekoZ commented on September 22, 2024

I think you don't understand what the issue is. You can check this thread to understand:
https://stackoverflow.com/questions/50470933/readline-confused-by-ansi-escape-sequences
That's actually what I did, by just copying what is already done on the gef> part of the prompt.

from gef.

Grazfather avatar Grazfather commented on September 22, 2024

I understand the issue. I have \[ and \] in my bashrc prompt to remediate it. Anyway, we'd probably only need it on the gef> part, as well as (remote) and the other prompts we do.

from gef.

hugsy avatar hugsy commented on September 22, 2024

Closing as #1103 was merged

from gef.

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.