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

Error: Invalid Value Object #1142

Open
ImkoMarijnissen opened this issue Sep 17, 2024 · 7 comments
Open

Error: Invalid Value Object #1142

ImkoMarijnissen opened this issue Sep 17, 2024 · 7 comments

Comments

@ImkoMarijnissen
Copy link

OS: WSL 2 - Ubuntu 22.04
VSCode version: 1.93.1
CodeLLDB version: 1.10.1
Compiler: rustc
Debuggee: x86_64-linux-gnu

While debugging, I ran into the issue that I cannot see the values of vectors as it simply shows that <error: invalid value object> with the following error output message:

Verbose log
[DEBUG codelldb::dap_codec] --> {"command":"evaluate","arguments":{"expression":"boolean","frameId":1001,"context":"watch"},"type":"request","seq":26}
ERROR(Python) 13:47:14 codelldb: Traceback (most recent call last):
  File "/home/user/.vscode-server/extensions/vadimcn.vscode-lldb-1.10.0/adapter/scripts/codelldb/codelldb.py", line 175, in evaluate
    value = evaluate_in_context(pycode, is_simple_expr, context)
  File "/home/user/.vscode-server/extensions/vadimcn.vscode-lldb-1.10.0/adapter/scripts/codelldb/codelldb.py", line 320, in evaluate_in_context
    return eval(code, eval_globals, eval_locals)
  File "", line 1, in 
  File "/home/user/.vscode-server/extensions/vadimcn.vscode-lldb-1.10.0/adapter/scripts/codelldb/codelldb.py", line 309, in 
    eval_globals['__eval'] = lambda expr: nat_eval(frame, expr)
  File "/home/user/.vscode-server/extensions/vadimcn.vscode-lldb-1.10.0/adapter/scripts/codelldb/codelldb.py", line 300, in nat_eval
    raise Exception(err.GetCString())
Exception: error: could not find item
@elenakrittik
Copy link

Same issue for me!

@joshuataylor
Copy link

Also seeing this on RustRover, seems rust-lang/rust#126793 changed lldb_providers.py , I'll see if I can submit an issue..

@liukaizheng
Copy link

liukaizheng commented Sep 23, 2024

Because Rust have changed the implementation of Vec by using RawVec, which is essentially an u8 array, not a T array. Codelldb cannot't currently infer the type T by it's customized rust formmater. It still doesn't work even though I use the formatter provided by lldb_providers.py

class StdVecSyntheticProvider:
    def __init__(self, valobj, dict):
        self.valobj = valobj
        self.update()

    def num_children(self):
        return self.length

    def get_child_index(self, name):
        index = name.lstrip('[').rstrip(']')
        if index.isdigit():
            return int(index)
        else:
            return -1

    def get_child_at_index(self, index):
        start = self.data_ptr.GetValueAsUnsigned()
        address = start + index * self.element_type_size
        element = self.data_ptr.CreateValueFromAddress("[%s]" % index, address, self.element_type)
        return element

    def update(self):
        self.length = self.valobj.GetChildMemberWithName("len").GetValueAsUnsigned()
        self.buf = self.valobj.GetChildMemberWithName("buf").GetChildMemberWithName("inner")

        self.data_ptr = unwrap_unique_or_non_null(self.buf.GetChildMemberWithName("ptr"))

        self.element_type = self.valobj.GetType().GetTemplateArgumentType(0)
        self.element_type_size = self.element_type.GetByteSize()

    def has_children(self):
        return True

Finally I realized the reason for my failure was because the lldb with version 17.x provided by codelldb cannot infer the element_type:

self.element_type = self.valobj.GetType().GetTemplateArgumentType(0)

I guess It's can be solved by bumping lldb version to 18.x. I can't do it by myself because I don't know how to adapt this in codelldb. Oops, codelldb hasn't been updated in a long time

Also seeing this on RustRover, seems rust-lang/rust#126793 changed lldb_providers.py , I'll see if I can submit an issue..

@joshuataylor
Copy link

codelldb doesn't need to be updated often if it's working (lldb doesn't really update), apart from major updates like these :-)

@Shelim
Copy link

Shelim commented Oct 2, 2024

Any progress on this (or workarounds)? :)

@Shelim
Copy link

Shelim commented Oct 2, 2024

Workaround: when compiling specify +nightly-2024-08-01 instead of +nightly

@vadimcn
Copy link
Owner

vadimcn commented Oct 9, 2024

As of v1.11, CodeLLDB will just use formatters shipped with rustc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants