Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing any character in the terminal causes jump to source #213

Open
Charlie-83 opened this issue Jan 12, 2025 · 5 comments
Open

Typing any character in the terminal causes jump to source #213

Charlie-83 opened this issue Jan 12, 2025 · 5 comments

Comments

@Charlie-83
Copy link
Contributor

This makes things pretty unusable.

The issue is cause by this change:
09c92da#diff-f73960b7024bf1aed12c42b6d3c29f67b52a1dfee2fb99cc07d937d6d340bb3dL50

The pattern $ matches every string so this code is triggered every time the input buffer is changed. I have fixed the issue by reverting this change to the actual regex for the (gdb) prompt.

I am happy to submit a PR but I don't understand why it was changed to $ in the first place. Is there something I am missing?

@sakhnik
Copy link
Owner

sakhnik commented Jan 12, 2025

I remember that looking for just the prompt was fragile. Therefore, I added a custom marker ^z^z^z at some point. But it wasn't reliable in some scenarios, either.
I can't reproduce the issue, I can type any commands. Could you please give me more details? Could you investigate what's happening?

@Charlie-83
Copy link
Contributor Author

Charlie-83 commented Jan 17, 2025

https://asciinema.org/a/TGYF2fu0k5LYfW2BBKzjx3vy1

I need to look into this issue more to find a reproducible case but here is a video showing this issue.
I think that the issue can also be much worse depending on the config. I was getting it so that it also jumped my cursor to the window with the code which made it essentially impossible to type anything in the console; you need to change back to the terminal window after each character. I believe this had something to do with sticky_dbg_buf being false but I was changing other stuff also at the time

Edit: Confirmed that this issue is much worse when sticky_dbg_buf is false

sakhnik added a commit that referenced this issue Jan 19, 2025
sakhnik added a commit that referenced this issue Jan 19, 2025
@sakhnik
Copy link
Owner

sakhnik commented Jan 19, 2025

How does the branch develop work for you?

sakhnik added a commit that referenced this issue Jan 20, 2025
sakhnik added a commit that referenced this issue Jan 20, 2025
@Charlie-83
Copy link
Contributor Author

Charlie-83 commented Jan 22, 2025

Testing on 0da3d19

This has fixed the issue where typing any character causes it to jump.

This has also made commands like p 123 not jump (which was the aim of my PR).

There is a problem I have noticed.

  • Set a breakpoint
  • Run the program. It will hit the breakpoint and jump to it
  • Run the program again (run). It will hit the breakpoint and won't jump
  • Run it again and it will jump
  • Each time you run the program and it hits that same breakpoint, it alternates between jumping and not jumping
    https://asciinema.org/a/rZiJ4nJ3ty4cd77df3qNZWMj7

The same thing can be achieved by placing the breakpoint in a loop and using continue rather than run.

I think that the ideal behaviour is that p 123 doesn't cause a jump while continue/run will cause a jump even if it is to the same place as last time. This problem was something I fixed by adding a new reset-on-read flag to gdb_commands.py to record whether the program had actually ran or not since the last time it stopped.

sakhnik added a commit that referenced this issue Jan 25, 2025
This reverts commit e4a9a61.
@sakhnik
Copy link
Owner

sakhnik commented Jan 25, 2025

When your fix is slightly adjusted, it fixes #213 too.
I'll still have to investigate how to do that same for lldb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants