nvim-dap-ui icon indicating copy to clipboard operation
nvim-dap-ui copied to clipboard

Error executing vim.schedule lua callback: .../paqs/start/nvim-dap-ui/lua/dapui/components/threads.lua:41: attempt to index a nil value

Open tristone13th opened this issue 2 years ago • 6 comments

My configuration for dapui:

	require("dapui").setup({
		icons = { expanded = "▾", collapsed = "▸" },
		mappings = {
			-- Use a table to apply multiple mappings
			expand = { "<CR>", "<2-LeftMouse>" },
			open = "o",
			remove = "d",
			edit = "e",
			repl = "r",
			toggle = "t",
		},
		expand_lines = vim.fn.has("nvim-0.7"),
		layouts = {
			{
				elements = {
					-- Elements can be strings or table with id and size keys.
					{ id = "scopes", size = "0.4" },
					{ id = "stacks", size = "0.2" },
					{ id = "breakpoints", size = "0.2" },
					{ id = "watches", size = "0.2" },
				},
				size = 40, -- 40 columns
				position = "left",
			},
			{
				elements = {
					"repl",
				},
				size = 0.25, -- 25% of total lines
				position = "bottom",
			},
		},
		windows = { indent = 1 },
		render = {
			max_type_length = nil, -- Can be integer or nil.
			max_value_lines = 100, -- Can be integer or nil.
		},
	})
	local dap_, dapui = require("dap"), require("dapui")
	dap_.listeners.after.event_initialized["dapui_config"] = function()
		vim.schedule(dapui.open)
	end

My configuration for dap:

	local dap_ = require("dap")
	dap_.adapters.cppdbg = {
		id = "cppdbg",
		type = "executable",
		command = myutils.home .. "/.local/share/nvim/mason/packages/cpptools/extension/debugAdapters/bin/OpenDebugAD7",
		setupCommands = {
			{
				text = "-enable-pretty-printing",
				description = "enable pretty printing",
				ignoreFailures = false,
			},
		},
	}

Behavior: image

tristone13th avatar Sep 09 '22 08:09 tristone13th

Please create a log file with the DEBUG level (require('dap').set_log_level('DEBUG')) and provide it here.

Does this occur immediately when starting the debugger?

If you can provide a sample file to debug as well that'd be helpful

rcarriga avatar Sep 10 '22 14:09 rcarriga

require('dap').set_log_level('DEBUG')

dap.log

I think the related log is:

[ ERROR ] 2022-09-11T06:54:47Z+0800 ] ...e/nvim/site/pack/paqs/start/nvim-dap/lua/dap/session.lua:1141 ]	"stderr"	{
  command = "/home/lei/.local/share/nvim/mason/packages/cpptools/extension/debugAdapters/bin/OpenDebugAD7",
  id = "cppdbg",
  setupCommands = { {
      description = "enable pretty printing",
      ignoreFailures = false,
      text = "-enable-pretty-printing"
    } },
  type = "executable"
}	"waiting for v8 protocol on stdin/stdout\n"

tristone13th avatar Sep 10 '22 15:09 tristone13th

Thanks unfortunately I can't see the issue, it looks healthy

Could you pull the latest master, reproduce the error and run :lua require("dapui")._dump_state() and paste the contents of the created buffer here?

rcarriga avatar Sep 11 '22 10:09 rcarriga

lua require("dapui")._dump_state()

Thanks for your instant update.

Maybe it cannot reflect the state right when the error occurs because I have to close the error message, then the dapui will be normal, then I run the Lua function to get the following state.

{
  _current_frame = <1>{
    column = 1,
    id = 1000,
    instructionPointerReference = "0x000055555582163a",
    line = 47,
    name = "main(int argc, char ** argv)",
    scopes = { <2>{
        expensive = false,
        name = "Locals",
        presentationHint = "locals",
        variables = {
          argc = {
            evaluateName = "argc",
            memoryReference = "0x000000000000000d",
            name = "argc",
            type = "int",
            value = "13",
            variablesReference = 0
          },
          argv = {
            evaluateName = "argv",
            memoryReference = "0x00007fffffffe508",
            name = "argv",
            type = "char **",
            value = "0x7fffffffe508",
            variablesReference = 1002
          }
        },
        variablesReference = 1000
      }, <3>{
        expensive = true,
        name = "Registers",
        presentationHint = "registers",
        variablesReference = 1001
      } },
    source = {
      checksums = {},
      name = "main.c",
      path = "/home/lei/p/qemu/softmmu/main.c",
      sources = {}
    }
  },
  _disabled_breakpoints = {},
  _frames = {
    [2287324] = <4>{ <table 1> },
    [2287421] = { {
        column = 1,
        id = 1002,
        instructionPointerReference = "0x00007ffff789f868",
        line = 78,
        moduleId = 13,
        name = "libc.so.6!__GI___clock_nanosleep(clockid_t clock_id, int flags, const struct timespec * req, struct timespec * rem)",
        source = {
          checksums = {},
          name = "clock_nanosleep.c",
          path = "./time/../sysdeps/unix/sysv/linux/clock_nanosleep.c",
          presentationHint = "deemphasize",
          sources = {}
        }
      }, {
        column = 1,
        id = 1003,
        instructionPointerReference = "0x00007ffff78a46e7",
        line = 25,
        moduleId = 13,
        name = "libc.so.6!__GI___nanosleep(const struct timespec * req, struct timespec * rem)",
        source = {
          checksums = {},
          name = "nanosleep.c",
          path = "./posix/../sysdeps/unix/sysv/linux/nanosleep.c",
          presentationHint = "deemphasize",
          sources = {}
        }
      }, {
        column = 0,
        id = 1004,
        instructionPointerReference = "0x00007ffff7bdff67",
        line = 0,
        moduleId = 7,
        name = "libglib-2.0.so.0!g_usleep"
      }, {
        column = 1,
        id = 1005,
        instructionPointerReference = "0x0000555555f28656",
        line = 253,
        name = "call_rcu_thread(void * opaque)",
        source = {
          checksums = {},
          name = "rcu.c",
          path = "/home/lei/p/qemu/util/rcu.c",
          sources = {}
        }
      }, {
        column = 1,
        id = 1006,
        instructionPointerReference = "0x0000555555f1d51c",
        line = 504,
        name = "qemu_thread_start(void * args)",
        source = {
          checksums = {},
          name = "qemu-thread-posix.c",
          path = "/home/lei/p/qemu/util/qemu-thread-posix.c",
          sources = {}
        }
      }, {
        column = 1,
        id = 1007,
        instructionPointerReference = "0x00007ffff784eb43",
        line = 442,
        moduleId = 13,
        name = "libc.so.6!start_thread(void * arg)",
        source = {
          checksums = {},
          name = "pthread_create.c",
          path = "./nptl/./nptl/pthread_create.c",
          presentationHint = "deemphasize",
          sources = {}
        }
      }, {
        column = 1,
        id = 1008,
        instructionPointerReference = "0x00007ffff78e0a00",
        line = 81,
        moduleId = 13,
        name = "libc.so.6!clone3()",
        source = {
          checksums = {},
          name = "clone3.S",
          path = "./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S",
          presentationHint = "deemphasize",
          sources = {}
        }
      } }
  },
  _listener_id = "dapui_state",
  _listeners = {
    clear = { <function 1> },
    refresh = { <function 2> }
  },
  _monitored_vars = {},
  _scopes = { <table 2>, <table 3> },
  _step_number = 1,
  _stopped_thread_id = 2287324,
  _threads = {
    [2287324] = {
      frames = <table 4>,
      id = 2287324,
      name = "qemu-system-x86 [2287324]",
      stopped = true
    },
    [2287421] = {
      id = 2287421,
      name = "qemu-system-x86 [2287421]",
      stopped = true
    }
  },
  _variables = {
    [1000] = { {
        evaluateName = "argc",
        memoryReference = "0x000000000000000d",
        name = "argc",
        type = "int",
        value = "13",
        variablesReference = 0
      }, {
        evaluateName = "argv",
        memoryReference = "0x00007fffffffe508",
        name = "argv",
        type = "char **",
        value = "0x7fffffffe508",
        variablesReference = 1003
      } },
    [1001] = { {
        name = "CPU",
        presentationHint = {
          attributes = { "readOnly" }
        },
        value = "",
        variablesReference = 1004
      }, {
        name = "Segs",
        presentationHint = {
          attributes = { "readOnly" }
        },
        value = "",
        variablesReference = 1005
      }, {
        name = "FPU",
        presentationHint = {
          attributes = { "readOnly" }
        },
        value = "",
        variablesReference = 1006
      }, {
        name = "SSE",
        presentationHint = {
          attributes = { "readOnly" }
        },
        value = "",
        variablesReference = 1007
      }, {
        name = "AVX",
        presentationHint = {
          attributes = { "readOnly" }
        },
        value = "",
        variablesReference = 1008
      }, {
        name = "Other Registers",
        presentationHint = {
          attributes = { "readOnly" }
        },
        value = "",
        variablesReference = 1009
      }, {
        name = "MMX",
        presentationHint = {
          attributes = { "readOnly" }
        },
        value = "",
        variablesReference = 1010
      }, {
        name = "AMD3DNow",
        presentationHint = {
          attributes = { "readOnly" }
        },
        value = "",
        variablesReference = 1011
      } }
  },
  _watches = {},
  <metatable> = <5>{
    __index = <table 5>,
    _add_listener = <function 3>,
    _clear = <function 4>,
    _emit_refreshed = <function 5>,
    _refresh_scopes = <function 6>,
    _refresh_watches = <function 7>,
    add_watch = <function 8>,
    attach = <function 9>,
    breakpoints = <function 10>,
    buffer_breakpoints = <function 11>,
    current_frame = <function 12>,
    frames = <function 13>,
    is_monitored = <function 14>,
    monitor = <function 15>,
    new = <function 16>,
    on_clear = <function 17>,
    on_refresh = <function 18>,
    remove_watch = <function 19>,
    scopes = <function 20>,
    set_variable = <function 21>,
    step_number = <function 22>,
    stop_monitor = <function 23>,
    stopped_thread = <function 24>,
    threads = <function 25>,
    toggle_breakpoint = <function 26>,
    variables = <function 27>,
    watch = <function 28>,
    watches = <function 29>
  }
}

tristone13th avatar Sep 11 '22 13:09 tristone13th

That looks fine as well. Unfortunately I can't do much without being able to reproduce so if you can provide a sample file to reproduce I should be able to figure it out. You can also try adding some prints in the area that's throwing the error to try spot what's going on.

rcarriga avatar Sep 12 '22 06:09 rcarriga

That looks fine as well. Unfortunately I can't do much without being able to reproduce so if you can provide a sample file to reproduce I should be able to figure it out. You can also try adding some prints in the area that's throwing the error to try spot what's going on.

OK, will try to capture the log when throwing the error. Another point that needs to be mentioned is that this is not 100% reproducible, sometimes it works fine, I think the possibility may be 50%-50%.

tristone13th avatar Sep 12 '22 08:09 tristone13th

Hello @rcarriga, first of thank you for creating this plugin, it looks really nice :)

Second, I am experiencing the same issue as @tristone13th .

I get the above error when starting the dap, however things seem to work afterwards. I am using cpptools for my debug adapter, the configs for nvim-dap and nvim-dap-ui are below, I just copy pasted the recommended defaults from the documentation:

Can you tell where to locate the log file? I added the require('dap').set_log_level('DEBUG') line to my config, but I have no idea where is it placed.

local dap = require("dap")
local dapui = require("dapui")

dap.adapters.cppdbg = {
	id = "cppdbg",
	type = "executable",
	command = "/home/skobec/Programs/cpptools/extension/debugAdapters/bin/OpenDebugAD7",
}

dap.configurations.cpp = {
	{
		name = "Launch file",
		type = "cppdbg",
		request = "launch",
		program = function()
			return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
		end,
		cwd = "${workspaceFolder}",
		stopAtEntry = true,
	},
	{
		name = "Attach to gdbserver :1234",
		type = "cppdbg",
		request = "launch",
		MIMode = "gdb",
		miDebuggerServerAddress = "localhost:1234",
		miDebuggerPath = "/usr/bin/gdb",
		cwd = "${workspaceFolder}",
		program = function()
			return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
		end,
	},
}
dap.configurations.c = dap.configurations.cpp

dapui.setup({
	icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" },
	mappings = {
		-- Use a table to apply multiple mappings
		expand = { "<CR>", "<2-LeftMouse>" },
		open = "o",
		remove = "d",
		edit = "e",
		repl = "r",
		toggle = "t",
	},
	-- Expand lines larger than the window
	-- Requires >= 0.7
	expand_lines = vim.fn.has("nvim-0.7") == 1,
	-- Layouts define sections of the screen to place windows.
	-- The position can be "left", "right", "top" or "bottom".
	-- The size specifies the height/width depending on position. It can be an Int
	-- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while
	-- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns)
	-- Elements are the elements shown in the layout (in order).
	-- Layouts are opened in order so that earlier layouts take priority in window sizing.
	layouts = {
		{
			elements = {
				-- Elements can be strings or table with id and size keys.
				{ id = "scopes", size = 0.25 },
				"breakpoints",
				"stacks",
				"watches",
			},
			size = 40, -- 40 columns
			position = "left",
		},
		{
			elements = {
				"repl",
				"console",
			},
			size = 0.25, -- 25% of total lines
			position = "bottom",
		},
	},
	controls = {
		-- Requires Neovim nightly (or 0.8 when released)
		enabled = true,
		-- Display controls in this element
		element = "repl",
		icons = {
			pause = "",
			play = "",
			step_into = "",
			step_over = "",
			step_out = "",
			step_back = "",
			run_last = "↻",
			terminate = "□",
		},
	},
	floating = {
		max_height = nil, -- These can be integers or a float between 0 and 1.
		max_width = nil, -- Floats will be treated as percentage of your screen.
		border = "single", -- Border style. Can be "single", "double" or "rounded"
		mappings = {
			close = { "q", "<Esc>" },
		},
	},
	windows = { indent = 1 },
	render = {
		max_type_length = nil, -- Can be integer or nil.
		max_value_lines = 100, -- Can be integer or nil.
	},
})

-- require("dap").set_log_level("DEBUG")

dap.listeners.after.event_initialized["dapui_config"] = function()
	dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
	dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
	dapui.close()
end

MarkoSagadin avatar Oct 12 '22 18:10 MarkoSagadin

Thanks for the info. The log file can be found in the directory that is printed by :lua= vim.fn.stdpath("cache"). Can you also provide a sample file to reproduce with? I don't use C++ so don't have any repos to test.

Can you also provide the stack trace you're seeing? The file has changed since the original report and so I'd like to pinpoint where is it going wrong exactly

rcarriga avatar Oct 13 '22 08:10 rcarriga

em.. I also meet this error on cpp debug(cpptools), but when I retry debug, it work well. I didn't chang anything .This problem seems to be difficult to reproduce

jinzhongjia avatar Oct 17 '22 04:10 jinzhongjia

the dap.log and the debug sample is this:

#include <iostream>
using namespace std;
int main() {
  int a = 1;
  int b = 2;
  int c = a + b; // set a breakpoint here
  cout << c << endl;
  return 0;
}

my dap config

local dap = require("dap")
local dapui = require("dapui")
require("nvim-dap-virtual-text").setup({
	commented = true,
})

-- Define various icons

vim.fn.sign_define("DapBreakpoint", {
	text = "◉",
	texthl = "LspDiagnosticsSignError",
	linehl = "",
	numhl = "",
})

vim.fn.sign_define("DapStopped", {
	text = "",
	texthl = "LspDiagnosticsSignInformation",
	linehl = "DiagnosticUnderlineInfo",
	numhl = "LspDiagnosticsSignInformation",
})

vim.fn.sign_define("DapBreakpointRejected", {
	text = "",
	texthl = "LspDiagnosticsSignHint",
	linehl = "",
	numhl = "",
})

dapui.setup({
	icons = { expanded = "▾", collapsed = "▸" },
	mappings = {
		-- Use a table to apply multiple mappings
		expand = { "o", "<CR>", "<2-LeftMouse>" },
		open = "o",
		remove = "d",
		edit = "e",
		repl = "r",
		toggle = "t",
	},
	layouts = {
		{
			elements = {
				"scopes",
				"breakpoints",
				"stacks",
				"watches",
			},
			size = 40,
			position = "left",
		},
		{
			elements = {
				"repl",
				"console",
			},
			size = 10,
			position = "bottom",
		},
	},

	floating = {
		max_height = nil, -- These can be integers or a float between 0 and 1.
		max_width = nil, -- Floats will be treated as percentage of your screen.
		border = "single", -- Border style. Can be "single", "double" or "rounded"
		mappings = {
			close = { "q", "<Esc>" },
		},
	},
	windows = { indent = 1 },
	render = {
		max_type_length = nil, -- Can be integer or nil.
	},
}) -- use default
dap.listeners.after.event_initialized["dapui_config"] = function()
	dapui.open({})
end
dap.listeners.before.event_terminated["dapui_config"] = function()
	dapui.close({})
end
dap.listeners.before.event_exited["dapui_config"] = function()
	dapui.close({})
end

-- Bind nvim-dap shortcuts
require("keybindings").mapDAP()

and my cpptools config

	dap.adapters.cppdbg = {
		id = "cppdbg",
		type = "executable",
		command = dap_util.mason_module_dir .. "/bin/OpenDebugAD7",
	}
	dap.configurations.cpp = {
		{
			name = "Launch file",
			type = "cppdbg",
			request = "launch",
			program = function()
				return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
			end,
			cwd = "${workspaceFolder}",
			stopAtEntry = true,
		},
		{
			name = "Attach to gdbserver :1234",
			type = "cppdbg",
			request = "launch",
			MIMode = "gdb",
			miDebuggerServerAddress = "localhost:1234",
			-- miDebuggerPath = "/usr/bin/gdb",
			cwd = "${workspaceFolder}",
			program = function()
				return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
			end,
		},
	}

jinzhongjia avatar Oct 17 '22 05:10 jinzhongjia

the dap.logdap.log and the debug sample is this:和调试样本是这样的。

#include <iostream>
using namespace std;
int main() {
  int a = 1;
  int b = 2;
  int c = a + b; // set a breakpoint here
  cout << c << endl;
  return 0;
}

my dap config我的dap配置

local dap = require("dap")
local dapui = require("dapui")
require("nvim-dap-virtual-text").setup({
	commented = true,
})

-- Define various icons

vim.fn.sign_define("DapBreakpoint", {
	text = "◉",
	texthl = "LspDiagnosticsSignError",
	linehl = "",
	numhl = "",
})

vim.fn.sign_define("DapStopped", {
	text = "",
	texthl = "LspDiagnosticsSignInformation",
	linehl = "DiagnosticUnderlineInfo",
	numhl = "LspDiagnosticsSignInformation",
})

vim.fn.sign_define("DapBreakpointRejected", {
	text = "",
	texthl = "LspDiagnosticsSignHint",
	linehl = "",
	numhl = "",
})

dapui.setup({
	icons = { expanded = "▾", collapsed = "▸" },
	mappings = {
		-- Use a table to apply multiple mappings
		expand = { "o", "<CR>", "<2-LeftMouse>" },
		open = "o",
		remove = "d",
		edit = "e",
		repl = "r",
		toggle = "t",
	},
	layouts = {
		{
			elements = {
				"scopes",
				"breakpoints",
				"stacks",
				"watches",
			},
			size = 40,
			position = "left",
		},
		{
			elements = {
				"repl",
				"console",
			},
			size = 10,
			position = "bottom",
		},
	},

	floating = {
		max_height = nil, -- These can be integers or a float between 0 and 1.
		max_width = nil, -- Floats will be treated as percentage of your screen.
		border = "single", -- Border style. Can be "single", "double" or "rounded"
		mappings = {
			close = { "q", "<Esc>" },
		},
	},
	windows = { indent = 1 },
	render = {
		max_type_length = nil, -- Can be integer or nil.
	},
}) -- use default
dap.listeners.after.event_initialized["dapui_config"] = function()
	dapui.open({})
end
dap.listeners.before.event_terminated["dapui_config"] = function()
	dapui.close({})
end
dap.listeners.before.event_exited["dapui_config"] = function()
	dapui.close({})
end

-- Bind nvim-dap shortcuts
require("keybindings").mapDAP()

and my cpptools config和我的cpptools配置

	dap.adapters.cppdbg = {
		id = "cppdbg",
		type = "executable",
		command = dap_util.mason_module_dir .. "/bin/OpenDebugAD7",
	}
	dap.configurations.cpp = {
		{
			name = "Launch file",
			type = "cppdbg",
			request = "launch",
			program = function()
				return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
			end,
			cwd = "${workspaceFolder}",
			stopAtEntry = true,
		},
		{
			name = "Attach to gdbserver :1234",
			type = "cppdbg",
			request = "launch",
			MIMode = "gdb",
			miDebuggerServerAddress = "localhost:1234",
			-- miDebuggerPath = "/usr/bin/gdb",
			cwd = "${workspaceFolder}",
			program = function()
				return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
			end,
		},
	}

@rcarriga

in golang python nodejs, dap-ui work well,only in cpp

jinzhongjia avatar Oct 17 '22 05:10 jinzhongjia

@rcarriga So I am experiencing the same behaviour as @jinzhongjia.

If i use require('dap').set_log_level('DEBUG') I get no error at the time when dap-ui appears.

The error happens with a trivial C file, compile it with gcc -g3 -O0 hello_world.c -o hello_world.elf:

#include <stdio.h>

int main()
{
    printf("Hello, World!");
    return 0;
}

I also played with the lua config, below is more minimal setup, however it should be identical to the one I posted above, as I just default values for dap-ui.setup

local dap = require("dap")
local dapui = require("dapui")

dap.adapters.cppdbg = {
	id = "cppdbg",
	type = "executable",
	command = "/home/skobec/Programs/cpptools/extension/debugAdapters/bin/OpenDebugAD7",
}

dap.configurations.cpp = {
	{
		name = "Launch file",
		type = "cppdbg",
		request = "launch",
		program = function()
			return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
		end,
		cwd = "${workspaceFolder}",
		stopAtEntry = true,
	},
	{
		name = "Attach to gdbserver :1234",
		type = "cppdbg",
		request = "launch",
		MIMode = "gdb",
		miDebuggerServerAddress = "localhost:1234",
		miDebuggerPath = "/usr/bin/gdb",
		cwd = "${workspaceFolder}",
		program = function()
			return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
		end,
	},
}
dap.configurations.c = dap.configurations.cpp

dapui.setup()

-- require("dap").set_log_level("DEBUG")

dap.listeners.after.event_initialized["dapui_config"] = function()
	dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
	dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
	dapui.close()
end

MarkoSagadin avatar Oct 17 '22 18:10 MarkoSagadin

@rcarriga I managed to log the issue. I had to run the debugger several times to get it. Below is the log from the run that experienced the error, I hope that it will be usefull:

log dump

[ DEBUG ] 2022-10-17T20:56:35Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1114 ]	"Spawning debug adapter"	{
  command = "/home/skobec/Programs/cpptools/extension/debugAdapters/bin/OpenDebugAD7",
  id = "cppdbg",
  type = "executable"
}
[ DEBUG ] 2022-10-17T20:56:35Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1357 ]	"request"	{
  arguments = {
    adapterID = "cppdbg",
    clientId = "neovim",
    clientname = "neovim",
    columnsStartAt1 = true,
    linesStartAt1 = true,
    locale = "en_US.UTF-8",
    pathFormat = "path",
    supportsRunInTerminalRequest = true,
    supportsVariableType = true
  },
  command = "initialize",
  seq = 0,
  type = "request"
}
[ ERROR ] 2022-10-17T20:56:35Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1170 ]	"stderr"	{
  command = "/home/skobec/Programs/cpptools/extension/debugAdapters/bin/OpenDebugAD7",
  id = "cppdbg",
  type = "executable"
}	"waiting for v8 protocol on stdin/stdout\n"
[ DEBUG ] 2022-10-17T20:56:35Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    completionTriggerCharacters = {},
    exceptionBreakpointFilters = { {
        conditionDescription = "std::out_of_range,std::invalid_argument",
        default = false,
        filter = "all",
        label = "All C++ Exceptions",
        supportsCondition = true
      } },
    supportedChecksumAlgorithms = {},
    supportsClipboardContext = true,
    supportsCompletionsRequest = true,
    supportsConditionalBreakpoints = true,
    supportsConfigurationDoneRequest = true,
    supportsDataBreakpoints = true,
    supportsDisassembleRequest = true,
    supportsEvaluateForHovers = true,
    supportsExceptionFilterOptions = true,
    supportsFunctionBreakpoints = true,
    supportsGotoTargetsRequest = true,
    supportsInstructionBreakpoints = true,
    supportsLogPoints = true,
    supportsModulesRequest = true,
    supportsReadMemoryRequest = true,
    supportsSetExpression = true,
    supportsSetVariable = true,
    supportsSteppingGranularity = true,
    supportsValueFormattingOptions = true
  },
  command = "initialize",
  request_seq = 0,
  seq = 1,
  success = true,
  type = "response"
}
[ DEBUG ] 2022-10-17T20:56:35Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1357 ]	"request"	{
  arguments = {
    cwd = "/home/skobec/Work/computer_systems/code/02-03-bits-ints",
    name = "Launch file",
    program = "/home/skobec/Work/computer_systems/code/02-03-bits-ints/hello-world.elf",
    request = "launch",
    stopAtEntry = true,
    type = "cppdbg"
  },
  command = "launch",
  seq = 1,
  type = "request"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  arguments = {
    args = { "/bin/sh", "/tmp/Microsoft-MIEngine-Cmd-gp04mxjo.1sz" },
    cwd = "",
    env = vim.empty_dict(),
    kind = "integrated",
    title = "cppdbg: hello-world.elf"
  },
  command = "runInTerminal",
  seq = 2,
  type = "request"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:224 ]	"run_in_terminal"	{
  args = { "/bin/sh", "/tmp/Microsoft-MIEngine-Cmd-gp04mxjo.1sz" },
  cwd = "",
  env = vim.empty_dict(),
  kind = "integrated",
  title = "cppdbg: hello-world.elf"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1389 ]	"response"	{
  body = {
    processId = 515438
  },
  command = "runInTerminal",
  request_seq = 2,
  seq = 2,
  success = true,
  type = "response"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "telemetry",
    data = {
      ["VS.Diagnostics.Debugger.AdapterId"] = "cppdbg",
      ["VS.Diagnostics.Debugger.EngineVersion"] = "17.4.20910.1",
      ["VS.Diagnostics.Debugger.FrameworkVersion"] = "6.0.822.36306",
      ["VS.Diagnostics.Debugger.HostVersion"] = "17.4.20910.1",
      ["VS.Diagnostics.Debugger.ImplementationName"] = "Microsoft.MIDebugEngine",
      ["VS.Diagnostics.Debugger.Launch.Duration"] = 323
    },
    output = "VS/Diagnostics/Debugger/Launch"
  },
  event = "output",
  seq = 3,
  type = "event"
}
[ INFO ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:639 ]	"Telemetry"	"VS/Diagnostics/Debugger/Launch"
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = vim.empty_dict(),
  command = "launch",
  request_seq = 1,
  seq = 4,
  success = true,
  type = "response"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = vim.empty_dict(),
  event = "initialized",
  seq = 5,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1357 ]	"request"	{
  arguments = {
    filters = {}
  },
  command = "setExceptionBreakpoints",
  seq = 3,
  type = "request"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    breakpoints = {}
  },
  command = "setExceptionBreakpoints",
  request_seq = 3,
  seq = 6,
  success = true,
  type = "response"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1357 ]	"request"	{
  command = "configurationDone",
  seq = 4,
  type = "request"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "stdout",
    output = '=thread-group-added,id="i1"\nGNU gdb (GDB) 12.1\nCopyright (C) 2022 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\nType "show copying" and "show warranty" for details.\nThis GDB was configured as "x86_64-pc-linux-gnu".\nType "show configuration" for configuration details.\nFor bug reporting instructions, please see:\n<https://www.gnu.org/software/gdb/bugs/>.\nFind the GDB manual and other documentation resources online at:\n    <http://www.gnu.org/software/gdb/documentation/>.\n\nFor help, type "help".\nType "apropos word" to search for commands related to "word".\n=cmd-param-changed,param="auto-load safe-path",value="/"\nWarning: Debuggee TargetArchitecture not detected, assuming x86_64.\n=cmd-param-changed,param="pagination",value="off"\n'
  },
  event = "output",
  seq = 8,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = vim.empty_dict(),
  command = "configurationDone",
  request_seq = 4,
  seq = 7,
  success = true,
  type = "response"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    name = "/home/skobec/Work/computer_systems/code/02-03-bits-ints/hello-world.elf",
    pointerSize = 64,
    startMethod = "launch",
    systemProcessId = 515485
  },
  event = "process",
  seq = 9,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    reason = "started",
    threadId = 515485
  },
  event = "thread",
  seq = 10,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "stdout",
    output = "Stopped due to shared library event (no libraries added or removed)\n"
  },
  event = "output",
  seq = 11,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "console",
    output = "Loaded '/lib64/ld-linux-x86-64.so.2'. Symbols loaded.\n"
  },
  event = "output",
  seq = 12,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    module = {
      id = 1,
      name = "ld-linux-x86-64.so.2",
      path = "/lib64/ld-linux-x86-64.so.2",
      symbolFilePath = "/lib64/ld-linux-x86-64.so.2",
      vsIs64Bit = true,
      vsLoadAddress = "140737353920512",
      vsLoadOrder = 0,
      vsModuleSize = 155525,
      vsPreferredLoadAddress = "140737353920512",
      vsTimestampUTC = "1665152278"
    },
    reason = "new"
  },
  event = "module",
  seq = 13,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "stdout",
    output = "[Thread debugging using libthread_db enabled]\n"
  },
  event = "output",
  seq = 14,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "stdout",
    output = 'Using host libthread_db library "/usr/lib/libthread_db.so.1".\n'
  },
  event = "output",
  seq = 15,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "stdout",
    output = "\n"
  },
  event = "output",
  seq = 16,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "stdout",
    output = "Breakpoint 1, main () at hello-world.c:5\n"
  },
  event = "output",
  seq = 17,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "stdout",
    output = '5\t    printf("Hello, World!");\n'
  },
  event = "output",
  seq = 18,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "console",
    output = "Loaded '/usr/lib/libc.so.6'. Symbols loaded.\n"
  },
  event = "output",
  seq = 19,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    module = {
      id = 2,
      name = "libc.so.6",
      path = "/usr/lib/libc.so.6",
      symbolFilePath = "/usr/lib/libc.so.6",
      vsIs64Bit = true,
      vsLoadAddress = "140737351853120",
      vsLoadOrder = 1,
      vsModuleSize = 1412381,
      vsPreferredLoadAddress = "140737351853120",
      vsTimestampUTC = "1665152278"
    },
    reason = "new"
  },
  event = "module",
  seq = 20,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "console",
    output = 'Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)\n'
  },
  event = "output",
  seq = 21,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    allThreadsStopped = true,
    column = 1,
    line = 5,
    reason = "step",
    source = {
      checksums = {},
      name = "hello-world.c",
      path = "/home/skobec/Work/computer_systems/code/02-03-bits-ints/hello-world.c",
      sources = {}
    },
    threadId = 515485
  },
  event = "stopped",
  seq = 22,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1357 ]	"request"	{
  command = "threads",
  seq = 5,
  type = "request"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    threads = { {
        id = 515485,
        name = "hello-world.elf [515485]"
      } }
  },
  command = "threads",
  request_seq = 5,
  seq = 23,
  success = true,
  type = "response"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1357 ]	"request"	{
  arguments = {
    threadId = 515485
  },
  command = "stackTrace",
  seq = 6,
  type = "request"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1357 ]	"request"	{
  arguments = {
    threadId = 515485
  },
  command = "stackTrace",
  seq = 7,
  type = "request"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    stackFrames = { {
        column = 1,
        id = 1001,
        instructionPointerReference = "0x000055555555513d",
        line = 5,
        name = "main()",
        source = {
          checksums = {},
          name = "hello-world.c",
          path = "/home/skobec/Work/computer_systems/code/02-03-bits-ints/hello-world.c",
          sources = {}
        }
      } },
    totalFrames = 1
  },
  command = "stackTrace",
  request_seq = 7,
  seq = 25,
  success = true,
  type = "response"
}
[ DEBUG ] 2022-10-17T20:56:36Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    stackFrames = { {
        column = 1,
        id = 1000,
        instructionPointerReference = "0x000055555555513d",
        line = 5,
        name = "main()",
        source = {
          checksums = {},
          name = "hello-world.c",
          path = "/home/skobec/Work/computer_systems/code/02-03-bits-ints/hello-world.c",
          sources = {}
        }
      } },
    totalFrames = 1
  },
  command = "stackTrace",
  request_seq = 6,
  seq = 24,
  success = true,
  type = "response"
}
[ DEBUG ] 2022-10-17T20:56:42Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1357 ]	"request"	{
  arguments = {
    frameId = 1000
  },
  command = "scopes",
  seq = 8,
  type = "request"
}
[ DEBUG ] 2022-10-17T20:56:42Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    scopes = { {
        expensive = false,
        name = "Locals",
        presentationHint = "locals",
        variablesReference = 1000
      }, {
        expensive = true,
        name = "Registers",
        presentationHint = "registers",
        variablesReference = 1001
      } }
  },
  command = "scopes",
  request_seq = 8,
  seq = 26,
  success = true,
  type = "response"
}
[ DEBUG ] 2022-10-17T20:56:42Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1357 ]	"request"	{
  arguments = {
    variablesReference = 1000
  },
  command = "variables",
  seq = 9,
  type = "request"
}
[ DEBUG ] 2022-10-17T20:56:42Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1357 ]	"request"	{
  arguments = {
    variablesReference = 1000
  },
  command = "variables",
  seq = 10,
  type = "request"
}
[ DEBUG ] 2022-10-17T20:56:42Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1357 ]	"request"	{
  arguments = {
    variablesReference = 1001
  },
  command = "variables",
  seq = 11,
  type = "request"
}
[ DEBUG ] 2022-10-17T20:56:43Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    variables = {}
  },
  command = "variables",
  request_seq = 9,
  seq = 27,
  success = true,
  type = "response"
}
[ DEBUG ] 2022-10-17T20:56:43Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    variables = {}
  },
  command = "variables",
  request_seq = 10,
  seq = 28,
  success = true,
  type = "response"
}
[ DEBUG ] 2022-10-17T20:56:43Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    variables = { {
        name = "CPU",
        presentationHint = {
          attributes = { "readOnly" }
        },
        value = "",
        variablesReference = 1002
      }, {
        name = "Segs",
        presentationHint = {
          attributes = { "readOnly" }
        },
        value = "",
        variablesReference = 1003
      }, {
        name = "FPU",
        presentationHint = {
          attributes = { "readOnly" }
        },
        value = "",
        variablesReference = 1004
      }, {
        name = "SSE",
        presentationHint = {
          attributes = { "readOnly" }
        },
        value = "",
        variablesReference = 1005
      }, {
        name = "AVX",
        presentationHint = {
          attributes = { "readOnly" }
        },
        value = "",
        variablesReference = 1006
      }, {
        name = "Other Registers",
        presentationHint = {
          attributes = { "readOnly" }
        },
        value = "",
        variablesReference = 1007
      } }
  },
  command = "variables",
  request_seq = 11,
  seq = 29,
  success = true,
  type = "response"
}
[ DEBUG ] 2022-10-17T20:56:48Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1357 ]	"request"	{
  arguments = {
    restart = false,
    terminateDebuggee = true
  },
  command = "disconnect",
  seq = 12,
  type = "request"
}
[ DEBUG ] 2022-10-17T20:56:48Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "stdout",
    output = "Kill the program being debugged? (y or n) [answered Y; input not from terminal]\n"
  },
  event = "output",
  seq = 30,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:48Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "stdout",
    output = "[Inferior 1 (process 515485) killed]\n"
  },
  event = "output",
  seq = 31,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:48Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "console",
    output = "The program '/home/skobec/Work/computer_systems/code/02-03-bits-ints/hello-world.elf' has exited with code 0 (0x00000000).\r\n\n"
  },
  event = "output",
  seq = 32,
  type = "event"
}
[ DEBUG ] 2022-10-17T20:56:48Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = {
    category = "telemetry",
    data = {
      ["VS.Diagnostics.Debugger.AdapterId"] = "cppdbg",
      ["VS.Diagnostics.Debugger.DebugCompleted.BreakCounter"] = 1,
      ["VS.Diagnostics.Debugger.EngineVersion"] = "17.4.20910.1",
      ["VS.Diagnostics.Debugger.HostVersion"] = "17.4.20910.1",
      ["VS.Diagnostics.Debugger.ImplementationName"] = "Microsoft.MIDebugEngine"
    },
    output = "VS/Diagnostics/Debugger/DebugCompleted"
  },
  event = "output",
  seq = 33,
  type = "event"
}
[ INFO ] 2022-10-17T20:56:48Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:639 ]	"Telemetry"	"VS/Diagnostics/Debugger/DebugCompleted"
[ DEBUG ] 2022-10-17T20:56:48Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:844 ]	{
  body = vim.empty_dict(),
  command = "disconnect",
  request_seq = 12,
  seq = 34,
  success = true,
  type = "response"
}
[ INFO ] 2022-10-17T20:56:48Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1471 ]	"Session closed due to disconnect"
[ INFO ] 2022-10-17T20:56:48Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1134 ]	"Closed all handles"
[ INFO ] 2022-10-17T20:56:48Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1137 ]	"Process closed"	515345	false

MarkoSagadin avatar Oct 17 '22 18:10 MarkoSagadin

Thank your the reproductions, I've managed to find the issue and put in a fix. Still not sure on exact cause but the workaround should work fine

rcarriga avatar Oct 20 '22 07:10 rcarriga

thanks, now debug works well

jinzhongjia avatar Oct 22 '22 04:10 jinzhongjia

Thank you for your work @rcarriga!

MarkoSagadin avatar Oct 25 '22 07:10 MarkoSagadin