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

Helix thread 'main" panicked while trying to launch a debug session. #8625

Closed
pierrelgol opened this issue Oct 26, 2023 · 6 comments
Closed
Labels
C-bug Category: This is a bug

Comments

@pierrelgol
Copy link

pierrelgol commented Oct 26, 2023

Summary

this is the error message that I get when I try to launch a debugging session on MacOS Sonoma 14.0 using the latest version of Helix, 23.10, using the latest version of LLDB, having built LLDB-MI, and Having hx --health recognizing everything for C/Cpp dev Helix is truly the best code editor out there, but both the documentation for configuring the debugger, and actually tring to using it is poor at best, I would gladly be willing to help if i could receive some guidance on how the thing work, because so far it's been quite frustrating to try to debug in Helix, I know it's experimental. but I think the debugger could improve widely if we had access on better documentation on how to use it to give good feedback on what is working and what is not working :

Reproduction Steps

I tried this:

  1. hx test.c
  2. (go down to the main function)
  3. press : gl + b
  4. press : gl + l
  5. in the binary path i put : ./main
  6. press enter
  7. crash

I expected this to happen:

launching a debugging session.

Instead, this happened:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /private/tmp/helix-20231025-5763-189nx8o/helix-view/src/handlers/dap.rs:231:57
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Just in case here is the file I was using :

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define TABLE_SIZE 128

enum TokenKind
{
	TOKEN_KEYWORD,
};

typedef struct s_entry
{
	int	data;
	char	*key;
	
}Entry_t;

typedef struct s_table
{
	Entry_t	*table;
	
}Table_t;

Table_t	*table_init(void)
{
	Table_t	*self;

	self = (Table_t *) calloc(1, sizeof(Table_t));
	if (!self)
		return (NULL);
	self->table = (Entry_t *) calloc(TABLE_SIZE + 1, sizeof(Entry_t));
	if (!self->table)
	{
		free(self);
		return (NULL);
	}
	self->table[TABLE_SIZE].data = 0;
	self->table[TABLE_SIZE].key = NULL;
	return (self);
}

int	table_hash(char *key)
{
	unsigned index;

	index = strlen(key);
	index = ((key[index - 1] * key[0]) % TABLE_SIZE);
	return (index);
}

void	table_insert(Table_t *ht, Entry_t *entry)
{
	int hash = table_hash(entry->key);
	if (ht->table[hash].key != NULL)
	{
		while (ht->table[hash].key != NULL && hash < TABLE_SIZE)
			hash++;
	}
	ht->table[hash].key = entry->key;
	ht->table[hash].data = entry->data;
}

int table_lookup(Table_t *ht, char *key)
{
	int index = table_hash((key));
	if (ht->table[index].key == NULL)
	{
		while (index < TABLE_SIZE && ht->table[index].key == NULL)
		{
			index++;
		}
		
	}
	return (ht->table[index].data);
}

void	table_print(Table_t *ht)
{
	int count;

	count = 0;
	for (int i = 0; i < TABLE_SIZE; i++)
	{
		count += ht->table[i].data;
		printf("{%s:%d}\n",ht->table[i].key, ht->table[i].data);
	}
	printf("Key = %d\n",count);
}

int	main(void)
{
	Table_t *table;

	table = table_init();
	if (table)
	{
		table_insert(table, &(Entry_t){.data = 1, .key = "if"});
		table_insert(table, &(Entry_t){.data = 1, .key = "else"});
		table_insert(table, &(Entry_t){.data = 1, .key = "while"});
		table_insert(table, &(Entry_t){.data = 1, .key = "for"});
		table_insert(table, &(Entry_t){.data = 1, .key = "return"});
		table_insert(table, &(Entry_t){.data = 1, .key = "static"});
		table_insert(table, &(Entry_t){.data = 1, .key = "extern"});
		table_insert(table, &(Entry_t){.data = 1, .key = "int"});
		table_insert(table, &(Entry_t){.data = 1, .key = "short"});
		table_insert(table, &(Entry_t){.data = 1, .key = "double"});
		table_insert(table, &(Entry_t){.data = 1, .key = "float"});
		table_insert(table, &(Entry_t){.data = 1, .key = "unsigned"});
		table_insert(table, &(Entry_t){.data = 1, .key = "signed"});
		table_insert(table, &(Entry_t){.data = 1, .key = "void"});
		table_insert(table, &(Entry_t){.data = 1, .key = "long"});
		table_insert(table, &(Entry_t){.data = 1, .key = "sizeof"});
		table_insert(table, &(Entry_t){.data = 1, .key = "const"});
		table_insert(table, &(Entry_t){.data = 1, .key = "volatile"});

		table_print(table);
	}
}

here is the flag used to compile the program :

cc -Wall -Wextra -Werror -ggdb *.c -o main

the version of cc used is :

Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Helix log

~/.cache/helix/helix.log
2023-10-26T16:54:32.517 helix_lsp::transport [ERROR] clangd err <- "I[16:54:32.517] <-- shutdown(1)\n"
2023-10-26T16:54:32.519 helix_lsp::transport [ERROR] clangd err <- "I[16:54:32.517] --> reply:shutdown(1) 0 ms\n"
2023-10-26T16:54:32.519 helix_lsp::transport [ERROR] clangd err <- "I[16:54:32.519] <-- exit\n"
2023-10-26T16:54:32.519 helix_lsp::transport [ERROR] clangd err <- "I[16:54:32.519] LSP finished, exiting with status 0\n"
2023-10-26T16:54:41.492 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.490] Homebrew clangd version 17.0.3\n"
2023-10-26T16:54:41.492 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.492] Features: mac+xpc\n"
2023-10-26T16:54:41.493 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.492] PID: 87929\n"
2023-10-26T16:54:41.493 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.493] Working directory: /Users/plgol.perso/CompilerProject/testground/table\n"
2023-10-26T16:54:41.493 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.493] argv[0]: /opt/homebrew/opt/llvm/bin/clangd\n"
2023-10-26T16:54:41.494 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.494] Starting LSP over stdin/stdout\n"
2023-10-26T16:54:41.496 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.496] <-- initialize(0)\n"
2023-10-26T16:54:41.508 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.508] --> reply:initialize(0) 11 ms\n"
2023-10-26T16:54:41.508 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.508] <-- initialized\n"
2023-10-26T16:54:41.509 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.508] <-- textDocument/didOpen\n"
2023-10-26T16:54:41.514 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.514] Failed to find compilation database for /Users/plgol.perso/CompilerProject/testground/table/test.c\n"
2023-10-26T16:54:41.514 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.514] ASTWorker building file /Users/plgol.perso/CompilerProject/testground/table/test.c version 0 with command clangd fallback\n"
2023-10-26T16:54:41.514 helix_lsp::transport [ERROR] clangd err <- "[/Users/plgol.perso/CompilerProject/testground/table]\n"
2023-10-26T16:54:41.514 helix_lsp::transport [ERROR] clangd err <- "/Library/Developer/CommandLineTools/usr/bin/clang -resource-dir=/opt/homebrew/Cellar/llvm/17.0.3/lib/clang/17 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -- /Users/plgol.perso/CompilerProject/testground/table/test.c\n"
2023-10-26T16:54:41.623 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.623] Built preamble of size 997348 for file /Users/plgol.perso/CompilerProject/testground/table/test.c version 0 in 0.09 seconds\n"
2023-10-26T16:54:41.624 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.624] Indexing c17 standard library in the context of /Users/plgol.perso/CompilerProject/testground/table/test.c\n"
2023-10-26T16:54:41.647 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.647] --> textDocument/publishDiagnostics\n"
2023-10-26T16:54:41.663 helix_lsp::transport [ERROR] clangd err <- "I[16:54:41.663] Indexed c17 standard library: 3580 symbols, 5 filtered\n"
2023-10-26T16:54:45.759 helix_lsp::transport [ERROR] clangd err <- "I[16:54:45.759] <-- textDocument/documentHighlight(1)\n"
2023-10-26T16:54:45.760 helix_lsp::transport [ERROR] clangd err <- "I[16:54:45.760] --> reply:textDocument/documentHighlight(1) 1 ms\n"
2023-10-26T16:54:56.723 helix_view::handlers::dap [WARN] Unhandled event Process(Process { name: "/Users/plgol.perso/CompilerProject/testground/table/main", system_process_id: Some(87940), is_local_process: Some(true), start_method: Some("launch"), pointer_size: None })
2023-10-26T16:54:56.782 helix_dap::transport [ERROR] err: <- StreamClosed
2023-10-26T16:55:14.582 helix_view::handlers::dap [WARN] Unhandled event Process(Process { name: "/Users/plgol.perso/CompilerProject/testground/table/main", system_process_id: Some(87949), is_local_process: Some(true), start_method: Some("launch"), pointer_size: None })
2023-10-26T17:00:23.800 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.797] Homebrew clangd version 17.0.3\n"
2023-10-26T17:00:23.800 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.799] Features: mac+xpc\n"
2023-10-26T17:00:23.800 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.799] PID: 88177\n"
2023-10-26T17:00:23.800 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.800] Working directory: /Users/plgol.perso/CompilerProject/testground/table\n"
2023-10-26T17:00:23.800 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.800] argv[0]: /opt/homebrew/opt/llvm/bin/clangd\n"
2023-10-26T17:00:23.801 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.801] Starting LSP over stdin/stdout\n"
2023-10-26T17:00:23.803 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.803] <-- initialize(0)\n"
2023-10-26T17:00:23.817 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.817] --> reply:initialize(0) 14 ms\n"
2023-10-26T17:00:23.819 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.818] <-- initialized\n"
2023-10-26T17:00:23.819 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.819] <-- textDocument/didOpen\n"
2023-10-26T17:00:23.824 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.824] Failed to find compilation database for /Users/plgol.perso/CompilerProject/testground/table/test.c\n"
2023-10-26T17:00:23.824 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.824] ASTWorker building file /Users/plgol.perso/CompilerProject/testground/table/test.c version 0 with command clangd fallback\n"
2023-10-26T17:00:23.824 helix_lsp::transport [ERROR] clangd err <- "[/Users/plgol.perso/CompilerProject/testground/table]\n"
2023-10-26T17:00:23.824 helix_lsp::transport [ERROR] clangd err <- "/Library/Developer/CommandLineTools/usr/bin/clang -resource-dir=/opt/homebrew/Cellar/llvm/17.0.3/lib/clang/17 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -- /Users/plgol.perso/CompilerProject/testground/table/test.c\n"
2023-10-26T17:00:23.928 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.928] Built preamble of size 997348 for file /Users/plgol.perso/CompilerProject/testground/table/test.c version 0 in 0.08 seconds\n"
2023-10-26T17:00:23.929 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.929] Indexing c17 standard library in the context of /Users/plgol.perso/CompilerProject/testground/table/test.c\n"
2023-10-26T17:00:23.960 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.960] --> textDocument/publishDiagnostics\n"
2023-10-26T17:00:23.970 helix_lsp::transport [ERROR] clangd err <- "I[17:00:23.970] Indexed c17 standard library: 3580 symbols, 5 filtered\n"
2023-10-26T17:00:33.450 helix_view::handlers::dap [WARN] Unhandled event Process(Process { name: "/Users/plgol.perso/CompilerProject/testground/table/main", system_process_id: Some(88185), is_local_process: Some(true), start_method: Some("launch"), pointer_size: None })
2023-10-26T17:01:07.950 helix_view::clipboard [DEBUG] Using pbcopy+pbpaste to interact with the system clipboard
2023-10-26T17:01:07.958 helix_vcs [INFO] Error {
    context: "failed to open git repo",
    source: Discover(
        NoGitRepository {
            path: "/Users/plgol.perso/CompilerProject/testground/table",
        },
    ),
}
2023-10-26T17:01:07.959 helix_vcs [INFO] failed to open diff base for /Users/plgol.perso/CompilerProject/testground/table/test.c
2023-10-26T17:01:07.959 helix_vcs [INFO] Error {
    context: "failed to open git repo",
    source: Discover(
        NoGitRepository {
            path: "/Users/plgol.perso/CompilerProject/testground/table",
        },
    ),
}
2023-10-26T17:01:07.959 helix_vcs [INFO] failed to obtain current head name for /Users/plgol.perso/CompilerProject/testground/table/test.c
2023-10-26T17:01:07.960 helix_view::editor [DEBUG] editor status: Loaded 1 file.
2023-10-26T17:01:07.960 helix_lsp::transport [INFO] clangd -> {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"positionEncodings":["utf-8","utf-32","utf-16"]},"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"disabledSupport":true,"isPreferredSupport":true,"resolveSupport":{"properties":["edit","command"]}},"completion":{"completionItem":{"deprecatedSupport":true,"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{}},"hover":{"contentFormat":["markdown"]},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"versionSupport":true},"rename":{"dynamicRegistration":false,"honorsChangeAnnotations":false,"prepareSupport":true},"signatureHelp":{"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown"],"parameterInformation":{"labelOffsetSupport":true}}}},"window":{"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":false},"executeCommand":{"dynamicRegistration":false},"inlayHint":{"refreshSupport":false},"symbol":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true,"failureHandling":"abort","normalizesLineEndings":false,"resourceOperations":["create","rename","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"helix","version":"23.10 (f6021dd0)"},"processId":88247,"rootPath":"/Users/plgol.perso/CompilerProject/testground/table","rootUri":null,"workspaceFolders":[]},"id":0}
2023-10-26T17:01:07.961 helix_tui::backend::crossterm [DEBUG] The keyboard enhancement protocol is supported in this terminal (checked in 647.834µs)
2023-10-26T17:01:07.962 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:07.965 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:07.977 helix_lsp::transport [ERROR] clangd err <- "I[17:01:07.977] Homebrew clangd version 17.0.3\n"
2023-10-26T17:01:07.977 helix_lsp::transport [ERROR] clangd err <- "I[17:01:07.977] Features: mac+xpc\n"
2023-10-26T17:01:07.977 helix_lsp::transport [ERROR] clangd err <- "I[17:01:07.977] PID: 88248\n"
2023-10-26T17:01:07.977 helix_lsp::transport [ERROR] clangd err <- "I[17:01:07.977] Working directory: /Users/plgol.perso/CompilerProject/testground/table\n"
2023-10-26T17:01:07.977 helix_lsp::transport [ERROR] clangd err <- "I[17:01:07.977] argv[0]: /opt/homebrew/opt/llvm/bin/clangd\n"
2023-10-26T17:01:07.977 helix_lsp::transport [ERROR] clangd err <- "I[17:01:07.977] Starting LSP over stdin/stdout\n"
2023-10-26T17:01:07.977 helix_lsp::transport [ERROR] clangd err <- "I[17:01:07.977] <-- initialize(0)\n"
2023-10-26T17:01:07.985 helix_lsp::transport [ERROR] clangd err <- "I[17:01:07.985] --> reply:initialize(0) 8 ms\n"
2023-10-26T17:01:07.985 helix_lsp::transport [INFO] clangd <- {"id":0,"jsonrpc":"2.0","result":{"capabilities":{"astProvider":true,"callHierarchyProvider":true,"clangdInlayHintsProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor","info"]},"compilationDatabase":{"automaticReload":true},"completionProvider":{"resolveProvider":false,"triggerCharacters":[".","<",">",":","\"","/","*"]},"declarationProvider":true,"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentLinkProvider":{"resolveProvider":false},"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"\n","moreTriggerCharacter":[]},"documentRangeFormattingProvider":true,"documentSymbolProvider":true,"executeCommandProvider":{"commands":["clangd.applyFix","clangd.applyTweak"]},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"inactiveRegionsProvider":true,"inlayHintProvider":true,"memoryUsageProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":["declaration","definition","deprecated","deduced","readonly","static","abstract","virtual","dependentName","defaultLibrary","usedAsMutableReference","usedAsMutablePointer","constructorOrDestructor","userDefined","functionScope","classScope","fileScope","globalScope"],"tokenTypes":["variable","variable","parameter","function","method","function","property","variable","class","interface","enum","enumMember","type","type","unknown","namespace","typeParameter","concept","type","macro","modifier","operator","bracket","label","comment"]},"range":false},"signatureHelpProvider":{"triggerCharacters":["(",")","{","}","<",">",","]},"standardTypeHierarchyProvider":true,"textDocumentSync":{"change":2,"openClose":true,"save":true},"typeDefinitionProvider":true,"typeHierarchyProvider":true,"workspaceSymbolProvider":true},"serverInfo":{"name":"clangd","version":"Homebrew clangd version 17.0.3 mac+xpc arm64-apple-darwin23.0.0"}}}
2023-10-26T17:01:07.985 helix_lsp::transport [INFO] clangd <- {"capabilities":{"astProvider":true,"callHierarchyProvider":true,"clangdInlayHintsProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor","info"]},"compilationDatabase":{"automaticReload":true},"completionProvider":{"resolveProvider":false,"triggerCharacters":[".","<",">",":","\"","/","*"]},"declarationProvider":true,"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentLinkProvider":{"resolveProvider":false},"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"\n","moreTriggerCharacter":[]},"documentRangeFormattingProvider":true,"documentSymbolProvider":true,"executeCommandProvider":{"commands":["clangd.applyFix","clangd.applyTweak"]},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"inactiveRegionsProvider":true,"inlayHintProvider":true,"memoryUsageProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":["declaration","definition","deprecated","deduced","readonly","static","abstract","virtual","dependentName","defaultLibrary","usedAsMutableReference","usedAsMutablePointer","constructorOrDestructor","userDefined","functionScope","classScope","fileScope","globalScope"],"tokenTypes":["variable","variable","parameter","function","method","function","property","variable","class","interface","enum","enumMember","type","type","unknown","namespace","typeParameter","concept","type","macro","modifier","operator","bracket","label","comment"]},"range":false},"signatureHelpProvider":{"triggerCharacters":["(",")","{","}","<",">",","]},"standardTypeHierarchyProvider":true,"textDocumentSync":{"change":2,"openClose":true,"save":true},"typeDefinitionProvider":true,"typeHierarchyProvider":true,"workspaceSymbolProvider":true},"serverInfo":{"name":"clangd","version":"Homebrew clangd version 17.0.3 mac+xpc arm64-apple-darwin23.0.0"}}
2023-10-26T17:01:07.986 helix_lsp::transport [INFO] clangd -> {"jsonrpc":"2.0","method":"initialized","params":{}}
2023-10-26T17:01:07.986 helix_term::application [DEBUG] received editor event: LanguageServerMessage((0, Notification(Notification { jsonrpc: None, method: "initialized", params: None })))
2023-10-26T17:01:07.986 helix_lsp::transport [ERROR] clangd err <- "I[17:01:07.986] <-- initialized\n"
2023-10-26T17:01:07.986 helix_lsp::transport [INFO] clangd -> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"c","text":"#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define TABLE_SIZE 128\n\nenum TokenKind\n{\n\tTOKEN_KEYWORD,\n};\n\ntypedef struct s_entry\n{\n\tint\tdata;\n\tchar\t*key;\n\t\n}Entry_t;\n\ntypedef struct s_table\n{\n\tEntry_t\t*table;\n\t\n}Table_t;\n\nTable_t\t*table_init(void)\n{\n\tTable_t\t*self;\n\n\tself = (Table_t *) calloc(1, sizeof(Table_t));\n\tif (!self)\n\t\treturn (NULL);\n\tself->table = (Entry_t *) calloc(TABLE_SIZE + 1, sizeof(Entry_t));\n\tif (!self->table)\n\t{\n\t\tfree(self);\n\t\treturn (NULL);\n\t}\n\tself->table[TABLE_SIZE].data = 0;\n\tself->table[TABLE_SIZE].key = NULL;\n\treturn (self);\n}\n\nint\ttable_hash(char *key)\n{\n\tunsigned index;\n\n\tindex = strlen(key);\n\tindex = ((key[index - 1] * key[0]) % TABLE_SIZE);\n\treturn (index);\n}\n\nvoid\ttable_insert(Table_t *ht, Entry_t *entry)\n{\n\tint hash = table_hash(entry->key);\n\tif (ht->table[hash].key != NULL)\n\t{\n\t\twhile (ht->table[hash].key != NULL && hash < TABLE_SIZE)\n\t\t\thash++;\n\t}\n\tht->table[hash].key = entry->key;\n\tht->table[hash].data = entry->data;\n}\n\nint table_lookup(Table_t *ht, char *key)\n{\n\tint index = table_hash((key));\n\tif (ht->table[index].key == NULL)\n\t{\n\t\twhile (index < TABLE_SIZE && ht->table[index].key == NULL)\n\t\t{\n\t\t\tindex++;\n\t\t}\n\t\t\n\t}\n\treturn (ht->table[index].data);\n}\n\nvoid\ttable_print(Table_t *ht)\n{\n\tint count;\n\n\tcount = 0;\n\tfor (int i = 0; i < TABLE_SIZE; i++)\n\t{\n\t\tcount += ht->table[i].data;\n\t\tprintf(\"{%s:%d}\\n\",ht->table[i].key, ht->table[i].data);\n\t}\n\tprintf(\"Key = %d\\n\",count);\n}\n\nint\tmain(void)\n{\n\tTable_t *table;\n\n\ttable = table_init();\n\tif (table)\n\t{\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"if\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"else\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"while\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"for\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"return\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"static\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"extern\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"int\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"short\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"double\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"float\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"unsigned\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"signed\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"void\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"long\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"sizeof\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"const\"});\n\t\ttable_insert(table, &(Entry_t){.data = 1, .key = \"volatile\"});\n\n\t\ttable_print(table);\n\t}\n}","uri":"file:///Users/plgol.perso/CompilerProject/testground/table/test.c","version":0}}}
2023-10-26T17:01:07.986 helix_lsp::transport [ERROR] clangd err <- "I[17:01:07.986] <-- textDocument/didOpen\n"
2023-10-26T17:01:07.986 helix_lsp::transport [ERROR] clangd err <- "I[17:01:07.986] Failed to find compilation database for /Users/plgol.perso/CompilerProject/testground/table/test.c\n"
2023-10-26T17:01:07.986 helix_lsp::transport [ERROR] clangd err <- "I[17:01:07.986] ASTWorker building file /Users/plgol.perso/CompilerProject/testground/table/test.c version 0 with command clangd fallback\n"
2023-10-26T17:01:07.986 helix_lsp::transport [ERROR] clangd err <- "[/Users/plgol.perso/CompilerProject/testground/table]\n"
2023-10-26T17:01:07.986 helix_lsp::transport [ERROR] clangd err <- "/Library/Developer/CommandLineTools/usr/bin/clang -resource-dir=/opt/homebrew/Cellar/llvm/17.0.3/lib/clang/17 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -- /Users/plgol.perso/CompilerProject/testground/table/test.c\n"
2023-10-26T17:01:08.006 helix_lsp::transport [ERROR] clangd err <- "I[17:01:08.006] Built preamble of size 997348 for file /Users/plgol.perso/CompilerProject/testground/table/test.c version 0 in 0.02 seconds\n"
2023-10-26T17:01:08.006 helix_lsp::transport [ERROR] clangd err <- "I[17:01:08.006] Indexing c17 standard library in the context of /Users/plgol.perso/CompilerProject/testground/table/test.c\n"
2023-10-26T17:01:08.010 helix_lsp::transport [INFO] clangd <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///Users/plgol.perso/CompilerProject/testground/table/test.c","version":0}}
2023-10-26T17:01:08.010 helix_term::application [DEBUG] received editor event: LanguageServerMessage((0, Notification(Notification { jsonrpc: Some(V2), method: "textDocument/publishDiagnostics", params: Map({"diagnostics": Array [], "uri": String("file:///Users/plgol.perso/CompilerProject/testground/table/test.c"), "version": Number(0)}) })))
2023-10-26T17:01:08.010 helix_lsp::transport [ERROR] clangd err <- "I[17:01:08.010] --> textDocument/publishDiagnostics\n"
2023-10-26T17:01:08.021 helix_term::application [DEBUG] received editor event: Redraw
2023-10-26T17:01:08.021 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:08.027 helix_lsp::transport [ERROR] clangd err <- "I[17:01:08.027] Indexed c17 standard library: 3580 symbols, 5 filtered\n"
2023-10-26T17:01:09.063 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:09.064 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:09.159 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:09.162 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:09.588 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:09.589 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:09.836 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:09.837 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:09.852 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:09.854 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:09.871 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:09.872 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:09.888 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:09.889 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:09.905 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:09.906 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:09.921 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:09.922 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:09.935 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:09.936 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:09.952 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:09.953 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:09.970 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:09.971 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:09.989 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:09.991 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.005 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.007 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.023 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.025 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.041 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.042 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.059 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.060 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.076 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.077 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.087 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.093 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.103 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.105 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.120 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.121 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.136 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.138 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.154 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.155 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.171 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.172 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.185 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.187 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.202 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.203 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.220 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.222 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:10.588 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:10.590 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:11.625 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:11.626 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:12.784 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:12.784 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:14.703 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:14.704 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:15.864 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:15.883 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:15.884 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:17.057 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:17.084 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:17.084 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-26T17:01:18.260 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:18.471 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:18.975 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:19.697 helix_dap::transport [INFO] -> DAP {"type":"request","seq":0,"command":"initialize","arguments":{"adapterID":"lldb-vscode","clientID":"hx","clientName":"helix","columnsStartAt1":true,"linesStartAt1":true,"locale":"en-us","pathFormat":"path","supportsInvalidatedEvent":false,"supportsMemoryReferences":false,"supportsProgressReporting":false,"supportsRunInTerminalRequest":true,"supportsVariablePaging":false,"supportsVariableType":true}}
2023-10-26T17:01:19.796 helix_dap::transport [INFO] <- DAP {"body":{"completionTriggerCharacters":["."," ","\t"],"exceptionBreakpointFilters":[{"default":false,"filter":"cpp_catch","label":"C++ Catch"},{"default":false,"filter":"cpp_throw","label":"C++ Throw"},{"default":false,"filter":"objc_catch","label":"Objective-C Catch"},{"default":false,"filter":"objc_throw","label":"Objective-C Throw"},{"default":false,"filter":"swift_catch","label":"Swift Catch"},{"default":false,"filter":"swift_throw","label":"Swift Throw"}],"supportTerminateDebuggee":true,"supportsCompletionsRequest":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsDelayedStackTraceLoading":true,"supportsEvaluateForHovers":true,"supportsExceptionInfoRequest":true,"supportsExceptionOptions":true,"supportsFunctionBreakpoints":true,"supportsGotoTargetsRequest":false,"supportsHitConditionalBreakpoints":true,"supportsLoadedSourcesRequest":false,"supportsLogPoints":true,"supportsModulesRequest":true,"supportsProgressReporting":true,"supportsRestartFrame":false,"supportsRestartRequest":true,"supportsRunInTerminalRequest":true,"supportsSetVariable":true,"supportsStepBack":false,"supportsStepInTargetsRequest":false,"supportsValueFormattingOptions":true},"command":"initialize","request_seq":0,"seq":0,"success":true,"type":"response"}
2023-10-26T17:01:19.796 helix_dap::transport [INFO] <- DAP success in response to 0
2023-10-26T17:01:19.796 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:19.797 helix_dap::transport [INFO] -> DAP {"type":"request","seq":1,"command":"launch","arguments":{"console":"internalConsole","cwd":"/Users/plgol.perso/CompilerProject/testground/table","program":"/Users/plgol.perso/CompilerProject/testground/table/main"}}
2023-10-26T17:01:20.181 helix_dap::transport [INFO] <- DAP {"command":"launch","request_seq":1,"seq":0,"success":true,"type":"response"}
2023-10-26T17:01:20.181 helix_dap::transport [INFO] <- DAP success in response to 1
2023-10-26T17:01:20.181 helix_dap::transport [INFO] <- DAP {"body":{"isLocalProcess":true,"name":"/Users/plgol.perso/CompilerProject/testground/table/main","startMethod":"launch","systemProcessId":88256},"event":"process","seq":0,"type":"event"}
2023-10-26T17:01:20.181 helix_dap::transport [INFO] <- DAP event Process(Process { name: "/Users/plgol.perso/CompilerProject/testground/table/main", system_process_id: Some(88256), is_local_process: Some(true), start_method: Some("launch"), pointer_size: None })
2023-10-26T17:01:20.181 helix_dap::transport [INFO] <- DAP {"event":"initialized","seq":0,"type":"event"}
2023-10-26T17:01:20.181 helix_dap::transport [INFO] <- DAP event Initialized(None)
2023-10-26T17:01:20.182 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:20.183 helix_term::application [DEBUG] received editor event: DebuggerEvent(Event(Process(Process { name: "/Users/plgol.perso/CompilerProject/testground/table/main", system_process_id: Some(88256), is_local_process: Some(true), start_method: Some("launch"), pointer_size: None })))
2023-10-26T17:01:20.183 helix_view::handlers::dap [WARN] Unhandled event Process(Process { name: "/Users/plgol.perso/CompilerProject/testground/table/main", system_process_id: Some(88256), is_local_process: Some(true), start_method: Some("launch"), pointer_size: None })
2023-10-26T17:01:20.183 helix_term::application [DEBUG] received editor event: DebuggerEvent(Event(Initialized(None)))
2023-10-26T17:01:20.183 helix_dap::transport [INFO] -> DAP {"type":"request","seq":2,"command":"setBreakpoints","arguments":{"breakpoints":[{"line":95}],"source":{"path":"/Users/plgol.perso/CompilerProject/testground/table/test.c"},"sourceModified":false}}
2023-10-26T17:01:20.183 helix_dap::transport [INFO] <- DAP {"body":{"breakpoints":[{"id":1,"line":95,"source":{"name":"test.c","path":"/Users/plgol.perso/CompilerProject/testground/table/test.c"},"verified":false}]},"command":"setBreakpoints","request_seq":2,"seq":0,"success":true,"type":"response"}
2023-10-26T17:01:20.183 helix_dap::transport [INFO] <- DAP success in response to 2
2023-10-26T17:01:20.183 helix_dap::transport [INFO] -> DAP {"type":"request","seq":3,"command":"configurationDone","arguments":null}
2023-10-26T17:01:20.183 helix_dap::transport [INFO] <- DAP {"command":"configurationDone","request_seq":3,"seq":0,"success":true,"type":"response"}
2023-10-26T17:01:20.183 helix_dap::transport [INFO] <- DAP success in response to 3
2023-10-26T17:01:20.183 helix_view::editor [DEBUG] editor status: Debugged application started
2023-10-26T17:01:20.184 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-26T17:01:20.214 helix_dap::transport [INFO] <- DAP {"body":{"breakpoint":{"id":1,"verified":false},"reason":"changed"},"event":"breakpoint","seq":0,"type":"event"}
2023-10-26T17:01:20.214 helix_dap::transport [INFO] <- DAP event Breakpoint(Breakpoint { reason: "changed", breakpoint: Breakpoint { id: Some(1), verified: false, message: None, source: None, line: None, column: None, end_line: None, end_column: None, instruction_reference: None, offset: None } })
2023-10-26T17:01:20.214 helix_term::application [DEBUG] received editor event: DebuggerEvent(Event(Breakpoint(Breakpoint { reason: "changed", breakpoint: Breakpoint { id: Some(1), verified: false, message: None, source: None, line: None, column: None, end_line: None, end_column: None, instruction_reference: None, offset: None } })))
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP {"body":{"category":"stdout","output":"{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{volatile:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{int:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{void:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{short:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n"},"event":"output","seq":0,"type":"event"}
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP event Output(Output { output: "{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{volatile:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{int:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{void:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{short:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n", category: Some("stdout"), group: None, line: None, column: None, variables_reference: None, source: None, data: None })
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP {"body":{"category":"stdout","output":"{(null):0}\r\n{unsigned:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{float:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{sizeof:1}\r\n"},"event":"output","seq":0,"type":"event"}
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP event Output(Output { output: "{(null):0}\r\n{unsigned:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{float:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{sizeof:1}\r\n", category: Some("stdout"), group: None, line: None, column: None, variables_reference: None, source: None, data: None })
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP {"body":{"category":"stdout","output":"{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{if:1}\r\n{(null):0}\r\n{(null):0}\r\n{else:1}\r\n{(null):0}\r\n{(null):0}\r\n{const:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n"},"event":"output","seq":0,"type":"event"}
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP event Output(Output { output: "{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{if:1}\r\n{(null):0}\r\n{(null):0}\r\n{else:1}\r\n{(null):0}\r\n{(null):0}\r\n{const:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n", category: Some("stdout"), group: None, line: None, column: None, variables_reference: None, source: None, data: None })
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP {"body":{"category":"stdout","output":"{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{extern:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n"},"event":"output","seq":0,"type":"event"}
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP event Output(Output { output: "{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{extern:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n", category: Some("stdout"), group: None, line: None, column: None, variables_reference: None, source: None, data: None })
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP {"body":{"category":"stdout","output":"{(null):0}\r\n{(null):0}\r\n{for:1}\r\n{signed:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n"},"event":"output","seq":0,"type":"event"}
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP event Output(Output { output: "{(null):0}\r\n{(null):0}\r\n{for:1}\r\n{signed:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n", category: Some("stdout"), group: None, line: None, column: None, variables_reference: None, source: None, data: None })
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP {"body":{"category":"stdout","output":"{while:1}\r\n{double:1}\r\n{long:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{static:1}\r\n{(null):0}\r\n"},"event":"output","seq":0,"type":"event"}
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP event Output(Output { output: "{while:1}\r\n{double:1}\r\n{long:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\n{static:1}\r\n{(null):0}\r\n", category: Some("stdout"), group: None, line: None, column: None, variables_reference: None, source: None, data: None })
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP {"body":{"category":"stdout","output":"{(null):0}\r\n{return:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\nKey = 18\r\n"},"event":"output","seq":0,"type":"event"}
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP event Output(Output { output: "{(null):0}\r\n{return:1}\r\n{(null):0}\r\n{(null):0}\r\n{(null):0}\r\nKey = 18\r\n", category: Some("stdout"), group: None, line: None, column: None, variables_reference: None, source: None, data: None })
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP {"body":{"exitCode":0},"event":"exited","seq":0,"type":"event"}
2023-10-26T17:01:20.232 helix_dap::transport [INFO] <- DAP event Exited(Exited { exit_code: 0 })
2023-10-26T17:01:20.235 helix_dap::transport [INFO] <- DAP {"event":"terminated","seq":0,"statistics":{"memory":"{\"strings\":{\"bytesTotal\":3145728,\"bytesUnused\":1419922,\"bytesUsed\":1725806}}","targets":"[{\"breakpoints\":[{\"details\":{\"Breakpoint\":{\"BKPTOptions\":{\"AutoContinue\":false,\"ConditionText\":\"\",\"EnabledState\":true,\"IgnoreCount\":0,\"OneShotState\":false},\"BKPTResolver\":{\"Options\":{\"Column\":0,\"Exact\":false,\"FileName\":\"/Users/plgol.perso/CompilerProject/testground/table/test.c\",\"Inlines\":true,\"LineNumber\":95,\"Offset\":0,\"SkipPrologue\":true},\"Type\":\"FileAndLine\"},\"Hardware\":false,\"Names\":[\"vscode\"],\"SearchFilter\":{\"Options\":{},\"Type\":\"Unconstrained\"}}},\"hitCount\":0,\"id\":1,\"internal\":false,\"numLocations\":0,\"numResolvedLocations\":0,\"resolveTime\":0.000134},{\"details\":{\"Breakpoint\":{\"BKPTOptions\":{\"AutoContinue\":false,\"ConditionText\":\"\",\"EnabledState\":true,\"IgnoreCount\":0,\"OneShotState\":false},\"BKPTResolver\":{\"Options\":{\"NameMask\":[4],\"Offset\":0,\"SkipPrologue\":false,\"SymbolNames\":[\"lldb_image_notifier\"]},\"Type\":\"SymbolName\"},\"Hardware\":false,\"SearchFilter\":{\"Options\":{\"ModuleList\":[\"/usr/lib/dyld\"]},\"Type\":\"Modules\"}}},\"hitCount\":1,\"id\":-3,\"internal\":true,\"kindDescription\":\"shared-library-event\",\"numLocations\":1,\"numResolvedLocations\":1,\"resolveTime\":5.8e-05}],\"expressionEvaluation\":{\"failures\":0,\"successes\":0},\"firstStopTime\":0.28909354199999998,\"frameVariable\":{\"failures\":0,\"successes\":0},\"launchOrAttachTime\":0.28521162500000002,\"moduleIdentifiers\":[4898849112,4897263672,4897382504,4897390264,4897394392,4897422808,4897427720,4897435960,4897305000,4897283784,4897334968,4897391096,4897414968,4897367976,4897380152,4897467288,4897369656,4897423640,4897359976,4897485416,4897327768,4897468120,4897469432,4897341288,4897322696,4897307400,4897306344,4897396344,4897397656,4897399480,4897401848,4897403160,4897343784,4897345608,4897498440,4897499272,4897346440,4897348264,4897350088,4897353256,4897351944,4897354568,4897357144],\"signals\":[{\"SIGSTOP\":1}],\"sourceMapDeduceCount\":0,\"stopCount\":7,\"targetCreateTime\":0.094724000000000003,\"totalBreakpointResolveTime\":0.000192}]","totalDebugInfoByteSize":2392,"totalDebugInfoEnabled":1,"totalDebugInfoIndexLoadedFromCache":0,"totalDebugInfoIndexSavedToCache":0,"totalDebugInfoIndexTime":0,"totalDebugInfoParseTime":7.3999999999999996e-05,"totalModuleCount":43,"totalModuleCountHasDebugInfo":1,"totalModuleCountWithIncompleteTypes":0,"totalModuleCountWithVariableErrors":0,"totalSymbolTableIndexTime":0.0053099999999999987,"totalSymbolTableParseTime":0.0135,"totalSymbolTableStripped":3,"totalSymbolTablesLoadedFromCache":0,"totalSymbolTablesSavedToCache":0},"type":"event"}
2023-10-26T17:01:20.235 helix_dap::transport [INFO] <- DAP event Terminated(None)

Platform

MacOS Sonoma 14.0

Terminal Emulator

Iterm2 v3.4

Helix Version

helix 23.10 (f6021dd)

@pierrelgol pierrelgol added the C-bug Category: This is a bug label Oct 26, 2023
@gabydd
Copy link
Member

gabydd commented Oct 26, 2023

looks like lldb-vscode(they just changed the name to lldb-dap last week) doesn't send the full breakpoint back if the breakpoint is from the editor because of sourcemaps: https://github.com/llvm/llvm-project/blob/a13696fd8490f67b6ad119fcb6fda20e1fd3a089/lldb/tools/lldb-dap/lldb-dap.cpp#L528-L533 you can see it in the request here that it is missing some info specifically line is what causes the crash:

DAP {"body":{"breakpoint":{"id":1,"verified":false},"reason":"changed"},"event":"breakpoint","seq":0,"type":"event"}

this is because currently in the code when we get a changed event we reset everything to what comes in the request:

breakpoints[i].line =
breakpoint.line.unwrap().saturating_sub(1); // TODO: no unwrap
in this case most things are none except for verified but this is only a problem for line which isn't an option.

the spec doesnt really say how we are supposed to handle breakpoint changed events so best bet is too look at what vscode does, I think what we probably want to do is only set things that are some when we get a changed event, then we wouldn't need to unwrap the line and it just wouldn't get set

@pierrelgol
Copy link
Author

pierrelgol commented Oct 29, 2023

I've looked into it, but I don't know know typescript, or javascript for that matter, but the comments were quite helpful, they talk about how the events hare handled and in which order they are expected, I'm not sure if this is of any help but just in case this is where I've found it.

https://github.com/microsoft/vscode/blob/6697193a79694d59c8e4f586330ee7a95c42b1b1/src/vs/workbench/contrib/debug/common/debugProtocol.d.ts#L31

@Agilan989

This comment was marked as spam.

@lucas-yotsui
Copy link

Any news on this?? I've just changed Neovim for Helix and this is the only thing I'm still missing

@gabydd
Copy link
Member

gabydd commented Feb 16, 2024

Fixed by #9632

@gabydd gabydd closed this as completed Feb 16, 2024
@pierrelgol
Copy link
Author

Thanks very much this is a big upgrade for my current workflow <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

4 participants