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

Unable to enter variables when debugging. #592

Closed
2 tasks done
rileychc opened this issue Mar 22, 2023 · 2 comments
Closed
2 tasks done

Unable to enter variables when debugging. #592

rileychc opened this issue Mar 22, 2023 · 2 comments
Labels
dap Debug Adapter related issues usage User-specific issues

Comments

@rileychc
Copy link

Version confirmation

  • Confirm

Following prerequisites

  • Confirm

Neovim version

NVIM v0.8.3

Operating system/version

macOS 13.2.1

Terminal name/version

iterm2 Build 3.4.19

$TERM environment variable

No response

Branch info

main (Default/Latest)

Fetch Preferences

SSH (use_ssh = true)

Affected language servers

clang

How to reproduce the issue

image

Actual behavior

able to proceed to the next debugging

Expected behavior

No response

Support info

image

Logs

No response

Additional information

No response

@rileychc rileychc added bug Something isn't working lsp LSP related issues labels Mar 22, 2023
@Jint-lzxy
Copy link
Collaborator

See #440. One solution is to attach the debugger to a running executable. More info: lldb-vscode/README.md, option "attach".

Getting dap to handle user input currently requires appreciable user configuration as it's platform specific. If you don't want to spend time setting up all those "dirty details" then I would recommend you redirect stdin to a file or simply get user input from a file.

This is the minimal equivalent of your program that would get user input from a file (to keep the code concise, I omitted several status checks):

#include <fstream>
#include <iostream>

int main()
{
	std::ifstream in("dat.txt", std::ifstream::in | std::ifstream::binary); // read from ./dat.txt
	if (in.is_open()) {
		int var1 = 0;
		in >> var1;
		std::cout << var1;

		in.close();
	}
	return 0;
}

Using C-style freopen to redirect stdin is also feasible.

@Jint-lzxy Jint-lzxy added usage User-specific issues and removed bug Something isn't working labels Mar 22, 2023
@Jint-lzxy Jint-lzxy added dap Debug Adapter related issues and removed lsp LSP related issues labels Apr 7, 2023
@Jint-lzxy
Copy link
Collaborator

Closed due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dap Debug Adapter related issues usage User-specific issues
Projects
None yet
Development

No branches or pull requests

2 participants