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

Variable doesn't get printed through -exec in repl #907

Open
Fabian-programmer opened this issue Mar 18, 2023 · 4 comments
Open

Variable doesn't get printed through -exec in repl #907

Fabian-programmer opened this issue Mar 18, 2023 · 4 comments

Comments

@Fabian-programmer
Copy link

Fabian-programmer commented Mar 18, 2023

Debug adapter definition and debug configuration

Config based on vscode default with logging
Within vscode this config works and produces the expected result.

local cpptools = mason_registry.get_package("cpptools")

dap.adapters.cppdbg = {
  id = 'cppdbg',
  type = 'executable',
  command = cpptools:get_install_path() .. '/extension/debugAdapters/bin/OpenDebugAD7'
}

Debug adapter version

cpptools v1.14.4

Steps to Reproduce

This error is random, but with following minimal example I could reproduce the error at least every 2nd time. With a more complex example the error occurs all the time. When I reduce the complexity by removing catch2 the error doesn't occur.
It also uses a 3rd party gdb extension. (maybe some timing error?) Edit: this is optional

In vscode it works for me without error.

Now to reproduce:

  1. git clone https://github.com/Fabian-programmer/oid_bug
  2. g++ -o oid_bug oid_bug.cpp -ggdb -O0
  3. Install openimagedebugger (optional)
 git clone https://github.com/OpenImageDebugger/OpenImageDebugger.git
 cd OpenImageDebugger
 git submodule init
 git submodule update
 
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=../bin
make -j4
make install

GDB integration: Edit the file ~/.gdbinit (create it if it doesn't exist) and append the following line:
source /path/to/OpenImageDebugger/oid.py
  1. In oid_bug.cpp set a breakpoint in line 31.
  2. Start the debugging with the provided configuration
  3. if openimagedebugger is enabled, the variable should be selectable +visible in the ui. But it is also possible to execute -exec print test in the dap repl console, which will return No symbol "test" in current context.

Expected Result

I don't know why I currently can't embed png's here.
But this is the expected result. It should display the variable test inside the open image debugger.

For the -exec print test this is the result from vscode:

--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (10239) ->(gdb)\n"},"seq":1262}
1: (10239) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (10239) 1122: elapsed time 0\n"},"seq":1264}
1: (10239) 1122: elapsed time 0
--> R (variables-22): {"type":"response","request_seq":22,"success":true,"command":"variables","body":{"variables":[{"name":"test","value":"{...}","type":"cv::Mat","evaluateName":"test","variablesReference":1005}]},"seq":1266}

Actual Result

For the actual result the Open Image Debugger window stays blank with the last line in repl:

[OpenImageDebugger] Error: Could not plot variable
--> E (output): {"type":"event","event":"output","body":{"category":"stdout","output":"No symbol "test" in current context.\n"},"seq":100}
No symbol "test" in current context.

repl output for nvim dap

compared to working repl output from vscode

I hope it is ok, that I've just linked everyth. into this repository. Didn't want to clutter the ticket with these outputs.

@leosmaia21
Copy link

leosmaia21 commented Jul 21, 2023

i have the same problem, when u step in a function the repl doest update, u need for exemple type p test, it will say:-var-create: unable to create variable object, and then type -exec p test, the first command will update the repl i guess

@leosmaia21
Copy link

here some information:
microsoft/vscode-cpptools#5235 (comment)

@Fabian-programmer
Copy link
Author

I saw that ticket, too. But I was wondering, why it works for me in vscode but not in nvim + the logs look quite different.

@Fabian-programmer
Copy link
Author

I switched to gdb 14.1, this issue isn't relevant for me anymore.
Maybe this helps you too @leosmaia21

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