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

"errror: reference to '...' is ambiguous" message in LLDB #47938

Open
michaeleiselsc opened this issue Feb 1, 2018 · 8 comments
Open

"errror: reference to '...' is ambiguous" message in LLDB #47938

michaeleiselsc opened this issue Feb 1, 2018 · 8 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.

Comments

@michaeleiselsc
Copy link

When I try to print a local variable in LLDB, e.g. with po foo, and there's a function with the same name, I get this message:

error: reference to 'foo' is ambiguous
candidate found by name lookup is 'foo'
candidate found by name lookup is 'some_module::some_struct::{{impl}}::foo'
@michaeleiselsc michaeleiselsc changed the title Reference '...' is ambiguous in LLDB "errror: reference to '...' is ambiguous" message in LLDB Feb 1, 2018
@pietroalbini pietroalbini added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. labels Feb 6, 2018
@mikeyhew
Copy link
Contributor

Just found this bug. Is there a workaround / something you can pass to lldb to make it print the local variable?

@samg31
Copy link

samg31 commented Jul 3, 2018

I have encountered this bug as well.

@ahti
Copy link

ahti commented Aug 7, 2018

frame variable varname did the job as a workaround for me.

@fanzeyi
Copy link

fanzeyi commented Jan 3, 2019

Having a pair of single quotation mark around the variable name can solve this issue, but I found this trick by randomly trying and I reached this issue when I'm digging more into this issue...

@epai
Copy link

epai commented May 28, 2019

I was able to get the info by first just directly printing out the memory address for the object:

example (request is the local variable name here)

>>> (lldb)  frame variable request
(NSMutableURLRequest *) request = 0x00006000002df950
>>> (lldb)  po 0x00006000002df950
<NSMutableURLRequest: 0x6000002df950> { URL: http://example.com }

@alexreg
Copy link
Contributor

alexreg commented Aug 17, 2019

Any update on this?

@ranweiler
Copy link
Contributor

I ran into this running the rustc test suite and lldb 8.0.0.

It looks like I can always repro with a program like this:

fn main() {
    let ascii = 123;

    println!("hi");
}

After breaking at println!, we can elicit:

(lldb) p ascii
error: reference to 'ascii' is ambiguous
candidate found by name lookup is 'ascii'
candidate found by name lookup is 'core::ascii'

It looks like I can repro this by having my local var shadow any direct submodule of core (array, unique, &c).

This may be related to this lldb (todo) "project": Fix local variable lookup in the lldb expression parser

In lldb, print is an alias for expr, whereas frame variable doesn't use the expression parser:

The “frame variable” command is not a full expression parser but it does support a few simple operations [...]

https://lldb.llvm.org/use/tutorial.html#examining-stack-frame-state

It also looks like this project, if completed, would at least provide a workaround: Expression parser needs syntax for “{symbol,type} A in CU B.cpp”

@ranweiler
Copy link
Contributor

See also:

We have a not-yet-implemented scheme to allow some syntax like:
(lldb) expr $$foo.c$bar(5)
that would mean: look up the version of bar defined in foo.c and call that. [...]

http://lists.llvm.org/pipermail/lldb-dev/2016-June/010623.html

ranweiler added a commit to ranweiler/rust that referenced this issue Sep 1, 2019
LLDB's expression parser can't unambiguously resolve local variables in
some cases, as described in rust-lang#47938. Work around this by using names that
don't shadow direct submodules of `core`.
Centril added a commit to Centril/rust that referenced this issue Sep 5, 2019
…050, r=alexcrichton

Rename test locals to work around LLDB bug

LLDB's expression parser can't unambiguously resolve local variables in
some cases, as described in rust-lang#47938. Work around this by using names that
don't shadow direct submodules of `core`.

Closes rust-lang#64050.
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Sep 6, 2019
…050, r=alexcrichton

Rename test locals to work around LLDB bug

LLDB's expression parser can't unambiguously resolve local variables in
some cases, as described in rust-lang#47938. Work around this by using names that
don't shadow direct submodules of `core`.

Closes rust-lang#64050.
Centril added a commit to Centril/rust that referenced this issue Sep 7, 2019
…050, r=alexcrichton

Rename test locals to work around LLDB bug

LLDB's expression parser can't unambiguously resolve local variables in
some cases, as described in rust-lang#47938. Work around this by using names that
don't shadow direct submodules of `core`.

Closes rust-lang#64050.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

9 participants