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

The GDB interface does not support comments in the command #923

Open
andrei132 opened this issue Oct 22, 2024 · 3 comments
Open

The GDB interface does not support comments in the command #923

andrei132 opened this issue Oct 22, 2024 · 3 comments

Comments

@andrei132
Copy link

Describe the bug
GDB comment commands are not supported by eclipse. Any GDB comment cannot be executed successfully and give Undefined command: "". Try "help".

To Reproduce
It can be reproduced using any view that allows giving commands to GDB. I will give DebuggerConsole as an example.

  1. Create a new C project
  2. Build project
  3. Debug project with C/C++ Application
  4. Open Debugger Console view
  5. Give some GDB comment

Observed behavior
Undefined command: "". Try "help".
image

Expected behavior
The command must be given successfully without displaying errors

Version Information (please complete the following information):

  • Windows 10/11
  • Eclipse 23.12
  • CDT Version from Help -> 11.04
@jonahgraham
Copy link
Member

Hi @andrei132, The bug you reported here is a GDB issue. CDT does "the right thing" AFAICT and this is the MI sent to GDB:

711,264 35-interpreter-exec console "#some comment"
711,266 &"Undefined command: \"\".  Try \"help\".\n"
711,266 35^error,msg="Undefined command: \"\".  Try \"help\"."

Please report this bug to GDB.

PS the version of GDB in your screenshot is unfortunately ancient. While this issue exists in latest GDB, I recommend reporting the bug with a more recent screenshot.

@andrei132
Copy link
Author

andrei132 commented Nov 14, 2024

In GDB, the comments are evaluated ok
image
But in eclipse
image
I would insist on re-opening this ticket if it is posible

@jonahgraham
Copy link
Member

Your screenshot does not show gdb doing the correct thing - it shows GDB in CLI mode, not MI mode. The bug is that -interpreter-exec console "#some comment" in GDB's MI mode generates an error instead of silently ignoring the comment. If this issue is affecting you, you will need to ask GDB to resolve it, first step is to create a bug report.

If you want CDT to resolve (workaround) the issue, you can suggest a patch. I will reopen the issue in the hope you provide such a patch. For example you can add some interpretation of commands users types to edit command before passing them to -interpreter-exec console. Have a look at org.eclipse.cdt.dsf.mi.service.breakpoint.actions.CLIDebugActionEnabler. It will be a fairly high high bar to accept a patch that does comment processing in CDT as it would mean CDT would have to understand a lot of CLI context. For example, you can't just exclude everything after # without parsing the line, or else a command like print "this is # not a comment" would break.

PS I note that your host machine is Windows - the other (and probably better) option would be to implement new-ui support on Windows. This would resolve similar problems like #362

@jonahgraham jonahgraham reopened this Nov 14, 2024
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